|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2011-07-01 03:26 UTC] abhargav at in dot ibm dot com
[2011-07-12 19:40 UTC] fsteegmans at sugarcrm dot com
[2018-08-27 09:40 UTC] vnkbabu@php.net
-Status: Open
+Status: Closed
-Assigned To:
+Assigned To: vnkbabu
[2018-08-27 09:40 UTC] vnkbabu@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 08:00:01 2025 UTC |
Description: ------------ When checking for errors on a prepared statement which has problems no errors are being reported back unless the check is done after an execute. See code below. When checking the return value of db2_execute and checking for errors without the statement as a parameter we get the correct error report. However checking for errors with the prepared statement should produce consistent results. Either report the error directly after the prepare, after the execute, or after both. Reproduce code: --------------- var_dump("Starting prepare...<br>"); $stmt = db2_prepare($db, "select wha"); var_dump("Prepare done<br>"); if($stmt) { var_dump("Prepare ok, executing query...<br>"); var_dump($stmt); var_dump(db2_stmt_error($stmt)); var_dump(db2_stmt_errormsg($stmt)); db2_execute($stmt); var_dump("<br>Query executed checking error<br>"); var_dump(db2_stmt_error($stmt)); var_dump(db2_stmt_errormsg($stmt)); } else { var_dump("Problem with prepare dumping error without stmt<br>"); var_dump(db2_stmt_error()); // note no reference to $stmt, as $stmt is not valid var_dump(db2_stmt_errormsg()); } Expected result: ---------------- resource(193) of type (DB2 Persistent Connection) string(23) "Starting prepare... " string(16) "Prepare done " string(46) "Problem with prepare dumping error without stmt " string(5) "42601" string(174) "[IBM][CLI Driver] [DB2/LINUX] SQL0104N An unexpected token "END-OF-STATEMENT" was found following "select wha". Expected tokens may include: "". SQLSTATE=42601" OR something to this effect... resource(193) of type (DB2 Persistent Connection) string(23) "Starting prepare... " string(16) "Prepare done " string(34) "Prepare ok, executing query... " resource(463) of type (DB2 Statement) string(37) " string(5) "42601" string(174) "[IBM][CLI Driver][DB2/LINUX] SQL0104N An unexpected token "END-OF-STATEMENT" was found following "select wha". Expected tokens may include: "". SQLSTATE=42601" " Query executed checking error " string(5) "42601" string(174) "[IBM][CLI Driver] [DB2/LINUX] SQL0104N An unexpected token "END-OF-STATEMENT" was found following "select wha". Expected tokens may include: "". SQLSTATE=42601" Actual result: -------------- resource(193) of type (DB2 Persistent Connection) string(23) "Starting prepare... " string(16) "Prepare done " string(34) "Prepare ok, executing query... " resource(463) of type (DB2 Statement) string(0) "" string(0) "" string(37) " Query executed checking error " string(0) "" string(0) ""