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

Function TestRejectLimitInSQLServer

pkg/sql/parser/dialect_test.go:194–203  ·  view source on GitHub ↗

--------------------------------------------------------------------------- LIMIT dialect gate --------------------------------------------------------------------------- TestRejectLimitInSQLServer checks that LIMIT is rejected when the dialect is explicitly set to SQL Server.

(t *testing.T)

Source from the content-addressed store, hash-verified

192// TestRejectLimitInSQLServer checks that LIMIT is rejected when the dialect is
193// explicitly set to SQL Server.
194func TestRejectLimitInSQLServer(t *testing.T) {
195 sql := "SELECT id, name FROM users LIMIT 10"
196 _, err := ParseWithDialect(sql, keywords.DialectSQLServer)
197 if err == nil {
198 t.Fatal("expected error: LIMIT should be rejected in SQL Server dialect")
199 }
200 if !containsAny(err.Error(), "LIMIT", "SQL Server", "TOP", "FETCH") {
201 t.Errorf("error should mention LIMIT or SQL Server, got: %v", err)
202 }
203}
204
205// TestAcceptLimitInMySQL checks that LIMIT is accepted in MySQL dialect.
206func TestAcceptLimitInMySQL(t *testing.T) {

Callers

nothing calls this directly

Calls 4

containsAnyFunction · 0.85
ParseWithDialectFunction · 0.70
ErrorfMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected