LoadFromFile ZOES + PostGreSQL + field Bytea

In this forum we will discuss things relating the ZEOSLib 6.6.x stable versions

Moderators: gto, EgonHugeist

Post Reply
scribes
Fresh Boarder
Fresh Boarder
Posts: 8
Joined: 19.11.2005, 07:07

LoadFromFile ZOES + PostGreSQL + field Bytea

Post by scribes »

Hi All,

I'm trying to upload a file to a field of type byte to PostGeSQL and I received the error below when I post a query

I'm using the code below

Stream := TMemoryStream.Create();
Stream.LoadFromFile(DAbre.FileName);
ZImagem.edit;
TBlobField(ZImagem.FieldByName('programa')).LoadFromStream(Stream);
ZImagem.post;
Stream.Free;

Thanks
Edmilson
You do not have the required permissions to view the files attached to this post.
trupka
Expert Boarder
Expert Boarder
Posts: 140
Joined: 26.08.2007, 22:10

Post by trupka »

Code: Select all

(ZImagem.FieldByName('programa') as TBlobField).LoadFromFile(fileName)
Maybe this should do it?
scribes
Fresh Boarder
Fresh Boarder
Posts: 8
Joined: 19.11.2005, 07:07

Post by scribes »

Hi,

The same mistake not resolved

Thanks

Edmilson
seawolf
Zeos Dev Team *
Zeos Dev Team *
Posts: 385
Joined: 04.06.2008, 19:50
Contact:

Post by seawolf »

Which Delphi version are you using?

Does exists a column with the name displayed on the MessageDlg?
scribes
Fresh Boarder
Fresh Boarder
Posts: 8
Joined: 19.11.2005, 07:07

Post by scribes »

Hi,
I use Turbo Delphi
Not content that he is claiming and the contents of the file.

Thanks

Edmilson
trupka
Expert Boarder
Expert Boarder
Posts: 140
Joined: 26.08.2007, 22:10

Post by trupka »

scribes,
I'm having trouble to read text on attached picture, but it seems that error is more "database related".
Maybe you can use TZSQLMonitor or look into postgresql log file to reveal some more details about error?
scribes
Fresh Boarder
Fresh Boarder
Posts: 8
Joined: 19.11.2005, 07:07

Post by scribes »

Hi, trupka
Thanks for the idea I saw the error with TZSQLMonitor, I just generate the insert with the table name field and the error was here
app.name_app the right and so the field name_app

Thanks All

Edmilson
Post Reply