NAME
Bio::MAGETAB::Util::Persistence - A Tangram-based object persistence class for MAGE-TAB.
SYNOPSIS
use Bio::MAGETAB::Util::Persistence;
my $db = Bio::MAGETAB::Util::Persistence->new({
dbparams => [ "dbi:mysql:$dbname", $user, $pass ],
});
$db->deploy();
$db->connect();
$db->insert( $magetab_object );
DESCRIPTION
This class provides an object persistence mechanism for storing MAGE-TAB objects in a relational database. The class is, in effect, just a thin wrapper around a Tangram::Storage instance which implements most of the database interaction methods. The class has been used successfully with both MySQL and SQLite database backends, and should in theory be usable with any database engine supported by the Tangram modules.
ATTRIBUTES
- dbparams
-
A reference to an array containing database connection parameters. This array is passed directly to
DBI->connect()
. - config
-
The Tangram schema definition used to create the database. This attribute is read-only.
- store
-
The underlying Tangram::Storage object used for most of the interaction with the database.
METHODS
- deploy
-
Connect to the database and deploy the schema. This only needs to be done once to set up the database.
- connect
-
Connect to the database. This must be done before using any of the following methods.
- get_schema
-
Returns the Tangram::Schema object created using the config attribute.
- class_config
-
A class method which returns the config hash reference used to create the Tangram::Schema object.
- insert
- select
- update
- erase
- id
- count
- sum
- cursor
- remote
-
All these methods are delegated directly to the Tangram::Storage object created by the
connect
method, and contained within the Persistence object. Please see the Tangram documentation for more information on these methods.
SEE ALSO
Bio::MAGETAB::DBLoader http://tangram.utsl.gen.nz/
AUTHOR
Tim F. Rayner <tfrayner@gmail.com>
LICENSE
This library is released under version 2 of the GNU General Public License (GPL).