Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion named.go
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ func bindStruct(bindType int, query string, arg interface{}, m *reflectx.Mapper)
return bound, arglist, nil
}

var valuesReg = regexp.MustCompile(`\)\s*(?i)VALUES\s*\(`)
var valuesReg = regexp.MustCompile(`\)\s*(?i)(?:SETTINGS\s+.*)?\s*VALUES\s*\(`)

func findMatchingClosingBracketIndex(s string) int {
count := 0
Expand Down
8 changes: 7 additions & 1 deletion named_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -422,13 +422,19 @@ func TestFixBounds(t *testing.T) {
)`,
loop: 2,
},
{
name: `clickhouse settings`,
query: `INSERT INTO foo (a,b) settings async_insert=1, wait_for_async_insert=1 VALUES(:a, :b)`,
expect: `INSERT INTO foo (a,b) settings async_insert=1, wait_for_async_insert=1 VALUES(:a, :b),(:a, :b)`,
loop: 2,
},
}

for _, tc := range table {
t.Run(tc.name, func(t *testing.T) {
res := fixBound(tc.query, tc.loop)
if res != tc.expect {
t.Errorf("mismatched results")
t.Errorf("mismatched results got %v", res)
}
})
}
Expand Down