Module ActiveRecord::ConnectionAdapters::DatabaseStatements
In: lib/active_record/connection_adapters/abstract/database_statements.rb

Methods

Public Instance methods

Appends LIMIT and OFFSET options to an SQL statement. This method modifies the sql parameter.

Examples
 add_limit_offset!('SELECT * FROM suppliers', {:limit => 10, :offset => 50})

generates

 SELECT * FROM suppliers LIMIT 10 OFFSET 50

Appends a locking clause to an SQL statement. This method modifies the sql parameter.

  # SELECT * FROM suppliers FOR UPDATE
  add_lock! 'SELECT * FROM suppliers', :lock => true
  add_lock! 'SELECT * FROM suppliers', :lock => ' FOR UPDATE'

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

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

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

Executes the SQL statement in the context of this connection.

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

Inserts the given fixture into the table. Overridden in adapters that require something beyond a simple insert (eg. Oracle).

Set the sequence to the max value of the table‘s column.

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

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

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

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

Returns a single value from a record

Returns an array of the values of the first column in a select:

  select_values("SELECT id FROM companies LIMIT 3") => [1,2,3]

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

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

Protected Instance methods

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

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

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

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

[Validate]