(t *testing.T)
| 7 | ) |
| 8 | |
| 9 | func TestValidateQuery(t *testing.T) { |
| 10 | tests := []struct { |
| 11 | statement string |
| 12 | valid bool |
| 13 | description string |
| 14 | }{ |
| 15 | { |
| 16 | statement: "SELECT * FROM users", |
| 17 | valid: true, |
| 18 | description: "Basic SELECT query", |
| 19 | }, |
| 20 | { |
| 21 | statement: "SELECT * FROM users WHERE id = 1", |
| 22 | valid: true, |
| 23 | description: "SELECT with WHERE clause", |
| 24 | }, |
| 25 | { |
| 26 | statement: "SHOW DATA", |
| 27 | valid: true, |
| 28 | description: "SHOW DATA statement", |
| 29 | }, |
| 30 | { |
| 31 | statement: "SHOW DATA FROM db1", |
| 32 | valid: true, |
| 33 | description: "SHOW DATA with FROM clause", |
| 34 | }, |
| 35 | { |
| 36 | statement: "SHOW DATABASES", |
| 37 | valid: true, |
| 38 | description: "SHOW DATABASES statement", |
| 39 | }, |
| 40 | { |
| 41 | statement: "SHOW TABLES", |
| 42 | valid: true, |
| 43 | description: "SHOW TABLES statement", |
| 44 | }, |
| 45 | { |
| 46 | statement: "SHOW TABLETS FROM table1", |
| 47 | valid: true, |
| 48 | description: "SHOW TABLETS statement", |
| 49 | }, |
| 50 | { |
| 51 | statement: "SHOW VARIABLES", |
| 52 | valid: true, |
| 53 | description: "SHOW VARIABLES statement", |
| 54 | }, |
| 55 | { |
| 56 | statement: "SHOW CREATE TABLE users", |
| 57 | valid: true, |
| 58 | description: "SHOW CREATE TABLE statement", |
| 59 | }, |
| 60 | { |
| 61 | statement: "SHOW CREATE DATABASE db1", |
| 62 | valid: true, |
| 63 | description: "SHOW CREATE DATABASE statement", |
| 64 | }, |
| 65 | { |
| 66 | statement: "INSERT INTO users (id, name) VALUES (1, 'test')", |
nothing calls this directly
no test coverage detected