Quantcast
Channel: SmartClient Forums
Viewing all articles
Browse latest Browse all 4756

Minor bug with generated SQL for ORDER BY on included column

$
0
0
Hi Isomorpic,

please see the following example (builtInDS-based, 4.1-p20140822),
where the generated SQL does only include the tableName for the normal(=not-included) field.

Changes to animals.ds.xml (1 added, 1 modified):
Code:

<field name="incName" includeFrom="employees.Name" />
<field foreignKey="employees.EmployeeId" name="lifeSpan" title="Life Span" type="integer" />

Changes to BuiltInDS.bindComponents():
Code:

boundList.setDataSource(ds);
boundList.setSort(new SortSpecifier[] { new SortSpecifier("incName", SortDirection.ASCENDING),
        new SortSpecifier("lifeSpan", SortDirection.ASCENDING) });

Also set boundList.setProgressiveLoading(true); so that the real SELECT-SQL is executed even if the JOIN results in an empty resultset.

The resulting SQL is:
Code:

SELECT LIMIT 0 76  animals.userOrder, animals.Name, animals.ReportsTo, animals.scientificName, animals.lifeSpan, animals.status, animals.diet, animals.information, animals.picture, employeeTable.Name AS incName FROM animals, employeeTable WHERE ('1'='1') AND animals.lifeSpan = employeeTable.EmployeeId ORDER BY incName, animals.lifeSpan
I think it should be employeeTable.Name (or the relatedTableAlias, if given). This happens with HSQLDB as well as with Oracle.

Best regards,
Blama

Viewing all articles
Browse latest Browse all 4756

Trending Articles