looksLikeSQL performs basic heuristic checks to see if input looks like SQL
(input string)
| 177 | |
| 178 | // looksLikeSQL performs basic heuristic checks to see if input looks like SQL |
| 179 | func looksLikeSQL(input string) bool { |
| 180 | upper := strings.ToUpper(strings.TrimSpace(input)) |
| 181 | keywords := []string{ |
| 182 | "SELECT", "INSERT", "UPDATE", "DELETE", "CREATE", "DROP", "ALTER", |
| 183 | "TRUNCATE", "WITH", "MERGE", "EXPLAIN", "ANALYZE", "SHOW", "DESCRIBE", "DESC", |
| 184 | } |
| 185 | for _, kw := range keywords { |
| 186 | if strings.HasPrefix(upper, kw+" ") || strings.HasPrefix(upper, kw+"\n") || strings.HasPrefix(upper, kw+"\t") || upper == kw { |
| 187 | return true |
| 188 | } |
| 189 | } |
| 190 | return false |
| 191 | } |
| 192 | |
| 193 | // ExpandFileArgs expands file arguments, handling directories and wildcards |
| 194 | // This centralizes the file expansion logic used across multiple commands |
no outgoing calls