How to fetch sqlite TEXT fild to a grid lazarus / 13-General ---------------------------------------------------------------------- gelinp · 2015-10-12 20:52 Hi, I'm using a sqlite database with Lazarus 1.4.4. I discovred that a TEXT filed display into a TDBGrid control as a "(MEMO)", without the content. I think it will be the same with string controls... I don't konw if I can change TEXT into table defintion with VARCHAR(255) or something like this into sqlite and it's OK for the grid control, or if there is a trick to do te content display ! May be a TSUperGrid (sub class of TDBGrid) will display it ! Tank you for your help. ---------------------------------------------------------------------- Jurassic Pork · 2015-10-12 21:33 hello, when you have a memo field in a tdbgrid, you can display the content of this field in a tdbmemo in the same form.  Have a look to the memo field note in my example of a sqlite3 database  with lazarus (examples/database/image_mushrooms) :  see attachment Friendly, J.P ---------------------------------------------------------------------- gelinp · 2015-10-14 17:02 Yes, but it's not really a memo, only varchar(255) but with SQLITE I hade to declare TEXT type for the field into the table and Lazarus read it as a MEMO... I have to test if I could declare VARCHAR(255) and if Lazarus read it as small text. Do you know the reponse ? ---------------------------------------------------------------------- LacaK · 2015-10-14 18:26 Quote from: gelinp on October 14, 2015, 07:02:50 pmYes, but it's not really a memo, only varchar(255) but with SQLITE I hade to declare TEXT type for the field into the table and Lazarus read it as a MEMO... I have to test if I could declare VARCHAR(255) and if Lazarus read it as small text. Do you know the reponse ? Yes If 255 characters is enough for your data then if you declare column as VARCHAR(255) then you will see in TDBGrid field content (not (MEMO)) ---------------------------------------------------------------------- eny · 2015-10-14 23:08 Maybe you can use a CAST in your program to cast the TEXT column as a VARCHAR. You then have to provide all columns in the query: Code: [Select]SELECT ...,        CAST( AS VARCHAR) .        ...I did a quick test with the example given bij JP and that seems to work. ---------------------------------------------------------------------- gelinp · 2015-10-15 05:16 OK thank you for yours answers ! Do you think SQLITE use a lot of memory to store TEXTE against VARCHAR(100) ?  I understand TEXT is not a type, but a storage class. I don't know really the difference, and there is only INTEGER, REAL, TEXT and BLOB storage class. So I think SQLITE would be opimized to run like this, but i'm astonished about memory optimization ! ---------------------------------------------------------------------- LacaK · 2015-10-15 15:51 SQLite stores data as effective as possible. So storage space requirement depends on actual stored data not on "column definition". So it does not affect storage requirements if you create table with TEXT or VARCHAR(100) data type. ---------------------------------------------------------------------- fabiopesaju · 2015-10-15 17:44 http://forum.lazarus.freepascal.org/index.php/topic,28521.msg178700.ht ml