ID:               36345
 Updated by:       [EMAIL PROTECTED]
 Reported By:      milanm at datax dot biz
-Status:           Assigned
+Status:           Closed
 Bug Type:         PDO related
 Operating System: Linux
 PHP Version:      5.1.2
 Assigned To:      george
 New Comment:

This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.

For large buffers > 1 meg, there was an option added
PDO_MYSQL_ATTR_MAX_BUFFER_SIZE that allows you to indicate the desired
maximum buffer size.


Previous Comments:
------------------------------------------------------------------------

[2006-02-10 15:17:38] [EMAIL PROTECTED]

Assigned to the maintainer.

------------------------------------------------------------------------

[2006-02-10 11:16:06] milanm at datax dot biz

I found something strange in ext/pdo_mysql/mysql_statement.c
There is constant defined called PDO_MYSQL_MAX_BUFFER like this:
#define PDO_MYSQL_MAX_BUFFER 1024*1024
I've changed this to:
#define PDO_MYSQL_MAX_BUFFER 1024*1024*10
and recompiled PHP.
Now PDO loads whole 1.5MB from DB.
Hope that helps.

------------------------------------------------------------------------

[2006-02-09 22:48:44] 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-09 20:07:54] 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;




------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=36345&edit=1

Reply via email to