Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: Mysql smallint out of range. How to fetch warning?

by samtregar (Abbot)
on Oct 16, 2010 at 03:39 UTC ( #865620=note: print w/ replies, xml ) Need Help??


in reply to Mysql smallint out of range. How to fetch warning?

Just use the SHOW WARNINGS statement:

$dbh->do("CREATE TEMPORARY TABLE foo (bar SMALLINT)") $dbh->do("INSERT INTO foo (bar) VALUES (100000000)"); use Data::Dumper; print Dumper($dbh->selectall_arrayref("SHOW WARNINGS"));

Output:

$VAR1 = [ [ 'Warning', '1264', 'Out of range value adjusted for column \'bar\' at row 1' ] ];

-sam


Comment on Re: Mysql smallint out of range. How to fetch warning?
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://865620]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (6)
As of 2015-07-06 03:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (70 votes), past polls