|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
Patchesxqxmjbea (last revision 2020-04-18 03:51 UTC by sample at email dot tst)Pull RequestsHistoryAllCommentsChangesGit/SVN commits
[2016-12-30 18:55 UTC] cmb@php.net
-Package: Feature/Change Request
+Package: ODBC related
[2020-04-18 03:51 UTC] sample at email dot tst
[2022-04-07 19:19 UTC] ilutov@php.net
-Status: Open
+Status: Closed
-Assigned To:
+Assigned To: ilutov
[2022-04-07 19:19 UTC] ilutov@php.net
|
|||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 18:00:01 2025 UTC |
Description: ------------ When accessing a DB2 database (either DB2 version 7 or 8) via ODBC (i.e., PHP compiled without the --with-db2 flag), every odbc_exec call that generates an error, returns the error message: function.odbc-exec.html</a>]: SQL error: [unixODBC][IBM][CLI Driver] CLI0005W Option value changed. SQLSTATE=01S02, SQL state 01S02 in SQLExecDirect in ... Notice that the message (returned by odbc_errormsg), and the corresponding error number (returned by odbc_error) point to the warning, even though an error occured. We have confirmed that an error has occured, but it is not due to the option value changing. This appears to be a duplicate of bug number 15141, which is from 21 Jan 2002 and was closed "No Feedback". I have examined the ODBC source code, and see that function odbc_sql_error has comments in it that indicated that it was orgionally designed to retrieve all the errors assoicated with an ODBC call. The loop is commented out, and the comments indicate that some ODBC device drivers would cause an endless loop. These comments appear in the latest snapshot. Since I can't control the options that are generating the "option value changed" warning, I'd really like a solution where I can see the real errors. I'm not familiar enough with the PHP and ODBC soure to be competent in suggesting a solution, but it would appear to me that returning multiple error messages while guarding against an endless loop would be appropriate. Perhaps a simple counter to return no more than 5 messages (which I would think would be enough, given that no one else seems to notice that it won't return more than 1) would work. Reproduce code: --------------- <?php if ( $cid = odbc_connect("coredev", "xxxxx", "xxxxx") ) { if ( $rid = @odbc_exec($cid, "select count(*) from c_sensor") ) { if ( odbc_fetch_into($rid, $result) ) { echo "No Error Occured, result: ", var_dump($result), "\n"; } else { echo "Error on odbc_fetch_into:\n"; echo " ", odbc_errormsg($cid), "\n"; } } else { echo "Error on odbc_exec:\n"; echo " ", odbc_errormsg($cid), "\n"; } } else { echo "Error trying to connect to database\n"; } ?> Expected result: ---------------- In the sample code above, the sql statement is in error, because the table referenced doesn't exist. The output should be: Error on odbc_exec: [unixODBC][IBM][CLI Driver] SQL0204N "BERGY.C_SENSOR" is an undefined name. SQLSTATE=42704 Actual result: -------------- Error on odbc_exec: [unixODBC][IBM][CLI Driver] CLI0005W Option value changed. SQLSTATE=01S02