mirror of
https://github.com/chaisql/chai.git
synced 2025-10-16 20:50:51 +08:00
Thread safe statements (#406)
Previously, expressions and params were evaluated during the planning phase. This change builds the query plan without evaluating params and expressions which are then evaluated only during the execution phase.
This commit is contained in:
@@ -8,6 +8,7 @@ import (
|
||||
"github.com/genjidb/genji/internal/expr"
|
||||
"github.com/genjidb/genji/internal/query/statement"
|
||||
"github.com/genjidb/genji/internal/sql/parser"
|
||||
"github.com/genjidb/genji/internal/stream"
|
||||
)
|
||||
|
||||
func TestParserMultiStatement(t *testing.T) {
|
||||
@@ -18,12 +19,12 @@ func TestParserMultiStatement(t *testing.T) {
|
||||
}{
|
||||
{"OnlyCommas", ";;;", nil},
|
||||
{"TrailingComma", "SELECT * FROM foo;;;DELETE FROM foo;", []statement.Statement{
|
||||
&statement.SelectStmt{
|
||||
TableName: "foo",
|
||||
ProjectionExprs: []expr.Expr{expr.Wildcard{}},
|
||||
&statement.StreamStmt{
|
||||
Stream: stream.New(stream.SeqScan("foo")).Pipe(stream.Project(expr.Wildcard{})),
|
||||
ReadOnly: true,
|
||||
},
|
||||
&statement.DeleteStmt{
|
||||
TableName: "foo",
|
||||
&statement.StreamStmt{
|
||||
Stream: stream.New(stream.SeqScan("foo")).Pipe(stream.TableDelete("foo")),
|
||||
},
|
||||
}},
|
||||
}
|
||||
|
Reference in New Issue
Block a user