Forum > Databases

SQLite3 concat string problem

(1/1)

uea:
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;   

Chris78:
Hi,

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

essence-ciel:
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.

Navigation

[0] Message Index

Go to full version