Bug #76400 [Opn]: PDO cannot caught mysql error 1690:bigint unsigned value is out of range

From: Date: Fri, 01 Jun 2018 06:56:44 +0000
Subject: Bug #76400 [Opn]: PDO cannot caught mysql error 1690:bigint unsigned value is out of range
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-215465@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=76400&edit=1

 ID:                 76400
 User updated by:    kadovat at gmail dot com
 Reported by:        kadovat at gmail dot com
 Summary:            PDO cannot caught mysql error 1690:bigint unsigned
                     value is out of range
 Status:             Open
 Type:               Bug
 Package:            PDO MySQL
 Operating System:   Linux
 PHP Version:        5.6.36
 Block user comment: N
 Private report:     N

 New Comment:

MySQL cli show error like this:

mysql> select id,pv-yesterday_pv from test;
ERROR 1690 (22003): BIGINT UNSIGNED value is out of range in
'(DB_ad_fengye.test.pv -
DB_ad_fengye.test.yesterday_pv)'


Previous Comments:
------------------------------------------------------------------------
[2018-06-01 06:50:57] kadovat at gmail dot com

Description:
------------
PDO doesn't throw an exception when occurs mysql error 1690:bigint unsigned value is out of
range,just return an empty array 

Test script:
---------------
# CREATE TABLE  test (id int(10) unsigned DEFAULT NULL, pv
int(10) unsigned DEFAULT NULL,yesterday_pv int(10) unsigned DEFAULT NULL) ENGINE=InnoDB
DEFAULT CHARSET=utf8

#insert into test set id=1,pv=1,yesterday_pv=2;
<?php
$dbh = new PDO("mysql:host=localhost;port=3306;dbname=testdb","root");
$sth = $dbh->prepare('select id,pv-yesterday_pv from test');
$sth->execute();
$result = $sth->fetchAll();
var_dump($result);

Expected result:
----------------
throw a PDOException

Actual result:
--------------
array(0) {
}


------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=76400&edit=1


Thread (3 messages)

« previous php.bugs (#215465) next »