Recent

Author Topic: 2015 era sqllite app doesn't display field.  (Read 1624 times)

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 12645
  • FPC developer.
2015 era sqllite app doesn't display field.
« on: September 28, 2025, 01:40:26 pm »
I've an 2015-2017 era sqldb-with-sqllite app that is for some personal administration. I had to update it, and saw that a field wasn't showing anymore. (with the same original DLL)

The field is ftfixedchar with size 128 and precision -1, and it is a simple query  (select * from tablename).  Any idea what that could be? something changed in the handling of string types?

paweld

  • Hero Member
  • *****
  • Posts: 1568
Re: 2015 era sqllite app doesn't display field.
« Reply #1 on: September 28, 2025, 04:27:24 pm »
You didn't mention which version of FPC you are using. But if it's trunk, 3.2-fixes, or 3.2.4rc1, the cause may be the patch from issue : https://gitlab.com/freepascal.org/fpc/source/-/issues/40686
The symptom is the field type set as ftMemo.
Best regards / Pozdrawiam
paweld

rvk

  • Hero Member
  • *****
  • Posts: 6944
Re: 2015 era sqllite app doesn't display field.
« Reply #2 on: September 28, 2025, 04:41:15 pm »
Any idea what that could be? something changed in the handling of string types?
Yes. Something has changed.
TEXT fields are now treated as ftMemo as in the past they were treated as ftString.

I think this was a wrong decision but it was done.

It would have been better to fix the FTS-Tables issue instead of generally change this for all tables.
« Last Edit: September 28, 2025, 04:43:29 pm by rvk »

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 12645
  • FPC developer.
Re: 2015 era sqllite app doesn't display field.
« Reply #3 on: September 28, 2025, 05:55:47 pm »
fpc trunk/lazarus trunk, I tried setting the field to ftmemo, ftstring or ftfixedchar, and it doesn't display values in the grid either way.

PascalDragon

  • Hero Member
  • *****
  • Posts: 6322
  • Compiler Developer
Re: 2015 era sqllite app doesn't display field.
« Reply #4 on: September 28, 2025, 06:00:56 pm »
If I remember correctly then you need to set some option in the grid that allows it to display memo fields (dgDisplayMemoText in Options).

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 12645
  • FPC developer.
Re: 2015 era sqllite app doesn't display field.
« Reply #5 on: January 02, 2026, 12:20:58 pm »
I investigated it a bit further, and no that is not it. I standard have the ongettext assigned to handle that.

The memo fields display fine, it is the TStringfield fields that fail.

cdbc

  • Hero Member
  • *****
  • Posts: 2621
    • http://www.cdbc.dk
Re: 2015 era sqllite app doesn't display field.
« Reply #6 on: January 02, 2026, 12:51:10 pm »
Hi
Quote
I standard have the ongettext assigned to handle that.
In that case, I'd suggest you read the field-value 'AsBytes' and convert to string yourself, in your handler...
Regards Benny
If it ain't broke, don't fix it ;)
PCLinuxOS(rolling release) 64bit -> KDE6/QT6 -> FPC Release -> Lazarus Release &  FPC Main -> Lazarus Main

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 12645
  • FPC developer.
Re: 2015 era sqllite app doesn't display field.
« Reply #7 on: January 02, 2026, 07:31:16 pm »
Hmm:

Maybe related to:

https://gitlab.com/freepascal.org/fpc/source/-/commit/f0e34e8fabafd121ee2a7e4f6e3f005727a271f7

 Map text field on ftMemo, since string has limited length. Fixes issue #40686

Thaddy

  • Hero Member
  • *****
  • Posts: 18729
  • To Europe: simply sell USA bonds: dollar collapses
Re: 2015 era sqllite app doesn't display field.
« Reply #8 on: January 03, 2026, 12:43:31 pm »
That fix has also caused other problems, namely the other way around: simple dbedit fields and the likes were accepting ftString, which you have to adapt to ftMemo.
Although the fix is logical, it is a breaking fix.
(Likely you ran into that)
If Europe sells their USA bonds the USD will collapse. Europe can affort that given average state debts. The USA can't affort that. Just an advice...

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 12645
  • FPC developer.
Re: 2015 era sqllite app doesn't display field.
« Reply #9 on: January 04, 2026, 01:25:27 pm »
I now confirmed this was the problem. It was a bit confusing, since the query editor of Lazarus still adds a TStringfield. I really had to manually add a field as ftmemo.

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 12645
  • FPC developer.
Re: 2015 era sqllite app doesn't display field.
« Reply #10 on: January 04, 2026, 02:31:31 pm »
Worse, the linked TDBEdit still show (MEMO) and that doesn't have a property to display like dbgrid has.

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 12645
  • FPC developer.
Re: 2015 era sqllite app doesn't display field.
« Reply #11 on: January 04, 2026, 11:36:34 pm »
Yes, Thaddy, I ran into that.

I asked Michael about it, and now there is at least some info about it:

https://wiki.freepascal.org/User_Changes_Trunk#TSQLite3Connection_string_fields


rvk

  • Hero Member
  • *****
  • Posts: 6944
Re: 2015 era sqllite app doesn't display field.
« Reply #12 on: January 05, 2026, 12:06:22 am »
Yes, Thaddy, I ran into that.

I asked Michael about it, and now there is at least some info about it:

https://wiki.freepascal.org/User_Changes_Trunk#TSQLite3Connection_string_fields
I remember that the following was only true for some virtual tables. Not for normal tables.

Quote
TStringField size is limited to 8k, leading to loss of data if the field is longer (e.g. memo).

TStringField is definitely not limited to 8k.
O, apparently it is. But it's was not the original reason for the change to memo.

According to the source code this change was only implemented because of some limitations in FTS tables. I've always found this a wrong fix. They could have checked the table type and only implemented this for FTS, and not for other tables.

https://forum.lazarus.freepascal.org/index.php/topic,67472.msg519366.html#msg519366


« Last Edit: January 05, 2026, 12:17:05 am by rvk »

madref

  • Hero Member
  • *****
  • Posts: 1116
  • ..... A day not Laughed is a day wasted !!
    • Nursing With Humour
Re: 2015 era sqllite app doesn't display field.
« Reply #13 on: January 06, 2026, 12:16:53 pm »
I investigated it a bit further, and no that is not it. I standard have the ongettext assigned to handle that.

The memo fields display fine, it is the TStringfield fields that fail.


Had the same problem back then.
I did this:
Code: Pascal  [Select][+][-]
  1. procedure TForm_Wedstrijd_Informatie.DBMemoGetText(Sender: TField; var aText: string; DisplayText: Boolean);
  2. begin
  3.   aText := Sender.AsString;
  4. end;     // DBMemoGetText
  5.  
You treat a disease, you win, you lose.
You treat a person and I guarantee you, you win, no matter the outcome.

Main Platform:
--------------
Mac OS X Tahoe 26.2
Lazarus 4.99 (rev main_4_99-3149-g7867f6275c) FPC 3.3.1 x86_64-darwin-cocoa

Windows 10 Pro
Lazarus 3.99 (rev cbfd80ce39)

 

TinyPortal © 2005-2018