@@ -177,7 +177,7 @@ func RunEngineScripts(ctx *sql.Context, e *sqle.Engine, scripts []setup.SetupScr
177177 return e , nil
178178}
179179
180- func MustQuery (ctx * sql.Context , e * sqle.Engine , q string ) []sql.Row {
180+ func MustQuery (ctx * sql.Context , e * sqle.Engine , q string ) (sql. Schema , []sql.Row ) {
181181 sch , iter , err := e .Query (ctx , q )
182182 if err != nil {
183183 panic (err )
@@ -186,7 +186,42 @@ func MustQuery(ctx *sql.Context, e *sqle.Engine, q string) []sql.Row {
186186 if err != nil {
187187 panic (err )
188188 }
189- return rows
189+ return sch , rows
190+ }
191+
192+ func MustQueryWithBindings (ctx * sql.Context , e * sqle.Engine , q string , bindings map [string ]sql.Expression ) (sql.Schema , []sql.Row ) {
193+ ctx = ctx .WithQuery (q )
194+ sch , iter , err := e .QueryWithBindings (ctx , q , bindings )
195+ if err != nil {
196+ panic (err )
197+ }
198+
199+ rows , err := sql .RowIterToRows (ctx , sch , iter )
200+ if err != nil {
201+ panic (err )
202+ }
203+
204+ return sch , rows
205+ }
206+
207+ func MustQueryWithPreBindings (ctx * sql.Context , e * sqle.Engine , q string , bindings map [string ]sql.Expression ) (sql.Node , sql.Schema , []sql.Row ) {
208+ ctx = ctx .WithQuery (q )
209+ pre , err := e .PrepareQuery (ctx , q )
210+ if err != nil {
211+ panic (err )
212+ }
213+
214+ sch , iter , err := e .QueryWithBindings (ctx , q , bindings )
215+ if err != nil {
216+ panic (err )
217+ }
218+
219+ rows , err := sql .RowIterToRows (ctx , sch , iter )
220+ if err != nil {
221+ panic (err )
222+ }
223+
224+ return pre , sch , rows
190225}
191226
192227func mustNewEngine (t * testing.T , h Harness ) * sqle.Engine {
0 commit comments