Error messages for mysql and mysql2 that indicate the current connection should be disconnected
Support stored procedures on MySQL
# File lib/sequel/adapters/utils/mysql_mysql2.rb, line 25 def call_sproc(name, opts=OPTS, &block) args = opts[:args] || [] execute("CALL #{name}#{args.empty? ? '()' : literal(args)}", opts.merge(:sproc=>false), &block) end
Executes the given SQL using an available connection, yielding the connection if the block is given.
# File lib/sequel/adapters/utils/mysql_mysql2.rb, line 32 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
# File lib/sequel/adapters/utils/mysql_mysql2.rb, line 44 def add_prepared_statements_cache(conn) class << conn attr_accessor :prepared_statements end conn.prepared_statements = {} end
# File lib/sequel/adapters/utils/mysql_mysql2.rb, line 51 def database_specific_error_class(exception, opts) case exception.errno when 1048 NotNullConstraintViolation when 1062 UniqueConstraintViolation when 1451, 1452 ForeignKeyConstraintViolation when 4025 CheckConstraintViolation else super end end