in reply to dbi style questions (code, discussion)

A couple tips:

First: Regarding ugly insert and update statements, I solve this problem by using DBIx::Abstract with it's insert() and update() functions:

use DBIx::Abstract; # get started using existing $DBH handle my $db = DBIx::Abstract->connect($DBH); # insert from a hash, auto-quoting along the way $db->insert('table_name',\%hash_ref); # update from a hash, auto-quoting for you $db->update'table_name',\%hash_ref,'item_id = 3');

Very handy. I don't really use the rest of the DBIx::Abstract interface. I prefer straight DBI most of the time. One plus to this system: DBIx::Abstract can handle passing in constants that don't get quoting, like CURRENT_DATE, for example. See it's docs for that exact syntax. One minus to this system: It doesn't use DBI's prepare_cached() method, one of my new favorite DBI tricks for an easy performance boost.

Second: In many cases you can combine the the flexibility of $sth methods, like using prepare_cached() and placeholders, with the simplicity of the $DBH calling style, like this:

$sth->prepare_cached("SELECT * from t where id = ?"); $DBH->selectall_arrayref($sth, {}, @bind_values);

-mark