MCPcopy
hub / github.com/Masterminds/squirrel / TestSelectSubqueryInConjunctionPlaceholderNumbering

Function TestSelectSubqueryInConjunctionPlaceholderNumbering

select_test.go:267–280  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

265}
266
267func TestSelectSubqueryInConjunctionPlaceholderNumbering(t *testing.T) {
268 subquery := Select("a").Where(Eq{"b": 1}).Prefix("EXISTS(").Suffix(")").PlaceholderFormat(Dollar)
269
270 sql, args, err := Select("*").
271 Where(Or{subquery}).
272 Where("c = ?", 2).
273 PlaceholderFormat(Dollar).
274 ToSql()
275 assert.NoError(t, err)
276
277 expectedSql := "SELECT * WHERE (EXISTS( SELECT a WHERE b = $1 )) AND c = $2"
278 assert.Equal(t, expectedSql, sql)
279 assert.Equal(t, []interface{}{1, 2}, args)
280}
281
282func TestSelectJoinClausePlaceholderNumbering(t *testing.T) {
283 subquery := Select("a").Where(Eq{"b": 2}).PlaceholderFormat(Dollar)

Callers

nothing calls this directly

Calls 6

SelectFunction · 0.85
ToSqlMethod · 0.65
PlaceholderFormatMethod · 0.45
SuffixMethod · 0.45
PrefixMethod · 0.45
WhereMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…