Unbinder
is used to take a dataset filter and return a
modified version that unbinds already bound values and returns a dataset
with bound value placeholders and a hash of bind values. You can then
prepare the dataset and use the bound variables to execute it with the same
values.
This class only does a limited form of unbinding where the variable names
and values can be associated unambiguously. The only cases it handles are
<tt>SQL::ComplexExpression<tt> with
an operator in UNBIND_OPS
, a first argument that’s an
instance of a member of UNBIND_KEY_CLASSES
, and a second
argument that’s an instance of a member of
UNBIND_VALUE_CLASSES
.
So it can handle cases like:
DB.where(:a=>1).exclude(:b=>2).where{c > 3}
But it cannot handle cases like:
DB.where(:a + 1 < 0)
The key classes (first argument of the ComplexExpression) that will considered for transformation.
The <tt>SQL::ComplexExpression<tt> operates that will be considered for transformation.
The value classes (second argument of the ComplexExpression) that will be considered for transformation.
The hash of bind variables that were extracted from the dataset filter.
Intialize an empty binds
hash.
# File lib/sequel/ast_transformer.rb, line 167 def initialize Sequel::Deprecation.deprecate("Sequel::Unbinder", 'There is no replacement') @binds = {} end