Progress
ADM 2 Guide
AppBuilder Modifications to the SmartDataObject Master
When you generate the master (.w file) for the SmartDataObject that has been set up for conditional compilation into database-aware and nondatabase-aware versions, the AppBuilder modifies the master as follows:
- It checks each code-block section to see whether its DB–REQUIRED toggle box is checked. If it is, the AppBuilder brackets the code in that section with the following preprocessor names:
These preprocessor names resolve to the following code:
This code excludes the section from the r-code during the compilation of the client proxy.
If the section’s DB Required toggle box is unchecked, the AppBuilder does not bracket its code with the {&DB–REQUIRED–START} and {&DB–REQUIRED–END} preprocessor names, and the section is included in the r-code during the compilation.
- If the preprocessor names for a section are present, the AppBuilder generates the following code to define them before it produces any code block that might require them:
If DB–REQUIRED is not defined when the compiler processes this block of code, all code blocks are included in the compiled r-code. However, if DB–REQUIRED is defined as false, code blocks bracketed with {&DB–REQUIRED–START} and {&DB–REQUIRED–END} are not included in the compiled r-code. This is the case when generating a client proxy (a SmartDataObject proxy to be used on a client machine); it means that the proxy is not required to be connected to any database when executed.
You can choose to compile out just a part of an internal procedure or function. To do this, uncheck the DBRequired toggle box and program the following statements around the section of code to be executed only when a database connection is available:
This technique allows you to execute different versions of the same procedure on the client and the AppServer. You might even code the client version to invoke the AppServer version; for an example, see the installed file
%DLC%/src/adcm2/cltorsrver.i
.- When it generates the
.w
file for the SmartDataObject, the AppBuilder also produces a client proxy.w
file. The proxy has the same name of the form sdoname_cl.w
, where sdoname is the name of the SmartDataObject. For example, a SmartDataObject nameddcust.w
automatically has a proxy nameddcust_cl.w
. The proxy contains the following code:
This code, when compiled, first sets {&DB–REQUIRED} to false, then creates an r-code proxy named
dcust_cl.r
that is identical to its sibling SmartDataObject nameddcust.r
except that all sections marked DB–Required are removed.- The AppBuilder turns on the SmartDataObject’s DBAware attribute. It uses this attribute later, when it generates a SmartContainer that contains the SmartDataObject.
Copyright © 2004 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |