(sql string, stmt *ast.SelectStmt)
| 215 | } |
| 216 | |
| 217 | func findMySQLLimitInsertPosition(sql string, stmt *ast.SelectStmt) (int, bool) { |
| 218 | if stmt.Into != nil && stmt.Into.Loc.Start > 0 { |
| 219 | intoStart := findMySQLKeywordBefore(sql, stmt.Into.Loc.Start, "INTO") |
| 220 | if intoStart >= maxMySQLLocEndBeforeTailClauses(stmt) { |
| 221 | return intoStart, true |
| 222 | } |
| 223 | } |
| 224 | if stmt.ForUpdate != nil && stmt.ForUpdate.Loc.Start > 0 { |
| 225 | return stmt.ForUpdate.Loc.Start, true |
| 226 | } |
| 227 | if stmt.Loc.End > 0 { |
| 228 | return stmt.Loc.End, false |
| 229 | } |
| 230 | return -1, false |
| 231 | } |
| 232 | |
| 233 | func extractMySQLLimit(node ast.Node) int { |
| 234 | limit, ok := node.(*ast.IntLit) |
no test coverage detected