typedef struct JOININFO{ char jiSchemaTableName1[288]; char jiSchemaTableName2[288]; char jiAliasName[128]; char jiJoinType[64]; char jiJoinCondition[800]; int jiJoinOrder; }JOININFO; void ddlRelateEx( CONTROL *ctl, char *OptnStr, char *ArgList, int JoinInfoCount, /* the number of JOININFO{} members */ JOININFO *ji);
<cx> [PRESENT BY [D] <field1> [[D] <field2> ..]] [<value-clause>] [<calc-clause>] [<post-calc-clause>] |
Where: |
<cx> is the name of the collection <field1> <field2> ... are the PRESENT BY fields <value-clause> is an optional clause for carrying data to the next process; VALUE <value-field1> ... <value-var1> ... <calc-clause> is an optional clause for calculating PRESENT BY and/or VALUE parameters <calc-expression> [<calc-expression>] ... CALCOBJECT <calc-object-name> <calc-expression> is: {CALC | SET | IF | ELSE | ENDIF} statement <post-calc-clause> is an optional clause for processing sort results in a single step POSTCALCOBJECT <post-calc-object-name> The PRESENT BY Clause performs a SORT on the results of the RELATEX JOIN. It is used to translate a GROUP BY or ORDER BY Clause. However, if both GROUP BY and ORDER BY Clauses are present, additional processing is required. The VALUE Clause is an optimization: 1) If no POSTCALCOBJECT is present, the specified values are written to the result file, alleviating the subsequent process from having to re-read the data. 2) If a POSTCALCOBJECT is present, the values are passed thru memory to the POSTCALCOBJECT. The VALUE Clause is especially useful for virtual data and for calculated values. The CALCOBJECT Clause specifies a Calc Object that operates on data as it is being read to calculate variables based on the incoming data. The POSTCALCOBJECT Clause specifies a Calc Object that operates on the output of the RELATEX. There are several types of functions that can be performed. For example: . Compute aggregate and grouping; . Compute other calculated values; . Create a result temporary table; . Perform a HAVING Clause A POSTCALCOBJECT is functionally equivalent to . RELATEX . CALCOBJECT but is more efficient. |
int JoinInfoCount is the number of JOININFO{} elements that are being passed in. |
JOININFO *ji is an array of JoinInfoCount JOININFO{} elements that are being passed in. The elements are in JOIN order. |
typedef struct JOININFO{} is a structure that is used to pass JOIN
parameters into the ddlRelateEx() API function.
The members of typedef struct JOININFO{} are:
|
The values within each JOININFO{} element (both singly and collectively)
must reflect the FROM clause of a legal Ansi SQL query. For example, the
legal Ansi SQL query fragment: SELECT ... FROM Orders JOIN Emp ON Orders.EmpID = Emp.EmpID JOIN Cust ON Orders.CustID = Cust.CustID JOIN Invoices ON Orders.InvoiceID = Invoices.InvoiceID ... would be encoded (using the alternate encoding described in Notes below) as / Orders / Emp / INNER / Orders.EmpID = Emp.EmpID // Emp / Cust / INNER / Orders.CustID = Cust.CustID // Cust / Invoices / INNER / Orders.InvoiceID = Invoices.InvoiceID |
ddlRelateEx() combines the records in the specified collection and the specified
tables into a hierarchical order.
The hierarchy is defined by the order of the tables in the JOININFO{} structure.
The result of ddlRelateEx() is an ordered global collection. The result collection is addressed in subsequent functions by the <cx> name without a table name. The result collection persists until either: 1) It is explicitly destroyed by ddlClear(); 2) It is implicitly destroyed by a function that re-defines the collection; for example: ddlFill(), ddlFind(), etc 3) It is superceeded by another ddlRelate(), ddlRelateEx(); When the ddlRelateEx() function includes a POSTCALCOBJECT, creation of the result collection can be modified by the Calc Object NOTEMIT statement. |
Control.Ans1 | Number of records in final RELATed collection |
Control.Ans2 | Initial Number of records in unRELATed collection |
Control.Ans3 | Number of frames (logical records) in result |
Control.Ans1L | Number of records in final RELATed collection (64 bit) |
Control.Ans2L | Initial Number of records in unRELATed collection (64 bit) |
Control.Ans3L | Number of frames (logical records) in result (64 bit) |
When called thru ddlCommand(), or from ddtl, or from TQL,
the JOININFO{} data can be specified in an alternate fashion. In this case, the syntax is: RELATEX <ArgList> <JoinInfoList> where <JoinInfoList> is in the form: / <SchemaTableName1> / <SchemaTableName2> / <Join Type> / <JoinCondition> / |
Advanced ddlRelateEx() API Functionality |
Copyright © 2019 , WhamTech, Inc. All rights reserved. This
document is provided for information purposes only and the contents hereof are
subject to change without notice. Names may be
trademarks of their respective owners.