module Sequel::MySQL::MysqlMysql2::DatabaseMethods

  1. lib/sequel/adapters/utils/mysql_mysql2.rb

Methods

Public Instance

  1. call_sproc
  2. execute

Constants

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

Public Instance methods

call_sproc(name, opts=OPTS, &block)

Support stored procedures on MySQL

[show source]
   # File lib/sequel/adapters/utils/mysql_mysql2.rb
27 def call_sproc(name, opts=OPTS, &block)
28   args = opts[:args] || [] 
29   execute("CALL #{name}#{args.empty? ? '()' : literal(args)}", opts.merge(:sproc=>false), &block)
30 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/utils/mysql_mysql2.rb
34 def execute(sql, opts=OPTS, &block)
35   if opts[:sproc]
36     call_sproc(sql, opts, &block)
37   elsif sql.is_a?(Symbol) || sql.is_a?(Sequel::Dataset::ArgumentMapper)
38     execute_prepared_statement(sql, opts, &block)
39   else
40     synchronize(opts[:server]){|conn| _execute(conn, sql, opts, &block)}
41   end
42 end