| Class | FlexiRecord::Connection |
| In: |
lib/flexirecord.rb
|
| Parent: | Object |
A Connection object represents a distinct connection to the database.
Generates a new Connection object. The passed ‘options’ are a hash, which may contain the following keys:
Same as record_query, but having no ‘record_class’, theirfor returning nil.
Same as record_query, but using BaseRecord‘s as ‘record_class’.
Executes an SQL query and returns an Array of objects of ‘record_class’ (which should be a sub-class of BaseRecord). The ‘command_template’ is an SQL statement with ’$’ placeholders to be replaced by the following ‘command_arguments’.
Starts a transaction or "nested transaction" (implemented by using save points), if already one is in progress. The arguments to this function can be an IsolationLevel constant, a symbol representing an IsolationLevel, the special symbol :unless_open or any number of BaseRecord objects, which are copied with BaseRecord#dup and restored with BaseRecord#replace, in case the transaction fails. If :unless_open is specified, and a transaction is already open, this method does nothing, except calling the given block. As partitial rollbacks on errors won‘t happen in this case, it‘s not recommended to use the :unless_open parameter, unless you know what you are doing. IsolationLevel‘s are only regarded, if there is no transaction open yet.