MCPcopy Create free account
hub / github.com/auxten/postgresql-parser / SplitFirstStatement

Function SplitFirstStatement

pkg/sql/parser/scan.go:966–978  ·  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

964// including the first semicolon that separates statements. If there is no
965// semicolon, returns ok=false.
966func SplitFirstStatement(sql string) (pos int, ok bool) {
967 s := makeScanner(sql)
968 var lval sqlSymType
969 for {
970 s.scan(&lval)
971 switch lval.id {
972 case 0, ERROR:
973 return 0, false
974 case ';':
975 return s.pos, true
976 }
977 }
978}
979
980// Tokens decomposes the input into lexical tokens.
981func 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

Used in the wild real call sites across dependent graphs

searching dependent graphs…