Supporting SQLPreview event

PowerServer (and PowerClient) now fully supports the DataWindow SQLPreview event.

But in PowerServer, due to its Web architecture, you may want to take advantage of the "enablesqlpreview" setting to control which level of support for DataWindow SQLPreview event.

  • When the "enablesqlpreview" setting is "false", the sqltype parameter supports PreviewSelect only and the request argument supports PreviewFunctionRetrieve only.

    The support for SQLPreview event is limited (the sqltype parameter does not support Previewlnsert, PreviewDelete, & PreviewUpdate; and the request argument does not support PreviewFunctionReselectRow and PreviewFunctionUpdate).

  • When the "enablesqlpreview" setting is "true", the sqltype parameter supports PreviewSelect, Previewlnsert, PreviewDelete, & PreviewUpdate; and the request argument supports PreviewFunctionRetrieve, PreviewFunctionReselectRow, and PreviewFunctionUpdate.

    The SQLPreview event is fully supported. But the performance may be compromised in this case. When "enablesqlpreview" is "true", DataWindow Update uses the line-by-line commit approach (for each line of code, a separate request is sent to the server) rather than committing the entire DataWindow data to the server in one request, therefore, in the PowerServer architecture, the performance is easily affected by the network. If there is batch data update in the DataWindow, it is recommended to set "enablesqlpreview" to "false".

By default, the "enablesqlpreview" setting is "false".

You can change the "enablesqlpreview" setting through the CloudAppSet function.

CloudAppSet ("enablesqlpreview", "true")

You can consider setting "enablesqlpreview" to "true" for only some DataWindow Updates. For example:

//Enable SQLPreview support before update, and then disable it after update.
CloudAppSet ("enablesqlpreview", "true")
if dw_1.update() = 1 then
 commit;
else
 rollback;
end if
CloudAppSet ("enablesqlpreview", "false")