| 403 | } |
| 404 | |
| 405 | func TestFetchSQL(t *testing.T) { |
| 406 | fv := int64(10) |
| 407 | ov := int64(5) |
| 408 | stmt := &SelectStatement{ |
| 409 | Columns: []Expression{&Identifier{Name: "x"}}, |
| 410 | From: []TableReference{{Name: "t"}}, |
| 411 | Fetch: &FetchClause{ |
| 412 | FetchType: "FIRST", |
| 413 | FetchValue: &fv, |
| 414 | OffsetValue: &ov, |
| 415 | IsPercent: true, |
| 416 | WithTies: true, |
| 417 | }, |
| 418 | } |
| 419 | sql := stmt.SQL() |
| 420 | for _, want := range []string{"OFFSET 5 ROWS", "FETCH FIRST 10 PERCENT ROWS WITH TIES"} { |
| 421 | if !strings.Contains(sql, want) { |
| 422 | t.Errorf("missing %q in: %s", want, sql) |
| 423 | } |
| 424 | } |
| 425 | } |
| 426 | |
| 427 | func TestForSQL(t *testing.T) { |
| 428 | stmt := &SelectStatement{ |