SplitFirstStatement returns the length of the prefix of the string up to and including the first semicolon that separates statements. If there is no including the first semicolon that separates statements. If there is no semicolon, returns ok=false.
(sql string)
| 21 | // including the first semicolon that separates statements. If there is no |
| 22 | // semicolon, returns ok=false. |
| 23 | func SplitFirstStatement(sql string) (pos int, ok bool) { |
| 24 | s := makeSQLScanner(sql) |
| 25 | var lval = &sqlSymType{} |
| 26 | for { |
| 27 | s.Scan(lval) |
| 28 | switch lval.ID() { |
| 29 | case 0, lexbase.ERROR: |
| 30 | return 0, false |
| 31 | case ';': |
| 32 | return s.Pos(), true |
| 33 | } |
| 34 | } |
| 35 | } |
| 36 | |
| 37 | // Tokens decomposes the input into lexical tokens. |
| 38 | func Tokens(sql string) (tokens []TokenString, ok bool) { |
nothing calls this directly
no test coverage detected
searching dependent graphs…