Bug #73191 [Nab]: "SQLColAttribute can't handle SQL_DESC_OCTET_LENGTH" with Foxpro
| From: | eion at robbmob dot com | Date: | Wed, 28 Sep 2016 19:56:10 +0000 |
| Subject: | Bug #73191 [Nab]: "SQLColAttribute can't handle SQL_DESC_OCTET_LENGTH" with Foxpro | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-204327@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=73191&edit=1
ID: 73191
User updated by: eion at robbmob dot com
Reported by: eion at robbmob dot com
Summary: "SQLColAttribute can't handle SQL_DESC_OCTET_LENGTH"
with Foxpro
Status: Not a bug
Type: Bug
Package: ODBC related
Operating System: Windows
PHP Version: 7.0.11
Assigned To: ab
Block user comment: N
Private report: N
New Comment:
According to https://msdn.microsoft.com/en-us/library/ms716450(v=vs.85).aspx
the call to SQLColAttribute() with SQL_DESC_OCTET_LENGTH will result in an error:
"If FieldIdentifier is one of the following: ... SQL_DESC_OCTET_LENGTH ...
the Driver Manager returns SQL_ERROR with SQLSTATE HY091 (Invalid descriptor field identifier). No
further rules of this section apply."
I read this as expected behaviour that will happen with all ODBC 2.0 drivers when accessed using
ODBC 3.0 functions and thus shouldn't be a warning in PHP if it's expected to work with
ODBC 2.0 drivers.
Previous Comments:
------------------------------------------------------------------------
[2016-09-28 19:04:51] ab@php.net
Thanks for checking, Christoph. Yeah, it looks like not a PHP issue.
Our default builds are ODBC 3.0 by default, while some parts still maintain BC workarounds. The
error S1091 witnesses that the driver is ODBC 2.x. Besides that, the technology seems to be not
supported anymore - the support for the last FoxPro 9.0 product was discontinued over a year ago,
and there are no new versions.
@eion, an option for you were to compile the required ext/odbc variant while setting --with-odbcver
to like 0x0250 or other that is suitable for your app. The warning itself is useful as the actual
reason adding it was about drivers that have inconsistent ODBC 3.x implementation.
Thanks.
------------------------------------------------------------------------
[2016-09-28 16:00:03] cmb@php.net
That appears to be a bug in the Microsoft ODBC Visual FoxPro
driver (BTW, which version do you use?) Apparently, the driver
claims ODBC 3.0 compatibility, but doesn't know about
SQL_DESC_OCTET_LENGTH.
Not sure if we should do something here, besides reporting the
issue to Microsoft.
Anatol, what do you think?
------------------------------------------------------------------------
[2016-09-28 06:43:06] eion at robbmob dot com
Description:
------------
Every query with odbc_exec() that returns a string is outputting a PHP Warning of
"SQLColAttribute can't handle SQL_DESC_OCTET_LENGTH" when using the Foxpro driver.
The full error is
[28-Sep-2016 19:15:10 Pacific/Auckland] PHP Warning: odbc_exec(): SQLColAttribute can't handle
SQL_DESC_OCTET_LENGTH: [S1091] [Microsoft][ODBC Visual FoxPro Driver]Descriptor type out of range in
test.php on line 2
Looking at https://github.com/php/php-src/blob/master/ext/odbc/php_odbc.c#L1018
php_error_docref(NULL, E_WARNING, "SQLColAttribute can't handle SQL_DESC_OCTET_LENGTH:
[%s] %s", state, errtxt);
It appears that this warning should actually be a notice, or have some way of blocking this message.
This warning was added in http://git.php.net/?p=php-src.git;a=commit;h=268eb1999b1598a2a1a875c5f0172d5b615811ac
Test script:
---------------
<?php
$a = odbc_connect('Foxpro', '', '');
odbc_exec($a, "SELECT foo FROM bar");
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=73191&edit=1