Re: [Lazarus] SQLite & DB Aware Components
Dňa 1.12.2016 o 21:40 Martin Collins via Lazarus napísal(a): On 01/12/16 16:15, Martin Collins via Lazarus wrote: From what I understand, SQLite TEXT type has no set length so db aware components treat it as a memo. Therefore when I assign a TEXT field to a db aware component, all that appears in the component is "(MEMO)", even though most of my TEXT fields are only up to 10-30 characters long. Solutions offered on-line suggest using a dbmemo (which I have for my longer TEXT fields as that's what I want), but I need to use dbgrids, dbedits, dbcomboboxs, etc for the shorter TEXT fields. I have found a solution to my problem, with thanks to the following link: http://www.tweaking4all.com/software-development/lazarus-development/lazarus-pascal-getting-started-with-sqlite/#ATEXTfieldshowsamemoinaDBGrid The answer was altering my SQL Query text, from something like this: SELECT "Filename", "Date" FROM "mytable"; to this: SELECT CAST( "Filename" AS VARCHAR) AS "Filename", "Date" FROM "mytable"; Casting it as a different type in the SQL statement worked! You are not required to that if you have declared table "mytable" as: CREATE TABLE "mytable" ( FileName varchar(100), Date datetime ) -Laco -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org http://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] Form Width bigger than 4096 pixels?
Mac has high X resolution, so please, dev's, make thus limit more than 4K. See * iMac (Retina 5K, 27-inch, Late 2014) and later displays have a 5120-by-2880 native resolution with support for millions of colors. * iMac (Retina 4K, 21.5-inch, Late 2015) displays have a 4096-by-2304 native resolution with support for millions of colors. Alex -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org http://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] CCR, how to send files?
>Vincent answered in the meantime? Yes, thks, I've sent my files to him. -- Regards, Alex -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org http://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] AutoAdjustLayout fixes
On 30.11.2016 22:29, Ondrej Pokorny via Lazarus wrote: Just curious: what widget set do you use for macOS? Carbon, and soon I want Cocoa but have problem with TFontDialog on cocoa. (so I wait). -- Regards, Alex -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org http://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] SQLite & DB Aware Components
On 01/12/16 16:15, Martin Collins via Lazarus wrote: > From what I understand, SQLite TEXT type has no set length so db aware > components treat it as a memo. Therefore when I assign a TEXT field to a > db aware component, all that appears in the component is "(MEMO)", even > though most of my TEXT fields are only up to 10-30 characters long. > Solutions offered on-line suggest using a dbmemo (which I have for my > longer TEXT fields as that's what I want), but I need to use dbgrids, > dbedits, dbcomboboxs, etc for the shorter TEXT fields. > I have found a solution to my problem, with thanks to the following link: http://www.tweaking4all.com/software-development/lazarus-development/lazarus-pascal-getting-started-with-sqlite/#ATEXTfieldshowsamemoinaDBGrid The answer was altering my SQL Query text, from something like this: SELECT "Filename", "Date" FROM "mytable"; to this: SELECT CAST( "Filename" AS VARCHAR) AS "Filename", "Date" FROM "mytable"; Casting it as a different type in the SQL statement worked! My bad and inexperience with databases! Hope this will help someone else one day! :-) Thanks & best regards, Martin -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org http://lists.lazarus-ide.org/listinfo/lazarus
[Lazarus] SQLite & DB Aware Components
Hi, Using SQLite3, Lazarus 1.6.2 & FPC 3.0.0 on Peppermint Linux 7. I have a small problem when using the db aware components & sqlite. After countless googling I understand why the components do this but can not find a simple solution! (BTW I this is my first time working with DBs & SQLite seemed the simplest and meets my needs (embeddable)). My problem is described below, but I'll ask my questions first: 1. Are there any tricks anybody knows of so I can show the text via code in lazarus, or 2. Are there any tricks anybody knows of so I can show the text by altering the sqlite database (other than switching to another database entirely)? As this affects all db aware components, it's probably something fundamental I am missing if it exists at all. From what I understand, SQLite TEXT type has no set length so db aware components treat it as a memo. Therefore when I assign a TEXT field to a db aware component, all that appears in the component is "(MEMO)", even though most of my TEXT fields are only up to 10-30 characters long. Solutions offered on-line suggest using a dbmemo (which I have for my longer TEXT fields as that's what I want), but I need to use dbgrids, dbedits, dbcomboboxs, etc for the shorter TEXT fields. I found a solution for dbgrids, using the dbgridpreparecanvas event, but not for the other db aware component types. I can extract the text, using: DataSource.DataSet.FieldByName('field').AsString and I could use that to manually write the values to non db aware components as needed, but that seems a waste when we have these superb db aware components to use. For information, I am coupling the data to the components simply by assigning the datasource & datafield to the db aware component. I'm using SQLite3Connection (as opposed to SQLite3Dataset), SQLQuery, SQLTransaction & DataSource. Thanks for your help. Martin -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org http://lists.lazarus-ide.org/listinfo/lazarus