How friends!!
I have the follow problem:
I created a table using postgresql
CREATE TABLE prueba
(
id serial NOT NULL,
picture bytea,
PRIMARY KEY (id)
) ;
and I have a picture in c:\pictures\mypicture.jpg
insert into prueba(picture)
values('c/pictures/mypicture.jpg');
But, I can't show the pictures in DBGrid. I used DBImage too, but nothing happend.
How can I show the pictures??
Thanks!!
pictures & postgresql
Moderators: gto, cipto_kh, EgonHugeist, olehs
- mdaems
- Zeos Project Manager
- Posts: 2766
- Joined: 20.09.2005, 15:28
- Location: Brussels, Belgium
- Contact:
Hi Jose,
I think you just stored some string (file name) into the picture field. So don't try any longer to display pictures from this field. The coding you need to do the insert has to do something with BLOB values, I believe. I never did it myself, so :
'Anybody around who stored blobs using zeoslib?'
Mark
I think you just stored some string (file name) into the picture field. So don't try any longer to display pictures from this field. The coding you need to do the insert has to do something with BLOB values, I believe. I never did it myself, so :
'Anybody around who stored blobs using zeoslib?'
Mark
Try to look in here (but in that article I use Firebird, but I think same solution with MySQL):
ZeosDBO BLOB
ZeosDBO BLOB
Hi,
I try to use "bytea" - but with some problems at the moment (PostgreSQL 8.1, Zeos 6.5.1-alpha, Delphi 7).
What I did is :
o created a textfile with ASCII-Characters 0x00 to 0x63
o load this file into a TMemoryStream
o "post" this Stream with
TBlobField (FieldByName ('Daten')).LoadFromStream (Daten)
When I try to read this field with
TBlobField (FieldByName ('Daten')).SaveToStream (Daten)
into a TMemoryStream, the character "\" (which is inside the data, 0x5C) is missing !
Also : the original number of bytes was 100, the result only has 97. I think, the backslash is treated in a special way.
Any ideas to get a "real" binary without interpretation ?
I try to use "bytea" - but with some problems at the moment (PostgreSQL 8.1, Zeos 6.5.1-alpha, Delphi 7).
What I did is :
o created a textfile with ASCII-Characters 0x00 to 0x63
o load this file into a TMemoryStream
o "post" this Stream with
TBlobField (FieldByName ('Daten')).LoadFromStream (Daten)
When I try to read this field with
TBlobField (FieldByName ('Daten')).SaveToStream (Daten)
into a TMemoryStream, the character "\" (which is inside the data, 0x5C) is missing !
Also : the original number of bytes was 100, the result only has 97. I think, the backslash is treated in a special way.
Any ideas to get a "real" binary without interpretation ?
See the small patch I posted here: http://zeos.firmos.at/viewtopic.php?t=1641&highlight=
I've been using it and it seems to work. Try it and see how you get on.
Regards,
Ben
I've been using it and it seems to work. Try it and see how you get on.
Regards,
Ben
Hi again,
for the moment I have a solution :
original :
if (GetMetadata.GetColumnType(ColumnIndex) = stAsciiStream) then
added :
if (GetMetadata.GetColumnType(ColumnIndex) = stAsciiStream) or
(GetMetadata.GetColumnType(ColumnIndex) = stBinaryStream) then
(in unit ZDbcPostgreSqlResultSet, TZPostgreSQLResultSet.GetBlob)
I will have a look if it works with other data.
Regards
Andreas
for the moment I have a solution :
original :
if (GetMetadata.GetColumnType(ColumnIndex) = stAsciiStream) then
added :
if (GetMetadata.GetColumnType(ColumnIndex) = stAsciiStream) or
(GetMetadata.GetColumnType(ColumnIndex) = stBinaryStream) then
(in unit ZDbcPostgreSqlResultSet, TZPostgreSQLResultSet.GetBlob)
I will have a look if it works with other data.
Regards
Andreas