php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #18628 odbc_columns returns SQL error 00000
Submitted: 2002-07-29 14:15 UTC Modified: 2002-08-15 15:14 UTC
From: jeff dot albert at ualberta dot ca Assigned:
Status: Closed Package: ODBC related
PHP Version: 4.2.2 OS: Windows 2000 Professional
Private report: No CVE-ID: None
 [2002-07-29 14:15 UTC] jeff dot albert at ualberta dot ca
Hello,
I will limit this report to odbc_columns, although other odbc functions appear to be affected similarly:

<?php
$con = odbc_connect("dev", "", "");
$result = odbc_columns($con, "", "", "", "%");
?>

The above code will produce an SQL State 00000 error when connecting to an MS Access 2000 database through ODBC on a Windows 2000 Professional box. PHP is version 4.2.2, and the problem appears to occur in both Apache 1.3.* and 2.0.39.

<?php
$con = odbc_connect("dev", "", "");
$result = odbc_columns($con);
?>

Calling odbc_columns without the extra parameters actually causes php.exe to crash altogether under the same environment.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-08-12 20:39 UTC] kalowsky@php.net
Partially fixed.  

In your first case, the '%' operator is not really handled at all by MSAccess as far as I can tell.  If you have proof otherwise, please show me some documentation so I can fully fix this.  

The crash case though is now fixed in the CVS.  Try a snapshot and see if this works for you.
 [2002-08-15 15:14 UTC] jeff dot albert at ualberta dot ca
The latest snapshot appears to have fixed the crash problem entirely for all the affected functions including odbc_columns() and odbc_tables(). It appears that you are correct in asserting that % is not interpreted properly by the Access driver. Thanks for your help!

Jeff Albert
 [2002-08-16 11:18 UTC] mlambert at kodak dot com
On the SQL state error, I knew from using iSQL Viewer that the column information was available. Turning on SQL tracing shows that the problem lies with "" vs <empty string>.

Extract from SQL log:
iSQL-Viewer-2_1 49-b7 EXIT SQLColumnsW  with return code 0 (SQL_SUCCESS)
	HSTMT       0BC25F40
	WCHAR *    0x0BC21828 [      -3] "D:\ekos\R"
	SWORD      -3 
	WCHAR *   0x00000000 [      -3] <empty string>
	SWORD    -3 
	WCHAR *  0x0BC22090 [      -3] "Slo"
	SWORD    -3 
	WCHAR *  0x00000000 [      -3] <empty string>
	SWORD     -3 

php -f alt 97-73 EXIT SQLColumnsW with return code -1 (SQL_ERROR)
	HSTMT      00CE1A18
	WCHAR *   0x00CE1E20 [      -3] "D:\ekos\R"
	SWORD      -3 
	WCHAR *   0x00CE15E0 [      -3] ""
	SWORD     -3 
	WCHAR *  0x00CE1E58 [      -3] "Slo"
	SWORD    -3 
	WCHAR * 0x00CE1E78 [      -3] ""
	SWORD   -3 

The actual code for this example is

$qid=odbc_columns($c,"D:\ekos\RXCoating","","Slots","");

There is a similar conflict with odbc_specialcolumns, but bizzarely, odbc_tables is happy to accept ""

I stopped the crashing by using pconnect or including odbc_close.
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Thu Nov 26 16:01:23 2020 UTC