Displaying MemoAsText in SQLite DB aware components lazarus / 16-Databases ---------------------------------------------------------------------- Arskin_Fertrubble · 2023-10-08 21:33 I'm frustrated trying to overcome the issue of SQLite text values displaying a "(Memo)" in db aware components, except dbGrid that has an option to display memo field values as text. What is a practical & efficient way to display memo as text, especially when using dbTable as a the source? Thanks ---------------------------------------------------------------------- GAN · 2023-10-09 03:00 I solved it by changing the field definition of the tables, instead of using "text" I use "VarChar(N)". ---------------------------------------------------------------------- Arskin_Fertrubble · 2023-10-09 03:22 OK, thanks. I wasn't aware that was an option. Done. Cheers ---------------------------------------------------------------------- egsuh · 2023-10-09 04:13 QuoteI solved it by changing the field definition of the tables, instead of using "text" I use "VarChar(N)". But aren't the data storage methods different between varchar and blob data? AFAIK, VarChar assigns maximum spaces for the varchar length, while BLOB data has flexible structure. ---------------------------------------------------------------------- Arskin_Fertrubble · 2023-10-09 04:35 QuoteBut aren't the data storage methods different between varchar and blob data? AFAIK, VarChar assigns maximum spaces for the varchar length, while BLOB data has flexible structure. I'm only cobbling a trivial application together for personal use, so anything that gets me there faster (remember RAID?) is OK by me  But if there is a convenient way to display the TEXT type in dbedit, dbcombo etc I'd like to know anyway Cheers ---------------------------------------------------------------------- taazz · 2023-10-09 04:55 Quote from: egsuh on October 09, 2023, 06:13:30 amQuoteI solved it by changing the field definition of the tables, instead of using "text" I use "VarChar(N)". But aren't the data storage methods different between varchar and blob data? AFAIK, VarChar assigns maximum spaces for the varchar length, while BLOB data has flexible structure. That's the difference between char and varchar. both blob and varchar have flexible structure with different "size" usage. ---------------------------------------------------------------------- egsuh · 2023-10-09 05:49 QuoteThat's the difference between char and varchar. both blob and varchar have flexible structure with different "size" usage. I'm talking about the allocation of disk space. For example varchar(120) would allocate 120 byte size block. But if defined as BLOB with size 40, then the auto-allocated space would be 40 bytes. As the size becomes more than 40, other 40-byte blocks would allocated as necessary. For example, to save 110-byte string,  two more 40-byte blocks would be allocated. ---------------------------------------------------------------------- egsuh · 2023-10-09 05:50 Anyway I can see the content correctly with TDBMemo with TBufdataset. Not tested with SQLite. ---------------------------------------------------------------------- Zvoni · 2023-10-09 06:17 Quote from: Arskin_Fertrubble on October 09, 2023, 06:35:39 amQuoteBut aren't the data storage methods different between varchar and blob data? AFAIK, VarChar assigns maximum spaces for the varchar length, while BLOB data has flexible structure. I'm only cobbling a trivial application together for personal use, so anything that gets me there faster (remember RAID?) is OK by me  But if there is a convenient way to display the TEXT type in dbedit, dbcombo etc I'd like to know anyway Cheers That's been answered many times here in the Forum Code: SQL  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i SELECT CHAR(SomeTextColumn) AS Field1 FROM SomeTablehttps://forum.lazarus.fre epascal.org/index.php/topic,63821.msg484056.html#msg484056 And, AFAIK, all DB***-Controls have a something "Show Memo as text"-Option.... ---------------------------------------------------------------------- Arskin_Fertrubble · 2023-10-09 07:02 QuoteAnd, AFAIK, all DB***-Controls have a something "Show Memo as text"-Option.... Only the DBgrid kind, as best as I can make out. Happy to be shown to be wrong.... ---------------------------------------------------------------------- rvk · 2023-10-09 07:08 Quote from: Arskin_Fertrubble on October 09, 2023, 09:02:05 amQuoteAnd, AFAIK, all DB***-Controls have a something "Show Memo as text"-Option.... Only the DBgrid kind, as best as I can make out. So what other data-aware components do you need to show the text (other than TDBGrid which has the option)? If you know the maximum length of your text than it might be best to just use VARCHAR(maxlength). ---------------------------------------------------------------------- Zvoni · 2023-10-09 07:33 Code: SQL  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i SELECT CHAR(SomeTextColumn) AS Field1 FROM SomeTablewill always work ---------------------------------------------------------------------- rvk · 2023-10-09 07:45 Quote from: Zvoni on October 09, 2023, 09:33:57 amCode: SQL  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i SELECT CHAR(SomeTextColumn) AS Field1 FROM SomeTablewill always work How will editing work in TDBEdit? Does FPC extract a correct modifySQL from this (with Field1 being something different from SomeTextColumn)? Using VARCHAR during creation of the database is easiest, I think. Unless you want to edit the modifySQL's yourself. ---------------------------------------------------------------------- Zvoni · 2023-10-09 07:56 Quote from: rvk on October 09, 2023, 09:45:12 amQuote from: Zvoni on October 09, 2023, 09:33:57 amCode: SQL  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i SELECT CHAR(SomeTextColumn) AS Field1 FROM SomeTablewill always work How will editing work in TDBEdit? Does FPC extract a correct modifySQL from this (with Field1 being something different from SomeTextColumn)? Using VARCHAR during creation of the database is easiest, I think. Unless you want to edit the modifySQL's yourself. The Thread-Title says "Displaying", so no idea about writing back. Frankly, i don't use DB-aware controls, since i only trust my own SQL- Statements. That said, i did have a look at the Source of TDBEdit (and TDBGrid to find the "difference"), and it boils down to "Field.AsString" vs. "Field.Text/DisplayText" In TDBGrid there is an explicit check for ftMemo In TDBEdit there isn't Maybe override the Procedures in a Class-Helper or subclassed class