Class/Module Index [+]

Quicksearch

Sequel::Postgres::AutoParameterize::DatasetMethods

Public Instance Methods

literal_append(sql, v) click to toggle source

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

# File lib/sequel/extensions/pg_auto_parameterize.rb, line 127
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() click to toggle source

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

# File lib/sequel/extensions/pg_auto_parameterize.rb, line 120
def no_auto_parameterize
  clone(:no_auto_parameterize=>true)
end
use_cursor(*) click to toggle source
# File lib/sequel/extensions/pg_auto_parameterize.rb, line 161
def use_cursor(*)
  super.no_auto_parameterize
end

Protected Instance Methods

to_prepared_statement(*a) click to toggle source

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

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

[Validate]

Generated with the Darkfish Rdoc Generator 2.