Module: Sequel::Dataset::EmulatePreparedStatementMethods

Includes:
UnnumberedArgumentMapper
Defined in:
lib/sequel/dataset/prepared_statements.rb

Overview

Prepared statements emulation support for adapters that don't support native prepared statements. Uses a placeholder literalizer to hold the prepared sql with the ability to interpolate arguments to prepare the final SQL string.

Instance Method Summary collapse

Methods included from ArgumentMapper

#bind_arguments, #call, #prepared_sql, #prepared_statement_name

Instance Method Details

#run(&block) ⇒ Object


273
274
275
276
277
278
279
280
# File 'lib/sequel/dataset/prepared_statements.rb', line 273

def run(&block)
  if @opts[:prepared_sql_frags]
    sql = literal(Sequel::SQL::PlaceholderLiteralString.new(@opts[:prepared_sql_frags], @opts[:bind_arguments], false))
    clone(:prepared_sql_frags=>nil, :sql=>sql, :prepared_sql=>sql).run(&block)
  else
    super
  end
end