Cannot read correctly a string of bytes from a text field

Discussion of open issues, suggestions and bugs regarding PgDAC (PostgreSQL Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
radub
Posts: 105
Joined: Sat 10 Jul 2010 18:46

Cannot read correctly a string of bytes from a text field

Post by radub » Tue 05 Nov 2013 10:00

In a text field I put a string of ASCII (an custom encrypted string) and I tried to read with a simple PgQuery,
"select 'field' from 'table' where 'keyfield'='key'",
but no matter the type of field I cast it (TBinaryField, TByteField etc), it returns a different string, each time the same length and content.

When executing the query in pgAdmin it return the correct string.

More, if I put a text in that field, even a large one (287k), the query reads correctly, so I think the problem is how the PgDAC is interpreting the content when the field contains control characters.

How can I bypass the issue?

Thank you,
Radu B.

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: Cannot read correctly a string of bytes from a text field

Post by AlexP » Tue 05 Nov 2013 10:43

Hello,

Please send the script for creating and filling in the table or a dump to alexp*devart*com, in order for us to reproduce and fix the problem. Also, please specify the exact versions of the IDE and PgDAC

radub
Posts: 105
Joined: Sat 10 Jul 2010 18:46

Re: Cannot read correctly a string of bytes from a text field

Post by radub » Fri 08 Nov 2013 12:48

Hello,

In response to the previous post, I've sent a mail to [email protected] on November 5th and I don't know if you have received it or it contains all you needed to reproduce the issue.

Thank you

Radu B.

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: Cannot read correctly a string of bytes from a text field

Post by AlexP » Fri 08 Nov 2013 13:16

Hello,

For correct work with UniCode symbols, you should set the UseUnicode property to True

radub
Posts: 105
Joined: Sat 10 Jul 2010 18:46

Re: Cannot read correctly a string of bytes from a text field

Post by radub » Fri 08 Nov 2013 14:25

Thnaks! It works.

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: Cannot read correctly a string of bytes from a text field

Post by AlexP » Fri 08 Nov 2013 14:37

Hello,

Glad to see that the problem was solved. If you have any other questions, feel free to contact us.

Post Reply