Index: ext/pdo_oci/oci_driver.c =================================================================== --- ext/pdo_oci/oci_driver.c (revision 293440) +++ ext/pdo_oci/oci_driver.c (working copy) @@ -173,7 +173,7 @@ /* little mini hack so that we can use this code from the dbh ctor */ if (!dbh->methods) { - zend_throw_exception_ex(php_pdo_get_exception(), 0 TSRMLS_CC, "SQLSTATE[%s]: %s", *pdo_err, einfo->errmsg); + zend_throw_exception_ex(php_pdo_get_exception(), einfo->errcode TSRMLS_CC, "SQLSTATE[%s]: %s", *pdo_err, einfo->errmsg); } return einfo->errcode; Index: ext/pdo_dblib/dblib_driver.c =================================================================== --- ext/pdo_dblib/dblib_driver.c (revision 293440) +++ ext/pdo_dblib/dblib_driver.c (working copy) @@ -255,7 +255,7 @@ dbh->driver_data = H; if (!ret) { - zend_throw_exception_ex(php_pdo_get_exception(), 0 TSRMLS_CC, + zend_throw_exception_ex(php_pdo_get_exception(), DBLIB_G(err).dberr TSRMLS_CC, "SQLSTATE[%s] %s (severity %d)", DBLIB_G(err).sqlstate, DBLIB_G(err).dberrstr, Index: ext/pdo_sqlite/sqlite_driver.c =================================================================== --- ext/pdo_sqlite/sqlite_driver.c (revision 293440) +++ ext/pdo_sqlite/sqlite_driver.c (working copy) @@ -78,7 +78,7 @@ } if (!dbh->methods) { - zend_throw_exception_ex(php_pdo_get_exception(), 0 TSRMLS_CC, "SQLSTATE[%s] [%d] %s", + zend_throw_exception_ex(php_pdo_get_exception(), einfo->errcode TSRMLS_CC, "SQLSTATE[%s] [%d] %s", *pdo_err, einfo->errcode, einfo->errmsg); } Index: ext/pdo_mysql/mysql_driver.c =================================================================== --- ext/pdo_mysql/mysql_driver.c (revision 293440) +++ ext/pdo_mysql/mysql_driver.c (working copy) @@ -127,7 +127,7 @@ if (!dbh->methods) { PDO_DBG_INF("Throwing exception"); - zend_throw_exception_ex(php_pdo_get_exception(), 0 TSRMLS_CC, "SQLSTATE[%s] [%d] %s", + zend_throw_exception_ex(php_pdo_get_exception(), einfo->errcode TSRMLS_CC, "SQLSTATE[%s] [%d] %s", *pdo_err, einfo->errcode, einfo->errmsg); } Index: ext/pdo_firebird/firebird_driver.c =================================================================== --- ext/pdo_firebird/firebird_driver.c (revision 293440) +++ ext/pdo_firebird/firebird_driver.c (working copy) @@ -691,7 +691,7 @@ char errmsg[512]; ISC_STATUS *s = H->isc_status; isc_interprete(errmsg, &s); - zend_throw_exception_ex(php_pdo_get_exception(), 0 TSRMLS_CC, "SQLSTATE[%s] [%d] %s", + zend_throw_exception_ex(php_pdo_get_exception(), H->isc_status[1] TSRMLS_CC, "SQLSTATE[%s] [%d] %s", "HY000", H->isc_status[1], errmsg); } Index: ext/pdo_pgsql/pgsql_driver.c =================================================================== --- ext/pdo_pgsql/pgsql_driver.c (revision 293440) +++ ext/pdo_pgsql/pgsql_driver.c (working copy) @@ -87,7 +87,7 @@ } if (!dbh->methods) { - zend_throw_exception_ex(php_pdo_get_exception(), 0 TSRMLS_CC, "SQLSTATE[%s] [%d] %s", + zend_throw_exception_ex(php_pdo_get_exception(), einfo->errcode TSRMLS_CC, "SQLSTATE[%s] [%d] %s", *pdo_err, einfo->errcode, einfo->errmsg); } Index: ext/pdo_odbc/odbc_driver.c =================================================================== --- ext/pdo_odbc/odbc_driver.c (revision 293440) +++ ext/pdo_odbc/odbc_driver.c (working copy) @@ -104,7 +104,7 @@ strcpy(*pdo_err, einfo->last_state); /* printf("@@ SQLSTATE[%s] %s\n", *pdo_err, einfo->last_err_msg); */ if (!dbh->methods) { - zend_throw_exception_ex(php_pdo_get_exception(), 0 TSRMLS_CC, "SQLSTATE[%s] %s: %d %s", + zend_throw_exception_ex(php_pdo_get_exception(), einfo->last_error TSRMLS_CC, "SQLSTATE[%s] %s: %d %s", *pdo_err, what, einfo->last_error, einfo->last_err_msg); }