php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #18941 odbc_columns returns SQL ERROR
Submitted: 2002-08-16 13:13 UTC Modified: 2002-09-21 01:55 UTC
From: mlambert at kodak dot com Assigned:
Status: No Feedback Package: ODBC related
PHP Version: 4CVS-2002-08-16 OS: Win NT 4.0
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
MUST BE VALID
Solve the problem:
45 - 37 = ?
Subscribe to this entry?

 
 [2002-08-16 13:13 UTC] mlambert at kodak dot com
As originally reported in bug # 18629, odbc_columns returns SQL state 00000 error with Access database.

Using php snapshot 16-Aug-02 12:24 in command line mode.

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

I know from using iSQL Viewer that the column information can be retrieved using ODBC and the MS Access driver. Turning on SQL tracing shows that the problem lies with "" 
vs <empty string>. Empty strings are passed as pointer to (possibly) "" whereas a null pointer appears to be  required.

 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 SQL log shows the same problem with odbc_specialcolumns.
odbc_statistics,odbc_foreignkeys, and odbc_primarykeys also give the same SQL state 00000 errors. 
 Howerver odbc_tables works fine with ""  passed to SQLTablesW

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-08-21 01:43 UTC] kalowsky@php.net
Can you please try applying this patch and seeing if this solves the problem for you?

Index: php_odbc.c
===================================================================
RCS file: /repository/php4/ext/odbc/php_odbc.c,v
retrieving revision 1.141
diff -u -u -r1.141 php_odbc.c
--- php_odbc.c  14 Aug 2002 20:40:48 -0000      1.141
+++ php_odbc.c  21 Aug 2002 05:40:21 -0000
@@ -2924,6 +2924,23 @@
                RETURN_FALSE;
        }
 
+       /* This hack is needed to access table information in Access databases */
+       if (column_len == 0) {
+               column = NULL;
+       }
+
+       if (cat_len == 0) {
+               cat = NULL;
+       }
+
+       if (schema_len == 0) {
+               schema = NULL;
+       }
+
+       if (table_len == 0) {
+               table = NULL;
+       }
+
        rc = SQLColumns(result->stmt, 
                        cat, cat_len,
                        schema, schema_len,
 [2002-09-21 01:55 UTC] sniper@php.net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.


 [2003-11-21 06:05 UTC] frosty dot z at freesbee dot fr
mlambert > "As originally reported in bug # 18629"...

You were probably talking about bug #18628.
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Wed Sep 23 00:01:23 2020 UTC