Module: Sequel::Dataset::ArgumentMapper

Module | Sequel::Dataset::ArgumentMapper
In: | lib/sequel/dataset/prepared_statements.rb

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).

### Methods

call prepared_sql

### Constants

SQL_QUERY_TYPE | = | Hash.new{|h,k| h[k] = k}

### Attributes

bind_arguments | [RW] | The bind arguments to use for running this prepared statement
prepared_statement_name | [RW] | The name of the prepared statement, if any.

### Public Instance methods

call(bind_vars={}, &block)

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

[Source]

        # File lib/sequel/dataset/prepared_statements.rb, line 19
    19:       def call(bind_vars={}, &block)
    20:         ds = bind(bind_vars)
    21:         ds.prepared_sql
    22:         ds.bind_arguments = ds.map_to_prepared_args(ds.opts[:bind_vars])
    23:         ds.run(&block)
    24:       end

prepared_sql()

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

[Source]

        # File lib/sequel/dataset/prepared_statements.rb, line 28
    28:       def prepared_sql
    29:         return @prepared_sql if @prepared_sql
    30:         @prepared_args ||= []
    31:         @prepared_sql = super
    32:         meta_def("#{sql_query_type}_sql"){|*args| prepared_sql}
    33:         @prepared_sql
    34:       end

[Validate]