switch to 0-pased positional arguments

add docs, many docs
This commit is contained in:
Brian J. Cardiff 2016-01-31 19:40:02 -03:00
parent a96776e336
commit fd804dd592
9 changed files with 229 additions and 30 deletions

View file

@ -86,7 +86,7 @@ class DummyDriver < DB::Driver
return nil if n == "NULL"
if n == "?"
return @statement.params[1]
return @statement.params[0]
end
if n.starts_with?(":")

View file

@ -13,9 +13,9 @@ describe DB::Statement do
with_dummy do |db|
stmt = db.prepare("the query")
stmt.query "a", 1, nil
stmt.params[1].should eq("a")
stmt.params[2].should eq(1)
stmt.params[3].should eq(nil)
stmt.params[0].should eq("a")
stmt.params[1].should eq(1)
stmt.params[2].should eq(nil)
end
end
@ -43,9 +43,9 @@ describe DB::Statement do
with_dummy do |db|
stmt = db.prepare("the query")
stmt.exec "a", 1, nil
stmt.params[1].should eq("a")
stmt.params[2].should eq(1)
stmt.params[3].should eq(nil)
stmt.params[0].should eq("a")
stmt.params[1].should eq(1)
stmt.params[2].should eq(nil)
end
end
@ -73,9 +73,9 @@ describe DB::Statement do
with_dummy do |db|
stmt = db.prepare("the query")
stmt.scalar String, "a", 1, nil
stmt.params[1].should eq("a")
stmt.params[2].should eq(1)
stmt.params[3].should eq(nil)
stmt.params[0].should eq("a")
stmt.params[1].should eq(1)
stmt.params[2].should eq(nil)
end
end
@ -103,9 +103,9 @@ describe DB::Statement do
with_dummy do |db|
stmt = db.prepare("the query")
stmt.scalar? String, "a", 1, nil
stmt.params[1].should eq("a")
stmt.params[2].should eq(1)
stmt.params[3].should eq(nil)
stmt.params[0].should eq("a")
stmt.params[1].should eq(1)
stmt.params[2].should eq(nil)
end
end