Bug #6658 [NEW]: bytea data insertion doesont work for me
| From: | muaddib at kopernet dot org | Date: | Wed, 01 Feb 2006 16:56:56 +0000 |
| Subject: | Bug #6658 [NEW]: bytea data insertion doesont work for me | ||
| Groups: | php.pear.doc | ||
| Request: | Send a blank email to pear-doc+get-7485@lists.php.net to get a copy of this message | ||
From: muaddib at kopernet dot org
Operating system: debian sarge
Package version:
PHP version: 4.3.10
Package: Documentation
Bug Type: Bug
Bug description: bytea data insertion doesont work for me
Description:
------------
I dont know if this is really a bug or just my lack of knowledge but
Inserting() data into PostgreSQL 7.4.7 results in error:
ERROR: invalid input syntax for type bytea
Test script:
---------------
$data = file_get_contents($myfilename);
$image->binarydata = pg_escape_bytea($data);
$image->insert();
// when i change to this..
//$data = file_get_contents($myfilename);
//$image->binarydata = pg_escape_bytea($data);
//$image->query("insert into table (column)
values('$image->binarydata'));
//..all goes as expected.
//also i can insert an empty string.
Actual result:
--------------
2006-02-01 14:24:11 [22633] LOG: statement: INSERT INTO public.binarydata
(binarydata ) VALUES
('\\\\377\\\\330\\\\377\\\\340\\\\000\\\\020JFIF\\\\000\\\\001
(...)
\\\\210\\\\200""\\\\000\\\\210\\\\210\\\\002"
\\\\010\\\\210\\\\200\\\\377\\\\331' )
2006-02-01 14:24:11 [22633] ERROR: invalid input syntax for type bytea
--
Edit bug report at http://pear.php.net/bugs/bug.php?id=6658&edit=1
--