| In: |
vendor/activerecord/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.
Returns an array of record hashes with the column names as a keys and fields as values.
# File vendor/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb, line 181
181: def select_all(sql, name = nil) end
Returns a record hash with the column names as a keys and fields as values.
# File vendor/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb, line 184
184: def select_one(sql, name = nil) end
Returns an array of column objects for the table specified by table_name.
# File vendor/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb, line 187
187: def columns(table_name, name = nil) end
Returns the last auto-generated ID from the affected table.
# File vendor/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb, line 190
190: def insert(sql, name = nil) end
Executes the update statement.
# File vendor/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb, line 193
193: def update(sql, name = nil) end
Executes the delete statement.
# File vendor/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb, line 196
196: def delete(sql, name = nil) end
Begins the transaction (and turns off auto-committing).
# File vendor/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb, line 205
205: def begin_db_transaction() end
Commits the transaction (and turns on auto-committing).
# File vendor/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb, line 208
208: def commit_db_transaction() end
Rollsback the transaction (and turns on auto-committing). Must be done if the transaction block raises an exception or returns false.
# File vendor/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb, line 212
212: def rollback_db_transaction() end
# File vendor/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb, line 214
214: def quote(value, column = nil)
215: case value
216: when String then "'#{value.gsub(/\\/,'\&\&').gsub(/'/, "''")}'" # ' (for ruby-mode)
217: when NilClass then "NULL"
218: when TrueClass then (column and column.type == :boolean ? "'t'" : "1")
219: when FalseClass then (column and column.type == :boolean ? "'f'" : "0")
220: when Float, Fixnum, Date then "'#{value.to_s}'"
221: when Time, DateTime then "'#{value.strftime("%Y-%m-%d %H:%M:%S")}'"
222: else "'#{value.to_yaml}'"
223: end
224: end