SanitizeSQL removes comments, splits the sql by `;` and returns the trimmed sql statement array.
(sql string)
| 193 | |
| 194 | // SanitizeSQL removes comments, splits the sql by `;` and returns the trimmed sql statement array. |
| 195 | func SanitizeSQL(sql string) ([]string, error) { |
| 196 | query, err := removeCommentsAndTrim(sql) |
| 197 | if err != nil { |
| 198 | return nil, err |
| 199 | } |
| 200 | stmts, err := splitStatement(query) |
| 201 | if err != nil { |
| 202 | return nil, err |
| 203 | } |
| 204 | return stmts, nil |
| 205 | } |
| 206 | |
| 207 | // IsDDL returns true if the given sql string is a DDL statement. |
| 208 | func IsDDL(query string) bool { |