Note: isIgnoredSetParameter tests have been moved to transpiler/transpiler_test.go. The transpiler package now handles SET parameter filtering via AST transformation.
(t *testing.T)
| 1339 | // Note: isIgnoredSetParameter tests have been moved to transpiler/transpiler_test.go. |
| 1340 | // The transpiler package now handles SET parameter filtering via AST transformation. |
| 1341 | |
| 1342 | func TestBuildCommandTagFromRowCount(t *testing.T) { |
| 1343 | tests := []struct { |
| 1344 | cmdType string |
| 1345 | rowCount int64 |
| 1346 | expected string |
| 1347 | }{ |
| 1348 | {"INSERT", 0, "INSERT 0 0"}, |
| 1349 | {"INSERT", 1, "INSERT 0 1"}, |
| 1350 | {"INSERT", 5, "INSERT 0 5"}, |
| 1351 | {"UPDATE", 0, "UPDATE 0"}, |
| 1352 | {"UPDATE", 1, "UPDATE 1"}, |
| 1353 | {"UPDATE", 3, "UPDATE 3"}, |
| 1354 | {"DELETE", 0, "DELETE 0"}, |
| 1355 | {"DELETE", 1, "DELETE 1"}, |
| 1356 | {"DELETE", 3, "DELETE 3"}, |
| 1357 | {"SELECT", 0, "SELECT 0"}, |
| 1358 | {"SELECT", 5, "SELECT 5"}, |
| 1359 | // Large row counts |
| 1360 | {"INSERT", 1000000, "INSERT 0 1000000"}, |
| 1361 | {"DELETE", 999999, "DELETE 999999"}, |
| 1362 | // Unknown command types fall through to SELECT-style |
| 1363 | {"CREATE TABLE", 0, "SELECT 0"}, |
| 1364 | {"", 0, "SELECT 0"}, |
| 1365 | {"COPY", 0, "SELECT 0"}, |
| 1366 | // Verify INSERT always has the OID 0 prefix (PostgreSQL compat) |
| 1367 | {"INSERT", 42, "INSERT 0 42"}, |
| 1368 | } |
| 1369 | |
| 1370 | for _, tt := range tests { |
| 1371 | t.Run(fmt.Sprintf("%s_%d", tt.cmdType, tt.rowCount), func(t *testing.T) { |
| 1372 | got := buildCommandTagFromRowCount(tt.cmdType, tt.rowCount) |
| 1373 | if got != tt.expected { |
| 1374 | t.Errorf("buildCommandTagFromRowCount(%q, %d) = %q, want %q", tt.cmdType, tt.rowCount, got, tt.expected) |
| 1375 | } |
| 1376 | }) |
| 1377 | } |
| 1378 | } |
| 1379 | |
| 1380 | // TestBuildCommandTagConsistency verifies that buildCommandTagFromRowCount produces |
nothing calls this directly
no test coverage detected