Module Sequel::Postgres::AutoParameterize::DatasetMethods
In: lib/sequel/extensions/pg_auto_parameterize.rb

Methods

Public Instance methods

For strings, numeric arguments, and date/time arguments, add them as parameters to the query instead of literalizing them into the SQL.

[Source]

     # File lib/sequel/extensions/pg_auto_parameterize.rb, line 113
113:         def literal_append(sql, v)
114:           if sql.is_a?(StringWithArray)
115:             case v
116:             when String
117:               case v
118:               when LiteralString
119:                 super
120:               when Sequel::SQL::Blob
121:                 sql.add_arg(v, :bytea)
122:               else
123:                 sql.add_arg(v, :text)
124:               end
125:             when Bignum
126:               sql.add_arg(v, :int8)
127:             when Fixnum
128:               sql.add_arg(v, :int4)
129:             when Float
130:               sql.add_arg(v, "double precision""double precision")
131:             when BigDecimal
132:               sql.add_arg(v, :numeric)
133:             when Sequel::SQLTime
134:               sql.add_arg(v, :time)
135:             when Time, DateTime
136:               sql.add_arg(v, :timestamp)
137:             when Date
138:               sql.add_arg(v, :date)
139:             else
140:               super
141:             end
142:           else
143:             super
144:           end
145:         end

Return a clone of the dataset that will not do automatic parameterization.

[Source]

     # File lib/sequel/extensions/pg_auto_parameterize.rb, line 106
106:         def no_auto_parameterize
107:           clone(:no_auto_parameterize=>true)
108:         end

[Source]

     # File lib/sequel/extensions/pg_auto_parameterize.rb, line 147
147:         def use_cursor(*)
148:           super.no_auto_parameterize
149:         end

Protected Instance methods

Disable automatic parameterization for prepared statements, since they will use manual parameterization.

[Source]

     # File lib/sequel/extensions/pg_auto_parameterize.rb, line 155
155:         def to_prepared_statement(*a)
156:           opts[:no_auto_parameterize] ? super : no_auto_parameterize.to_prepared_statement(*a)
157:         end

[Validate]