Bug #81688 [Com]: PDO_ODBC doesn't handle fixed-length character columns with character conversio
From: calvin at cmpct dot info Date: Wed, 05 Jan 2022 18:23:04 +0000 Subject: Bug #81688 [Com]: PDO_ODBC doesn't handle fixed-length character columns with character conversio References: 1 Groups: php.bugs Request: Send a blank email to php-bugs+get-238777@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=81688&edit=1
ID: 81688
Comment by: calvin at cmpct dot info
Reported by: calvin at cmpct dot info
Summary: PDO_ODBC doesn't handle fixed-length character
columns with character conversio
Status: Feedback
Type: Bug
Package: PDO ODBC
Operating System: IBM i 7.2
PHP Version: 8.0.13
Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
I tried the patch and not only does it work (as below):
```
Record
string(180)
"éééééééééééééééééééééééééééééé
"
Record
string(165) "ééééééééééééééé
"
Record
string(155) "ééééé
"
```
...it's actually faster. I took the sample from earlier, wrapped the
prepare-execute-fetch-display in a 10000 iteration loop, ran the script 10 times (to average out
outliers - it's not super scientific, but to make it fair), and unmodified PHP returning
garbage takes 10 seconds, and your fix takes 7 seconds. Now I'm wondering if SQLGetData might
be more efficient for other scenarios...
Previous Comments:
------------------------------------------------------------------------
[2022-01-05 16:15:37] cmb@php.net
I made a quick patch which disables any column binding for ext/odbc[1].
That is, all data are now retrieved by SQLGetData(). This is obviously
less efficient, but I like to know whether that would work with the IBM
driver/DB. Could you please check it out?
Note that all ext/odbc tests work for me like without the patch
(or undefining ODBC_DONT_BIND), except for bug44618.phpt which now
is able to retrieve the third column.
[1] <https://gist.github.com/cmb69/839d5e04395936ad64fd049d2cb7fd55>
------------------------------------------------------------------------
[2021-12-30 23:06:56] cmb@php.net
Oh yeah, sorry, zeroing the memory can't work, since the length is
only properly set when fetching, so we cannot do that upfront.
Sorry for the delay, once again. I shall dig deeper ASAP.
------------------------------------------------------------------------
[2021-12-28 16:58:01] calvin at cmpct dot info
Was going to write a sample w/ ODBC in C, but decided to poke the existing code path to determine if
it's just junk left over before, or just created after.
Gist b/c it's too long to post here: https://gist.githubusercontent.com/NattyNarwhal/3864224066dda8ed4be991c06e67a670/raw/3e3aad9efbc6472f7dde1e8e1167e2bc9ad06288/gistfile1.txt
(I rebuilt PHP w/ --enable-debug for my own sanity in GDB. Also on Linux too.)
Note that the garbage on 0x7ffff767e3a8 that appears in the string comes from before the memset, so
I think this is just leftover in memory and not coming from the driver. (You can also see my
connection string... thankfully not my password.)
------------------------------------------------------------------------
[2021-12-27 22:10:27] cmb@php.net
> [â¦], just chuffed at the issue tracker that it got auto-closed.
Yeah, that is a bit unfortunate. If the status is set to
"feedback", the bug is automatically closed on the next but one
Sunday, even if feedback has been provided. You, as bug reporter,
should be able to change the status back to "open", though
("re-opened" doesn't work, IIRC).
> but I don't notice any different behaviour
Hmm, does the *driver* fill the buffers with some garbage at the
end, in this case? I'll have a closer look tomorrow; it seems
using SQLGetData() always (for testing purposes) might be a way to
proceed.
------------------------------------------------------------------------
[2021-12-27 21:32:34] calvin at cmpct dot info
Thankfully was a quick build, but I don't notice any different behaviour (where /tmp/php is a
build of PHP-8.0.14 with your patch vs. my system 8.0.13 from Fedora, both using the Linux build of
the same driver I've been using on i):
```
[calvin@salient src]$ /tmp/php/bin/php -d
extension_dir=/tmp/php/lib/php/extensions/no-debug-non-zts-20200930 test4.php
before ODBC
bool(true)
after ODBC
Record
string(180)
"éééééééééééééééééééééééééééééé
V��(���j"
Record
string(165) "ééééééééééééééé
"
Record
string(155) "ééééé
"
[calvin@salient src]$ php test4.php
before ODBC
bool(true)
after ODBC
Record
string(180)
"éééééééééééééééééééééééééééééé
�c��]"
Record
string(165) "ééééééééééééééé
�c��]"
Record
string(155) "ééééé
"
```
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
https://bugs.php.net/bug.php?id=81688
--
Edit this bug report at https://bugs.php.net/bug.php?id=81688&edit=1
Thread (37 messages)
- Bug #81688 [Opn]: PDO_ODBC doesn't handle fixed-length character columns with character conversio
- Bug #81688 [Com]: PDO_ODBC doesn't handle fixed-length character columns with character conversio
- Bug #81688 [Com]: PDO_ODBC doesn't handle fixed-length character columns with character conversio
- Bug #81688 [Com]: PDO_ODBC doesn't handle fixed-length character columns with character conversio
- Bug #81688 [Opn]: PDO_ODBC doesn't handle fixed-length character columns with character conversio
- Bug #81688 [Asn]: PDO_ODBC doesn't handle fixed-length character columns with character conversio
- Bug #81688 [Asn->Fbk]: PDO_ODBC doesn't handle fixed-length character columns with character conversio
- Bug #81688 [Com]: PDO_ODBC doesn't handle fixed-length character columns with character conversio
- Bug #81688 [Fbk->NoF]: PDO_ODBC doesn't handle fixed-length character columns with character conversio
- Bug #81688 [Com]: PDO_ODBC doesn't handle fixed-length character columns with character conversio
- Bug #81688 [NoF->Opn]: PDO_ODBC doesn't handle fixed-length character columns with character conversio
- Bug #81688 [Com]: PDO_ODBC doesn't handle fixed-length character columns with character conversio
- Bug #81688 [Com]: PDO_ODBC doesn't handle fixed-length character columns with character conversio
- Bug #81688 [Com]: PDO_ODBC doesn't handle fixed-length character columns with character conversio
- Bug #81688 [Asn]: PDO_ODBC doesn't handle fixed-length character columns with character conversio
- Bug #81688 [Com]: PDO_ODBC doesn't handle fixed-length character columns with character conversio
- Bug #81688 [Asn]: PDO_ODBC doesn't handle fixed-length character columns with character conversio
- Bug #81688 [Asn->Fbk]: PDO_ODBC doesn't handle fixed-length character columns with character conversio
- Bug #81688 [Com]: PDO_ODBC doesn't handle fixed-length character columns with character conversio
- Bug #81688 [Fbk]: PDO_ODBC doesn't handle fixed-length character columns with character conversio
- Bug #81688 [Com]: PDO_ODBC doesn't handle fixed-length character columns with character conversio
- Bug #81688 [Com]: PDO_ODBC doesn't handle fixed-length character columns with character conversio
- Bug #81688 [Fbk->Opn]: PDO_ODBC doesn't handle fixed-length character columns with character conversio
- Bug #81688 [Com]: PDO_ODBC doesn't handle fixed-length character columns with character conversio
- Bug #81688 [Asn]: PDO_ODBC doesn't handle fixed-length character columns with character conversio
- Bug #81688 [Com]: PDO_ODBC doesn't handle fixed-length character columns with character conversio
- Bug #81688 [Com]: PDO_ODBC doesn't handle fixed-length character columns with character conversio
- Bug #81688 [Com]: PDO_ODBC doesn't handle fixed-length character columns with character conversio
- Bug #81688 [Asn]: PDO_ODBC doesn't handle fixed-length character columns with character conversio
- Bug #81688 [Com]: PDO_ODBC doesn't handle fixed-length character columns with character conversio
- Bug #81688 [Com]: PDO_ODBC doesn't handle fixed-length character columns with character conversio
- Bug #81688 [Com]: PDO_ODBC doesn't handle fixed-length character columns with character conversio
- Bug #81688 [Com]: PDO_ODBC doesn't handle fixed-length character columns with character conversio
- Bug #81688 [Com]: PDO_ODBC doesn't handle fixed-length character columns with character conversio
- Bug #81688 [Com]: PDO_ODBC doesn't handle fixed-length character columns with character conversio
- Bug #81688 [Com]: PDO_ODBC doesn't handle fixed-length character columns with character conversio
| « previous | php.bugs (#238777) | next » |
|---|