Recent

Author Topic: Has Lazarus acquired new ftXXX TFieldType values?  (Read 939 times)

vfclists

  • Hero Member
  • *****
  • Posts: 1013
    • HowTos Considered Harmful?
Has Lazarus acquired new ftXXX TFieldType values?
« on: February 20, 2024, 01:13:18 am »
When I look in Db I see TFieldType defined as

Code: Pascal  [Select][+][-]
  1.   TFieldClass = class of TField;
  2.  
  3.   // Data type for field.
  4.   // The order is determined by Delphi compatibility
  5.   TFieldType = (ftUnknown, ftString, ftSmallint, ftInteger, ftWord,
  6.     ftBoolean, ftFloat, ftCurrency, ftBCD, ftDate,  ftTime, ftDateTime,
  7.     ftBytes, ftVarBytes, ftAutoInc, ftBlob, ftMemo, ftGraphic, ftFmtMemo,
  8.     ftParadoxOle, ftDBaseOle, ftTypedBinary, ftCursor, ftFixedChar,
  9.     ftWideString, ftLargeint, ftADT, ftArray, ftReference,
  10.     ftDataSet, ftOraBlob, ftOraClob, ftVariant, ftInterface,
  11.     ftIDispatch, ftGuid, ftTimeStamp, ftFMTBcd, ftFixedWideChar, ftWideMemo);
  12.  

I don't see any special field to specify a field which is Utf8 in the list of field types, so which is it likely to be ftString, ftWideString,ftMemo, ftWideMemo or what?

How does the database library decide the TFieldType for a database text type? It is up to the library designer?
Lazarus 3.0/FPC 3.2.2

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4467
  • I like bugs.
Re: Has Lazarus acquired new ftXXX TFieldType values?
« Reply #1 on: February 20, 2024, 07:56:25 am »
I don't see any special field to specify a field which is Utf8 in the list of field types, so which is it likely to be ftString, ftWideString,ftMemo, ftWideMemo or what?
It would be ftString.
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

vfclists

  • Hero Member
  • *****
  • Posts: 1013
    • HowTos Considered Harmful?
Re: Has Lazarus acquired new ftXXX TFieldType values?
« Reply #2 on: February 20, 2024, 10:18:15 am »
I don't see any special field to specify a field which is Utf8 in the list of field types, so which is it likely to be ftString, ftWideString,ftMemo, ftWideMemo or what?
It would be ftString.

Is this irrespective of length, even if it is a Postgres Text column?
Lazarus 3.0/FPC 3.2.2

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4467
  • I like bugs.
Re: Has Lazarus acquired new ftXXX TFieldType values?
« Reply #3 on: February 21, 2024, 08:30:46 am »
I don't know really. You must study the Postgres documentation.
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

vfclists

  • Hero Member
  • *****
  • Posts: 1013
    • HowTos Considered Harmful?
Re: Has Lazarus acquired new ftXXX TFieldType values?
« Reply #4 on: February 21, 2024, 09:33:05 am »
I don't know really. You must study the Postgres documentation.

I suspect it may be down to the libraries used.

It seems that Zeos treats any varchar column which doesn't specify a length as a text field and causes them all to show as (memo) in the controls.
Lazarus 3.0/FPC 3.2.2

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11447
  • FPC developer.
Re: Has Lazarus acquired new ftXXX TFieldType values?
« Reply #5 on: February 21, 2024, 04:02:03 pm »
That's true, and that can be fixed using the ongettext

So I have a function like this in my main datamodule

Code: Pascal  [Select][+][-]
  1. procedure TDataModuleBase.defaultGetText(Sender: TField; var Text: string;
  2.   DisplayText: Boolean);
  3. begin
  4.   if DisplayText then
  5.      Text := Copy(sender.AsString, 1, 50)
  6.   else
  7.      text:=sender.AsString;
  8. end;
  9.  

and assign ongettext of every twidememofield to this function.

 

TinyPortal © 2005-2018