tables

Phil (OmnisList) phil at pgpotter.co.uk
Tue Mar 14 17:07:54 UTC 2023


Daniel,

Have you also looked at a table superclass?

If you have common code for any SQL updates... maybe put that into the 
superclass... if you have specific code for this particular 
table->schema, then write that in this table's methods.

In my opinion its the superclass on tables that makes all the difference.

Personally I don't update queries... but there is no reason not to, if 
you know enough to be able to update the relevant individual rows.

PK's FK's, yep, how could they be linked in any other way?
You still need to create the main record, and copy the id or whatever 
into the FK of the subordinate records.

regards
Phil Potter
Based in Chester in the UK.

On 14/03/2023 16:24, Daniel Sananes wrote:
> Good afternoon, or what it might be somewhere else,
>
> Pardon my ignorance but I find this table-thing interfering with my logical thinking.
>
> I am really starting to wonder what the difference is using the table-approach or just have the same code somewhere else, maybe in a code-class.
> The Table is the list, somehow and sort of, but I could as well just call a method in a code-class and send the list in there.
> The $defienfromsqlclass seems to me just be the same as $schemas.SCHEMA.$makelist.$objs(ref.$name) returns LIST.
> Or is there something else in this I do not understand. Apart from that the command invokes a table.
>
> If I have an order-window and are to create an order I will:
>
>    1.  Press a button called New order
>    2.  I will find a client that the order belongs to
>    3.  I will find articles that belongs to the order. These will be orderrows.
>    4.  When finished the setup, I will press create the order.
> Am I supposed to have 3 tables working at the same time?
> The order has to be saved/inserted into the database with a new primary key and the foreign key for the clients primary key has to be calculated.
> Then the orderrows has to be saved with the FK from the orders PK. And new PK's has to be calculated for the orderrows/records.
> How would the setup be with the table-approach?
> I don't get it.
> Do I do 2 $inserts using 2 tables, one after the other? One for order and one for orderrows.
>
> If $cinst.$servertablenames is a query there will be several schemas to handle.
> I would say the schema is like the Omnis7 file format.
>
> $cinst.$servertablenames can contain several schemas (from query). How would a table handle $insert or $update when there are several schemas?
> I would process each schema, building my own lists with $makelist, one after the other, with correct SQL. Why do I have to have that code in a table?
>
> /Daniel
> 0736 704070
>
> _____________________________________________________________
> Manage your list subscriptions athttps://lists.omnis-dev.com
> Start a new message ->mailto:omnisdev-en at lists.omnis-dev.com  


More information about the omnisdev-en mailing list