Closed djpalm801 closed 7 months ago
Summary:
When escaping a ? using ??, the query builder fails when checking the parameter counts. This is because we aren't escaping the args text.
?
??
Adding text = strings.ReplaceAll(text, "??", tempPh) after line 182 in utils.go resolves this, tested using:
text = strings.ReplaceAll(text, "??", tempPh)
func TestQueryLiteralQWrapped(t *testing.T) { q := New("WHERE ??| = ?", "asdf") wrapped := New("?", q) sql, _, err := wrapped.ToPgsql() if err != nil { t.Errorf("got error from ToPgsql(): %v", err) } want := "WHERE ?| = $1" if want != sql { t.Errorf("got: %q, want:%q", sql, want) } }
Summary:
When escaping a
?
using??
, the query builder fails when checking the parameter counts. This is because we aren't escaping the args text.Adding
text = strings.ReplaceAll(text, "??", tempPh)
after line 182 in utils.go resolves this, tested using: