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
|
@ -97,7 +97,7 @@ class DummyDriver < DB::Driver
|
|||
property params
|
||||
|
||||
def initialize(connection, @query : String, @prepared : Bool)
|
||||
@params = Hash(Int32 | String, DB::Any).new
|
||||
@params = Hash(Int32 | String, DB::Any | Array(DB::Any)).new
|
||||
super(connection)
|
||||
raise DB::Error.new(query) if query == "syntax error"
|
||||
end
|
||||
|
@ -126,6 +126,10 @@ class DummyDriver < DB::Driver
|
|||
@params[index] = value
|
||||
end
|
||||
|
||||
private def set_param(index, value : Array)
|
||||
@params[index] = value.map(&.as(DB::Any))
|
||||
end
|
||||
|
||||
private def set_param(index, value)
|
||||
raise "not implemented for #{value.class}"
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue