Module: Sequel::Postgres::AutoParameterize::DatasetMethods
- Defined in:
- lib/sequel/extensions/pg_auto_parameterize.rb
Instance Method Summary collapse
-
#literal_append(sql, v) ⇒ Object
For strings, numeric arguments, and date/time arguments, add them as parameters to the query instead of literalizing them into the SQL.
-
#no_auto_parameterize ⇒ Object
Return a clone of the dataset that will not do automatic parameterization.
- #use_cursor ⇒ Object
Instance Method Details
#literal_append(sql, v) ⇒ Object
For strings, numeric arguments, and date/time arguments, add them as parameters to the query instead of literalizing them into the SQL.
117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 |
# File 'lib/sequel/extensions/pg_auto_parameterize.rb', line 117 def literal_append(sql, v) if sql.is_a?(StringWithArray) case v when String case v when LiteralString super when Sequel::SQL::Blob sql.add_arg(v, :bytea) else sql.add_arg(v) end when Bignum sql.add_arg(v, :int8) when Fixnum sql.add_arg(v, :int4) when Float sql.add_arg(v, :"double precision") when BigDecimal sql.add_arg(v, :numeric) when Sequel::SQLTime sql.add_arg(v, :time) when Time, DateTime sql.add_arg(v, :timestamp) when Date sql.add_arg(v, :date) else super end else super end end |
#no_auto_parameterize ⇒ Object
Return a clone of the dataset that will not do automatic parameterization.
110 111 112 |
# File 'lib/sequel/extensions/pg_auto_parameterize.rb', line 110 def no_auto_parameterize clone(:no_auto_parameterize=>true) end |
#use_cursor ⇒ Object
151 152 153 |
# File 'lib/sequel/extensions/pg_auto_parameterize.rb', line 151 def use_cursor(*) super.no_auto_parameterize end |