File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -82,7 +82,7 @@ type QueryStats struct {
8282
8383var (
8484 // SQL
85- selectRe = regexp .MustCompile (`(?is)^(?:WITH|@{.+|SELECT)\s.+$` )
85+ selectRe = regexp .MustCompile (`(?is)^(?:WITH|CALL| @{.+|SELECT)\s.+$` )
8686
8787 // DDL
8888 createDatabaseRe = regexp .MustCompile (`(?is)^CREATE\s+DATABASE\s.+$` )
Original file line number Diff line number Diff line change @@ -507,6 +507,21 @@ func TestBuildStatement(t *testing.T) {
507507 input : "DESC SELECT * FROM t1" ,
508508 want : & ExplainStatement {Explain : "SELECT * FROM t1" },
509509 },
510+ {
511+ desc : "Stored system procedures" ,
512+ input : `CALL cancel_query("1234567890123456789")` ,
513+ want : & SelectStatement {Query : `CALL cancel_query("1234567890123456789")` },
514+ },
515+ {
516+ desc : "EXPLAIN Stored system procedures" ,
517+ input : `EXPLAIN CALL cancel_query("1234567890123456789")` ,
518+ want : & ExplainStatement {Explain : `CALL cancel_query("1234567890123456789")` },
519+ },
520+ {
521+ desc : "EXPLAIN ANALYZE Stored system procedures" ,
522+ input : `EXPLAIN ANALYZE CALL cancel_query("1234567890123456789")` ,
523+ want : & ExplainAnalyzeStatement {Query : `CALL cancel_query("1234567890123456789")` },
524+ },
510525 } {
511526 t .Run (test .desc , func (t * testing.T ) {
512527 got , err := BuildStatement (test .input )
You can’t perform that action at this time.
0 commit comments