lib/wise_gopher/base.rb in wise_gopher-0.2.1 vs lib/wise_gopher/base.rb in wise_gopher-0.2.2
- old
+ new
@@ -99,11 +99,10 @@
def_delegator :query_class, :row_class
def initialize(inputs = {})
@inputs = inputs
@binds = []
- @bind_symbol = WiseGopher.postgresql? ? +"$1" : "?"
@query_prepared = false
self.class.ensure_all_params_are_given(inputs)
prepare_query
@@ -178,17 +177,21 @@
@binds << param.build_bind(value)
end
def use_bind_symbol
if WiseGopher.postgresql?
- symbol = @bind_symbol.dup
+ symbol = bind_symbol.dup
- @bind_symbol.next!
+ bind_symbol.next!
symbol
else
- @bind_symbol
+ bind_symbol
end
+ end
+
+ def bind_symbol
+ @bind_symbol ||= WiseGopher.postgresql? ? +"$1" : "?"
end
def ensure_row_class_is_declared
raise RowClassIsMissing unless row_class
end