Class | DataMapper::Adapters::DataObjectsAdapter |
In: |
lib/dm-do-adapter/adapter.rb
|
Parent: | AbstractAdapter |
DataObjectsAdapter is the base class for all adapers for relational databases. If you want to add support for a new RDBMS, it makes sense to make your adapter class inherit from this class.
By inheriting from DataObjectsAdapter, you get a copy of all the standard sub-modules (Quoting, Coersion and Queries) in your own Adapter. You can extend and overwrite these copies without affecting the originals.
For each model instance in resources, issues an SQL INSERT (or equivalent) statement to create a new record in the data store for the instance
Note that this method does not update the identity map. If a plugin needs to use an adapter directly, it is up to plugin developer to keep the identity map up to date.
@param [Enumerable(Resource)] resources
The list of resources (model instances) to create
@return [Integer]
The number of records that were actually saved into the database
@api semipublic
Constructs and executes DELETE statement for given query
@param [Collection] collection
collection of records to be deleted
@return [Integer]
the number of records deleted
@api semipublic
Execute non-SELECT SQL query
@param [String] statement
the SQL statement
@param [Array] *bind_values
optional bind values to merge into the statement
@return [DataObjects::Result]
result with number of affected rows, and insert id if any
@api public
Constructs and executes SELECT query, then instantiates one or many object from result set.
@param [Query] query
composition of the query to perform
@return [Array]
result set of the query
@api semipublic
Retrieve results using an SQL SELECT statement
@param [String] statement
the SQL SELECT statement
@param [Array] *bind_values
optional bind values to merge into the statement
@return [Array]
if fields > 1, return an Array of Struct objects if fields == 1, return an Array of objects
@api public
Constructs and executes UPDATE statement for given attributes and a query
@param [Hash(Property => Object)] attributes
hash of attribute values to set, keyed by Property
@param [Collection] collection
collection of records to be updated
@return [Integer]
the number of records updated
@api semipublic