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.

Methods
Public Instance methods
adapter_name()

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

     # File vendor/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb, line 342
342:       def adapter_name()
343:         'Abstract'
344:       end
add_column(table_name, column_name, type, options = {})
     # File vendor/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb, line 386
386:       def add_column(table_name, column_name, type, options = {})
387:         native_type = native_database_types[type]
388:         add_column_sql = "ALTER TABLE #{table_name} ADD #{column_name} #{type_to_sql(type, options[:limit])}"
389:         add_column_options!(add_column_sql, options)
390:         execute(add_column_sql)
391:       end
add_index(table_name, column_name, index_type = '')
     # File vendor/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb, line 413
413:       def add_index(table_name, column_name, index_type = '')
414:         execute "CREATE #{index_type} INDEX #{table_name}_#{column_name.to_a.first}_index ON #{table_name} (#{column_name.to_a.join(", ")})"
415:       end
add_limit!(sql, options)
     # File vendor/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb, line 349
349:       def add_limit!(sql, options)
350:         return unless options
351:         add_limit_offset!(sql, options)
352:       end
add_limit_offset!(sql, options)
     # File vendor/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb, line 354
354:       def add_limit_offset!(sql, options)
355:         return if options[:limit].nil?
356:         sql << " LIMIT #{options[:limit]}"
357:         sql << " OFFSET #{options[:offset]}" if options.has_key?(:offset) and !options[:offset].nil?
358:       end
begin_db_transaction()

Begins the transaction (and turns off auto-committing).

     # File vendor/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb, line 306
306:       def begin_db_transaction()    end
change_column(table_name, column_name, type, options = {})
     # File vendor/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb, line 397
397:       def change_column(table_name, column_name, type, options = {})
398:         raise NotImplementedError, "change_column is not implemented"
399:       end
change_column_default(table_name, column_name, default)
     # File vendor/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb, line 401
401:       def change_column_default(table_name, column_name, default)
402:         raise NotImplementedError, "change_column_default is not implemented"
403:       end
columns(table_name, name = nil)

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

     # File vendor/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb, line 273
273:       def columns(table_name, name = nil) end
commit_db_transaction()

Commits the transaction (and turns on auto-committing).

     # File vendor/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb, line 309
309:       def commit_db_transaction()   end
create_table(name, options = {}) {|table_definition| ...}
     # File vendor/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb, line 370
370:       def create_table(name, options = {})
371:         table_definition = TableDefinition.new(self)
372:         table_definition.primary_key(options[:primary_key] || "id") unless options[:id] == false
373: 
374:         yield table_definition
375:         create_sql = "CREATE TABLE #{name} ("
376:         create_sql << table_definition.to_sql
377:         create_sql << ") #{options[:options]}"
378:                 
379:         execute create_sql
380:       end
delete(sql, name = nil)

Executes the delete statement and returns the number of rows affected.

     # File vendor/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb, line 282
282:       def delete(sql, name = nil) end
drop_table(name)
     # File vendor/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb, line 382
382:       def drop_table(name)
383:         execute "DROP TABLE #{name}"
384:       end
initialize_schema_information()
     # File vendor/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb, line 361
361:       def initialize_schema_information
362:         begin
363:           execute "CREATE TABLE schema_info (version #{type_to_sql(:integer)})"
364:           insert "INSERT INTO schema_info (version) VALUES(0)"
365:         rescue ActiveRecord::StatementInvalid
366:           # Schema has been intialized
367:         end
368:       end
insert(sql, name = nil, pk = nil, id_value = nil)

Returns the last auto-generated ID from the affected table.

     # File vendor/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb, line 276
276:       def insert(sql, name = nil, pk = nil, id_value = nil) end
native_database_types()
     # File vendor/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb, line 425
425:       def native_database_types
426:         {}
427:       end
quote(value, column = nil)
     # File vendor/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb, line 315
315:       def quote(value, column = nil)
316:         case value
317:           when String
318:             if column && column.type == :binary
319:               "'#{quote_string(column.string_to_binary(value))}'" # ' (for ruby-mode)
320:             else
321:               "'#{quote_string(value)}'" # ' (for ruby-mode)
322:             end
323:           when NilClass              then "NULL"
324:           when TrueClass             then (column && column.type == :boolean ? "'t'" : "1")
325:           when FalseClass            then (column && column.type == :boolean ? "'f'" : "0")
326:           when Float, Fixnum, Bignum then value.to_s
327:           when Date                  then "'#{value.to_s}'"
328:           when Time, DateTime        then "'#{value.strftime("%Y-%m-%d %H:%M:%S")}'"
329:           else                            "'#{quote_string(value.to_yaml)}'"
330:         end
331:       end
quote_column_name(name)
     # File vendor/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb, line 337
337:       def quote_column_name(name)
338:         name
339:       end
quote_string(s)
     # File vendor/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb, line 333
333:       def quote_string(s)
334:         s.gsub(/\\/, '\&\&').gsub(/'/, "''") # ' (for ruby-mode)
335:       end
remove_column(table_name, column_name)
     # File vendor/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb, line 393
393:       def remove_column(table_name, column_name)
394:         execute "ALTER TABLE #{table_name} DROP #{column_name}"
395:       end
remove_index(table_name, column_name)
     # File vendor/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb, line 417
417:       def remove_index(table_name, column_name)
418:         execute "DROP INDEX #{table_name}_#{column_name}_index ON #{table_name}"
419:       end
rename_column(table_name, column_name, new_column_name)
     # File vendor/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb, line 409
409:       def rename_column(table_name, column_name, new_column_name)
410:         raise NotImplementedError, "rename_column is not implemented"
411:       end
rollback_db_transaction()

Rolls back the transaction (and turns on auto-committing). Must be done if the transaction block raises an exception or returns false.

     # File vendor/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb, line 313
313:       def rollback_db_transaction() end
select_all(sql, name = nil)

Returns an array of record hashes with the column names as a keys and fields as values.

     # File vendor/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb, line 267
267:       def select_all(sql, name = nil) end
select_one(sql, name = nil)

Returns a record hash with the column names as a keys and fields as values.

     # File vendor/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb, line 270
270:       def select_one(sql, name = nil) end
structure_dump()

Returns a string of the CREATE TABLE SQL statements for recreating the entire structure of the database.

     # File vendor/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb, line 347
347:       def structure_dump() end
supports_migrations?()
     # File vendor/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb, line 405
405:       def supports_migrations?
406:         false
407:       end
supports_migrations?()
     # File vendor/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb, line 421
421:       def supports_migrations?
422:         false
423:       end
transaction(start_db_transaction = true) {|| ...}

Wrap a block in a transaction. Returns result of block.

     # File vendor/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb, line 291
291:       def transaction(start_db_transaction = true)
292:         begin
293:           if block_given?
294:             begin_db_transaction if start_db_transaction
295:             result = yield
296:             commit_db_transaction if start_db_transaction
297:             result
298:           end
299:         rescue Exception => database_transaction_rollback
300:           rollback_db_transaction if start_db_transaction
301:           raise
302:         end
303:       end
type_to_sql(type, limit = nil)
     # File vendor/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb, line 429
429:       def type_to_sql(type, limit = nil)
430:         native = native_database_types[type]
431:         limit ||= native[:limit]
432:         column_type_sql = native[:name]
433:         column_type_sql << "(#{limit})" if limit
434:         column_type_sql
435:       end
update(sql, name = nil)

Executes the update statement and returns the number of rows affected.

     # File vendor/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb, line 279
279:       def update(sql, name = nil) end