sqlite3, database views and db.gb.form controls. Does it work?

Ask about the individual Gambas components here.
User avatar
Posts: 144
Joined: Sunday 25th June 2017 12:14am
Location: Western Australia

Re: sqlite3, database views and db.gb.form controls. Does it work?

Post by Quincunxian » Friday 05th February 2021 11:21pm

I'm glad that you are making changes to the way I do things as it's the best way to learn.
It was only ever meant to be an example to show all the aspects of data management without any dataview controls.

One of the reasons I abstract the data Get/Add/Change/Delete to a class, is that I can call that class anywhere in the application
to get access to that data. For example, on the Main (start up) form, you can set up a quick view of say:
All the Mount Types you have available.

Add a ListBox control to your main form.
Create the following subroutine.
Call the subroutine from your Form_Open event.
Private Sub DisplayMountTypes()
  Dim Mnt As New Cls_Mounts
  Dim TmpInt As Integer  
  For Tmpint = 1 To Mnt.RecordCount
  Mnt = Null    

Lens Form
It's a busy form. Lots of variables in the lens data set. I did toy with the idea of using a TabStrip control, with each tab containing
lens elements controls that 'belonged' together but I don't know enough about lenses to sort out the relevant
information into any sensible sets/families.

One thing with using any tabbed control - TabPanel or TabStrip, when you are validating data input for the user,
make sure that you display the panel with the error. There is nothing worse that getting a validation error and
having to hunt through various tabs to try and find it.
Cheers - Quin.
I code therefore I am

Posts: 71
Joined: Sunday 24th January 2021 8:25pm

Re: sqlite3, database views and db.gb.form controls. Does it work?

Post by 01McAc » Monday 22nd February 2021 11:04am

I am happy to provide a first beta release of The Lens Register. If you are an photography aficionado the application enables you to manage lenses in general, your purchases, sales and clean-lube-adjust jobs. There are a lot of information about lenses available so I organised them into different tabs within an icon panel. Thanks to Quincunxian who helped me a lot and pointed me into right direction with Gambas and the database backend engine sqlite.
The app allows new entries for lenses, mounts and makers (manufacturer). If there are images of the lenses available you can drag and drop them into the appropriate field. Images are stored as jpg in the Image-folder. The entire data about lenses is stored in the database.
The software is still beta ( and probably will be for the next years;). I haven't got the time to document the code as I should have been done it. Since I disabled the excellent error management in most of the modules and classes from Quincunxian it is easier for me to find bugs in case the compiler throws an error and it comes to a full stop in the IDE. If you find any errors don't keep them for yourself- instead give me a quick hint where to look at.
I still have a couple of awkward procedures in the code. One of them is the Sub "SelectedLoadGridView" in class "CLS_Lenses". I changed the original procedure in order to get a general solution to load the gridview with different columns due to different DB sources. I haven't got a clue how to keep this clean and tidy.

The app could be extraced in any directory of your choice. Feel free to use it, enhance it or just to browse through the code.
(7.23 MiB) Downloaded 189 times
start.jpg (264.14 KiB) Viewed 2067 times

Posts: 71
Joined: Sunday 24th January 2021 8:25pm

Re: sqlite3, database views and db.gb.form controls. Does it work?

Post by 01McAc » Thursday 25th February 2021 10:59am

I am just experimenting with the Full-Text Search engine (FTS) in sqlite3. FTS allows to search in all columns of all tables w/o a full table scan in the DB. The performance is breathtaking (with a lot of non-sense test data). This is quite usefull if one is looking for specific information in a related table.
I know, it doesn't make sense with just a handful lenses in the database - but the journey is the reward. If anyone is interested I'm happy to share a next preliminary/beta release in the next days.

Post Reply