php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #57576 statement->execute is not throw exception
Submitted: 2007-03-16 00:37 UTC Modified: 2007-04-11 11:52 UTC
From: miwai at sumitem dot co dot jp Assigned: kfbombar (profile)
Status: Closed Package: PDO_IBM (PECL)
PHP Version: 5.2.0 OS: Fedora Core 2
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: miwai at sumitem dot co dot jp
New email:
PHP Version: OS:

 

 [2007-03-16 00:37 UTC] miwai at sumitem dot co dot jp
Description:
------------
Now I'm developing Web Application using PHP5.2 and DB2 V8.2.
I created database access object by PDO_ODBC first.
Then I modified it by PDO_IBM(1.1.0).
One day I found execute method of PDO_IBM didn't throw a specified exception. It thrown exception of statement error. But It didn't throw exception of result of excecute. - insert or update and so on -
When I tried to execute insert statement on DB2 Command Center it thrown an exception.
Then I changed driver PDO_ODBC from PDO_IBM it thrown same exception.
But only PDO_IBM didn't throw it.

SQLSTATE[23505]: Unique violation: -803 [IBM][CLI Driver][DB2/LINUX] SQL0803N "1" ....




Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-03-16 08:07 UTC] kfbombar at us dot ibm dot com
We will look into this, but can you provide a simple example that displays this problem with expected and actual output?  Thanks,
 [2007-03-22 00:39 UTC] miwai at sumitem dot co dot jp
This is sample program. Could you try it?

Program:
print('This is PDO_ODBC.<br>');
$con = new PDO('odbc:dbname','user','password');

print('This is PDO_IBM.<br>');
$con = new PDO('ibm:DSN=dbname','user','password');

$con->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

print('beginTran<br>');
$con->beginTransaction();

$stmt = $con->prepare("insert into TEST (TEST_ID, TEST_NM ) values (?, ?)");

try {
    print('execute<br>');
    $res = $stmt->execute(array(1,'a'));
	
    if($res){
        print('commit<br>');
        $con->commit();   
    } else {
        $err = $stmt->errorInfo();
        print('execute failed<br>');
        print($err[0].'<br>');
        print($err[1].'<br>');
        print($err[2].'<br>');
        $con->rollBack();
    }
}
catch(Exception $e) {
    $err = $stmt->errorInfo();
    print('exception occured<br>');
    print($err[0].'<br>');
    print($err[1].'<br>');
    print($err[2].'<br>');
    $con->rollBack();   
}



Result of PDO_ODBC.
This is PDO_ODBC.
beginTran
execute
exception occured
23505
-803
[IBM][CLI Driver][DB2/LINUX] SQL0803N "1" ~Japanese message~ SQLSTATE=23505 (SQLExecute[-803] at /usr/local/src/php-5.2.0/ext/pdo_odbc/odbc_stmt.c:133)

Result of PDO_IBM
This is PDO_IBM.
beginTran
execute
execute failed
00000
0
(SQLExecute[0] at /usr/local/src/php-5.2.0/ext/pdo_ibm/ibm_statement.c:717)
 [2007-04-11 11:52 UTC] kfbombar at us dot ibm dot com
This bug has been fixed in CVS.

In case this was a documentation problem, the fix will show up at the
end of next Sunday (CET) on pecl.php.net.

In case this was a pecl.php.net website problem, the change will show
up on the website in short time.
 
Thank you for the report, and for helping us make PECL better.

This has been fixed in CVS Head.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 13:01:31 2024 UTC