Page 1 of 1

Driver option "coLongStrings" not working correct

Posted: Thu 16 Jul 2020 16:40
by alexer
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.

Re: Driver option "coLongStrings" not working correct

Posted: Thu 23 Jul 2020 11:23
by oleg0k
Hello,
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