On Oct 29, 2009, at 5:10 PM, David E. Wheeler wrote:
Well, yes. But if there were 'fetch*' and 'select*' keys that could
go to all of them at once, that would be cool, too.
I found another great use for callbacks: A callback on `connected()`
to set things up for a handle the first time it connects. Bricolage is
using it for its MySQL support:
http://github.com/bricoleurs/bricolage/commit/68571810c4d79c73e7224471e008398ba9141a8d
The relevant code is:
Callbacks => {
connected => sub {
my $dbh = shift;
$dbh->do(q{
SET SESSION
sql_mode='ansi,strict_trans_tables,no_auto_value_on_zero';
}) unless exists $dbh->{private_bric_sql_mode};
$dbh->{private_bric_sql_mode} = 1;
return;
},
},
Best,
David