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

Function TestFormatSQLWithDialect_Oracle

pkg/transform/dialect_test.go:49–66  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

47}
48
49func TestFormatSQLWithDialect_Oracle(t *testing.T) {
50 tree, err := ParseSQL("SELECT * FROM users u")
51 if err != nil {
52 t.Fatalf("parse: %v", err)
53 }
54 stmt := tree.Statements[0]
55 if err := Apply(stmt, SetLimit(100)); err != nil {
56 t.Fatalf("apply: %v", err)
57 }
58
59 got := FormatSQLWithDialect(stmt, keywords.DialectOracle)
60 if !strings.Contains(got, "FETCH FIRST 100 ROWS ONLY") {
61 t.Errorf("oracle: expected FETCH FIRST 100 ROWS ONLY, got: %s", got)
62 }
63 if strings.Contains(got, "LIMIT") {
64 t.Errorf("oracle: should not contain LIMIT, got: %s", got)
65 }
66}
67
68func TestFormatSQLWithDialect_EmptyDialect(t *testing.T) {
69 tree, err := ParseSQL("SELECT * FROM users")

Callers

nothing calls this directly

Calls 6

ParseSQLFunction · 0.85
ApplyFunction · 0.85
SetLimitFunction · 0.85
FormatSQLWithDialectFunction · 0.85
FatalfMethod · 0.65
ErrorfMethod · 0.65

Tested by

no test coverage detected