mirror of
https://gitea.invidious.io/iv-org/shard-crystal-db.git
synced 2024-08-15 00:53:32 +00:00
Merged branch master into feature/pool
This commit is contained in:
commit
3c91978d36
8 changed files with 39 additions and 15 deletions
|
@ -49,6 +49,7 @@ class DummyDriver < DB::Driver
|
|||
|
||||
protected def perform_exec(args : Enumerable)
|
||||
set_params args
|
||||
raise "forced exception due to query" if @query == "raise"
|
||||
DB::ExecResult.new 0i64, 0_i64
|
||||
end
|
||||
|
||||
|
|
|
@ -237,6 +237,14 @@ describe DummyDriver do
|
|||
end
|
||||
end
|
||||
|
||||
it "should raise executing raise query" do
|
||||
with_dummy do |db|
|
||||
expect_raises do
|
||||
db.exec "raise"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
{% for value in [1, 1_i64, "hello", 1.5, 1.5_f32] %}
|
||||
it "should set positional arguments for {{value.id}}" do
|
||||
with_dummy do |db|
|
||||
|
|
|
@ -56,4 +56,12 @@ describe DB::ResultSet do
|
|||
|
||||
cols.should eq(["c0", "c1"])
|
||||
end
|
||||
|
||||
it "gets all column names" do
|
||||
with_dummy do |db|
|
||||
db.query "1,2" do |rs|
|
||||
rs.column_names.should eq(%w(c0 c1))
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -118,4 +118,13 @@ describe DB::Statement do
|
|||
rs.statement.should be(stmt)
|
||||
end
|
||||
end
|
||||
|
||||
it "connection should be released if error occurs during exec" do
|
||||
with_dummy do |db|
|
||||
expect_raises do
|
||||
db.exec "raise"
|
||||
end
|
||||
db.@in_pool.should be_true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue