transaction

transaction(options = {}) Instance Public methods Runs the given block in a database transaction, and returns the result of the block. Nested transactions support Most databases don't support true nested transactions. At the time of writing, the only database that supports true nested transactions that we're aware of, is MS-SQL. In order to get around this problem, transaction will emulate the effect of nested transactions, by using savepoints: dev.mysql.com/doc/refman/5.0/en/savep

to_sql

to_sql(arel, binds = []) Instance Public methods Converts an arel AST to SQL

supports_statement_cache?

supports_statement_cache?() Instance Public methods Returns true when the connection adapter supports prepared statement caching, otherwise returns false

select_values

select_values(arel, name = nil) Instance Public methods Returns an array of the values of the first column in a select: select_values("SELECT id FROM companies LIMIT 3") => [1,2,3]

select_value

select_value(arel, name = nil, binds = []) Instance Public methods Returns a single value from a record

select_rows

select_rows(sql, name = nil, binds = []) Instance Public methods Returns an array of arrays containing the field values. Order is the same as that returned by columns.

select_one

select_one(arel, name = nil, binds = []) Instance Public methods Returns a record hash with the column names as keys and column values as values.

select_all

select_all(arel, name = nil, binds = []) Instance Public methods Returns an ActiveRecord::Result instance.

sanitize_limit

sanitize_limit(limit) Instance Public methods Sanitizes the given LIMIT parameter in order to prevent SQL injection. The limit may be anything that can evaluate to a string via to_s. It should look like an integer, or a comma-delimited list of integers, or an Arel SQL literal. Returns Integer and Arel::Nodes::SqlLiteral limits as is. Returns the sanitized limit parameter, either as an integer, or as a string which contains a comma-delimited list of integers.

rollback_db_transaction

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