Driver option "coLongStrings" not working correct

Discussion of open issues, suggestions and bugs regarding usage of dbExpress drivers for PostgreSQL in Delphi and C++Builder
Post Reply
Posts: 30
Joined: Tue 26 Dec 2006 14:07

Driver option "coLongStrings" not working correct

Post by alexer » Thu 16 Jul 2020 16:40

The simple select return TMemoField for field "MF" :

select (case when 1>2 then 'Yes' else 'No' end) as MF from dual;

The result is undepended of the value of driver option TSQLConnectionOption(coLongStrings)=True or TSQLConnectionOption(coLongStrings)=False.

As a result in the grid I see value "(MEMO)" but I am waiting for "No".

I think the type TMemoField is not actual today becose the value is hidden in the grid.

Is it possible repare the option error, or alwase return type TStringField for long and short strings?

Thank you.

Devart Team
Posts: 81
Joined: Wed 11 Mar 2020 08:28

Re: Driver option "coLongStrings" not working correct

Post by oleg0k » Thu 23 Jul 2020 11:23

According to the Readme file, the option LongStrings is designed for a different purpose:
When this boolean property is set to True, it allows the dataset to represent long strings (with more than 255 characters) as memos. The default value is True.
In your scenario, the field displayed as MEMO (WIDEMEMO), is not an error, since PostreSQL returns the type of a new field in a dataset as character varying, but doesn't return the length of a string if it's not explicitly defined in an expression. For that reason, a TMemo (TWideMemo) field is created.
If you change the expression to cast (case when 3>2 then 'Yes' else 'No' end as char(3)) as MF, then a TStringField will be created and the correct value of the MF field displayed.

wbr, Oleg
Devart Team

Post Reply