class ActiveRecord::ConnectionAdapters::AbstractAdapter

notably, the instance methods provided by SchemaStatement are very useful.
Most of the methods in the adapter are useful during migrations. Most
you can use.
ActiveRecord::Base.connection returns an AbstractAdapter object, which
All the concrete database adapters follow the interface laid down in this class.
and ‘:limit’ options, etc.
a connection, escaping values, building the right SQL fragments for ‘:offset’
abstract interface for database-specific functionality such as establishing
An AbstractAdapter represents a connection to a database, and provides an
related classes form the abstraction layer which makes this possible.
ActiveRecord supports multiple database systems. AbstractAdapter and
:nodoc:

def active?

the connection isn't stale.
checking whether the database is actually capable of responding, i.e. whether
Checks whether the connection to the database is still active. This includes
def active?
  @active != false
end

def adapter_name

can always use downcase if needed.
Returns the human-readable name of the adapter. Use mixed case - one
def adapter_name
  'Abstract'
end

def create_savepoint

def create_savepoint
end

def current_savepoint_name

def current_savepoint_name
  "active_record_#{open_transactions}"
end

def decrement_open_transactions

def decrement_open_transactions
  @open_transactions -= 1
end

def disable_referential_integrity(&block)

Override to turn off referential integrity while executing &block.
def disable_referential_integrity(&block)
  yield
end

def disconnect!

method does nothing.
Disconnects from the database if already connected. Otherwise, this
def disconnect!
  @active = false
end

def format_log_entry(message, dump = nil)

def format_log_entry(message, dump = nil)
  if ActiveRecord::Base.colorize_logging
    if @@row_even
      @@row_even = false
      message_color, dump_color = "4;36;1", "0;1"
    else
      @@row_even = true
      message_color, dump_color = "4;35;1", "0"
    end
    log_entry = "  \e[#{message_color}m#{message}\e[0m   "
    log_entry << "\e[#{dump_color}m%#{String === dump ? 's' : 'p'}\e[0m" % dump if dump
    log_entry
  else
    "%s  %s" % [message, dump]
  end
end

def increment_open_transactions

def increment_open_transactions
  @open_transactions ||= 0
  @open_transactions += 1
end

def initialize(connection, logger = nil) #:nodoc:

:nodoc:
def initialize(connection, logger = nil) #:nodoc:
  @connection, @logger = connection, logger
  @runtime = 0
  @last_verification = 0
  @query_cache_enabled = false
end

def log(sql, name)

def log(sql, name)
  if block_given?
    result = nil
    ms = Benchmark.ms { result = yield }
    @runtime += ms
    log_info(sql, name, ms)
    result
  else
    log_info(sql, name, 0)
    nil
  end
rescue SystemExit, SignalException, NoMemoryError => e
  # Don't re-wrap these exceptions. They are probably not being caused by invalid
  # sql, but rather some external stimulus beyond the responsibilty of this code.
  # Additionaly, wrapping these exceptions with StatementInvalid would lead to
  #  meaningful loss of data, such as losing SystemExit#status.
  raise e
rescue Exception => e
  # Log message and raise exception.
  # Set last_verification to 0, so that connection gets verified
  # upon reentering the request loop
  @last_verification = 0
  message = "#{e.class.name}: #{e.message}: #{sql}"
  log_info(message, name, 0)
  raise ActiveRecord::StatementInvalid, message
end

def log_info(sql, name, ms)

def log_info(sql, name, ms)
  if @logger && @logger.debug?
    name = '%s (%.1fms)' % [name || 'SQL', ms]
    @logger.debug(format_log_entry(name, sql.squeeze(' ')))
  end
end

def open_transactions

def open_transactions
  @open_transactions ||= 0
end

def prefetch_primary_key?(table_name = nil)

This is false for all adapters but Firebird.
is called before each insert to set the record's primary key.
sequence before the insert statement? If true, next_sequence_value
Should primary key values be selected from their corresponding
def prefetch_primary_key?(table_name = nil)
  false
end

def quote_table_name(name)

Override to return the quoted table name. Defaults to column quoting.
def quote_table_name(name)
  quote_column_name(name)
end

def raw_connection

PostgreSQL's lo_* methods.
This is useful for when you need to call a proprietary method such as

and a PGconn object in case of PostgreSQLAdapter.
example, this method returns a Mysql object in case of MysqlAdapter,
Provides access to the underlying database driver for this adapter. For
def raw_connection
  @connection
end

def reconnect!

new connection with the database.
Disconnects from the database if already connected, and establishes a
def reconnect!
  @active = true
end

def release_savepoint

def release_savepoint
end

def requires_reloading?

Returns true if its safe to reload the connection between requests for development mode.
def requires_reloading?
  true
end

def reset!

overridden by concrete adapters.
The default implementation does nothing; the implementation should be

database-dependent operation.
transactions and other connection-related server-side state. Usually a
Reset the state of this connection, directing the DBMS to clear
def reset!
  # this should be overridden by concrete adapters
end

def reset_runtime #:nodoc:

:nodoc:
def reset_runtime #:nodoc:
  rt, @runtime = @runtime, 0
  rt
end

def rollback_to_savepoint

def rollback_to_savepoint
end

def supports_count_distinct?

for all adapters except sqlite.
Does this adapter support using DISTINCT within COUNT? This is +true+
def supports_count_distinct?
  true
end

def supports_ddl_transactions?

SQL Server, and others support this. MySQL and others do not.
CREATE TABLE or ALTER TABLE get rolled back by a transaction? PostgreSQL,
Does this adapter support DDL rollbacks in transactions? That is, would
def supports_ddl_transactions?
  false
end

def supports_migrations?

abstract adapter always returns +false+.
Does this adapter support migrations? Backend specific, as the
def supports_migrations?
  false
end

def supports_primary_key?

the abstract adapter always returns +false+.
to an ActiveRecord class, such as join tables? Backend specific, as
Can this adapter determine the primary key for tables not attached
def supports_primary_key?
  false
end

def supports_savepoints?

does not.
Does this adapter support savepoints? PostgreSQL and MySQL do, SQLite
def supports_savepoints?
  false
end

def transaction_joinable=(joinable)

def transaction_joinable=(joinable)
  @transaction_joinable = joinable
end

def verify!(*ignored)

is no longer active, then this method will reconnect to the database.
This is done under the hood by calling active?. If the connection
Checks whether the connection to the database is still active (i.e. not stale).
def verify!(*ignored)
  reconnect! unless active?
end