|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[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 PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Nov 05 07:00:01 2025 UTC |
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,