MCPcopy Create free account
hub / github.com/PostHog/duckgres / TestGetCommandType

Function TestGetCommandType

server/conn_test.go:200–435  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

198 }
199}
200
201func TestGetCommandType(t *testing.T) {
202 // Create a minimal clientConn for testing
203 c := &clientConn{}
204
205 tests := []struct {
206 name string
207 query string
208 expected string
209 }{
210 // Basic commands without comments
211 {
212 name: "SELECT",
213 query: "SELECT * FROM users",
214 expected: "SELECT",
215 },
216 {
217 name: "INSERT",
218 query: "INSERT INTO users VALUES (1)",
219 expected: "INSERT",
220 },
221 {
222 name: "UPDATE",
223 query: "UPDATE users SET name='test'",
224 expected: "UPDATE",
225 },
226 {
227 name: "DELETE",
228 query: "DELETE FROM users",
229 expected: "DELETE",
230 },
231 {
232 name: "CREATE TABLE",
233 query: "CREATE TABLE users (id INT)",
234 expected: "CREATE TABLE",
235 },
236 {
237 name: "CREATE TEMPORARY TABLE",
238 query: "CREATE TEMPORARY TABLE temp_users (id INT)",
239 expected: "CREATE TABLE",
240 },
241 {
242 name: "CREATE TEMP TABLE",
243 query: "CREATE TEMP TABLE temp_users (id INT)",
244 expected: "CREATE TABLE",
245 },
246 {
247 name: "CREATE TEMPORARY TABLE with Fivetran comment",
248 query: "/*Fivetran*/CREATE TEMPORARY TABLE temp_users (id INT)",
249 expected: "CREATE TABLE",
250 },
251 {
252 name: "CREATE SCHEMA",
253 query: "CREATE SCHEMA myschema",
254 expected: "CREATE SCHEMA",
255 },
256 {
257 name: "DROP TABLE",

Callers

nothing calls this directly

Calls 2

getCommandTypeMethod · 0.95
RunMethod · 0.65

Tested by

no test coverage detected