HasMultipleStatements returns true if the sql string contains more than one statements.
(sql string)
| 271 | // HasMultipleStatements returns true if the sql string contains more than one |
| 272 | // statements. |
| 273 | func 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`. |
nothing calls this directly
no test coverage detected