mirror of
https://gitea.invidious.io/iv-org/shard-crystal-db.git
synced 2024-08-15 00:53:32 +00:00
ensure exec and scalar release connection
ensure exec, query can be executed with Enumerable(Any) update db doc sample
This commit is contained in:
parent
d45427dfdd
commit
4ed7f28fe6
5 changed files with 64 additions and 7 deletions
|
@ -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
|
||||
|
|
|
@ -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")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue