module Sequel::Dataset::ArgumentMapper

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

Public Instance methods

bind_arguments()

The bind arguments to use for running this prepared statement

[show source]
   # File lib/sequel/dataset/prepared_statements.rb
51 def bind_arguments
52   @opts[:bind_arguments]
53 end
call(bind_vars=OPTS, &block)

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

[show source]
   # File lib/sequel/dataset/prepared_statements.rb
56 def call(bind_vars=OPTS, &block)
57   sql = prepared_sql
58   prepared_args.freeze
59   ps = bind(bind_vars)
60   ps.clone(:bind_arguments=>ps.map_to_prepared_args(ps.opts[:bind_vars]), :sql=>sql, :prepared_sql=>sql).run(&block)
61 end
prepared_sql()

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

[show source]
   # File lib/sequel/dataset/prepared_statements.rb
65 def prepared_sql
66   if sql = @opts[:prepared_sql] || cache_get(:_prepared_sql)
67     return sql
68   end
69   cache_set(:_prepared_sql, super)
70 end
prepared_statement_name()

The name of the prepared statement, if any.

[show source]
   # File lib/sequel/dataset/prepared_statements.rb
46 def prepared_statement_name
47   @opts[:prepared_statement_name]
48 end