Kbase P14744: How to destroy SDOs started with 'startDataObject' in WebSpe
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  21/03/2003 |
|
Status: Unverified
GOAL:
How to destroy SDOs started with 'startDataObject' in WebSpeed
FACT(s) (Environment):
WebSpeed 3.x
FIX:
If the application logic requires to use more than one SDO in the WebSpeed application, that can be achieved using the call to the function 'startDataObject'. The resulting code will look like this:
startDataObject('sdo1.w').
Sdo1Hdl = dynamic-function('getDataSource').
RUN stuff IN Sdo1Hdl.
destroyDataObject().
startDataObject('sdo2.w').
Sdo2Hdl = dynamic-function('getDataSource').
RUN stuff IN Sdo2Hdl.
destroyDataObject().
However, if it is necessary to postpone destroying the SDO, for example
to avoid overhead of initializing it again, then it is not possible to
use the 'destroyDataObject()' function call as it will destroy only the
SDO that was the last one initialized by 'startDataObject'.
As the function 'destroyDataObject' uses call to 'getDataSource'
function, only the SDO that was started as last one will be destroyed.
In the case when it is necessary to start several SDOs and to avoid
overhead of starting the SDO several times in the same procedure,
the best way to dispose of all SDOs that were started is to hold their
handles in variables until they are no longer needed and then to use:
RUN destroyObject IN Sdo1Hdl.
RUN destroyObject IN Sdo2Hdl.
etc.
This approach will ensure that all necessary SDOs are started
only once per each web request and properly destroyed at the
web request procedure end.