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:

  1. 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:
  2. {&DB-REQUIRED-START}
    .
    .
    .
    {&DB-REQUIRED-END} 
    

    These preprocessor names resolve to the following code:

    &IF {&DB-REQUIRED} &THEN
    .
    .
    .
    &ENDIF 
    

    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.

  3. 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:
  4. /* DB-Required Preprocessor definitions */
    &IF DEFINED (DB-REQUIRED) = 0 &THEN
      &GLOBAL-DEFINE DB-REQUIRED TRUE
    &ENDIF
    &GLOBAL-DEFINE DB-REQUIRED-START &IF {&DB-REQUIRED} &THEN
    &GLOBAL-DEFINE DB-REQUIRED-END   &ENDIF 
    

    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:

    &IF {&DB-REQUIRED} &THEN
      .
      .
      .
    &ENDIF 
    

    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.

  5. 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 named dcust.w automatically has a proxy named dcust_cl.w. The proxy contains the following code:
  6. /* dcust_cl.w - non-db proxy for dcust.w */
    &GLOBAL-DEFINE DB-REQUIRED FALSE
    {dcust.w} 
    

    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 named dcust.r except that all sections marked DB–Required are removed.

  7. 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