module Sequel::Dataset::ArgumentMapper

Default implementation of the argument mapper to allow native database support for bind variables and prepared statements (as opposed to the emulated ones used by default).

Public Instance Methods

bind_arguments() click to toggle source

The bind arguments to use for running this prepared statement

# File lib/sequel/dataset/prepared_statements.rb, line 63
def bind_arguments
  @opts[:bind_arguments]
end
call(bind_vars={}, &block) click to toggle source

Set the bind arguments based on the hash and call super.

# File lib/sequel/dataset/prepared_statements.rb, line 68
def call(bind_vars={}, &block)
  sql = prepared_sql
  prepared_args.freeze
  ps = bind(bind_vars)
  ps.clone(:bind_arguments=>ps.map_to_prepared_args(ps.opts[:bind_vars]), :sql=>sql, :prepared_sql=>sql).run(&block)
end
prepared_sql() click to toggle source

Override the given *_sql method based on the type, and cache the result of the sql.

Calls superclass method
# File lib/sequel/dataset/prepared_statements.rb, line 77
def prepared_sql
  if sql = @opts[:prepared_sql] || cache_get(:_prepared_sql)
    return sql
  end
  cache_set(:_prepared_sql, super)
end
prepared_statement_name() click to toggle source

The name of the prepared statement, if any.

# File lib/sequel/dataset/prepared_statements.rb, line 58
def prepared_statement_name
  @opts[:prepared_statement_name]
end