Recent

Author Topic: DBMemo gets truncated  (Read 3902 times)

JanRoza

  • Hero Member
  • *****
  • Posts: 672
    • http://www.silentwings.nl
DBMemo gets truncated
« on: January 26, 2015, 11:06:02 pm »
In my application I use a dbmemo component to show/edit a SQLite memo field but it seems the data gets truncated if it contains more than a couple lines of text.
I copy a large text into the dbmemo (via ctrl-c and ctrl-v) and as long as I leave the cursor in the dbmemo all text is shown (see dbmemo1.jpg).
The moment the cursor is put into another dbedit or dbmemo the text that was just pasted in the dbmemo gets truncated (see dbmemo2.jpg).
The dbmemo has a OnExit procedure which does no more than applyupdates and commitretaining.
The MaxLength parameter for the dbmemo is set to 0 (unlimited)

The SQLite database has no problem as I can paste the same text into the database (via a separate tool) without any truncation.
Is this a bug in dbmemo?
« Last Edit: January 26, 2015, 11:09:32 pm by JanRoza »
OS: Windows 10 (64 bit) / Linux Mint (64 bit)
       Lazarus 3.2 FPC 3.2.2
       CodeTyphon 8.40 FPC 3.3.1

kpeters58

  • Sr. Member
  • ****
  • Posts: 267
Re: DBMemo gets truncated
« Reply #1 on: January 26, 2015, 11:57:57 pm »
Looks like a mapping issue - i.e. how the Lazarus' sqlite framework maps SQLite data types to Lazarus data types.

What is the DDL for the column underneath the DBmemo? Are you using persistent field objects?
Lazarus 2.0.4/FPC 3.0.4/Win 64

JanRoza

  • Hero Member
  • *****
  • Posts: 672
    • http://www.silentwings.nl
Re: DBMemo gets truncated
« Reply #2 on: January 27, 2015, 12:04:08 am »
The DDL for that field looks like this:   [Description] MEMO
I'm not sure what you mean with persistent field objects.
OS: Windows 10 (64 bit) / Linux Mint (64 bit)
       Lazarus 3.2 FPC 3.2.2
       CodeTyphon 8.40 FPC 3.3.1

kpeters58

  • Sr. Member
  • ****
  • Posts: 267
Re: DBMemo gets truncated
« Reply #3 on: January 27, 2015, 12:25:22 am »
By persistent field objects I mean did you create field objects for your query or table at design time with Lazarus' field editor?

Try changing the column definition from MEMO to TEXT (if that also fails, try VARCHAR) and report back....

I assume you use SQLDB components?
Lazarus 2.0.4/FPC 3.0.4/Win 64

JanRoza

  • Hero Member
  • *****
  • Posts: 672
    • http://www.silentwings.nl
Re: DBMemo gets truncated
« Reply #4 on: January 27, 2015, 07:56:06 am »
Your tip was gold! Changing the database field type from Memo to Text did the trick.
Now the dbmemo stores and shows all data.
And yes I was using the SQLDB component in Lazarus 1.2.6/FPC 2.6.4.
Thanks again!

 :)
OS: Windows 10 (64 bit) / Linux Mint (64 bit)
       Lazarus 3.2 FPC 3.2.2
       CodeTyphon 8.40 FPC 3.3.1

kpeters58

  • Sr. Member
  • ****
  • Posts: 267
Re: DBMemo gets truncated
« Reply #5 on: January 27, 2015, 06:26:18 pm »
Great - you have at least two ways to see how the framework maps field types:

1) Create persistent field objects and look at their type - MEMO translates to ftBlob if my memory serves me correcly; not what you want...

2) Look it up in the source code (which I have not yet done)

Since SQLite only truly supports 4 data types (storage classes) https://www.sqlite.org/datatype3.html, it is quite helpful to know how things map to field types on the Lazarus side.
Lazarus 2.0.4/FPC 3.0.4/Win 64

 

TinyPortal © 2005-2018