Save TStringList on Pg and Get it after

The alpha/beta tester's forum for ZeosLib 7.0.x series

Report problems concerning our Delphi 2009+ version and new Zeoslib 7.0 features here.

This is a forum that will be removed once the 7.X version goes into stable!!

Moderators: gto, EgonHugeist, olehs

Locked
MarcoBidoia
Fresh Boarder
Fresh Boarder
Posts: 1
Joined: 05.07.2011, 18:27
Location: Brasil

Save TStringList on Pg and Get it after

Post by MarcoBidoia »

I create a table with a bytea column that I use to save a TStringList.
Ok, it's inserting as I'd like. When I execute an SQL on PGAdmin I can see the right information.
But, when I use the zeos connection and zeos query to select this field, I get a very strange value.
To save the file in column I do some thing like:

Code: Select all

LStringList := TStringList.Create;
LStringList.Text := 'Test zeos connection';
LStringList.SaveToStream(LStream);
LStream.Postion := 0;
LParam := FDBConnection.SQLQuery.ParamByName('BColumn');
LParam.ParamType := ptInput;
LParam.DataType := ftBlob;
LParam.SetBlobData(LStream.Memory, LStream.Size)
When I select this column by PgAdmin this works, and I can see the text correctly.
But when I select it using Zeos, with a code like:

Code: Select all

ZQuery1.FieldByName('BColumn').AsString;
I get a very strange value.

Some one can help me with this ?

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

Post by seawolf »

Are the chars all ansi?
And What do you see? The number of chars are the same, but the text looks
different?
Locked