NAME
GenOO::Data::DB::DBIC::Species::Schema - Schema object
SYNOPSIS
# All the database manipulation with DBIx::Class is done via one central Schema object
# which maintains the connection to the database. This class inherits from DBIx::Class::Schema
# and loads the tables with sequencing reads automatically.
# To create a schema object, call connect on GenOO::Data::DB::DBIC::Species::Schema, passing it a Data Source Name.
GenOO::Data::DB::DBIC::Species::Schema->
connect
(
"$connection_string"
);
DESCRIPTION
In High Troughput Sequencing analysis we usually have many db tables
with
similar
structure and columns. Unfortunalely, DBIx::Class requires
each
Result class to specify
the table name explicitly which means that we would have to explicitly create a Result class
for
every db table. To avoid this, upon request we dynamically create (meta-programming) a new Result class
for
the provided table name. The new Result class inherits the table structure from
a base class which is also provided.
One can also hard code a Result class under the namespace GenOO::Data::DB::DBIC::Species::Schema::Result and it will also be registered under the schema.
The implementation follows draegtun suggestion in
L<http://stackoverflow.com/questions/14515153/
use
-dbixclass-
with
-a-single-result-class-definition-to-handle-several-tables-w>
EXAMPLES
my
$schema
= GenOO::Data::DB::DBIC::Species::Schema->
connect
(
"dbi:mysql:dbname=$database;host=$host;"
,
$user
,
$pass
);
my
$result_set
=
$schema
->resultset(
'sample_table_name'
);