Mombu the Php Forum sponsored links

Go Back   Mombu the Php Forum > Php > #35338 : PDO freezes while retreiving binary data from postgres
User Name
Password
REGISTER NOW! Mark Forums Read

sponsored links


Reply
 
1 24th April 10:30
php-bugs
External User
 
Posts: 1
Default #35338 : PDO freezes while retreiving binary data from postgres



From: f dot engelhardt at 21torr dot com
Operating system: Linux
PHP version: 5CVS-2005-11-22 (CVS)
PHP Bug Type: PDO related
Bug description: PDO freezes while retreiving binary data from postgres

Description:
------------
I tried to write binary data into a postgresql table, that work, but i can
not get this data out the table anymore.

Reproduce code:
---------------
<?php

$dbh = new PDO('pgsql:host=localhost;dbname=test','root','fo0 224');

$q = 'SELECT data FROM foobar';
$stmt = $dbh->prepare($q);
if ($stmt)
{
$stmt->bindColumn('DATA',$sData);
if (!$stmt->execute())
{
print_r($stmt->errorInfo());
die('DAMN');
}
if (!$stmt->fetch(PDO::FETCH_BOUND))
{
print_r($stmt->errorInfo());
die('DAMN');
}
header('Content-Type: image/jpeg');
echo $sData;
} else {
print_r($dbh->errorInfo());
}

?>


Table foobar only has a bytea column named data

Expected result:
----------------
should display the image

Actual result:
--------------
the php-process does not do anything, the browser waits for an answer (i
waited 5 minutes, but nothing happened)

--
Edit bug report at http://bugs.php.net/?id=35338&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=35338&r=trysnapshot4
Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=35338&r=trysnapshot50
Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=35338&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=35338&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=35338&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=35338&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=35338&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=35338&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=35338&r=support
Expected behavior: http://bugs.php.net/fix.php?id=35338&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=35338&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=35338&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=35338&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=35338&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=35338&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=35338&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=35338&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=35338&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=35338&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=35338&r=mysqlcfg
  Reply With Quote


  sponsored links


2 24th April 14:05
External User
 
Posts: 1
Default #35338 : PDO freezes while retreiving binary data from postgres



ID: 35338
Updated by: tony2001@php.net
Reported By: f dot engelhardt at 21torr dot com
-Status: Open
+Status: Feedback
Bug Type: PDO related
Operating System: Linux
PHP Version: 5CVS-2005-11-22 (CVS)
New Comment:

Are you able to reproduce it with something different than PgSQL?
Sqlite, for example?
Are you able to reproduce it with PHP CLI?

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

[2005-11-22 20:57:09] f dot engelhardt at 21torr dot com

Description:
------------
I tried to write binary data into a postgresql table, that work, but i
can not get this data out the table anymore.

Reproduce code:
---------------
<?php

$dbh = new PDO('pgsql:host=localhost;dbname=test','root','fo0 224');

$q = 'SELECT data FROM foobar';
$stmt = $dbh->prepare($q);
if ($stmt)
{
$stmt->bindColumn('DATA',$sData);
if (!$stmt->execute())
{
print_r($stmt->errorInfo());
die('DAMN');
}
if (!$stmt->fetch(PDO::FETCH_BOUND))
{
print_r($stmt->errorInfo());
die('DAMN');
}
header('Content-Type: image/jpeg');
echo $sData;
} else {
print_r($dbh->errorInfo());
}

?>


Table foobar only has a bytea column named data

Expected result:
----------------
should display the image

Actual result:
--------------
the php-process does not do anything, the browser waits for an answer
(i waited 5 minutes, but nothing happened)


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


--
Edit this bug report at http://bugs.php.net/?id=35338&edit=1
  Reply With Quote
3 24th April 17:13
php-bugs
External User
 
Posts: 1
Default #35338 : PDO freezes while retreiving binary data from postgres


ID: 35338
User updated by: f dot engelhardt at 21torr dot com
Reported By: f dot engelhardt at 21torr dot com
-Status: Feedback
+Status: Open
Bug Type: PDO related
Operating System: Linux
PHP Version: 5CVS-2005-11-22 (CVS)
New Comment:

Exact the same script (replacing pgsql by mysql in the new PDO line) it
works with mysql.
I also tried it with CLI, the same error.

And i found out another bug. I tried to insert data into the table with
pdo into a postgresql database, but there are only some bytes inserted,
not all.

Script:

<?php

$dbh = new PDO('pgsql:host=localhost;dbname=test','root','fo0 224');

$sData =
file_get_contents('/home/bowman/.fluxbox/backgrounds/NVA-91.jpg');

$q = 'INSERT INTO foobar (data) VALUES (:data)';
$stmt = $dbh->prepare($q);
if ($stmt)
{
$stmt->bindParam(':data',$sData);
if (!$stmt->execute())
{
print_r($stmt->errorInfo());
die('DAMN');
}
//header('Content-Type: image/jpeg');
echo $sData;
flush();
exit;
} else {
print_r($dbh->errorInfo());
}

?>


This script is working with MySQL, but not with Postgresql


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

[2005-11-22 22:36:40] tony2001@php.net

Are you able to reproduce it with something different than PgSQL?
Sqlite, for example?
Are you able to reproduce it with PHP CLI?


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

[2005-11-22 20:57:09] f dot engelhardt at 21torr dot com

Description:
------------
I tried to write binary data into a postgresql table, that work, but i
can not get this data out the table anymore.

Reproduce code:
---------------
<?php

$dbh = new PDO('pgsql:host=localhost;dbname=test','root','fo0 224');

$q = 'SELECT data FROM foobar';
$stmt = $dbh->prepare($q);
if ($stmt)
{
$stmt->bindColumn('DATA',$sData);
if (!$stmt->execute())
{
print_r($stmt->errorInfo());
die('DAMN');
}
if (!$stmt->fetch(PDO::FETCH_BOUND))
{
print_r($stmt->errorInfo());
die('DAMN');
}
header('Content-Type: image/jpeg');
echo $sData;
} else {
print_r($dbh->errorInfo());
}

?>


Table foobar only has a bytea column named data

Expected result:
----------------
should display the image

Actual result:
--------------
the php-process does not do anything, the browser waits for an answer
(i waited 5 minutes, but nothing happened)


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


--
Edit this bug report at http://bugs.php.net/?id=35338&edit=1
  Reply With Quote
4 24th April 17:13
php-bugs
External User
 
Posts: 1
Default #35338 : PDO freezes while retreiving binary data from postgres


ID: 35338
User updated by: f dot engelhardt at 21torr dot com
Reported By: f dot engelhardt at 21torr dot com
Status: Open
Bug Type: PDO related
Operating System: Linux
PHP Version: 5CVS-2005-11-22 (CVS)
New Comment:

Sorry, i forgot to give you another hint:
The data in the postgresql database in the first script was added with
the pg_-functions into a bytea field.
As explained some minutes ago, inserting binary data into a bytea field
in postgres via pdo failes with no error output.
Maybe i am using the wrong datatype for binary data in postgres, but i
only found bytea for binary puroses.


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

[2005-11-23 12:25:07] f dot engelhardt at 21torr dot com

Exact the same script (replacing pgsql by mysql in the new PDO line) it
works with mysql.
I also tried it with CLI, the same error.

And i found out another bug. I tried to insert data into the table with
pdo into a postgresql database, but there are only some bytes inserted,
not all.

Script:

<?php

$dbh = new PDO('pgsql:host=localhost;dbname=test','root','fo0 224');

$sData =
file_get_contents('/home/bowman/.fluxbox/backgrounds/NVA-91.jpg');

$q = 'INSERT INTO foobar (data) VALUES (:data)';
$stmt = $dbh->prepare($q);
if ($stmt)
{
$stmt->bindParam(':data',$sData);
if (!$stmt->execute())
{
print_r($stmt->errorInfo());
die('DAMN');
}
//header('Content-Type: image/jpeg');
echo $sData;
flush();
exit;
} else {
print_r($dbh->errorInfo());
}

?>


This script is working with MySQL, but not with Postgresql

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

[2005-11-22 22:36:40] tony2001@php.net

Are you able to reproduce it with something different than PgSQL?
Sqlite, for example?
Are you able to reproduce it with PHP CLI?


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

[2005-11-22 20:57:09] f dot engelhardt at 21torr dot com

Description:
------------
I tried to write binary data into a postgresql table, that work, but i
can not get this data out the table anymore.

Reproduce code:
---------------
<?php

$dbh = new PDO('pgsql:host=localhost;dbname=test','root','fo0 224');

$q = 'SELECT data FROM foobar';
$stmt = $dbh->prepare($q);
if ($stmt)
{
$stmt->bindColumn('DATA',$sData);
if (!$stmt->execute())
{
print_r($stmt->errorInfo());
die('DAMN');
}
if (!$stmt->fetch(PDO::FETCH_BOUND))
{
print_r($stmt->errorInfo());
die('DAMN');
}
header('Content-Type: image/jpeg');
echo $sData;
} else {
print_r($dbh->errorInfo());
}

?>


Table foobar only has a bytea column named data

Expected result:
----------------
should display the image

Actual result:
--------------
the php-process does not do anything, the browser waits for an answer
(i waited 5 minutes, but nothing happened)


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


--
Edit this bug report at http://bugs.php.net/?id=35338&edit=1
  Reply With Quote
5 24th April 17:13
External User
 
Posts: 1
Default #35338 : PDO freezes while retreiving binary data from postgres


ID: 35338
Updated by: tony2001@php.net
Reported By: f dot engelhardt at 21torr dot com
-Status: Open
+Status: Assigned
Bug Type: PDO related
Operating System: Linux
PHP Version: 5CVS-2005-11-22 (CVS)
-Assigned To:
+Assigned To: wez
New Comment:

Assigned to the maintainer.


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

[2005-11-23 12:28:51] f dot engelhardt at 21torr dot com

Sorry, i forgot to give you another hint:
The data in the postgresql database in the first script was added with
the pg_-functions into a bytea field.
As explained some minutes ago, inserting binary data into a bytea field
in postgres via pdo failes with no error output.
Maybe i am using the wrong datatype for binary data in postgres, but i
only found bytea for binary puroses.

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

[2005-11-23 12:25:07] f dot engelhardt at 21torr dot com

Exact the same script (replacing pgsql by mysql in the new PDO line) it
works with mysql.
I also tried it with CLI, the same error.

And i found out another bug. I tried to insert data into the table with
pdo into a postgresql database, but there are only some bytes inserted,
not all.

Script:

<?php

$dbh = new PDO('pgsql:host=localhost;dbname=test','root','fo0 224');

$sData =
file_get_contents('/home/bowman/.fluxbox/backgrounds/NVA-91.jpg');

$q = 'INSERT INTO foobar (data) VALUES (:data)';
$stmt = $dbh->prepare($q);
if ($stmt)
{
$stmt->bindParam(':data',$sData);
if (!$stmt->execute())
{
print_r($stmt->errorInfo());
die('DAMN');
}
//header('Content-Type: image/jpeg');
echo $sData;
flush();
exit;
} else {
print_r($dbh->errorInfo());
}

?>


This script is working with MySQL, but not with Postgresql

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

[2005-11-22 22:36:40] tony2001@php.net

Are you able to reproduce it with something different than PgSQL?
Sqlite, for example?
Are you able to reproduce it with PHP CLI?


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

[2005-11-22 20:57:09] f dot engelhardt at 21torr dot com

Description:
------------
I tried to write binary data into a postgresql table, that work, but i
can not get this data out the table anymore.

Reproduce code:
---------------
<?php

$dbh = new PDO('pgsql:host=localhost;dbname=test','root','fo0 224');

$q = 'SELECT data FROM foobar';
$stmt = $dbh->prepare($q);
if ($stmt)
{
$stmt->bindColumn('DATA',$sData);
if (!$stmt->execute())
{
print_r($stmt->errorInfo());
die('DAMN');
}
if (!$stmt->fetch(PDO::FETCH_BOUND))
{
print_r($stmt->errorInfo());
die('DAMN');
}
header('Content-Type: image/jpeg');
echo $sData;
} else {
print_r($dbh->errorInfo());
}

?>


Table foobar only has a bytea column named data

Expected result:
----------------
should display the image

Actual result:
--------------
the php-process does not do anything, the browser waits for an answer
(i waited 5 minutes, but nothing happened)


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


--
Edit this bug report at http://bugs.php.net/?id=35338&edit=1
  Reply With Quote
6 24th April 21:15
External User
 
Posts: 1
Default #35338 : PDO freezes while retreiving binary data from postgres


ID: 35338
Updated by: wez@php.net
Reported By: f dot engelhardt at 21torr dot com
-Status: Assigned
+Status: Feedback
Bug Type: PDO related
Operating System: Linux
PHP Version: 5CVS-2005-11-22 (CVS)
Assigned To: wez
New Comment:

Please try using this CVS snapshot:

http://snaps.php.net/php5-latest.tar.gz

For Windows:

http://snaps.php.net/win32/php5-win32-latest.zip

I've made some adjustments in CVS; please try the next PHP 5.1 snapshot
and let me know how it goes.


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

[2005-11-23 13:53:52] tony2001@php.net

Assigned to the maintainer.

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

[2005-11-23 12:28:51] f dot engelhardt at 21torr dot com

Sorry, i forgot to give you another hint:
The data in the postgresql database in the first script was added with
the pg_-functions into a bytea field.
As explained some minutes ago, inserting binary data into a bytea field
in postgres via pdo failes with no error output.
Maybe i am using the wrong datatype for binary data in postgres, but i
only found bytea for binary puroses.

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

[2005-11-23 12:25:07] f dot engelhardt at 21torr dot com

Exact the same script (replacing pgsql by mysql in the new PDO line) it
works with mysql.
I also tried it with CLI, the same error.

And i found out another bug. I tried to insert data into the table with
pdo into a postgresql database, but there are only some bytes inserted,
not all.

Script:

<?php

$dbh = new PDO('pgsql:host=localhost;dbname=test','root','fo0 224');

$sData =
file_get_contents('/home/bowman/.fluxbox/backgrounds/NVA-91.jpg');

$q = 'INSERT INTO foobar (data) VALUES (:data)';
$stmt = $dbh->prepare($q);
if ($stmt)
{
$stmt->bindParam(':data',$sData);
if (!$stmt->execute())
{
print_r($stmt->errorInfo());
die('DAMN');
}
//header('Content-Type: image/jpeg');
echo $sData;
flush();
exit;
} else {
print_r($dbh->errorInfo());
}

?>


This script is working with MySQL, but not with Postgresql

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

[2005-11-22 22:36:40] tony2001@php.net

Are you able to reproduce it with something different than PgSQL?
Sqlite, for example?
Are you able to reproduce it with PHP CLI?


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

[2005-11-22 20:57:09] f dot engelhardt at 21torr dot com

Description:
------------
I tried to write binary data into a postgresql table, that work, but i
can not get this data out the table anymore.

Reproduce code:
---------------
<?php

$dbh = new PDO('pgsql:host=localhost;dbname=test','root','fo0 224');

$q = 'SELECT data FROM foobar';
$stmt = $dbh->prepare($q);
if ($stmt)
{
$stmt->bindColumn('DATA',$sData);
if (!$stmt->execute())
{
print_r($stmt->errorInfo());
die('DAMN');
}
if (!$stmt->fetch(PDO::FETCH_BOUND))
{
print_r($stmt->errorInfo());
die('DAMN');
}
header('Content-Type: image/jpeg');
echo $sData;
} else {
print_r($dbh->errorInfo());
}

?>


Table foobar only has a bytea column named data

Expected result:
----------------
should display the image

Actual result:
--------------
the php-process does not do anything, the browser waits for an answer
(i waited 5 minutes, but nothing happened)


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


--
Edit this bug report at http://bugs.php.net/?id=35338&edit=1
  Reply With Quote
7 25th April 03:33
php-bugs
External User
 
Posts: 1
Default #35338 : PDO freezes while retreiving binary data from postgres


ID: 35338
User updated by: f dot engelhardt at 21torr dot com
Reported By: f dot engelhardt at 21torr dot com
-Status: Feedback
+Status: Open
Bug Type: PDO related
Operating System: Linux
PHP Version: 5CVS-2005-11-22 (CVS)
Assigned To: wez
New Comment:

I am sorry, but i have to tell you, that nothing changed.
After executing the insert script, there was only the following in the
database:
id data
4 \377\330\377\340

There has to more data.
I know, that when using the pg_ functions i have to pg_escape_bytea()
function on the binary data, and when i
read it, i have to use the pg_unescape_bytea() function.
Maybe this isnīt done.


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

[2005-11-25 04:38:16] wez@php.net

Please try using this CVS snapshot:

http://snaps.php.net/php5-latest.tar.gz

For Windows:

http://snaps.php.net/win32/php5-win32-latest.zip

I've made some adjustments in CVS; please try the next PHP 5.1 snapshot
and let me know how it goes.

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

[2005-11-23 13:53:52] tony2001@php.net

Assigned to the maintainer.

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

[2005-11-23 12:28:51] f dot engelhardt at 21torr dot com

Sorry, i forgot to give you another hint:
The data in the postgresql database in the first script was added with
the pg_-functions into a bytea field.
As explained some minutes ago, inserting binary data into a bytea field
in postgres via pdo failes with no error output.
Maybe i am using the wrong datatype for binary data in postgres, but i
only found bytea for binary puroses.

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

[2005-11-23 12:25:07] f dot engelhardt at 21torr dot com

Exact the same script (replacing pgsql by mysql in the new PDO line) it
works with mysql.
I also tried it with CLI, the same error.

And i found out another bug. I tried to insert data into the table with
pdo into a postgresql database, but there are only some bytes inserted,
not all.

Script:

<?php

$dbh = new PDO('pgsql:host=localhost;dbname=test','root','fo0 224');

$sData =
file_get_contents('/home/bowman/.fluxbox/backgrounds/NVA-91.jpg');

$q = 'INSERT INTO foobar (data) VALUES (:data)';
$stmt = $dbh->prepare($q);
if ($stmt)
{
$stmt->bindParam(':data',$sData);
if (!$stmt->execute())
{
print_r($stmt->errorInfo());
die('DAMN');
}
//header('Content-Type: image/jpeg');
echo $sData;
flush();
exit;
} else {
print_r($dbh->errorInfo());
}

?>


This script is working with MySQL, but not with Postgresql

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

[2005-11-22 22:36:40] tony2001@php.net

Are you able to reproduce it with something different than PgSQL?
Sqlite, for example?
Are you able to reproduce it with PHP CLI?


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

The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/35338

--
Edit this bug report at http://bugs.php.net/?id=35338&edit=1
  Reply With Quote
8 25th April 03:33
php-bugs
External User
 
Posts: 1
Default #35338 : PDO freezes while retreiving binary data from postgres


ID: 35338
User updated by: f dot engelhardt at 21torr dot com
Reported By: f dot engelhardt at 21torr dot com
Status: Open
Bug Type: PDO related
Operating System: Linux
PHP Version: 5CVS-2005-11-22 (CVS)
Assigned To: wez
New Comment:

It works, if i specify PDO::PARAM_LOB with the bindParam() call in the
insert script:

$stmt->bindParam(':data',$sData,PDO::PARAM_LOB);

I am not sure, if it should work without this, but it is working on
postgresql if i do it like this.
It also works with mysql, but that was working also without the
PDO::PARAM_LOB parameter.

So my question is:
Is it desired that binary data can be inserted into a table without
PDO::PARAM_LOB or not?


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

[2005-11-25 11:05:56] f dot engelhardt at 21torr dot com

I am sorry, but i have to tell you, that nothing changed.
After executing the insert script, there was only the following in the
database:
id data
4 \377\330\377\340

There has to more data.
I know, that when using the pg_ functions i have to pg_escape_bytea()
function on the binary data, and when i
read it, i have to use the pg_unescape_bytea() function.
Maybe this isnīt done.

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

[2005-11-25 04:38:16] wez@php.net

Please try using this CVS snapshot:

http://snaps.php.net/php5-latest.tar.gz

For Windows:

http://snaps.php.net/win32/php5-win32-latest.zip

I've made some adjustments in CVS; please try the next PHP 5.1 snapshot
and let me know how it goes.

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

[2005-11-23 13:53:52] tony2001@php.net

Assigned to the maintainer.

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

[2005-11-23 12:28:51] f dot engelhardt at 21torr dot com

Sorry, i forgot to give you another hint:
The data in the postgresql database in the first script was added with
the pg_-functions into a bytea field.
As explained some minutes ago, inserting binary data into a bytea field
in postgres via pdo failes with no error output.
Maybe i am using the wrong datatype for binary data in postgres, but i
only found bytea for binary puroses.

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

[2005-11-23 12:25:07] f dot engelhardt at 21torr dot com

Exact the same script (replacing pgsql by mysql in the new PDO line) it
works with mysql.
I also tried it with CLI, the same error.

And i found out another bug. I tried to insert data into the table with
pdo into a postgresql database, but there are only some bytes inserted,
not all.

Script:

<?php

$dbh = new PDO('pgsql:host=localhost;dbname=test','root','fo0 224');

$sData =
file_get_contents('/home/bowman/.fluxbox/backgrounds/NVA-91.jpg');

$q = 'INSERT INTO foobar (data) VALUES (:data)';
$stmt = $dbh->prepare($q);
if ($stmt)
{
$stmt->bindParam(':data',$sData);
if (!$stmt->execute())
{
print_r($stmt->errorInfo());
die('DAMN');
}
//header('Content-Type: image/jpeg');
echo $sData;
flush();
exit;
} else {
print_r($dbh->errorInfo());
}

?>


This script is working with MySQL, but not with Postgresql

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

The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/35338

--
Edit this bug report at http://bugs.php.net/?id=35338&edit=1
  Reply With Quote
9 25th April 03:35
External User
 
Posts: 1
Default #35338 : PDO freezes while retreiving binary data from postgres


ID: 35338
Updated by: tony2001@php.net
Reported By: f dot engelhardt at 21torr dot com
-Status: Open
+Status: Assigned
Bug Type: PDO related
Operating System: Linux
PHP Version: 5CVS-2005-11-22 (CVS)
Assigned To: wez


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

[2005-11-25 11:12:56] f dot engelhardt at 21torr dot com

It works, if i specify PDO::PARAM_LOB with the bindParam() call in the
insert script:

$stmt->bindParam(':data',$sData,PDO::PARAM_LOB);

I am not sure, if it should work without this, but it is working on
postgresql if i do it like this.
It also works with mysql, but that was working also without the
PDO::PARAM_LOB parameter.

So my question is:
Is it desired that binary data can be inserted into a table without
PDO::PARAM_LOB or not?

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

[2005-11-25 11:05:56] f dot engelhardt at 21torr dot com

I am sorry, but i have to tell you, that nothing changed.
After executing the insert script, there was only the following in the
database:
id data
4 \377\330\377\340

There has to more data.
I know, that when using the pg_ functions i have to pg_escape_bytea()
function on the binary data, and when i
read it, i have to use the pg_unescape_bytea() function.
Maybe this isnīt done.

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

[2005-11-25 04:38:16] wez@php.net

Please try using this CVS snapshot:

http://snaps.php.net/php5-latest.tar.gz

For Windows:

http://snaps.php.net/win32/php5-win32-latest.zip

I've made some adjustments in CVS; please try the next PHP 5.1 snapshot
and let me know how it goes.

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

[2005-11-23 13:53:52] tony2001@php.net

Assigned to the maintainer.

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

[2005-11-23 12:28:51] f dot engelhardt at 21torr dot com

Sorry, i forgot to give you another hint:
The data in the postgresql database in the first script was added with
the pg_-functions into a bytea field.
As explained some minutes ago, inserting binary data into a bytea field
in postgres via pdo failes with no error output.
Maybe i am using the wrong datatype for binary data in postgres, but i
only found bytea for binary puroses.

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

The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/35338

--
Edit this bug report at http://bugs.php.net/?id=35338&edit=1
  Reply With Quote
10 26th April 11:16
External User
 
Posts: 1
Default #35338 : PDO freezes while retreiving binary data from postgres


ID: 35338
Updated by: iliaa@php.net
Reported By: f dot engelhardt at 21torr dot com
-Status: Assigned
+Status: Bogus
Bug Type: PDO related
Operating System: Linux
PHP Version: 5CVS-2005-11-22 (CVS)
Assigned To: wez
New Comment:

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the do***entation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

When using binary data you must specify the param as LOB via
PDO::PARAM_LOB. This is necessary to allow the underlying layer to
realize the data is binary and use a binary escaping function, rather
then a string escaping function. In PostgreSQL using a string escaping
function or binary data results in data loss.


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

[2005-11-25 11:12:56] f dot engelhardt at 21torr dot com

It works, if i specify PDO::PARAM_LOB with the bindParam() call in the
insert script:

$stmt->bindParam(':data',$sData,PDO::PARAM_LOB);

I am not sure, if it should work without this, but it is working on
postgresql if i do it like this.
It also works with mysql, but that was working also without the
PDO::PARAM_LOB parameter.

So my question is:
Is it desired that binary data can be inserted into a table without
PDO::PARAM_LOB or not?

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

[2005-11-25 11:05:56] f dot engelhardt at 21torr dot com

I am sorry, but i have to tell you, that nothing changed.
After executing the insert script, there was only the following in the
database:
id data
4 \377\330\377\340

There has to more data.
I know, that when using the pg_ functions i have to pg_escape_bytea()
function on the binary data, and when i
read it, i have to use the pg_unescape_bytea() function.
Maybe this isnīt done.

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

[2005-11-25 04:38:16] wez@php.net

Please try using this CVS snapshot:

http://snaps.php.net/php5-latest.tar.gz

For Windows:

http://snaps.php.net/win32/php5-win32-latest.zip

I've made some adjustments in CVS; please try the next PHP 5.1 snapshot
and let me know how it goes.

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

[2005-11-23 13:53:52] tony2001@php.net

Assigned to the maintainer.

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

[2005-11-23 12:28:51] f dot engelhardt at 21torr dot com

Sorry, i forgot to give you another hint:
The data in the postgresql database in the first script was added with
the pg_-functions into a bytea field.
As explained some minutes ago, inserting binary data into a bytea field
in postgres via pdo failes with no error output.
Maybe i am using the wrong datatype for binary data in postgres, but i
only found bytea for binary puroses.

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

The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/35338

--
Edit this bug report at http://bugs.php.net/?id=35338&edit=1
  Reply With Quote


  sponsored links


Reply


Thread Tools
Display Modes




Copyright Đ 2006 SmartyDevil.com - Dies Mies Jeschet Boenedoesef Douvema Enitemaus -
666