MCPcopy Create free account
hub / github.com/IceFireDB/IceFireDB / TestIsDML

Function TestIsDML

IceFireDB-SQLite/internal/sqlite/db_test.go:61–88  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

59}
60
61func TestIsDML(t *testing.T) {
62 testCases := []struct {
63 sql string
64 expected bool
65 }{
66 {"BEGIN", true},
67 {"BEGIN TRANSACTION", true},
68 {"COMMIT", true},
69 {"END TRANSACTION", true},
70 {"ROLLBACK", true},
71 {"INSERT INTO users VALUES (1)", true},
72 {"UPDATE users SET name='test'", true},
73 {"DELETE FROM users", true},
74 {"CREATE TABLE test (id INT)", true},
75 {"ALERT TABLE users ADD COLUMN email VARCHAR(100)", true},
76 {"DROP TABLE users", true},
77 {"SELECT * FROM users", false},
78 {"select version()", false},
79 {"", false},
80 }
81
82 for _, tc := range testCases {
83 result := isDML(tc.sql)
84 if result != tc.expected {
85 t.Errorf("isDML(%s) = %v, expected %v", tc.sql, result, tc.expected)
86 }
87 }
88}
89
90func TestSQLiteIntegration(t *testing.T) {
91 // Create a temporary database file

Callers

nothing calls this directly

Calls 1

isDMLFunction · 0.70

Tested by

no test coverage detected