Bug #81688 [Com]: PDO_ODBC doesn't handle fixed-length character columns with character conversio

From: Date: Mon, 19 Dec 2022 04:01:22 +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-243178@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: farid dot jamili4118 at gmail dot com Reported by: calvin at cmpct dot info Summary: PDO_ODBC doesn't handle fixed-length character columns with character conversio Status: Assigned 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: The other option might be to reallocate more aggressively if the buffer is inadequate. I'm unsure how tricky that'd be to implement. The annoying option for users but simplest to prevent crashes in PHP is to emit a warning if the driver is trying to return more that what PHP allocated. (https://www.myccpay.app/)php.net Previous Comments: ------------------------------------------------------------------------ [2022-06-21 13:27:28] cmb@php.net Thanks for the update, and the reminder! :) I shall have a look at this tomorrow. ------------------------------------------------------------------------ [2022-06-20 17:43:36] calvin at cmpct dot info FWIW, as an update: IBM released a new version of the Db2i driver that's worked around the issue for us by reporting the size after conversion. However, the underlying bug in PDO_ODBC/odbc is still lurking and could affect other drivers, so it's still worth pursuing a fix for it. ------------------------------------------------------------------------ [2022-01-26 20:56:02] calvin at cmpct dot info Nitpick I have found that probably doesn't matter: odbc_result_all doesn't work with the patch, it seems. It's deprecated, so I assume it's not a big deal, but it's something I noticed debugging some unrelated code. ------------------------------------------------------------------------ [2022-01-20 19:11:37] calvin at cmpct dot info Brief update w/ the PDO_ODBC patch from last week: The user does report the patch works for them without any (noticeable) performance regression. Probably a bit rough still, but good to know so far. ------------------------------------------------------------------------ [2022-01-14 16:49:39] cmb@php.net > So, I've ported the logic over for PDO_ODBC and I have the patch > here: […] Ah, cool! It might be possible to simplify further by just setting S->going_long = 1 early (but that doesn't matter for now). > coercing to string, have to get assembled in a 256 byte buffer > piecemeal I think that code is indeed rather suboptimal. I still wonder why fetching in small chunks is claimed to be faster than reading a single chunk[1]. > PDO_ODBC is *noticeably* faster at least on Linux. That's interesting! Might be worth investigating. [1] <https://github.com/php/php-src/pull/6716#issuecomment-783461335> ------------------------------------------------------------------------ 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

« previous php.bugs (#243178) next »