Sv: tables

Daniel Sananes daniel.s at
Sat Mar 18 22:14:34 UTC 2023

Great Scotte,
I understand the scenario you put forward.
In not a so far away galaxy this will be a thing I will test when I start studying objects.

You say one single transaction.
I believe this does not mean one sql-statement to the database? Or?


-----Ursprungligt meddelande-----
Från: omnisdev-en <omnisdev-en-bounces at> För Scotte Meredith
Skickat: den 18 mars 2023 22:53
Till: OmnisDev List - English <omnisdev-en at>
Ämne: Re: tables

So here's a possible scenario off the top of my head:

 -- tOrderHeader
 -- tOrderRow
 -- tCustomer
 -- tStockItem

You instantiate oMyOrderObject as ioMyOrderObject. Inside you have a row for the order header, list of the order rows, row for customer, list for stock items.

Your window fields point to those rows and headers.

Have methods:

$verifyOrder makes sure you have the customer record, there is enough stock available for all the order rows and returns something if they don't all match up $saveOrder copies the customer key into Order header, decrements the stock items. Then saves order header and gets the key, stuffs that key into each of the order rows and saves them, then saves the stock items to update the available stock. Do that all in a single transaction.

The tOrderHeader might have a method $getByPK that does the SQL to pull up a record from a primary key. Or others to do other searches, so you could do that SQL within the table class as a separate set of methods.

So to quote Tolkien:
"One object to rule them all, one object to find them, one object to call the tables classes and in the database bind them. In Postgres, where the data lies."

> On Mar 18, 2023, at 12:51 PM, Daniel Sananes <daniel.s at> wrote:
> Hi Scotte
> Would the object class have one $definefromsqlclass for the order-header and one for the orderrows?
> And "helper table classes" for client.
> In this case there would be 3 different $definefromsqlclass all assigned inside the object.
> Then with returning-clause one would get the PK for the different datatables?
> Is there correct OO to perform code inside a table to get values that do not belong to the table-instance?
> I am almost not understanding my own question here.
> Another question, are there situations where you would not use the table-instances but perform sql outside the table?
> Do I understand this question? Maybe...
> Regards
> Daniel

Scotte Meredith
spomacguy at

Manage your list subscriptions at Start a new message -> mailto:omnisdev-en at
VARNING: Det här e-postmeddelandet kommer från en extern avsändare. KLICKA INTE på länkar eller bilagor om du inte känner igen avsändaren och vet att innehållet är säkert.

More information about the omnisdev-en mailing list