Class ActiveRecord::ConnectionAdapters::Mysql2Adapter
In: lib/active_record/connection_adapters/mysql2_adapter.rb
Parent: AbstractAdapter

Methods

Constants

ADAPTER_NAME = 'Mysql2'
PRIMARY = "PRIMARY"
LOST_CONNECTION_ERROR_MESSAGES = [ "Server shutdown in progress", "Broken pipe", "Lost connection to MySQL server during query", "MySQL server has gone away" ]
QUOTED_FALSE = '1', '0'
NATIVE_DATABASE_TYPES = { :primary_key => "int(11) DEFAULT NULL auto_increment PRIMARY KEY", :string => { :name => "varchar", :limit => 255 }, :text => { :name => "text" }, :integer => { :name => "int", :limit => 4 }, :float => { :name => "float" }, :decimal => { :name => "decimal" }, :datetime => { :name => "datetime" }, :timestamp => { :name => "datetime" }, :time => { :name => "time" }, :date => { :name => "date" }, :binary => { :name => "blob" }, :boolean => { :name => "tinyint", :limit => 1 }

Public Class methods

Public Instance methods

CONNECTION MANAGEMENT ====================================

Returns the database character set.

Returns the database collation strategy.

Returns an array of +Mysql2Column+ objects for the table specified by table_name.

create(sql, name = nil, pk = nil, id_value = nil, sequence_name = nil)

Alias for insert_sql

Create a new MySQL database with optional :charset and :collation. Charset defaults to utf8.

Example:

  create_database 'charset_test', :charset => 'latin1', :collation => 'latin1_bin'
  create_database 'matt_development'
  create_database 'matt_development', :charset => :big5

Disconnects from the database if already connected. Otherwise, this method does nothing.

exec_update(sql, name, binds)

Alias for exec_delete

Executes the SQL statement in the context of this connection.

Returns an array of indexes for the given table.

Returns a table‘s primary key and belonging sequence.

Returns just a table‘s primary key

QUOTING ==================================================

Drops the database specified on the name attribute and creates it again using the provided options.

Renames a table.

Example:

  rename_table('octopuses', 'octopi')

this is set to true in 2.3, but we don‘t want it to be

Returns an array of arrays containing the field values. Order is the same as that returned by columns.

SHOW VARIABLES LIKE ‘name’.

SCHEMA STATEMENTS ========================================

Returns true, since this connection adapter supports migrations.

Returns true, since this connection adapter supports savepoints.

Maps logical Rails types to MySQL-specific data types.

Protected Instance methods

[Validate]