The PowerBuilder PowerServerLabel object provides label functions to merge and send multiple requests in one call. As suggested by the object name, these label functions only take effect when the application is deployed via the PowerServer project (they will be ignored when the application is deployed via the PowerClient project or the Application project).
-
StartMerge and EndMerge -- These two label functions must be used in pairs. They notify the application not to send database requests after the StartMerge function until the EndMerge function is called, so that multiple database requests can be sent in one call.
When these label functions are executed in the PowerServer environment, PowerServer will handle certain database operations differently than PowerBuilder with the aim of reducing the number of server calls. These label functions will not be executed or modify how the application works in the traditional client/server environment.
StartMerge and EndMerge label functions work in the same way as the of_startqueue and of_commitqueue Appeon Labels in old PowerServer (Appeon for PowerBuilder). If you have used Appeon Labels, you can easily migrate Appeon Labels to PowerServerLabel. A few code examples are provided here.
Appeon Labels: of_autocommitrollback, of_autocommit, of_autorollback, and of_imdcall must be removed; they will not work in the new PowerServer.
Appeon Labels: of_startqueue, of_commitqueue, and of_update can be modified to work in the new PowerServer. Here are a few code examples.
Example 1: Directly replace of_startqueue with StartMerge, and of_commitqueue with EndMerge. If AutoCommit = False, then add the Commit and Rollback statements as well.
The code that uses Appeon Labels:
gnv_appeondb.of_startqueue() lds_1.Retrieve(ll_id) dw_1.Retireve(ll_id) SELECT next_id INTO: ll_id_max FROM TableA; UPDATE TableA SET next_id = isnull(next_id,0) + 1; gnv_appeondb.of_commitqueue()
You can modify the code as below:
gnv_PowerServerLabel.StartMerge() lds_1.Retrieve(ll_id) dw_1.Retireve(ll_id) SELECT next_id INTO: ll_id_max FROM TableA; UPDATE TableA SET next_id = isnull(next_id,0) + 1; gnv_PowerServerLabel.EndMerge() COMMIT; //if AutoCommit = False
Example 2: Modify the DataWindow/DataStore/DataWindowChild when of_update(obj_1,obj_2) is used.
The code that uses Appeon Labels:
res = gnv_appeondb.of_update(1,dw_1,dw_2) If res = 1 Then COMMIT; Else ROLLBACK; End If
You can modify the code as below:
gnv_PowerServerLabel.StartMerge(1) //StartMerge(stopmode) //stopmode: 0-continue, 1-stop; dw_1.update() dw_2.Update() gnv_PowerServerLabel.EndMerge() If gnv_PowerServerLabel.Results[1].SQLCode = 0 And gnv_PowerServerLabel.Results[2].SQLCode = 0 Then COMMIT; Else ROLLBACK; End If
Example 3: Directly make changes to the definition of of_startqueue and of_commitqueue in appeon_workarounds.pbl > appeon_nvo_db_update. For example,
Modify of_startqueue as below:
/*************************************** * Queue start label * ***************************************/ //of_startQueue(0) gnv_label.StartMerge(0)
Modify of_commitqueue as below:
/*************************************** * Queue end label * ***************************************/ gnv_label.EndMerge()