Special Callback functions

<< Click to Display Table of Contents >>

Navigation:  The Vo2Ado RDD > RDD Support Library >

Special Callback functions

Previous pageReturn to chapter overviewNext page

The Vo2Ado RDD Support library contains a set of special callback functions, designed to be used with the AdoDbServer class.

They principle is that you can push a callback object on a stack, labeled with the name of the connection or table that it will handle. The AdoRddCallback class will try to get the object from the stack, and if it can't find an object, will create a default object.

 

Adding a connection callback to the stack is done through:

 

FUNCTION AdoDbSetConnectionCallBack(sName AS STRING, oCb AS OBJECT) AS VOID

 

Adding a table callback to the stack is done through:

 

FUNCTION AdoDbSetTableCallBack(sName AS STRING, oCb AS OBJECT) AS VOID

 

The AdoRddCallback function will use AdoDbGetConnectionCallBack and AdoDbGetTableCallBack to query for an object as you can see below.

 

FUNCTION AdoDbGetConnectionCallBack(sName AS STRING) AS OBJECT

and

FUNCTION AdoDbGetTableCallBack(sName AS STRING) AS OBJECT

 

 

FUNCTION AdoRddCallBack(symType, sName)

   LOCAL oCb AS OBJECT

   IF symType == #Connection

      oCb := AdoDbGetConnectionCallBack(sName)

      IF oCb == NULL_OBJECT

         IF symConnCallBack <> NULL_SYMBOL

            IF IsClass(symConnCallBack)

               oCb := CreateInstance(symConnCallBack)

            ENDIF

         ENDIF

      ENDIF

 ELSEIF  symType == #Table

      oCb := AdoDbGetTableCallBack(sName)

      IF oCb == NULL_OBJECT

         IF symTableCallBack <> NULL_SYMBOL

            IF IsClass(symTableCallBack)

               oCb := CreateInstance(symTableCallBack)

            ENDIF

         ENDIF

      ENDIF

   ENDIF

   RETURN oCb

Default callback handlers are registered through

 

FUNCTION AdoDbSetConnectionCallBackClass(symNewClass) AS SYMBOL

 

FUNCTION AdoDbSetTableCallBackClass(symNewClass) AS SYMBOL

 

these function both return the current names, which default to NULL_SYMBOL