ValidateSQLForEditor validates the SQL statement for editor. We support the following SQLs: 1. EXPLAIN statement, except EXPLAIN ANALYZE 2. SELECT statement We also support CTE with SELECT statements, but not with DML statements. The first bool indicates whether the query can run in read-only mode,
(engine storepb.Engine, statement string)
| 94 | // We also support CTE with SELECT statements, but not with DML statements. |
| 95 | // The first bool indicates whether the query can run in read-only mode, and the second bool determines whether all queries return data. |
| 96 | func ValidateSQLForEditor(engine storepb.Engine, statement string) (bool, bool, error) { |
| 97 | f, ok := queryValidators[engine] |
| 98 | if !ok { |
| 99 | return true, true, nil |
| 100 | } |
| 101 | return f(statement) |
| 102 | } |
| 103 | |
| 104 | func RegisterExtractChangedResourcesFunc(engine storepb.Engine, f ExtractChangedResourcesFunc) { |
| 105 | mux.Lock() |