parseSQL is a helper function to parse SQL and return the AST
(b *testing.B, sql string)
| 25 | |
| 26 | // parseSQL is a helper function to parse SQL and return the AST |
| 27 | func parseSQL(b *testing.B, sql string) *ast.AST { |
| 28 | tkz := tokenizer.GetTokenizer() |
| 29 | defer tokenizer.PutTokenizer(tkz) |
| 30 | tokens, err := tkz.Tokenize([]byte(sql)) |
| 31 | if err != nil { |
| 32 | b.Fatalf("Failed to tokenize: %v", err) |
| 33 | } |
| 34 | |
| 35 | p := parser.NewParser() |
| 36 | tree, err := p.ParseFromModelTokens(tokens) |
| 37 | if err != nil { |
| 38 | b.Fatalf("Failed to parse: %v", err) |
| 39 | } |
| 40 | return tree |
| 41 | } |
| 42 | |
| 43 | // BenchmarkScanner_CleanSQL benchmarks scanning clean SQL |
| 44 | func BenchmarkScanner_CleanSQL(b *testing.B) { |
no test coverage detected