Re: [Lazarus] save the detail record to sqlite
On 28/02/2014 08:39, tce tce wrote: Hi, I'm a new user for lazarus. I have tried the Master-Detail tutorial, everything is ok. I tried to save the detail record to the sqlite using the tsqleury post and applyupdate, the screen is ok, but actually not in the sqlite database. I don't know why? Thanks for describing your problem a bit but... how do we know what you did wrong if you don't give more details, such as: - which tutorial did you use (URL - there are multiple master/detail tutorials) - the code you use? However, I polished my crystal ball and my guess is that you forgot this step: http://wiki.lazarus.freepascal.org/MasterDetail#Adding_detail_records_with_the_right_foreign_key ... Thanks, Reinier Note: also posted on forum: forum.lazarus.freepascal.org/index.php/topic,23766 -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] save the detail record to sqlite
Le 28/02/2014 10:09, Reinier Olislagers a écrit : However, I polished my crystal ball and my guess is that you forgot this step: http://wiki.lazarus.freepascal.org/MasterDetail#Adding_detail_records_with_the_right_foreign_key ... Thanks, Reinier Note: also posted on forum: I guess that your cristal ball brights a lot after polishing it ( how much time: 10 minutes a day maybe ?) 8-) Mine desn't like polishing so I've built a bunch of rules for this kind of situation where updatable datasets are involved: - always assign an OnNewRecord event and dive the default value to all defined fields (TFields list). I know, some DBMS do it for you, but ... on creating the client dataset record, setting the master dataset key is always the first line, process generators, etc. - always explicitely name the used fields in the commanding Sql (any error on connecting to the DB will raise an error) This prevents me to trust my memory too much. Antonio. forum.lazarus.freepascal.org/index.php/topic,23766 -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus --- Ce courrier électronique ne contient aucun virus ou logiciel malveillant parce que la protection avast! Antivirus est active. http://www.avast.com -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] save the detail record to sqlite
On 28/02/2014 11:43, Antonio Fortuny wrote: Mine desn't like polishing so I've built a bunch of rules for this kind of situation where updatable datasets are involved: - always assign an OnNewRecord event and dive the default value to all defined fields (TFields list). I know, some DBMS do it for you, but ... on creating the client dataset record, setting the master dataset key is always the first line, process generators, etc. - always explicitely name the used fields in the commanding Sql (any error on connecting to the DB will raise an error) This prevents me to trust my memory too much. Hi Antonio, If you want to change/update/improve the tutorial article, be my guest ;) Thanks, Reinier -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] What GetChildParent does in designer and reader?
On Fri, 28 Feb 2014 01:47:38 +0100 Hans-Peter Diettrich drdiettri...@aol.com wrote: [...] Component DragDrop operations There is no drag when adding a component to a form. Mattias -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] save the detail record to sqlite
Le 28/02/2014 11:48, Reinier Olislagers a écrit : On 28/02/2014 11:43, Antonio Fortuny wrote: Mine desn't like polishing so I've built a bunch of rules for this kind of situation where updatable datasets are involved: - always assign an OnNewRecord event and dive the default value to all defined fields (TFields list). I know, some DBMS do it for you, but ... on creating the client dataset record, setting the master dataset key is always the first line, process generators, etc. - always explicitely name the used fields in the commanding Sql (any error on connecting to the DB will raise an error) This prevents me to trust my memory too much. Hi Antonio, If you want to change/update/improve the tutorial article, be my guest ;) I'd be happy to write some advices as far as you could consider them as some improvement to the DataSet processing. I guess you mean the wiki page http://wiki.lazarus.freepascal.org/MasterDetail#Adding_detail_records_with_the_right_foreign_key These are not specifically addressed to the master-detail relationship but specifically to the DataSet itself in a more general way. I can then give the exhaustive list of rules I follow since years. You could give some ideas on where to write tese rules. As a first approach I can point the SQLDB implementation chapter. Antonio. Thanks, Reinier -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus --- Ce courrier électronique ne contient aucun virus ou logiciel malveillant parce que la protection avast! Antivirus est active. http://www.avast.com -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] save the detail record to sqlite
On 28/02/2014 12:43, Antonio Fortuny wrote: I'd be happy to write some advices as far as you could consider them as some improvement to the DataSet processing. I guess you mean the wiki page http://wiki.lazarus.freepascal.org/MasterDetail#Adding_detail_records_with_the_right_foreign_key Yes, that's sort of why I posted the link earlier in the thread... These are not specifically addressed to the master-detail relationship but specifically to the DataSet itself in a more general way. I can then give the exhaustive list of rules I follow since years. You could give some ideas on where to write tese rules. As a first approach I can point the SQLDB implementation chapter. As I said, you're welcome to update the master/detail page. It's up to you what to write and where to write what... as long as it fits in with the rest of the tutorial... If you want to update other database pages: likewise, please feel free - I really appreciate other people contributing! (Possible locations: the working with sqlquery page, the database faq page perhaps there's something better) However, I don't want to be some kind of editor that is going to pre-approve what gets written as 1. I have other things to do 2. I'm not a GUI guy at all and prefer letting people who know what they're doing just do their stuff Thanks, Reinier -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] [Brook] HTTP method not allowed for the requested resource
2014-02-27 4:53 GMT-03:00 Giuseppe glpu...@gmail.com: [...] / Open \brookframework\demos\simple\entity project Build. Copy to cg1.bf to cgi-bin folder http://localhost:8080/cgi-bin/cgi1.bf returns HTTP method not allowed for the requested resource. Didn't worked (with BrookFCLCGIBroker, either with BrookFCLHttpAppBroker) Well, see: TMyAction = class(specialize TBrookEntityActionTMyType) public procedure Post; override; POST end; ie, you can't open it directly in the URL of Chrome (GET), you need to call it via POST method (using rest client). // Created postgres database with table person. Open brookframework/demos/db/dopf/cgi1.lpi Changed db configuration from dbutils.pas pointing to my database Copied all postgres dll from postgres/bin folder to project folder. http://localhost returns HTTP method not allowed for the requested resource. Oh, you can't open it directly in the URL of Chrome too calling only localhost. Compile your project using CGI broker, copy your executable to the cgi-bin folder, copy form.html to the htdocs folder, after, call: http://localhost/form.html;. Using this form it will do a request using POST method. -- Silvio Clécio My public projects - github.com/silvioprog -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
[Lazarus] [OT] Developing for Android with Pascal and Eclipse?
Hello, I saw in a post on Facebook, but not tested: http://web.fastermac.net/~MacPgmr/pba/PbaStatus.html I don't know about. -- Silvio Clécio My public projects - github.com/silvioprog -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] [OT] Developing for Android with Pascal and Eclipse?
Am 28.02.2014 16:38, schrieb silvioprog: Hello, I saw in a post on Facebook, but not tested: http://web.fastermac.net/~MacPgmr/pba/PbaStatus.html http://web.fastermac.net/%7EMacPgmr/pba/PbaStatus.html I don't know about. It uses FPC's JVM compiler. Not tested either ;) (the Eclipse integration, not the compiler :P ) Regards, Sven -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Is this bug ? or how to do?
Thank you Martin, I was forget and checked it that. I add this lines and now field list opening. RegisterPropertyEditor(TypeInfo(string), TExLookUp, 'DataField', TFieldProperty);//DataSource := Dataset1 RegisterPropertyEditor(TypeInfo(string), TExLookUp, 'ListField', TFieldProperty);//ListSource := Dataset2 RegisterPropertyEditor(TypeInfo(string), TExLookUp, 'KeyField', TFieldProperty);//ListSource := Dataset2 But: :) in components\ideintf\dbpropedits.pas procedure TFieldProperty.FillValues(const Values: TStringList); var DataSource: TDataSource; begin DataSource := GetObjectProp(GetComponent(0), 'DataSource') as TDataSource; LoadDataSourceFields(DataSource, Values); end; GetComponent(0) function is return my component TExLookUp, this is okey. But I have 2 Datasource Property: published property DataField: string read GetDataField write SetDataField;//Accually people use same propertyname property DataSource: TDataSource read GetDataSource write SetDataSource;//Accually people use same propertyname property KeyField: string read Get_KeyField write Set_KeyField; property ListField: string read Get_ListField write Set_ListField; property ListSource: TDataSource read Get_ListSource write Set_ListSource; TFieldProperty.FillValues function lookingfor in my root component, only (string type)'DataSource' property. For test: property DataSourcex: TDataSource read GetDataSource write SetDataSource; I change property name 'DataSource' to 'DataSourcex', when click to DataField property, this error popup. Unknown property: DataSource. Press OK to ignore and risk data corruption. Press Cancel to kill the program. Any idea ? 27-02-2014 21:44 tarihinde, Martin Frb yazdı: you are missing: RegisterPropertyEditor(TypeInfo(string), TComponent, 'DataField', TFieldProperty); see components\ideintf\dbpropedits.pas -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Is this bug ? or how to do?
On 28/02/2014 16:32, FreeMan wrote: Thank you Martin, I was forget and checked it that. I add this lines and now field list opening. RegisterPropertyEditor(TypeInfo(string), TExLookUp, 'DataField', TFieldProperty);//DataSource := Dataset1 RegisterPropertyEditor(TypeInfo(string), TExLookUp, 'ListField', TFieldProperty);//ListSource := Dataset2 RegisterPropertyEditor(TypeInfo(string), TExLookUp, 'KeyField', TFieldProperty);//ListSource := Dataset2 But: :) in components\ideintf\dbpropedits.pas procedure TFieldProperty.FillValues(const Values: TStringList); var DataSource: TDataSource; begin DataSource := GetObjectProp(GetComponent(0), 'DataSource') as TDataSource; LoadDataSourceFields(DataSource, Values); end; I am no expert on this, so I cant give you much more help. But it looks you need to write your own property editor. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] SEGFAULT: difference between pointer and dynarray?
Xiangrong Fang wrote The end of array mark is added by lua52.pas, if you read the source code... 在 六, 12月 29, 2012 at 9:39 下午,leledumbo lt; leledumbo_cool@.co gt; 写道: Reading luaL_newlib documentation and lua52.pas implementation of it (it's a macro in the original C code), I see that you need a sentinel value to mark the end of the array by putting nil in the name part. lua52.pas does not append a sentinel for you. You must do it yourself. Forgetting to append a sentinel will lead to unpredictable behavior of Lua internals. Inside API functions in lua52.pas *@lr* is always equal to *@lr[0]* because *lr* is an open array parameter. -- View this message in context: http://free-pascal-lazarus.989080.n3.nabble.com/Lazarus-SEGFAULT-difference-between-pointer-and-dynarray-tp4028296p4036026.html Sent from the Free Pascal - Lazarus mailing list archive at Nabble.com. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] [OT] Developing for Android with Pascal and Eclipse?
silvioprog wrote Hello, I saw in a post on Facebook, but not tested: http://web.fastermac.net/~MacPgmr/pba/PbaStatus.html I don't know about. The JVM compiler is tested, and I've tested it myself as well. I don't use Eclipse though, the Android SDK has enough tools to build the required directory layout and building only requires Ant. This is actually the most native way to build Android apps, but you have to sacrifice some (a lot of?) normal Pascal features and use different syntax in many places. A lot of standard units are missing, and the chance you can reuse existing units is also quite small (depends on how the units are coded). -- View this message in context: http://free-pascal-lazarus.989080.n3.nabble.com/Lazarus-OT-Developing-for-Android-with-Pascal-and-Eclipse-tp4036021p4036027.html Sent from the Free Pascal - Lazarus mailing list archive at Nabble.com. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus