Bio-Chado-Schema

 view release on metacpan or  search on metacpan

doc/slides/dbic_intro/Spork.slides  view on Meta::CPAN

  JOIN cvterm type
         ON type.cvterm_id = features.type_id
  WHERE species = ? AND type.name = ?
  EOS

----
= Convenient Loading of Relationships

  $chado->resultset( 'Cv::Cv' )
        ->find_or_create({ name => 'My Fake Ontology' })
        ->create_related(  'cvterm',
                           { name => 'MyFakeTerm' });

makes the SQL:

  SELECT me.cv_id
       , me.name
       , me.definition
  FROM cv me
  WHERE ( me.name = 'my fake ontology' )

  INSERT INTO cv ( name )
          VALUES ( 'my fake ontology' )
       RETURNING cv_id

  INSERT INTO cvterm ( cv_id,  name        )
              VALUES ( ?,     'MyFakeTerm' )

----
= Transactions

  $schema->txn_do(sub {

      $schema->resultset('Cv::Cv')
             ->find_or_create({ name => 'My Fake Ontology' })
             ->create_related( 'cvterm', { name => 'MyFakeTerm' } );

  });

----
= The Real Advantages of DBIC

* easier to manipulate and assemble queries

----
= The Real Advantages of DBIC

* complex joined queries (Chado queries) are very easy and compact

----
= The Real Advantages of DBIC

* SQL syntax errors are more difficult to make

----
= The Real Advantages of DBIC

* it's all objects.  you can delegate to them, pass them around, etc.
* HOWEVER:
+** usually you don't want to subclass them
** but, see |DBIx::Class::Manual::Cookbook|

----
== That's All

* The END



( run in 1.134 second using v1.01-cache-2.11-cpan-f56aa216473 )