mirror of
https://gitea.invidious.io/iv-org/shard-crystal-db.git
synced 2024-08-15 00:53:32 +00:00
Statement#exec and #query require named argument for array values
This change allows to use an array as single argument for #exec and #query methods. Before it was shadowed by the *args splat overload.
This commit is contained in:
parent
dcd0af5ce8
commit
d0d89c1e13
3 changed files with 27 additions and 7 deletions
|
@ -43,10 +43,18 @@ describe DB::Statement do
|
|||
end
|
||||
end
|
||||
|
||||
it "should initialize positional params in query with array" do
|
||||
it "accepts array as single argument" do
|
||||
with_dummy_connection do |cnn|
|
||||
stmt = cnn.prepared("the query").as(DummyDriver::DummyStatement)
|
||||
stmt.query ["a", 1, nil]
|
||||
stmt.params[0].should eq(["a", 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)
|
||||
stmt.query args: ["a", 1, nil]
|
||||
stmt.params[0].should eq("a")
|
||||
stmt.params[1].should eq(1)
|
||||
stmt.params[2].should eq(nil)
|
||||
|
@ -63,10 +71,18 @@ describe DB::Statement do
|
|||
end
|
||||
end
|
||||
|
||||
it "should initialize positional params in exec with array" do
|
||||
it "accepts array as single argument" do
|
||||
with_dummy_connection do |cnn|
|
||||
stmt = cnn.prepared("the query").as(DummyDriver::DummyStatement)
|
||||
stmt.exec ["a", 1, nil]
|
||||
stmt.params[0].should eq(["a", 1, nil])
|
||||
end
|
||||
end
|
||||
|
||||
it "should initialize positional params in exec with array" do
|
||||
with_dummy_connection do |cnn|
|
||||
stmt = cnn.prepared("the query").as(DummyDriver::DummyStatement)
|
||||
stmt.exec args: ["a", 1, nil]
|
||||
stmt.params[0].should eq("a")
|
||||
stmt.params[1].should eq(1)
|
||||
stmt.params[2].should eq(nil)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue