Recent

Author Topic: SQLite3 concat string problem  (Read 749 times)

uea

  • Newbie
  • Posts: 1
SQLite3 concat string problem
« on: July 25, 2023, 09:09:15 am »
Hi,

I am using the TSQLite3Connection, TSQLQuery and the TSQLTransaction accessing to my sqlite db.

In one of my queries I use "group_concat" of sqlite3 and generate a return string of bigger than 2000 chars. I can see that

select
   group_concat('"' || name || '"' || ' ' || format)  as srcsql
from
   mytable;


actually works because I can run it in a db editor. Return is correct and 2346 chars.

Nevertheless, only 1021 chars return within the pascal code. I cannot understand if this is the limitation of TSQLQuery , pascal or the sqlite3?

I have also tried the below casting, but it did not work either.

select
   cast(group_concat('"' || name || '"' || ' ' || format) as varchar(5000))  as srcsql
from
   mytable;


Any opinions where to look at?

using
  • lazarus 3.0
  • pascal 3.2.2
  • windows 10


My Solution  :D
Apparently, although there is only 1 row with 1 column, I am not waiting for query to be finalized. I did below and it worked.

With query do
  While not EOF do
  begin
     SQLsrc:=FieldByName('srcsql').AsString;
     Next;
  end;   
« Last Edit: July 25, 2023, 11:04:31 am by uea »

Chris78

  • Newbie
  • Posts: 3
Re: SQLite3 concat string problem
« Reply #1 on: July 25, 2023, 10:59:39 am »
Hi,

perhaps you can use  “group_concat_max_len” to modify the limit ?

essence-ciel

  • New member
  • *
  • Posts: 8
Re: SQLite3 concat string problem
« Reply #2 on: September 18, 2023, 08:37:25 am »
Hello,
I don't know if this can help you, but edit the fields in your SqlQuery, click on the relevant field and you'll find a "Size" item. It sets a number of characters to be displayed.

 

TinyPortal © 2005-2018