Same code for both databases

Daniel Sananes daniel.s at kopparbergs.se
Sat Feb 11 08:24:17 UTC 2023


Hi

I got an answer that solved the logon-problem. Now logon works.
Now I can work with both an SQLite  database and a Postgres database.

Am thinking to continue the programming-studies making it possible to connect to either one of the two databases.
With the same code.
I have created two objects, oSqlite and oPostgres, with Superclass set to the 2 DAM's SQLITESESS and PGSQLSESS.
There are also two taskvariables, tSqlite and tPostgres, with subtypes oSqlite and oPostgres.
Do I really need the two objects oSqlite and oPostgres?
Can I not instead set subtypes for the two taskvariables directly to the DAMs SQLITESESS and PGSQLSESS?
This may be a stupid question but I do not understand the concept of objects at the moment.

To be able to use the same code (as far as it is possible) for both databases can I create a taskvariable that subtypes either of them?
So instead of having Do tSqlite.$logon() and tPostgres.$logon() one can use tAnyDAM.$logon().
Lets say I create a window asking if logon should be on Sqlite or Postgres.
Would I then maybe have a taskvariable that in code assigns its subtype to one of them?

I am thankful for all answers to my questions and hope you don't get fed up with them.

Best regards
Daniel
0736 704070



More information about the omnisdev-en mailing list