The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Bio::DB::PersistenceAdaptorI - DESCRIPTION of Interface

SYNOPSIS

Give standard usage here

DESCRIPTION

This interface gives the base methods to be implemented by modules that bridge persistent objects to and from their datastores.

The design choice mixes the strategy pattern with the factory pattern (find_by_XXXX()).

FEEDBACK

Mailing Lists

User feedback is an integral part of the evolution of this and other Bioperl modules. Send your comments and suggestions preferably to the Bioperl mailing list. Your participation is much appreciated.

  bioperl-l@bioperl.org                  - General discussion
  http://bioperl.org/wiki/Mailing_lists  - About the mailing lists

Support

Please direct usage questions or support issues to the mailing list:

bioperl-l@bioperl.org

rather than to the module maintainer directly. Many experienced and reponsive experts will be able look at the problem and quickly address it. Please include a thorough description of the problem with code and data examples if at all possible.

Reporting Bugs

Report bugs to the Bioperl bug tracking system to help us keep track of the bugs and their resolution. Bug reports can be submitted via the web:

  http://redmine.open-bio.org/projects/bioperl/

AUTHOR - Hilmar Lapp

Email hlapp at gmx.net

Describe contact details here

CONTRIBUTORS

Additional contributors names and emails here

APPENDIX

The rest of the documentation details each of the object methods. Internal methods are usually preceded with a _

Methods for managing persistent objects

   Create (insert), store (update), remove (delete)

create

 Title   : create
 Usage   : $objectstoreadp->create($obj)
 Function: Creates the object as a persistent object in the datastore. This
           is equivalent to an insert.

           If the object already implements this interface, it will be
           populated with values, and the primary key will be set.

 Example :
 Returns : A Bio::DB::PersistentObjectI implementing object wrapping
           the inserted object.
 Args    : The object to be inserted.

           Optionally, additional named parameters. A common parameter
           will be -fkobjs, with a reference to an array of foreign
           key objects if these cannot be obtained from the object
           itself.

create_persistent

 Title   : create_persistent
 Usage   :
 Function: Takes the given object and turns it onto a
           L<Bio::DB::PersistentObjectI> implementing object. Returns
           the result. Does not actually create the object in a
           database.

           Calling this method is expected to have a recursive effect
           such that all children of the object, i.e., all slots that
           are objects themselves, are made persistent objects, too.

 Example :
 Returns : A Bio::DB::PersistentObjectI implementing object wrapping the
           passed object.
 Args    : An object to be made into a PersistentObjectI object, and the class
           of which is suitable for this adaptor.

           Optionally, the class which actually implements wrapping
           the object to become a PersistentObjectI.

store

 Title   : store
 Usage   : $objectstoreadp->store($persistent_obj)
 Function: Updates the given persistent object in the datastore.

           Implementations should be flexible and delegate to create()
           if the primary_key() method of the object returns undef.

 Example :
 Returns : TRUE on success and FALSE otherwise
 Args    : The object to be updated, which must implement
           Bio::DB:PersistentObjectI.

           Optionally, additional named parameters. A common parameter
           will be -fkobjs, with a reference to an array of foreign
           key objects if these cannot be obtained from the object
           itself.

remove

 Title   : remove
 Usage   : $objectstoreadp->remove($persistent_obj, @params)
 Function: Removes the persistent object from the datastore.
 Example :
 Returns : TRUE on success and FALSE otherwise
 Args    : The object to be removed, and optionally additional (named) 
           parameters.

Methods for locating objects

    Find by primary key, by unique key, by association, and by query.

find_by_primary_key

 Title   : find_by_primary_key
 Usage   : $popj = $objectstoreadp->find_by_primary_key($pk)
 Function: Locates the entry associated with the given primary key and
           initializes a persistent object with that entry.
 Example :
 Returns : An instance of the class this adaptor adapts, represented by an
           object implementing Bio::DB::PersistentObjectI, or undef if no
           matching entry was found.
 Args    : The primary key

find_by_unique_key

 Title   : find_by_unique_key
 Usage   :
 Function: Locates the entry matching the unique key attributes as set in the
           passed object, and populates a persistent object with this entry.
 Example :
 Returns : A Bio::DB::PersistentObjectI implementing object, with the
           attributes populated with values provided by the entry in
           the datastore, or undef if no matching entry was found. If
           one was found, the object returned will be the first
           argument if that implemented Bio::DB::PersistentObjectI
           already.

 Args    : The object with those attributes set that constitute the
           chosen unique key (note that the class of the object must
           be suitable for the adaptor).

           Additional attributes and values if required, passed as a
           reference to a hash map.

find_by_association

 Title   : find_by_association
 Usage   :
 Function: Locates those records associated between a number of
           objects. The focus object (the type to be instantiated)
           depends on the adaptor class that inherited from this
           class.

 Example :
 Returns : A Bio::DB::Query::QueryResultI implementing object 
 Args    : Named parameters. At least the following must be recognized:
               -objs   a reference to an array of objects to be associated with
                       each other
               -obj_factory the factory to use for instantiating objects from
                       the found rows
  Caveats: Make sure you *always* give the objects to be associated in the
           same order.

find_by_query

 Title   : find_by_query
 Usage   :
 Function: Locates entries that match a particular query and returns the
           result as an array of peristent objects.

           The query is represented by an instance of
           Bio::DB::Query::BioQuery or a derived class. Note that
           SELECT fields will be ignored and auto-determined. Give
           tables in the query as objects, class names, or adaptor
           names, and columns as slot names or foreign key class names
           in order to be maximally independent of the exact
           underlying schema. The driver of this adaptor will
           translate the query into tables and column names.

 Example :
 Returns : A Bio::DB::Query::QueryResultI implementing object
 Args    : The query as a Bio::DB::Query::BioQuery or derived instance.
           Note that the SELECT fields of that query object will inadvertantly
           be overwritten.
           Optionally additional (named) parameters. Recognized parameters
           at this time are
              -fkobjs    a reference to an array of foreign key objects that
                         are not retrievable from the persistent object itself
              -obj_factory  the object factory to use for creating objects for
                         resulting rows
              -name      a unique name for the query, which will make the
                         the statement be a cached prepared statement, which
                         in subsequent invocations will only be re-bound with
                         parameters values, but not recreated
              -values    a reference to an array holding the values to be
                         bound, if the query is a named query

Methods for transactional control

   Rollback and commit

commit

 Title   : commit
 Usage   :
 Function: Commits the current transaction, if the underlying driver
           supports transactions.
 Example :
 Returns : TRUE
 Args    : none

rollback

 Title   : rollback
 Usage   :
 Function: Triggers a rollback of the current transaction, if the
           underlying driver supports transactions.
 Example :
 Returns : TRUE
 Args    : none