Last active
March 15, 2021 11:32
-
-
Save davorg/333423320118ccf45dcb47cf30968b9f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
use strict; | |
use warnings; | |
use feature 'say'; | |
use DBI; | |
my $dbh = DBI->connect( | |
"DBI:mysql:database=test", | |
'xxx', 'xxx', | |
{ RaiseWarn => 1, PrintWarn => 1 }, | |
) | |
or die; | |
$dbh->do('set @@SQL_MODE = ""'); | |
$dbh->do('INSERT INTO example (tooshort) values ("12345")'); | |
my $sth = $dbh->prepare('SHOW WARNINGS'); | |
$sth->execute; | |
while (my $data = $sth->fetch) { | |
say join ' | ', @$data; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment