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)
| 1020 | // including the first semicolon that separates statements. If there is no |
| 1021 | // semicolon, returns ok=false. |
| 1022 | func 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. |
| 1037 | func Tokens(sql string) (tokens []TokenString, ok bool) { |
nothing calls this directly
no test coverage detected