mirror of
https://gitea.invidious.io/iv-org/shard-crystal-db.git
synced 2024-08-15 00:53:32 +00:00
add cache of pool statements per query
refactor/reuse connection statement cache
This commit is contained in:
parent
09b3b4bc01
commit
f568e4506d
5 changed files with 46 additions and 11 deletions
|
@ -47,4 +47,20 @@ describe DB::Database do
|
|||
db.prepare("query3").should be_a(DB::PoolStatement)
|
||||
end
|
||||
end
|
||||
|
||||
it "should return same statement in pool per query" do
|
||||
with_dummy do |db|
|
||||
stmt = db.prepare("query1")
|
||||
db.prepare("query2").should_not eq(stmt)
|
||||
db.prepare("query1").should eq(stmt)
|
||||
end
|
||||
end
|
||||
|
||||
it "should close pool statements when closing db" do
|
||||
stmt = uninitialized DB::PoolStatement
|
||||
with_dummy do |db|
|
||||
stmt = db.prepare("query1")
|
||||
end
|
||||
stmt.closed?.should be_true
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue