ID: 18941
Comment by: frosty dot z at freesbee dot fr
Reported By: mlambert at kodak dot com
Status: No Feedback
Bug Type: ODBC related
Operating System: Win NT 4.0
PHP Version: 4CVS-2002-08-16
New Comment:
mlambert > "As originally reported in bug # 18629"...
You were probably talking about bug #18628.
Previous Comments:
------------------------------------------------------------------------
[2002-09-21 01:55:50] [EMAIL PROTECTED]
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.
------------------------------------------------------------------------
[2002-08-21 01:43:23] [EMAIL PROTECTED]
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-08-16 13:13:25] 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
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=18941&edit=1