Class: ActiveRecord::ConnectionAdapters::AbstractAdapter

Class | ActiveRecord::ConnectionAdapters::AbstractAdapter
In: | lib/active_record/connection_adapters/abstract_adapter.rb
Parent: | Object

All the concrete database adapters follow the interface laid down in this class. You can use this interface directly by borrowing the database connection from the Base with Base.connection.

Most of the methods in the adapter are useful during migrations. Most notably, SchemaStatements#create_table, SchemaStatements#drop_table, SchemaStatements#add_index, SchemaStatements#remove_index, SchemaStatements#add_column, SchemaStatements#change_column and SchemaStatements#remove_column are very useful.

### Methods

active? adapter_name disable_referential_integrity disconnect! format_log_entry log log_info prefetch_primary_key? quote_table_name raw_connection reconnect! requires_reloading? supports_count_distinct? supports_migrations? verify!

### Included Modules

Quoting DatabaseStatements SchemaStatements QueryCache

### Public Instance methods

active?()

Is this connection active and ready to perform queries?

adapter_name()

Returns the human-readable name of the adapter. Use mixed case - one can always use downcase if needed.

disable_referential_integrity() {|| ...}

Override to turn off referential integrity while executing `&block`.

disconnect!()

Close this connection

log_info(sql, name, runtime)
prefetch_primary_key?(table_name = nil)

Should primary key values be selected from their corresponding sequence before the insert statement? If true, next_sequence_value is called before each insert to set the record‘s primary key. This is false for all adapters but Firebird.

quote_table_name(name)

Override to return the quoted table name. Defaults to column quoting.

raw_connection()

Provides access to the underlying database connection. Useful for when you need to call a proprietary method such as postgresql‘s lo_* methods

reconnect!()

Close this connection and open a new one in its place.

requires_reloading?()

Returns true if its safe to reload the connection between requests for development mode. This is not the case for Ruby/MySQL and it‘s not necessary for any adapters except SQLite.

supports_count_distinct?()

Does this adapter support using DISTINCT within COUNT? This is `true` for all adapters except sqlite.

supports_migrations?()

Does this adapter support migrations? Backend specific, as the abstract adapter always returns `false`.

verify!(timeout)

Lazily verify this connection, calling `active?` only if it hasn‘t been called for `timeout` seconds.

### Protected Instance methods

format_log_entry(message, dump = nil)
log(sql, name) {|| ...}

[Validate]