# my sql statement.
my $sql = "INSERT INTO msg ( " . join (",\n", @keys) . ") " .
"VALUES (" . join (",\n", @values) . ")";
I like it. Using join() this way simplifies the SQL generation a lot.
Unfortunately, there's no real help for manually $dbh->quote()ing values that need it - we use DB2 at work, and quoting a number gives a SQL error (grrrrrrrr). That's my #1 complaint about the thing.
We'll probably move to something between what your friend does, and the inline code. Generate the actual SQL in a module, but maintain control of it's execution inline - otherwise you're borked with transactions, and I hate passing $dbh's around all over the place.