#25917 [Ana->Csd]: odbc_error() sometimes returns a bad string

From: Date: Thu, 16 Sep 2004 13:18:30 +0000
Subject: #25917 [Ana->Csd]: odbc_error() sometimes returns a bad string
References: 1  Groups: php.doc 
Request: Send a blank email to phpdoc+get-969364093@lists.php.net to get a copy of this message
ID: 25917 Updated by: vrana@php.net Reported By: thorsten at rinne dot info -Status: Analyzed +Status: Closed Bug Type: Documentation problem Operating System: Windows2000 PHP Version: 4CVS, 5CVS New Comment: This bug has been fixed in the documentation's XML sources. Since the online and downloadable versions of the documentation need some time to get updated, we would like to ask you to be a bit patient. Thank you for the report, and for helping us make our documentation better. odbc_error, odbc_errormsg: "This function returns meaningful value only if last odbc query failed (i.e. odbc_exec() returned false)." Previous Comments: ------------------------------------------------------------------------ [2003-11-03 02:29:32] thorsten at rinne dot info Your explanation makes sense. Why does odbc_error sometimes return bad strings with special characters? Is this a bug in PHP or from the ODBC driver? ------------------------------------------------------------------------ [2003-10-31 09:35:18] kalowsky@php.net This is probably a documentation bug (and therefore a misunderstanding on your code) more than a PHP ODBC code bug. What you're seeing happening is an abuse of the odbc_error system really. The odbc_error values are only populated when an internal error is detected (i.e. SQLExecDirect() fails). The catch is they only over- write the values that had been in there previously. As such the each connections last error is never really free'd, so you'll constantly get a copy of the last seen error. Does that make sense? In any case you should be checking the return code for the function you're calling rather than just odbc_error(). Moving to a documentation bug. ------------------------------------------------------------------------ [2003-10-27 02:28:59] thorsten at rinne dot info Here's my log: SQLQuery: SELECT * FROM TABLE ErrorNum: 4ÃïÏ ErrorMsg: ï Here's the odbc log: [ Process: 924, Thread: 1084 ] [ Date & Time: 27/10/2003 08.23.23.000015 ] [ Product: QDB2/NT DB2 v8.1.3.132 ] [ Level Identifier: 02040106 ] [ CLI Driver Version: 08.01.0000 ] [ Informational Tokens: "DB2 v8.1.3.132","s030728","WR21324","Fixpack 3" ] [0000000924 0000001084] [27/10/2003 08.23.36.934791] SQLExecDirectW( hStmt=1:1, pszSqlStr="SELECT * FROM TABLE" - X"530045004C004500430054002000490044005F004D00410049004C0052004F004F004D002C0020004400450053004300520049005000540049004F004E002C0020005300450052005600450052004E0041004D0045002000460052004F004D0020004D00410049004C0052004F004F004D00", cbSqlStr=-3 ) [0000000924 0000001084] [27/10/2003 08.23.36.935123] [0000000924 0000001084] [27/10/2003 08.23.36.935863] SQLExecDirectW( ) [0000000924 0000001084] [27/10/2003 08.23.36.935972] <--- SQL_SUCCESS ------------------------------------------------------------------------ [2003-10-22 19:49:26] kalowsky@php.net can you please turn on the logging option in your client, and post the relavent portions to this bug? Under windows it's in the ODBC Administrator. ------------------------------------------------------------------------ [2003-10-22 08:32:47] thorsten at rinne dot info This bug can also reproduced with PHP 4.3.4RC1 and 4.3.4RC2. This happens with INSERTS, UPDATEs and DELETEs, too. ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/25917 -- Edit this bug report at http://bugs.php.net/?id=25917&edit=1

« previous php.doc (#969364093) next »