MCPcopy Create free account
hub / github.com/dolthub/doltgresql / HasMultipleStatements

Function HasMultipleStatements

postgres/parser/parser/parse.go:273–291  ·  view source on GitHub ↗

HasMultipleStatements returns true if the sql string contains more than one statements.

(sql string)

Source from the content-addressed store, hash-verified

271// HasMultipleStatements returns true if the sql string contains more than one
272// statements.
273func HasMultipleStatements(sql string) bool {
274 var p Parser
275 p.scanner.init(sql)
276 defer p.scanner.cleanup()
277 count := 0
278 for {
279 done := p.scanOneStmt(func(sqlStr string, tokens []sqlSymType) error {
280 return nil
281 })
282 if done {
283 break
284 }
285 count++
286 if count > 1 {
287 return true
288 }
289 }
290 return false
291}
292
293// ParseQualifiedTableName parses a SQL string of the form
294// `[ database_name . ] [ schema_name . ] table_name`.

Callers

nothing calls this directly

Calls 3

scanOneStmtMethod · 0.95
initMethod · 0.45
cleanupMethod · 0.45

Tested by

no test coverage detected