GLOPセットのメンバーになっている外部ルーチンは、最初にGLOPセットにアクセスし、それから任意のマッピングでデータを使用できます。
CまたはC++外部ルーチンでGLOPセットにアクセスするには、FNC_Get_GLOP_Mapライブラリ関数を呼び出します。最初に、FNC_Get_GLOP_Mapを呼び出してから、それ以外のGLOP関数(FNC_GLOP_Lock、FNC_GLOP_Unlock、FNC_GLOP_Map_Page、FNC_GLOP_Global_Copyなど)を呼び出す必要があります。また、FNC_Get_GLOP_Mapは、それ以外のGLOPルーチンを使用するテーブル関数の各段階の最初に呼び出して、その段階のメモリ ポインタを初期化する必要があります。
以下に、FNC_Get_GLOP_Map関数を使用するコードの抜粋を示します。C外部ルーチンでGLOPデータを使用する方法を示す完全な例については、GLOPデータを使用したC関数を参照してください。
#define SQL_TEXT Latin_Text #include <sqltypes_td.h> #include <string.h> struct Company { INTEGER deptid; char deptname[30]; }; struct Company_Info { struct Company Dept[20]; }*COMPANY_DETAILS; void *GLOP_Manager(INTEGER *record_n, INTEGER *result, char sqlstate[6]) { int glop_stat; GLOP_Map_t *MyGLOP; // Structure GLOP_Map_t is an array of eight // GLOP_ref_t structures, plus some internal // structures. Eight GLOP data references is // the maximum an external routine can map. glop_stat = FNC_Get_GLOP_Map(&MyGLOP); // Check whether access to the GLOP set is established or not if (glop_stat) { strcpy(sqlstate,"U0001"); return; } // Check the first GLOP mapping in the GLOP set if (MyGLOP->GLOP[0].GLOP_ptr == NULL) { strcpy(sqlstate,"U0002"); return; } else { // Use the first GLOP mapping (index 0) here COMPANY_DETAILS = MyGLOP->GLOP[0].GLOP_ptr; ... } ... return; }
FNC_Get_GLOP_Map Cライブラリ関数について詳しくは、FNC_Get_GLOP_Mapを参照してください。