Please Clarify about table identity

Das Goravani das at Goravani.com
Thu Jan 25 21:12:46 EST 2018


I may have figured this out for myself by reading the manual again about Table Classes.  So now tell me if I’m correct:

When you define a list from a Schema or Query class, an instance of an automatic hidden table class is created and associated with the defined list, so that it has the methods of a table class, which are a bunch regarding basic SQL functions like insert, update, delete etc…and this table class takes from the Schema or Query class the name of the actual server table it the table class is pointed at, so when you work the defined list, the hidden table class inside it is pointing to a certain server table, and that’s why you don’t need to specify the table in code like that shown below…because it’s already associated.

I think that’s right and that I thus now get it.  Wow, seems flimsy and limited to whole tables, one at a time.

When you do the kind of SQL commands that return lists of combined tables, how then do you specify the tables since it’s not just one. I realize Query classes can have columns from different tables, but I haven’t even looked at the interface for a query class yet.  I was surprised to find table classes have only code like objects. I thought they have a column list like Schema classes. I’m assuming Query classes have a columns list otherwise how would they know which fields to combine?  Stiff confusing these three Schema, Table and Query.  And if I should care, use Tables or not, I’ve been told both, to forget them and to use them, both. 

I’ve been solidly reading the Postgres Manual and my head is exploding, man SQL has tons in it, tons… it’s so vast.  So I had to turn my head back to pragmatic code and my real questions about it. Researching on that in the Omnis manuals.. etc…  



> On Jan 25, 2018, at 5:35 PM, Das Goravani <das at Goravani.com> wrote:
> 
> 
> The following code works, but nowhere is the table specified, except only in that it is typed into the Schema window as the associated table. Here the list is defined from the schema class. Is it true that the list stores the table name from the schema class?  That would be the only connection possible going forward to the other code, which works, in that the customers table is accessed, written to, updated to, all correctly, but nowhere is the table name said, this confuses me.  How do I switch now to another table… by redefining the list to the desired schema name ?  That would be the only connection given this code.  
> 
> In window construct we have
> 
> 	Do iSqlRow.$definefromsqlclass('sCustomers')
> 	Do iSqlRow.$sessionobject.$assign($root.$sessions.[lSessionName].$sessionobject) Returns #F
> 
> In “Next” button we have
> 
> On evClick
> 	Do iSqlRow.$fetch() Returns lStatus
> 	If lStatus=kFetchFinished|lStatus=kFetchError
> 		Do iSqlRow.$select()
> 		Do iSqlRow.$fetch() Returns lStatus
> 	End If
> 	Calculate iOldRow as iSqlRow
> 	Do $cwind.$redraw()
> 
> In Save Button we have
> 
> On evClick
> 	If iNew
> 		Do iSqlRow.$insert() Returns lReturnFlag
> 		If lReturnFlag
> 			Calculate iOldRow as iSqlRow
> 		End If
> 	Else
> 		Do iSqlRow.$update(iOldRow) Returns lReturnFlag
> 		Do $ctask.tPGSessObj.$commit Returns lReturnFlag
> 		If lReturnFlag
> 			Calculate iOldRow as iSqlRow
> 		End If
> 		Do $ctask.tPGSessObj.$transactionmode.$assign(kSessionTranAutomatic) Returns lReturnFlag
> 	End If
> 
> Thank you, best wishes,
> 
> Das Goravani
> _____________________________________________________________
> Manage your list subscriptions at http://lists.omnis-dev.com




More information about the omnisdev-en mailing list