(WideMemo) in DBControls in Delphi XE

(WideMemo) in DBControls in Delphi XE

Postby fellipeh » Fri 21 Sep 2012 17:17

Hello,

I have these SQL:

Code: Select all
SELECT CC.*,
       (CC.Desc || CC.Desc2) AS FK_PLANOPAI_DESC
FROM CAIXA_CONTA CC
where (CC.IDEMPRESA = 1) and
      (CC.ANA_SIN = 'A')
ORDER BY CC.IDCAIXA_CONTA


In delphi, FK_PLANOPAI_DESC show me as WideMemo... but all 2 fields is varchar!

Where I mess up?

Regards,
fellipeh
 
Posts: 7
Joined: Wed 09 Apr 2008 11:21

Re: (WideMemo) in DBControls in Delphi XE

Postby ZEuS » Mon 24 Sep 2012 10:33

To let the FK_PLANOPAI_DESC field become created as a string field, not as a memo field, you should explicitly specify its type and size in a SQL-statement. For example,
Code: Select all
  select cast((CC.Desc || CC.Desc2) as character varying(600)) AS FK_PLANOPAI_DESC

Otherwize, when preparing the statement, PostgreSQL server can not correctly determine the field size, and therefore the field is created as a memo field.
Also, you can use the Data Type Mapping feature to perform such task. Just create a new rule in the TPgQuery.DataTypeMap property editor, set the "Field Name" column value to "fk_planopai_desc" and the "Field Type" column value to "String". You can learn more about data type mapping in the "Working with Data Type Mapping" article in the PgDAC documentation.
ZEuS
Devart Team
 
Posts: 235
Joined: Thu 05 Apr 2012 07:32


Return to dbExpress driver for PostgreSQL