An Introduction to Class::DBI - Advanced Topics 35

Advanced Topics

Wrapping more complicated SQL in methods

  • use set_sql:

        FilmBuff::Person->set_sql('total_people' => 'SELECT count(*) FROM person');
        print "total people: ", FilmBuff::Person->search_total_people, "\n";
    
  • mix arbitrary SQL directly in with your code (SHAME!)

        my @nominations = Nomination->retrieve_from_sql(qq{
            TITLE like "Star Wars%"
            AND year <= 1987
    
        ORDER BY year
        LIMIT 2,3
    

 

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