Skip to content

Instantly share code, notes, and snippets.

@kazeburo
Created December 29, 2010 01:11
Show Gist options
  • Select an option

  • Save kazeburo/758000 to your computer and use it in GitHub Desktop.

Select an option

Save kazeburo/758000 to your computer and use it in GitHub Desktop.
use DBI;
use Carp;
my $dbh = DBI->connect('dbi:MySQL:test','','', {
RaiseError => 1,
Callbacks => {
ChildCallbacks => {
execute___ => sub {
my ($obj, @binds) = @_;
warn @binds;
map { ! defined $_ && Carp::croak('found undefined value') } @binds;
return;
},
},
},
});
$dbh->do(<<EOF);
CREATE TABLE IF NOT EXISTS hoge (
foo VARCHAR(255) NOT NULL
)
EOF
my $foo;
$dbh->do("SELECT FROM hoge WHERE foo=?",undef, $foo);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment