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

Function SplitFirstStatement

postgres/parser/parser/scan.go:1022–1034  ·  view source on GitHub ↗

SplitFirstStatement returns the length of the prefix of the string up to and including the first semicolon that separates statements. If there is no semicolon, returns ok=false.

(sql string)

Source from the content-addressed store, hash-verified

1020// including the first semicolon that separates statements. If there is no
1021// semicolon, returns ok=false.
1022func SplitFirstStatement(sql string) (pos int, ok bool) {
1023 s := makeScanner(sql)
1024 var lval sqlSymType
1025 for {
1026 s.scan(&lval)
1027 switch lval.id {
1028 case 0, ERROR:
1029 return 0, false
1030 case ';':
1031 return s.pos, true
1032 }
1033 }
1034}
1035
1036// Tokens decomposes the input into lexical tokens.
1037func Tokens(sql string) (tokens []TokenString, ok bool) {

Callers

nothing calls this directly

Calls 2

makeScannerFunction · 0.85
scanMethod · 0.80

Tested by

no test coverage detected