ID: 46249
Updated by: [EMAIL PROTECTED]
Reported By: hswong3i at gmail dot com
-Status: Open
+Status: Feedback
Bug Type: PDO related
Operating System: Debian
PHP Version: 5.2.6
New Comment:
I can't reproduce using 5.3CVS:
$db = new PDO('pgsql:host=localhost dbname=test', 'foo', 'bar',
array(PDO::ATTR_STRINGIFY_FETCHES => TRUE));
$stmt = $db->prepare("INSERT INTO test_one_blob (blob1) VALUES (?)");
$stmt->execute(array(''));
var_dump($db->errorinfo());
$stmt = $db->prepare("INSERT INTO test_one_blob (blob1) VALUES
(:foo)");
$x = '';
$stmt->bindParam(':foo', $x);
$stmt->execute();
var_dump($db->errorinfo());
$stmt = $db->query("INSERT INTO test_one_blob (blob1) VALUES ('')");
$stmt->execute();
teste=> select * from test_one_blob where blob1 is null;
id | blob1
----+-------
(0 registros)
Do you have tested using PDO directly, without Drupal's db_insert()?
Previous Comments:
------------------------------------------------------------------------
[2008-10-07 18:00:22] hswong3i at gmail dot com
Description:
------------
When pdo_pgsql working with:
1. BLOB field,
2. running INSERT/UPDATE queries, and
3. BLOB value with empty string ''
It will always fill NULL into database and so result as buggy.
INSERT/UPDATE BLOB value with NULL will function correctly.
P.S. pdo_mysql is NOT buggy when running with similar programming
logic, empty string pass into database correctly. Tested with PHP5.2.6
and PHP5.3-dev, both are buggy.
Reproduce code:
---------------
Please refer to http://drupal.org/node/316095#comment-1047830 for more
information.
Expected result:
----------------
Empty string should fill into database correctly.
Actual result:
--------------
Empty string is now stored as NULL.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=46249&edit=1