module Sequel::MySQL::PreparedStatements::DatabaseMethods

  1. lib/sequel/adapters/shared/mysql_prepared_statements.rb

Methods

Public Instance

  1. call_sproc
  2. execute

Constants

MYSQL_DATABASE_DISCONNECT_ERRORS = /\A#{Regexp.union(disconnect_errors)}/o  

Error messages for mysql and mysql2 that indicate the current connection should be disconnected

Public Instance methods

call_sproc (name, opts=OPTS, &block)

Support stored procedures on MySQL

[show source]
# File lib/sequel/adapters/shared/mysql_prepared_statements.rb, line 21
def call_sproc(name, opts=OPTS, &block)
  args = opts[:args] || [] 
  execute("CALL #{name}#{args.empty? ? '()' : literal(args)}", opts.merge(:sproc=>false), &block)
end
execute (sql, opts=OPTS, &block)

Executes the given SQL using an available connection, yielding the connection if the block is given.

[show source]
# File lib/sequel/adapters/shared/mysql_prepared_statements.rb, line 28
def execute(sql, opts=OPTS, &block)
  if opts[:sproc]
    call_sproc(sql, opts, &block)
  elsif sql.is_a?(Symbol)
    execute_prepared_statement(sql, opts, &block)
  else
    synchronize(opts[:server]){|conn| _execute(conn, sql, opts, &block)}
  end
end