Hello Isomorphic,
with the latest 13.0-p versions (eg. 13.0-p20220210) smartgwt generates faulty SELECT statements for ms sqlserver, when a explicte ordering is missing and the datasource has multiple primary key fields.
For example :
<DataSource dbName="mainDataBase" tableName="MANDANT_PARAMETER" ID="DSMANDANT_PARAMETER" dataSourceVersion="1" serverType="sql"> <fields> <field primaryKey="true" name="MANDANT" required="true" length="6" type="text" canEdit="false" width="150"></field> <field primaryKey="true" name="PARAMETER" required="true" length="180" type="text" canEdit="true"></field> <field name="STRING_VAL" required="false" length="2048" type="text" canEdit="true" escapeHTML="true"></field> </fields> </DataSource>
Example sql which is generated for a fetch
SELECT MANDANT_PARAMETER.MANDANT, MANDANT_PARAMETER.PARAMETER, MANDANT_PARAMETER.STRING_VAL
FROM MANDANT_PARAMETER
WHERE
(
MANDANT_PARAMETER.MANDANT='UNT2MX'
AND MANDANT_PARAMETER.PARAMETER='REORG_ARCHIVED_AFTER_DAYS'
)
ORDER BY
, PARAMETER OFFSET 0 ROWS FETCH NEXT 1 ROWS ONLY
The “ORDER BY ,PARAMETER” with the leading comma results to an sql error. So in my opinion the MANDANT field is missing here, or the comma should be ommited.
The regression should been happened since 13.0-d20211002, because this version works as expected. Interestingly, we have noticed this error only with mssql, not with mysql so this seems to be database vendor related.
Best regards
Helmut