mirror of
https://gitea.invidious.io/iv-org/shard-crystal-db.git
synced 2024-08-15 00:53:32 +00:00
refactor prepared and unprepared pool statements
This commit is contained in:
parent
0593f63dbb
commit
2cab0b37f5
6 changed files with 64 additions and 85 deletions
|
@ -42,9 +42,9 @@ describe DB::Database do
|
|||
|
||||
it "should allow creation of more statements than pool connections" do
|
||||
DB.open "dummy://localhost:1027?initial_pool_size=1&max_pool_size=2" do |db|
|
||||
db.build("query1").should be_a(DB::PoolStatement)
|
||||
db.build("query2").should be_a(DB::PoolStatement)
|
||||
db.build("query3").should be_a(DB::PoolStatement)
|
||||
db.build("query1").should be_a(DB::PoolPreparedStatement)
|
||||
db.build("query2").should be_a(DB::PoolPreparedStatement)
|
||||
db.build("query3").should be_a(DB::PoolPreparedStatement)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -59,8 +59,7 @@ describe DB::Database do
|
|||
it "should close pool statements when closing db" do
|
||||
stmt = uninitialized DB::PoolStatement
|
||||
with_dummy do |db|
|
||||
# TODO remove cast
|
||||
stmt = db.build("query1").as(DB::PoolStatement)
|
||||
stmt = db.build("query1")
|
||||
end
|
||||
stmt.closed?.should be_true
|
||||
end
|
||||
|
@ -132,7 +131,7 @@ describe DB::Database do
|
|||
|
||||
it "should build prepared statements if true" do
|
||||
with_dummy "dummy://localhost:1027?prepared_statements=true" do |db|
|
||||
db.build("the query").should be_a(DB::PoolStatement)
|
||||
db.build("the query").should be_a(DB::PoolPreparedStatement)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue