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

Function TestFetchSQL

pkg/sql/ast/sql_coverage_test.go:405–425  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

403}
404
405func 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
427func TestForSQL(t *testing.T) {
428 stmt := &SelectStatement{

Callers

nothing calls this directly

Calls 2

SQLMethod · 0.95
ErrorfMethod · 0.65

Tested by

no test coverage detected