An Introduction to Class::DBI - First Example 18

Example - And the winner is...

Using Class::DBI

  • Setup

        package Nomination;
        use base 'Class::DBI';
    
        Nomination->set_db('Main', 'dbi:pg', 'dbi_user', 'dbi_password');
        Nomination->table('nomination');
        Nomination->columns('id','type', 'year', 'film_id', 'credit_id', 'takes_the_oscar');
        Nomination->columns(Primary => 'id');
    
        package Voter;
        use base 'Class::DBI';
    
        Voter->set_db('Main', 'dbi:pg', 'dbi_user', 'dbi_password');
        Voter->table('vote');
        Voter->columns('voter_id', 'nomination_id');
        Voter->columns('Primary' => 'id');
    

continued...

 

YAPC::Canada << Previous | Index | Next >>
Copyright © 2003 Michael Graham