Page 1 of 1

Save TStringList on Pg and Get it after

Posted: 29.07.2011, 18:05
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

Posted: 29.07.2011, 22:02
by seawolf
Are the chars all ansi?
And What do you see? The number of chars are the same, but the text looks
different?