MCPcopy Create free account
hub / github.com/ajitpratap0/GoSQLX / BenchmarkScanner_MixedPatterns

Function BenchmarkScanner_MixedPatterns

pkg/sql/security/scanner_bench_test.go:348–361  ·  view source on GitHub ↗

BenchmarkScanner_MixedPatterns benchmarks detection of multiple injection patterns

(b *testing.B)

Source from the content-addressed store, hash-verified

346
347// BenchmarkScanner_MixedPatterns benchmarks detection of multiple injection patterns
348func BenchmarkScanner_MixedPatterns(b *testing.B) {
349 sql := "SELECT * FROM users WHERE id = 1 OR 1=1 UNION SELECT null, username, password FROM admin_users -- bypass"
350 scanner := NewScanner()
351
352 tree := parseSQL(b, sql)
353 defer ast.ReleaseAST(tree)
354
355 b.ReportAllocs()
356 b.ResetTimer()
357 for i := 0; i < b.N; i++ {
358 result := scanner.Scan(tree)
359 _ = result // Prevent optimization
360 }
361}
362
363// generateLargeSelectQuery generates a SELECT query with specified number of columns
364func generateLargeSelectQuery(columns int) string {

Callers

nothing calls this directly

Calls 4

ScanMethod · 0.95
ReleaseASTFunction · 0.92
NewScannerFunction · 0.85
parseSQLFunction · 0.70

Tested by

no test coverage detected