MCPcopy Create free account
hub / github.com/Mnexa-AI/e2a / looksMultiStatement

Function looksMultiStatement

internal/identity/migrate.go:280–286  ·  view source on GitHub ↗

looksMultiStatement returns true if body appears to contain more than one SQL statement. Not a full parser — handles the common shapes (line comments, block comments, single-quoted strings) and catches the case the no-transaction directive is most likely to trip on: a user writing `SET something; CR

(body string)

Source from the content-addressed store, hash-verified

278// those would need a real parser. The directive isn't intended for
279// those cases anyway — it's for single CONCURRENTLY-class statements.
280func looksMultiStatement(body string) bool {
281 stripped := stripSQLCommentsAndStrings(body)
282 // A single statement (with optional trailing whitespace + semicolon)
283 // has zero ';' after we trim. A multi-statement script has 1+.
284 stripped = strings.TrimRight(stripped, "; \t\n\r")
285 return strings.Contains(stripped, ";")
286}
287
288// stripSQLCommentsAndStrings removes -- line comments, /* */ block
289// comments, and '...' single-quoted strings from the body. Used by

Callers 1

applyOneFunction · 0.85

Calls 1

Tested by

no test coverage detected