Problem loading BLOB over 1MB
| Bug #36345 | Problem loading BLOB over 1MB | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Submitted: | 2006-02-09 20:07 UTC | Modified: | 2006-02-14 15:26 UTC |
|
||||||
| From: | milanm at datax dot biz | Assigned: | george (profile) | |||||||
| Status: | Closed | Package: | PDO related | |||||||
| PHP Version: | 5.1.2 | OS: | Linux | |||||||
| Private report: | No | CVE-ID: | None | |||||||
[2006-02-09 20:07 UTC] milanm at datax dot biz
Description:
------------
I got a table and a stored 1.5 MB image in it. But when i try to load it into variable using PDO it has only 1MB. I'm using pdo_mysql client library 5.0.18.
Reproduce code:
---------------
<?php
error_reporting(E_ALL);
$dsn = 'mysql:host=10.0.0.102;port=3306;dbname=test;';
$user = 'user';
$password = 'pass';
$mysql_pdo = new PDO($dsn, $user, $password);
$blob_id = 1;
$stmt = $mysql_pdo->prepare('SELECT data FROM test WHERE id=:id');
$stmt->bindParam(':id', $blob_id, PDO::PARAM_INT);
$mysql_pdo->beginTransaction();
$stmt->execute();
$mysql_pdo->commit();
$stmt->bindColumn(1, $blob_fp, PDO::PARAM_LOB);
$stmt->fetchAll(PDO::FETCH_BOUND);
header('Content-Type: image/jpeg');
print $blob_fp;
?>
Table looks like this:
CREATE TABLE test (
id INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
name VARCHAR(10) NOT NULL,
data LONGBLOB NOT NULL,
PRIMARY KEY id (id),
UNIQUE KEY name (name)
) type=InnoDB;
Patches
Pull Requests
History
AllCommentsChangesGit/SVN commits
[2006-02-09 22:48 UTC] milanm at datax dot biz
When I run code bellow everithing is OK and data are 1.5 MB big. I've also tried to downgrade mysql to 4.1 and recompile php but with no results. Same problem persits with PDO using client library 4.1.14. <?php $c = mysql_connect('10.0.0.102', 'user', 'pass'); mysql_select_db('test', $c); $res = mysql_query('SELECT data FROM test WHERE id=1', $c); $data = mysql_fetch_object($res); var_dump($data); ?>[2006-02-10 11:16 UTC] milanm at datax dot biz
[2006-02-14 15:26 UTC] iliaa@php.net