make pool_prepared_statements always prepare statement in connection

This commit is contained in:
Brian J. Cardiff 2016-12-03 20:59:14 -03:00
parent 2cab0b37f5
commit 543592a337
2 changed files with 13 additions and 1 deletions

View file

@ -140,6 +140,18 @@ describe DB::Database do
db.build("the query").should be_a(DB::PoolUnpreparedStatement)
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
describe "unprepared statements in pool" do

View file

@ -34,7 +34,7 @@ module DB
clean_connections
conn, existing = @db.checkout_some(@connections)
@connections << WeakRef.new(conn) unless existing
conn.build(@query)
conn.prepared.build(@query)
end
private def clean_connections