Class DataMapper::Adapters::DataObjectsAdapter
In: lib/dm-core/adapters/data_objects_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.

Methods

Included Modules

SQL

Public Class methods

TODO: document @api public

Public Instance methods

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 identity map. A plugin needs to use adapter directly, it is up to plugin developer to keep 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

Database-specific method TODO: document @api public

TODO: document @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

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

Protected Instance methods

Takes connection and closes it

@api semipublic

TODO: document @api private

Instantiates new connection object

@api semipublic

[Validate]