ID: 25917 User updated by: thorsten at rinne dot info Reported By: thorsten at rinne dot info Status: Open Bug Type: ODBC related Operating System: Windows2000 PHP Version: 4.3.3 New Comment:
This bug can also reproduced with PHP 4.3.4RC1 and 4.3.4RC2. This happens with INSERTS, UPDATEs and DELETEs, too. Previous Comments: ------------------------------------------------------------------------ [2003-10-20 03:49:22] thorsten at rinne dot info Description: ------------ We use IBM DB2 databases on our Windows2000 systems. The bug occured then writing a database class. The odbc_error() function returns sometimes bad strings with special characters. If a real error occurs, the function returns the correct six-digit ODBC state. After that, the error code will not be removed from memory and the error code will be returned on every query although it is correct. Note: var_dump(odbc_error()) returns sometimes bad strings with special characters, sometimes nothing. Reproduce code: --------------- function myquery($query) { $result = odbc_exec($conn, $query); if (odbc_error($conn)) { print "SQLQuery: ".$query; print "ErrorNum: ".odbc_error($conn)); print "ErrorMsg: ".odbc_errormsg($conn)); } return $result; } Expected result: ---------------- The expected result should be empty when no error occured and the six-digit ODBC state when an error occured. After every correct new query, the result should be empty. Actual result: -------------- Here are some results, the queries are correct: SQLQuery: SELECT * FROM SYSTEM ErrorNum: 8¸ÌP· ErrorMsg: Ìx¹Ì or SQLQuery: SELECT * FROM SYSTEM2 ErrorNum: àWPW ErrorMsg: or SQLQuery: SELECT * FROM SYSTEM ErrorNum: ErrorMsg: ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=25917&edit=1