An Introduction to Class::DBI - First Example 17

Example - And the winner is...

Using DBI

  • Setup

        use DBI;
    
        my $DBH = DBI::connect('dbi:pg', 'dbi_user', 'dbi_password);
    
        my $nominee_search = $DBH->prepare(
            'SELECT id FROM nomination WHERE year = ? and type = ?'
        );
    
        my $voter_count    = $DBH->prepare(
            'SELECT voter_id, nomination_id FROM vote WHERE nomination_id = ?'
        );
    
        my $update_winner  = $DBH->prepare(
            'UPDATE nominations SET takes_the_oscar = ? WHERE id = ?'
        );
    

continued...

 

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