ensure exec and scalar release connection

ensure exec, query can be executed with Enumerable(Any)
update db doc sample
This commit is contained in:
Brian J. Cardiff 2016-02-03 21:28:53 -03:00
parent d45427dfdd
commit 4ed7f28fe6
5 changed files with 64 additions and 7 deletions

View file

@ -69,4 +69,18 @@ describe DB do
end
end
end
it "exec should return to pool" do
with_dummy do |db|
db.exec "foo"
db.exec "bar"
end
end
it "scalar should return to pool" do
with_dummy do |db|
db.scalar "foo"
db.scalar "bar"
end
end
end

View file

@ -19,6 +19,16 @@ describe DB::Statement do
end
end
it "should initialize positional params in query with array" do
with_dummy do |db|
stmt = db.prepare("the query")
stmt.query ["a", 1, nil]
stmt.params[0].should eq("a")
stmt.params[1].should eq(1)
stmt.params[2].should eq(nil)
end
end
it "should initialize positional params in exec" do
with_dummy do |db|
stmt = db.prepare("the query")
@ -29,6 +39,16 @@ describe DB::Statement do
end
end
it "should initialize positional params in exec with array" do
with_dummy do |db|
stmt = db.prepare("the query")
stmt.exec ["a", 1, nil]
stmt.params[0].should eq("a")
stmt.params[1].should eq(1)
stmt.params[2].should eq(nil)
end
end
it "should initialize positional params in scalar" do
with_dummy do |db|
stmt = db.prepare("the query")