mirror of
https://gitea.invidious.io/iv-org/shard-crystal-db.git
synced 2024-08-15 00:53:32 +00:00
Concatenate arguments
This commit is contained in:
parent
15d0e57eb0
commit
8e64eb82c1
4 changed files with 79 additions and 2 deletions
|
@ -51,6 +51,25 @@ describe DB::Statement do
|
|||
end
|
||||
end
|
||||
|
||||
it "allows no arguments" do
|
||||
with_dummy_connection do |cnn|
|
||||
stmt = cnn.prepared("the query").as(DummyDriver::DummyStatement)
|
||||
stmt.query
|
||||
stmt.params.should be_empty
|
||||
end
|
||||
end
|
||||
|
||||
it "concatenate arguments" do
|
||||
with_dummy_connection do |cnn|
|
||||
stmt = cnn.prepared("the query").as(DummyDriver::DummyStatement)
|
||||
stmt.query 1, 2, args: ["a", [1, nil]]
|
||||
stmt.params[0].should eq(1)
|
||||
stmt.params[1].should eq(2)
|
||||
stmt.params[2].should eq("a")
|
||||
stmt.params[3].should eq([1, nil])
|
||||
end
|
||||
end
|
||||
|
||||
it "should initialize positional params in query with array" do
|
||||
with_dummy_connection do |cnn|
|
||||
stmt = cnn.prepared("the query").as(DummyDriver::DummyStatement)
|
||||
|
@ -89,6 +108,25 @@ describe DB::Statement do
|
|||
end
|
||||
end
|
||||
|
||||
it "allows no arguments" do
|
||||
with_dummy_connection do |cnn|
|
||||
stmt = cnn.prepared("the query").as(DummyDriver::DummyStatement)
|
||||
stmt.exec
|
||||
stmt.params.should be_empty
|
||||
end
|
||||
end
|
||||
|
||||
it "concatenate arguments" do
|
||||
with_dummy_connection do |cnn|
|
||||
stmt = cnn.prepared("the query").as(DummyDriver::DummyStatement)
|
||||
stmt.exec 1, 2, args: ["a", [1, nil]]
|
||||
stmt.params[0].should eq(1)
|
||||
stmt.params[1].should eq(2)
|
||||
stmt.params[2].should eq("a")
|
||||
stmt.params[3].should eq([1, nil])
|
||||
end
|
||||
end
|
||||
|
||||
it "should initialize positional params in scalar" do
|
||||
with_dummy_connection do |cnn|
|
||||
stmt = cnn.prepared("the query").as(DummyDriver::DummyStatement)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue