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

Function extractSQLStatement

pkg/sql/integration_test.go:101–115  ·  view source on GitHub ↗

extractSQLStatement extracts the main SQL statement from a file (ignoring comments)

(content string)

Source from the content-addressed store, hash-verified

99
100// extractSQLStatement extracts the main SQL statement from a file (ignoring comments)
101func extractSQLStatement(content string) string {
102 lines := strings.Split(content, "\n")
103 var sqlLines []string
104
105 for _, line := range lines {
106 trimmed := strings.TrimSpace(line)
107 // Skip empty lines and comment-only lines
108 if trimmed == "" || strings.HasPrefix(trimmed, "--") {
109 continue
110 }
111 sqlLines = append(sqlLines, line)
112 }
113
114 return strings.Join(sqlLines, "\n")
115}
116
117// TestIntegration_AllDialects tests all SQL files across all dialects
118func TestIntegration_AllDialects(t *testing.T) {

Calls

no outgoing calls

Tested by

no test coverage detected