mirror of
https://gitea.invidious.io/iv-org/shard-crystal-db.git
synced 2024-08-15 00:53:32 +00:00
make pool_prepared_statements always prepare statement in connection
This commit is contained in:
parent
2cab0b37f5
commit
543592a337
2 changed files with 13 additions and 1 deletions
|
@ -140,6 +140,18 @@ describe DB::Database do
|
||||||
db.build("the query").should be_a(DB::PoolUnpreparedStatement)
|
db.build("the query").should be_a(DB::PoolUnpreparedStatement)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "should be overrided by dsl" do
|
||||||
|
with_dummy "dummy://localhost:1027?prepared_statements=true" do |db|
|
||||||
|
stmt = db.unprepared.query("the query").statement.as(DummyDriver::DummyStatement)
|
||||||
|
stmt.prepared?.should be_false
|
||||||
|
end
|
||||||
|
|
||||||
|
with_dummy "dummy://localhost:1027?prepared_statements=false" do |db|
|
||||||
|
stmt = db.prepared.query("the query").statement.as(DummyDriver::DummyStatement)
|
||||||
|
stmt.prepared?.should be_true
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "unprepared statements in pool" do
|
describe "unprepared statements in pool" do
|
||||||
|
|
|
@ -34,7 +34,7 @@ module DB
|
||||||
clean_connections
|
clean_connections
|
||||||
conn, existing = @db.checkout_some(@connections)
|
conn, existing = @db.checkout_some(@connections)
|
||||||
@connections << WeakRef.new(conn) unless existing
|
@connections << WeakRef.new(conn) unless existing
|
||||||
conn.build(@query)
|
conn.prepared.build(@query)
|
||||||
end
|
end
|
||||||
|
|
||||||
private def clean_connections
|
private def clean_connections
|
||||||
|
|
Loading…
Reference in a new issue