PDO and MySQL blob column truncation

From: Date: Thu, 18 May 2006 15:19:27 +0000
Subject: PDO and MySQL blob column truncation
Groups: php.pecl.dev 
Request: Send a blank email to pecl-dev+get-3783@lists.php.net to get a copy of this message
(Apologies if this is a duplicate post. It's been a day since I posted and it hasn't shown yet.) I'm having problems selecting the value of a MySQL blob column passed through the MySQL uncompress function using PDO ('select uncompress(some_blob_col) from some_table'). It's being truncated to 8K (which also happens to be the 'len' value returned by PDOStatement::getColumnMeta()). I've been googling this for hours without any real progress, so any help would be appreciated. Here's what I've discovered: * My column value is being returned as a string, not a PHP stream, even when I attempt to bind the column as PDO::PARAM_LOB. * The column value is not truncated when using the standard PHP mysql routines, and it is returned as a string. I found a bug report that mentioned the driver must know the column is a LOB in order for that to work. Can I make a hint to the driver somehow, either programmatically or via SQL (some kind of cast or something), to treat this as a LOB? If not, is there anyway I can increase the maximum column length so that my value is not truncated? I'm using PHP 5.1.4 with the PDO extensions compiled in and MySQL 4.1.19. The size of the column in question is actually 2310 bytes (due to compression) and 10517 uncompressed (which is where the truncation comes in). Thanks in advance! Brad Fish

« previous php.pecl.dev (#3783) next »