| 246 | } |
| 247 | |
| 248 | func 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 | |
| 261 | func TestDropStatementSQL(t *testing.T) { |
| 262 | stmt := &DropStatement{ObjectType: "TABLE", IfExists: true, Names: []string{"users"}, CascadeType: "CASCADE"} |