MCPcopy Create free account
hub / github.com/ajitpratap0/GoSQLX / TestSetOperationSQL

Function TestSetOperationSQL

pkg/sql/ast/sql_test.go:248–259  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

246}
247
248func TestSetOperationSQL(t *testing.T) {
249 stmt := &SetOperation{
250 Left: &SelectStatement{Columns: []Expression{&Identifier{Name: "id"}}, From: []TableReference{{Name: "a"}}},
251 Operator: "UNION",
252 Right: &SelectStatement{Columns: []Expression{&Identifier{Name: "id"}}, From: []TableReference{{Name: "b"}}},
253 All: true,
254 }
255 want := "SELECT id FROM a UNION ALL SELECT id FROM b"
256 if got := stmt.SQL(); got != want {
257 t.Errorf("SQL() = %s, want %s", got, want)
258 }
259}
260
261func TestDropStatementSQL(t *testing.T) {
262 stmt := &DropStatement{ObjectType: "TABLE", IfExists: true, Names: []string{"users"}, CascadeType: "CASCADE"}

Callers

nothing calls this directly

Calls 2

SQLMethod · 0.95
ErrorfMethod · 0.65

Tested by

no test coverage detected