Greetings Lazarus community,
I want to run a concept idea by you all seeking input on how to achieve something within the Lazarus environment / ecosystem.
I envision Client/Server code, front-end being built with Lazarus, as interacting predominantly with SQL Stored Procedures on the BE DB. So that right there whacks the Lazarus RAD live data while developing concept. I am concerned that "unless I allow Lazarus to live data edit the forms" then I am totally on my own to have to hand type all of the needed Object Pascal code manually.
I would like the Lazarus RAD environment to be able to interrogate SQL BE DB Stored Procedure details to understand what columns and data types the Stored Procedure exposes / expects and to have it then automatically write out the needed Object Pascal client-side interface to the SQL BE DB Stored Procedure.
My database class design sets up class attributes for each column. The attribute data type could be looked up automatically by interrogating the Stored Procedure on the SQL BE DB. I would like the class attribute naming to be standardized... prefix of the data type followed by the SQL field name. So all of the field level interfacing code could be automatically written.
SQL operations... SELECT / INSERT / UPDATE... those each are individual Stored Procedures, so automatic Object Pascal code could be written for each standard method.
Further I envision a second layer of Object Pascal class in-between the FE UI controls and the SQL access class. This second class layer would perform data type validation and be responsible for populating the form controls with the data it has received from the SQL access class. All of that field mapping work could be again auto generated code based on the available columns from the Stored Procedure definition on the SQL BE DB.
Questions:
1) Ways and types of automated Object Pascal code building? Would it best be a type of pallet code writer that you push the button for the SELECT to be build for XYZ Stored Procedure, it then fills into the Lazarus editor the boilerplate Object Pascal code for that given SQL BE DB Stored Procedure schema at the current time?
Then push another button on the pallet code writer to receive the SELECT automatic code of the Validation class, reading all of the field values and populating unbound field controls?
Maybe there is some combo box controls on the pallet tab that allow navigating the database connection, select which Stored Procedure of that SQL BE DB.... then the buttons for the code builders do so in context of the specified object on the SQL BE DB.
2) I am seeking a type of "push the correct button from the pallet" level of automation.... Not sooooooo integrated as full two-way editing that will end up fighting to maintain the default automated code output. Let us say for example the table is quite wide, and only a subset of the field actually need to be in the focus of the form being developed. Push the button on the pallet code writer to receive the SELECT automatic code, then delete the automatic generated code for the columns that the form does not have need of. The tool should not put back the deleted code.... that would be overly helpful to the point of being an nuance.
I aim at a solution that would ease the manual typing burden of Client/Server front end with SQL Stored Procedures on the BE DB. Push the button to have written stub code that is aware of the data types, and then leave you to tweak the automatically stubbed prototype code as you see fit.
This is an expansion to code I developed back during 2011 to 2014 years in MS Access VBA. That MS Access VBA tool has the useful Immediate window. I had various Code Builder commands I would type into the Immediate window. The tool looked up the DB schema from the FE temp table. Lazarus does not have FE temp tables, so it must look up the schema off of the real SQL BE DB.
As similar, my solution back then in MS Access VBA was driving by me entering commands into the VBA Immediate window, then copy/paste the Immediate window output back into the VBA source file I meant to have the generated code in.
That proved a big time saver for writing serious Client/Server FE code in MS Access. So.....
3) Is it allowed by the Lazarus community to have a tab on the tool pallet, have the cursor at the spot in the Object Pascal source editor you want automatic generated code inserted at, push the button from the tool pallet, and the code builder writes into the Lazarus source editor the stub code appropriate based on the combo box values of what SQL BE DB object the code builder tool is to write for?
I propose brain storming ways to efficiently build out the same hierarchy of Object Pascal classes with Lazarus.
For prototyping I will be using Lazarus 4.6 running on Xubuntu 26.04 and PostgreSQL will be my development test SQL BE DB.
I am thankful,