@@ -52,6 +52,12 @@ db = DBInterface.connect(SQLite.DB, dbfile2)
5252# syntax correct, table missing
5353@test_throws SQLiteException DBInterface. execute (db, " SELECT name FROM sqlite_nomaster WHERE type='table';" )
5454
55+ @testset " close!(query)" begin
56+ qry = DBInterface. execute (db, " SELECT name FROM sqlite_master WHERE type='table';" )
57+ DBInterface. close! (qry)
58+ DBInterface. close! (qry) # test it doesn't throw on double-close
59+ end
60+
5561ds = DBInterface. execute (db, " SELECT name FROM sqlite_master WHERE type='table';" ) |> columntable
5662@test length (ds) == 1
5763@test keys (ds) == (:name ,)
@@ -60,9 +66,23 @@ ds = DBInterface.execute(db, "SELECT name FROM sqlite_master WHERE type='table';
6066results1 = SQLite. tables (db)
6167@test isequal (ds, results1)
6268
63- results = DBInterface. execute (db, " SELECT * FROM Employee;" ) |> columntable
64- @test length (results) == 15
65- @test length (results[1 ]) == 8
69+ @testset " DBInterface.execute([f])" begin
70+ # pipe approach
71+ results = DBInterface. execute (db, " SELECT * FROM Employee;" ) |> columntable
72+ @test length (results) == 15
73+ @test length (results[1 ]) == 8
74+ # callable approach
75+ @test isequal (DBInterface. execute (columntable, db, " SELECT * FROM Employee" ), results)
76+ employees_stmt = DBInterface. prepare (db, " SELECT * FROM Employee" )
77+ @test isequal (columntable (DBInterface. execute (employees_stmt)), results)
78+ @test isequal (DBInterface. execute (columntable, employees_stmt), results)
79+ @testset " throwing from f()" begin
80+ f (:: SQLite.Query ) = error (" I'm throwing!" )
81+ @test_throws ErrorException DBInterface. execute (f, employees_stmt)
82+ @test_throws ErrorException DBInterface. execute (f, db, " SELECT * FROM Employee" )
83+ end
84+ DBInterface. close! (employees_stmt)
85+ end
6686
6787DBInterface. execute (db, " create table temp as select * from album" )
6888DBInterface. execute (db, " alter table temp add column colyear int" )
0 commit comments