I would like to mention the possibility to use functions instead of constants, and move all these functions to a separate module.
This all in the spirit of McConnell's Code Complete. Paraphrased: If you don't like/ grog/ find strange/ consider to be difficult a certain library or structure or whatever, interface it in a separate module. That way, you don't clutter up your main code with things that are unclear and hard to maintain. As a spin-off, you can reuse that module.
In this case, you could write functions with very descriptive names just as wrappers for the SQL:
package SQL_functions; sub select_picture_from_userID{ my $userID = shift; "SELECT pict FROM users WHERE ID = $userID;" } sub select_some_nifty_case_with_contstraints{ ... #hehe, perl6 only } #and in the "main" code: use SQL_functions qw/:all/; my $sth = $dbh->prepare( select_picture_from_userID( 666 ) ) or die...
Hope this helps,
Jeroen
In reply to Re:{2} Leashing DBI
by jeroenes
in thread Leashing DBI
by billyak
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |