@@ -52,6 +52,12 @@ db = DBInterface.connect(SQLite.DB, dbfile2)
52
52
# syntax correct, table missing
53
53
@test_throws SQLiteException DBInterface. execute (db, " SELECT name FROM sqlite_nomaster WHERE type='table';" )
54
54
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
+
55
61
ds = DBInterface. execute (db, " SELECT name FROM sqlite_master WHERE type='table';" ) |> columntable
56
62
@test length (ds) == 1
57
63
@test keys (ds) == (:name ,)
@@ -60,9 +66,23 @@ ds = DBInterface.execute(db, "SELECT name FROM sqlite_master WHERE type='table';
60
66
results1 = SQLite. tables (db)
61
67
@test isequal (ds, results1)
62
68
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
66
86
67
87
DBInterface. execute (db, " create table temp as select * from album" )
68
88
DBInterface. execute (db, " alter table temp add column colyear int" )
0 commit comments