ID:               38015
 Updated by:       [EMAIL PROTECTED]
 Reported By:      sunaoka+bugs dot php dot net at gmail dot com
-Status:           Open
+Status:           Bogus
 Bug Type:         PDO related
 Operating System: Solaris
 PHP Version:      5.1.4
 New Comment:

>But, I do not understand why the result doesn't become
`int(10485760)'.
Why should it become equal to the size of the buffer?
Buffer is used to read the data by pieces and you can change size of of
these pieces.
This is why it's called "PDO_MYSQL_ATTR_MAX_BUFFER_SIZE" and not
"PDO_MYSQL_ATTR_MAX_DATA_SIZE".


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

[2006-07-07 06:17:08] sunaoka+bugs dot php dot net at gmail dot com

Thank you for your comment. But, I do not understand why the result
doesn't become `int(10485760)'.
I load `FileData' only 1MB.

I am using php5.2-200607060030.

Reproduce code:
---------------
try {
    $db = new PDO('mysql:host=localhost;dbname=test', 'user', 'pass');
    $db->setAttribute(PDO::MYSQL_ATTR_MAX_BUFFER_SIZE, 1024 * 1024 *
10);

    $sql = 'SELECT LENGTH(FileData) FROM FileInfo WHERE Id = ?';
    $stmt = $db->prepare($sql);
    $stmt->execute(array(1));
    $result = $stmt->fetch();
    $stmt->closeCursor();

    echo 'LENGTH(FileData):     ', $result[0], "\n";

    $sql = 'SELECT FileData FROM FileInfo WHERE Id = ?';
    $stmt = $db->prepare($sql);
    $stmt->execute(array(1));

    $stmt->bindColumn('FileData', $lob, PDO::PARAM_LOB);
    $result = $stmt->fetch(PDO::FETCH_BOUND);

    file_put_contents('/tmp/foo', $lob);
    echo "filesize('/tmp/foo'): ", filesize('/tmp/foo'), "\n";

} catch (PDOException $exception) {
    echo $exception->getMessage(), "\n";
}

Expected result:
----------------
LENGTH(FileData):     6971569
filesize('/tmp/foo'): 1048576

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

[2006-07-06 20:12:51] [EMAIL PROTECTED]

Expected result:
----------------
int(1048576)
bool(true)
int(1048576)


Right, this is the expected and ACTUAL result.
I don't see any problems there.

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

[2006-07-06 08:41:22] sunaoka+bugs dot php dot net at gmail dot com

Thank you for your comment. I try using CVS snapshot, but I have
another problem.
So, I can set PDO_MYSQL_ATTR_MAX_BUFFER_SIZE, but it can not set the
value.

Reproduce code:
---------------
$db = new PDO('mysql:host=localhost;dbname=test', 'user', 'pass');
var_dump($db->getAttribute(PDO::MYSQL_ATTR_MAX_BUFFER_SIZE));
var_dump($db->setAttribute(PDO::MYSQL_ATTR_MAX_BUFFER_SIZE, 1024 * 1024
* 10));
var_dump($db->getAttribute(PDO::MYSQL_ATTR_MAX_BUFFER_SIZE));

Expected result:
----------------
int(1048576)
bool(true)
int(1048576)

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

[2006-07-05 17:32:50] [EMAIL PROTECTED]

Please try using this CVS snapshot:

  http://snaps.php.net/php5.2-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5.2-win32-latest.zip



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

[2006-07-05 13:28:41] sunaoka+bugs dot php dot net at gmail dot com

Description:
------------
I'm using pdo_mysql client library 4.1.20.
I need treat the data of 1MB or more.
But I can not set PDO_MYSQL_ATTR_MAX_BUFFER_SIZE.

Reproduce code:
---------------
$db = new PDO('mysql:host=localhost;dbname=test', 'user', 'pass');
var_dump($db->setAttribute(PDO::MYSQL_ATTR_MAX_BUFFER_SIZE, 1024 * 1024
* 10));


Expected result:
----------------
bool(false)



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


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

Reply via email to