Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2014-06

Using Classes Generated by Lazarus Database Desktop

2 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Jack Linke

I'm building the second iteration of a desktop application which uses SQLite3, and rather than hard-coding SQL Queries as I did in the initial version, I'd like to use Object-oriented techniques to keep things flexible and extensible. I thought LazDataDesktop would be excellent for this purpose.

But I don't know what to do with the darned thing. It's probably something simple I'm missing, but nonetheless, I am missing it and can't move forward.

I've read through every scap of documentation, forum posts, etc that I could find on the Lazarus Data Desktop, and even the Borland/Delphi and JEDI data desktops, but I have found nothing that helps me understand the concepts for using the code that is generated. I've tried every variation of search terms I could think of. I looked for info on the lazarus documentation site, the lazarus wiki, and the lazarus forums. I even posted a question to the forums, but nobody seems to have a clue how to make use of the database desktop's output code.

I'm still pretty new to OO and it I've only been programming in pascal for about a month after a hiatus of several years, so I'm really struggling.

The LazDataDesktop Readme says the output can:
Create a Class with properties corresponding to the fields in your query. Additionally, create a list corresponding with this class and code to load it.

But it doesn't have an example of *how* this is actually done.

Is there any tutorial or documentation anywhere for how to actually use LazDataDesktop and the code that it generates? How do I use the classes that are generated within my application? Can any of you provide a sample of code that might get me started? Anything at all? I'm at my wit's end.

About to give up and just go ahead and hard-code everything. You brilliant guys and gals are my last hope.

Any assistance or clues you can provide will be very much appreciated.

Thanks much,

- Jack

If I can get this figured out, I'll be adding the relevant info to the wiki so others can use the data desktop effectively.

Reply by email

Graeme Geldenhuys
to Jack Linke
Jack Linke wrote
Any assistance or clues you can provide will be very much appreciated.

This might also be of interest to you:
tiOPF is a Object Persistence Framework, which allows you to create applications using OOP. The framework abstracts the data persistence (load or saving of data), and allows you to switch backend databases without changing a single line of code in your application. tiOPF also includes an advanced Model-GUI-Mediator (MGM) implementation. This allows you to hook up your data objects to standard VCL, LCL or fpGUI widgets - no need for DB-aware components. MGM also gives you bi-directional updating.

About Lazarus Data Desktop usage - here is old post I wrote in the tiOPF newsgroup. Hope this helps.

==================================================== http://opensoft.homeip.net/webnews/webnews.cgi?user=anonymous;group=tiopf.support;article=7151

Earlier message 94 lines
-------- Original Message -------- Subject: Lazarus Data Desktop binaries available for download Date: Thu, 26 Aug 2010 09:23:47 +0200 From: Graeme Geldenhuys Newsgroups: tiopf.support Hi, For you convenience I created binaries of Lazarus Data Desktop and made it available on SourceForge in the File Downloads section. Despite the name, this utility can be used by Lazarus and Delphi developers and it's a stand-alone program. It summary, Lazarus Data Desktop is something like Borland's old Database Desktop and tiOPF's tiSQLEditor rolled into one, with some new features... Features like creating visitors, whole class units etc from your database design. This is a *huge* time saver - especially if you use hard-coded visitor. http://sourceforge.net/projects/tiopf/files/ I uploaded Linux 32 & 64-bit, and Windows 32-bit executables. The latest source code for Lazarus Data Desktop is included with Lazarus IDE. How to use it: -------------- Steps to create a tiOPF Object and ObjectList class, and the associated CRUD visitors. 1) Run Lazarus Data Desktop and setup and open your database connection. 2) Expand the database tables treeview on the left. Expand the table you are interested in. 3) Select the 'Table Data' node. You will now see a grid with data only the right. 4) Select the document icon with the letters "PAS" above the grid. For some reason the tooltips are not available under Linux. You will now see a "Code Generation Dialog". 5) Select you choice. tiOPF is the 3rd option in my system. Code generation is a plugin system, so other options will become available in the future. 6) The "Configure Generate Code" dialog will now appear. 6a) This dialog allows you to reorder the fields, specify which ones you want to use, what property types to use (though the default are pretty accurate), specify the property name if you don't want it the same as the table field name etc... 6b) Under the "Options" tab you can specify what visitors to generate. What the names are of the object and objectlist classes. What the ancestor class should be used (default is TtiObject and TtiObjectList). Also you can specify the name of the unit which the code will reside in. Note #1: under the VisitorOptions you have a ReadList visitor (very handy) Note #2: under ClassOptions you can specify the caCreateClass option which will then generate the BOM classes, otherwise you will only generate visitors. 7) Specify the name of the unit in the "Save to" edit box. 8) Click OK. The code will be generated. A popup window will appear with the code as well. Hope that helps.... I can now generate classes and visitors with impressive speed. :-) The generate code normally needs one or two tweaks and it's ready to go. ------------------------------ For more details, you can read an old posting in this newsgroup titled "Create classes and visitors as easy as 1,2,3!" and dated 2008-07-10. Regards, - Graeme - ==================================================== Regards, - Graeme - -- fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://fpgui.sourceforge.net/

Reply by email