module Sequel::MySQL::PreparedStatements::DatasetMethods

Public Instance Methods

call(type, bind_arguments={}, *values, &block) click to toggle source

MySQL is different in that it supports prepared statements but not bound variables outside of prepared statements. The default implementation breaks the use of subselects in prepared statements, so extend the temporary prepared statement that this creates with a module that fixes it.

# File lib/sequel/adapters/shared/mysql_prepared_statements.rb, line 138
def call(type, bind_arguments={}, *values, &block)
  ps = to_prepared_statement(type, values)
  ps.extend(CallableStatementMethods)
  ps.call(bind_arguments, &block)
end
prepare(type, name=nil, *values) click to toggle source

Store the given type of prepared statement in the associated database with the given name.

# File lib/sequel/adapters/shared/mysql_prepared_statements.rb, line 146
def prepare(type, name=nil, *values)
  ps = to_prepared_statement(type, values)
  ps.extend(PreparedStatementMethods)
  if name
    ps.prepared_statement_name = name
    db.set_prepared_statement(name, ps)
  end
  ps
end