Hi Isomorphic,
please see the two connected DS. The additionally joined DS has a criteria-clause, which works for fetch, but is not used during joins (neither in the ON-clause of the JOIN nor in the final WHERE-clause of the generated SQL-statement). I assume that this is on purpose, but I'm not sure. If it is on purpose, it might be a useful enhancement.
DS that is joined:
DS with includeFrom:
The generated table-clause looks like this:
I'm looking for something like this:
Perhaps the fetch-operation binding is not the place for this clause and a new join-operationBinding would be better suited for something like this.
Do you think this is a good enhancement?
My use-case is that I add a "TENANT_ID = xxx"-clause in my subclassed IDACall to every fetch operation. This works for the base-table, but not the joined tables. In order to optimize my execution plan, I'd like to add it to the join-clause or where-clause as well.
I could solve it by making all my "tenant_id" columns part of the PK, but then I'd have composite PKs, which is not recommended (http://forums.smartclient.com/showpo...89&postcount=7).
Thank you & Best regards,
Blama
please see the two connected DS. The additionally joined DS has a criteria-clause, which works for fetch, but is not used during joins (neither in the ON-clause of the JOIN nor in the final WHERE-clause of the generated SQL-statement). I assume that this is on purpose, but I'm not sure. If it is on purpose, it might be a useful enhancement.
DS that is joined:
Code:
<DataSource dbName="Oracle" tableName="V_USER_CREATED_BY" ID="V_USER_CREATED_BY" dataSourceVersion="1" serverType="sql"> <fields> <field primaryKey="true" hidden="true" name="ID" type="sequence"></field> <field hidden="true" name="TENANT_ID" type="integer" canEdit="false"></field> <field name="CREATED_BY" title="Erstellt von" type="creator"></field> <field name="CREATED_AT" title="Erstellt am" type="creatorTimestamp"></field> <field name="MODIFIED_BY" title="Geändert von" type="modifier"></field> <field name="MODIFIED_AT" title="Geändert am" type="modifierTimestamp"></field> <field foreignKey="T_COMPANY.ID" joinType="outer" name="BELONGSTO_COMPANY_ID" title="Firma" type="integer"></field> <field name="COMPANY_NAME" includeFrom="T_COMPANY.NAME" canSave="false" hidden="true"></field> <field foreignKey="T_DISTRIBUTOR.ID" joinType="outer" name="BELONGSTO_DISTRIBUTOR_ID" title="Distributor" type="integer"></field> <field name="DISTRIBUTOR_NAME" includeFrom="T_DISTRIBUTOR.NAME" canSave="false" hidden="true"></field> ... </fields> <operationBindings> [B]<operationBinding operationType="fetch"> <criteria fieldName="TENANT_ID" value="$session.authenticatedUserTenantID" /> </operationBinding>[/B] </operationBindings> </DataSource>
Code:
<DataSource dbName="Oracle" tableName="T_CAMPAIGN" ID="T_CAMPAIGN" dataSourceVersion="1" serverType="sql"> <fields> <field primaryKey="true" hidden="true" name="ID" type="sequence"></field> <field hidden="true" name="TENANT_ID" type="integer" canEdit="false"></field> [B]<field foreignKey="V_USER_CREATED_BY.ID" name="CREATED_BY" title="Erstellt von" type="creator"></field>[/B] <field name="CREATED_AT" title="Erstellt am" type="creatorTimestamp"></field> [B] <field name="CREATED_BY_COMPANY_ID" includeFrom="V_USER_CREATED_BY.BELONGSTO_COMPANY_ID" hidden="true"></field>[/B] <field name="NAME" title="Name" length="60" type="text" escapeHTML="true" required="true"></field> <field name="ENDDATE" title="Enddatum" type="date"></field> </fields> </DataSource>
Code:
FROM T_CAMPAIGN JOIN V_USER_CREATED_BY ON T_CAMPAIGN.CREATED_BY = V_USER_CREATED_BY.ID
Code:
FROM T_CAMPAIGN JOIN V_USER_CREATED_BY ON T_CAMPAIGN.CREATED_BY = V_USER_CREATED_BY.ID [B]AND V_USER_CREATED_BY.TENANT_ID = xxx[/B] or FROM T_CAMPAIGN JOIN V_USER_CREATED_BY ON T_CAMPAIGN.CREATED_BY = V_USER_CREATED_BY.ID WHERE (..defaultWhereClauses...) [B]AND V_USER_CREATED_BY.TENANT_ID = xxx[/B] or (in case of joinType="outer") FROM T_CAMPAIGN JOIN V_USER_CREATED_BY ON T_CAMPAIGN.CREATED_BY = V_USER_CREATED_BY.ID WHERE (..defaultWhereClauses...) [B]AND (V_USER_CREATED_BY.TENANT_ID = xxx OR V_USER_CREATED_BY.TENANT_ID IS NULL)[/B]
Do you think this is a good enhancement?
My use-case is that I add a "TENANT_ID = xxx"-clause in my subclassed IDACall to every fetch operation. This works for the base-table, but not the joined tables. In order to optimize my execution plan, I'd like to add it to the join-clause or where-clause as well.
I could solve it by making all my "tenant_id" columns part of the PK, but then I'd have composite PKs, which is not recommended (http://forums.smartclient.com/showpo...89&postcount=7).
Thank you & Best regards,
Blama
Comment