php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #8811 DB2 SQLColumns() doens't work by default.
Submitted: 2001-01-19 15:42 UTC Modified: 2001-06-01 12:02 UTC
From: szii at sziisoft dot com Assigned:
Status: Closed Package: ODBC related
PHP Version: 4.0.4 OS: Linux
Private report: No CVE-ID: None
 [2001-01-19 15:42 UTC] szii at sziisoft dot com
In ext/php_odbc.c function odbc_columns() has 
an incorrect SQLColumns() set of parameters for
DB2 databases.

Currently:
rc = SQLColumns(result->stmt,
            cat, SAFE_SQL_NTS(cat),
            schema, SAFE_SQL_NTS(schema),
            table, SAFE_SQL_NTS(table),
            column, SAFE_SQL_NTS(column));

it should be something more along the lines of 
rc = SQLColumns(result->stmt,
            cat, 0,
            schema, strnlen(schema),
            table, strnlen(table),
            column, strnlen(column));

DB2 Documentation link
http://nscpcw.physics.upenn.edu/db2_docs/db2l0/sqll1311.htm#HDRFNCOLN

Currently it follows the SQLColumns as described by the
MSDN, which says:

"If the SQL_ATTR_METADATA_ID statement attribute is set to SQL_TRUE, ColumnName is treated as an identifier, and its case is not significant. If it is SQL_FALSE, ColumnName is a pattern value argument; it is treated literally, and its case is significant."

By default, DB2 has SQL_ATTR_METADATA_ID set to SQL_FALSE
and doesn't work with the current code.  Can we get at least a check and warning message for SQL_FALSE?  I don't know about Oracle.

Workaround: set SQL_ATTR_METADATA_ID to SQL_TRUE

Thanks.
-Szii
szii@sziisoft.com



Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-01-19 15:45 UTC] szii at sziisoft dot com
The workaround posted is incorrect as it'll change
the action of the cat/schema/table/etc values and
not the SIZE of the values.

Please ignore the workaround - the SQLColumns()
bugreport is still correct otherwise.
 [2001-01-19 15:56 UTC] szii at sziisoft dot com
After more research, please disregard this report.
the odbc_columns() is not working against DB2 7.1, but
there's something else going on. (It SIGSEGVs on multiple passes)  I'll have to do some more digging.

Apologies for the noise.

-Szii
 [2001-01-19 17:52 UTC] szii at sziisoft dot com
The data coming back from SQLColumns() is working 
correctly at the odbc_columns() level.

However, you cannot run odbc_fetch_row() or odbc_fetch_array() against the resources returned by odbc_columns().

The docs for odbc_fetch_row() says that it is only valid
after odbc_do/odbc_exe.  How do you iterate over the 
rows returned from odbc_columns() in a PHP script?  There
doesn't appear to be any way to do it...everything I try
SegFaults.

-Szii

 [2001-06-01 12:02 UTC] kalowsky@php.net
invalid report (as per submitter statement).   for help working with ODBC please see the manual, or other source (various web pages, irc, etc) not the bug system.  thank you!
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 18 13:01:27 2024 UTC