DIBOL to ORACLE Gateway API software reference


Previous Contents

3.2.17 dbl_oragtwy$item_sublist_cc()

Close an ITEM_SUBLIST cursor.

Syntax

status =dbl_oragtwy$item_sublist


RETURNS

VMS usage:
type: longword integer
access: read only
mechanism: by value

ORACLE OCI Error code


Description

Close an ITEM_SUBLIST cursor by calling a corresponding SP.

Return Values

0 Indicates successful completion
Positive Non-critical SQL Error
Negative Critical SQL Error

3.2.18 dbl_oragtwy$item_sublist_fd()

Fetch data from ITEM_SUBLIST cursor by calling an ORACLE SP ITEM_SUBLIST_FD:.

Syntax

status =dbl_oragtwy$item_sublist_fd

sku1 ,sku1len ,sup1 ,sup1len ,type1 ,type1len ,sku2 ,sku2len ,sup2 ,sup2len ,type2 ,type2len


RETURNS

VMS usage:
type: longword integer
access: read only
mechanism: by value

ORACLE OCI Error code


Arguments

sku1


VMS usage:
type: ASCII string
access: write only
mechanism: by reference

A pointer to a sku1.

sku1len


VMS usage:
type: word integer
access: read only
mechanism: by value

A size of the buffer for the sku1 parameter.

sup1


VMS usage:
type: ASCII string
access: write only
mechanism: by reference

A pointer to sup1.

sup1len


VMS usage:
type: word integer
access: read only
mechanism: by value

A size of the buffer for a sup1 parameter.

type1


VMS usage:
type: ASCII string
access: write only
mechanism: by reference

A pointer to type1.

type1len


VMS usage:
type: word integer
access: read only
mechanism: by value

A size of the buffer for type1 parameter.

sku2


VMS usage:
type: ASCII string
access: write only
mechanism: by reference

A pointer to a sku2.

sku2len


VMS usage:
type: word integer
access: read only
mechanism: by value

A size of the buffer for the sku2 parameter.

sup2


VMS usage:
type: ASCII string
access: write only
mechanism: by reference

A pointer to sup2.

sup2len


VMS usage:
type: word integer
access: read only
mechanism: by value

A size of the buffer for a sup2 parameter.

type2


VMS usage:
type: ASCII string
access: write only
mechanism: by reference

A pointer to type2.

type2len


VMS usage:
type: word integer
access: read only
mechanism: by value

A size of the buffer for type2 parameter.

Description

Fetch data from ITEM_SUBLIST cursor by calling an ORACLE SP ITEM_SUBLIST_FD(). Returned strings are padded by spaces to end of a buffer.

Return Values

0 Indicates successful completion
Positive Non-critical SQL Error
Negative Critical SQL Error

3.2.19 dbl_oragtwy$ora_rtc()

Rollback a current ORACLE transaction.

Syntax

status =dbl_oragtwy$ora_rtc


RETURNS

VMS usage:
type: longword integer
access: read only
mechanism: by value

ORACLE OCI Error code


Description

Rollback a current transaction by executing ORACLE ROLLBACK SQL statement.

Return Values

0 Indicates successful completion
Positive Non-critical SQL Error
Negative Critical SQL Error

3.2.20 dbl_oragtwy$ora_ctc()

Commit a current ORACLE transaction.

Syntax

status =dbl_oragtwy$ora_ctc


RETURNS

VMS usage:
type: longword integer
access: read only
mechanism: by value

ORACLE OCI Error code


Description

Commit a current transaction by executing ORACLE COMMIT SQL statement.

Return Values

0 Indicates successful completion
Positive Non-critical SQL Error
Negative Critical SQL Error

3.2.21 dbl_oragtwy$get_oracle_sku()

Fetch data by calling GET_ORACLE_SKU:.

Syntax

status=dbl_oragtwy$item_sublist_fd sku ,skulen ,sup ,suplen ,ora


RETURNS

VMS usage:
type: longword integer
access: read only
mechanism: by value

ORACLE OCI Error code


Arguments

sku


VMS usage:
type: ASCII string
access: read only
mechanism: by reference

A pointer to a sku.

skulen


VMS usage:
type: word integer
access: read only
mechanism: by value

A size of the buffer for the sku parameter.

sup


VMS usage:
type: ASCII string
access: read only
mechanism: by reference

A pointer to sup.

suplen


VMS usage:
type: word integer
access: read only
mechanism: by value

A size of the buffer for a sup parameter.

ora


VMS usage:
type: structure ora_rec
access: write only
mechanism: by reference

A record to accept fetched data.

Description

Select data with sku and sup criteria and fetch it into the structured buffer named ora. See DBL_ORAGTWYDEF.[H|FOR|BAS] file to get an information about fields size and type. Be advised that all character data field paddes by space to end of the fields.

Note

This routine can fetch only one record at any time.

Return Values

0 Indicates successful completion
Positive Non-critical SQL Error
Negative Critical SQL Error

3.2.22 dbl_oragtwy$itemlist_oc()

Open an ITEMLIST cursor.

Syntax

status=dbl_oragtwy$itemlist_oc legacy_seq


Arguments

legacy_seq


VMS usage: longword integer
type: read only
access: by value
mechanism:

A legacy_seq parameter.

RETURNS

VMS usage:
type: longword integer
access: read only
mechanism: by value

ORACLE OCI Error code


Description

Open a ITEMLIST cursor by calling a corresponding SP.

Return Values

0 Indicates successful completion
Positive Non-critical SQL Error
Negative Critical SQL Error

3.2.23 dbl_oragtwy$itemlist_cc()

Close an ITEMLIST cursor.

Syntax

status =dbl_oragtwy$itemlist


RETURNS

VMS usage:
type: longword integer
access: read only
mechanism: by value

ORACLE OCI Error code


Description

Close an ITEMLIST cursor by calling a corresponding SP.

Return Values

0 Indicates successful completion
Positive Non-critical SQL Error
Negative Critical SQL Error

3.2.24 dbl_oragtwy$itemlist_fd()

Fetch data from ITEMLIST cursor by calling an ORACLE SP ITEMLIST_FD:.

Syntax

status=dbl_oragtwy$itemlist_fd ora


RETURNS

VMS usage:
type: longword integer
access: read only
mechanism: by value

ORACLE OCI Error code


Arguments

ora


VMS usage:
type: record
access: write only
mechanism: by reference

A record to accept fetched data.

Description

Fetch it into the structured buffer named ora. See DBL_ORAGTWYDEF.[H|FOR|BAS] file to get an information about fields size and type. Be addvised that all character data field paddes by space to and of the fields.

Return Values

0 Indicates successful completion
Positive Non-critical SQL Error
Negative Critical SQL Error


Chapter 4
Develop Your Application

4.1 Common paradigm of API routines

An every top-level application must calling dbl_oragtwy$init() routine to performs API specific initalization task, this call opening session with an ORACLE server, performs preparsing of internaly used cursors. At end of main application specific code dbl_oragtwy$shut() routine must be called.

Most application specific routines supposes a next calling sequence: open a cursor routine, fetching data routine, close cursor routine. Follows piece of code demonstrates common coding rules.


 
 #include <descrip.h> 
 #include <stdio.h> 
 #include <stdlib.h> 
 
 
 /* 
 ** API Routines prototypes and data structures declarations 
 */ 
 #include "dbl_oragtwy.h" 
 #include "dbl_oragtwydef.h" 
 ... 
 
 void main (void) 
 { 
 int status; 
 $DESCRIPTOR(oracons,"scott/tiger@tessco"); 
 
 char    sku[] = "MOTOROLA",sup[] = "646444"; 
 char    short_name[2048],feature_name[2048]; 
 
 ... 
 
 /* 
 ** Initalize the DBL_ORAGTWY layer, this routine must be called only once 
 ** before calling any other routines of the API. 
 */ 
 if ( status = dbl_oragtwy$init(&oracons) ) 
  printf("dbl_oragtwy$init:ORA-%d\n",status); 
 
 
  /* 
  ** Initalize and open an ORACLE cursor 
  */ 
                if ( status = dbl_oragtwy$item_catlist_oc(sku,sizeof(sku)-1,sup,sizeof(sup)-1) ) 
                        printf("dbl_oragtwy$*_oc:ORA-%d\n",status); 
 
  /* 
  ** Just fetch a data from has been opened cursor 
  */ 
                if ( status = dbl_oragtwy$item_catlist_fd(short_name,sizeof(short_name)-1, 
     feature_name,sizeof(feature_name)-1) ) 
                        printf("dbl_oragtwy$*_fd:ORA-%d\n",status); 
 
  /* 
  ** Close cursor and deallocate resources 
  */ 
                if ( status = dbl_oragtwy$item_catlist_cc() ) 
                        printf("dbl_oragtwy$*_cc:ORA-%d\n",status); 
 
 /* 
 ** Shutdown the DBL_ORAGTWY layer 
 */ 
 dbl_oragtwy$shut(); 
 ... 
 } 
 

4.2 Link Your Application

Your applictaion must be linked with the shareable library, follows command line demonstrates how to do this:


 $LINK   DBL_ORAGTWY_EXAMPLE.OBJ,SYS$INPUT/OPT 
 SYS$LIBRAY:DBL_ORAGTWY.EXE/SHARE 
 ^Z 
 $ 

For faster access your system manager can installing this shareable image with VMS INSTALL Uitility.


Appendix A
Example of using the API


Examples

This is an example of using API in a C programm.
#1

 /* 
**++ 
**  FACILITY:  DIBOL 2 ORACLE Server 7/8/9 gateway 
** 
**  MODULE DESCRIPTION: 
** 
**      It's a simple test programe to demonstarate and testing the DIBOL/ORA Gateway API. 
** 
**  AUTHORS: 
** 
**      Ruslan R. Laishev 
** 
**  CREATION DATE:   15-MAR-2002 
** 
** 
**  BUILD: 
**   
** $CC /INCLUDE=([],ORA_RDBMS,ORA_OCI_DEMO) 
** $LINK DBL_ORAGTWY_EXAMPLE.OBJ,SYS$INPUT/OPT 
** dev:[dir]DBL_ORAGTWY.EXE/SHARE 
** ^Z 
**   
** 
**  MODIFICATION HISTORY: 
** 
**      {@tbs@}... 
**-- 
*/ 
 
 
/* 
** 
**  INCLUDE FILES 
** 
*/ 
 
#include <stdio.h> 
#include <starlet.h> 
#include <lib$routines.h> 
#include <ssdef.h> 
#include <descrip.h> 
 
/* 
** 
** DIBOL 2 ORACLE Server 7/8/9 gateway data and structures definitions 
** 
*/ 
#include "dbl_oragtwydef.h" 
 
/* 
** 
** DIBOL 2 ORACLE Server 7/8/9 gateway routines declarations 
** 
*/ 
#include "dbl_oragtwy.h" 
 
 
#define INIT_SDESC(dsc, len, ptr) {(dsc).dsc$b_dtype = DSC$K_DTYPE_T;\
        (dsc).dsc$b_class = DSC$K_CLASS_S; (dsc).dsc$w_length = (len);\
        (dsc).dsc$a_pointer = (ptr);} 
 
 
 
 
void main (void) 
{ 
int status,i; 
$DESCRIPTOR(oracons,"tessco/tessco@ora5"); 
 
char sku[] = "MOTOROLA",sup[] = "646444"; 
char short_name[2048],feature_name[2048],config[] = "PTYPE-213"; 
struct ora_rec ora; 
char buf[1024]; 
struct dsc$descriptor buf_dsc; 
 
 
 
 /* 
 ** Initalize the DBL_ORAGTWY layer, this routine must be called only once 
 ** before calling any other routines of the API. 
 */ 
 if ( status = dbl_oragtwy$init(&oracons) ) 
  printf("dbl_oragtwy$init:ORA-%d\n",status); 
 
 
 /* 
 ** Some test stuff... 
 */ 
 printf("dbl_oragtwy$itemlist_*...\n"); 
  /* 
  ** Open an ORACLE cursor 
  */ 
  if ( status = dbl_oragtwy$itemlist_oc(1) ) 
   { 
   /* 
   ** Obtain a detail diagnostic from the current ORACLE cursor 
   */ 
   INIT_SDESC(buf_dsc,sizeof(buf),buf); 
   dbl_oragtwy$getoramsg(&buf_dsc,&buf_dsc.dsc$w_length); 
   
   /* 
   ** Display error message 
   */ 
   printf("dbl_oragtwy$*_oc:ORA/OCI-%d,%.*s\n",status,buf_dsc.dsc$w_length,buf_dsc.dsc$a_pointer); 
   } 
 
  /* 
  ** Performing a data fetching 10 times 
  */ 
  for( i = 0;i < 10; i++) 
   { 
   /* 
   ** Fetching data 
   */ 
   if ( status = dbl_oragtwy$itemlist_fd(&ora) ) 
    { 
    /* 
    ** Obtain a detail diagnostic from the current ORACLE cursor 
    */ 
    INIT_SDESC(buf_dsc,sizeof(buf),buf); 
    dbl_oragtwy$getoramsg(&buf_dsc,&buf_dsc.dsc$w_length); 
   
    /* 
    ** Display error message 
    */ 
    printf("dbl_oragtwy$*_fd:ORA/OCI-%d,%.*s\n",status,buf_dsc.dsc$w_length,buf_dsc.dsc$a_pointer); 
    } 
 
   /* 
   ** Display a couple fields from fetched record 
   */ 
   printf("ORATYPE:'%.*s',ORAITEM:'%.*s'\n",sizeof(ora.ORATYPE),ora.ORATYPE, 
      sizeof(ora.ORAITEM),ora.ORAITEM); 
   } 
 
  /* 
  ** Close cursor 
  */ 
  if ( status = dbl_oragtwy$itemlist_cc() ) 
   printf("dbl_oragtwy$*_cc:ORA-%d\n",status); 
 
 
 printf("dbl_oragtwy$get_oracle_sku...\n"); 
  if ( status = dbl_oragtwy$get_oracle_sku (sku,sizeof(sku)-1,sup,sizeof(sup)-1,&ora) ) 
   { 
   /* 
   ** Obtain a detail diagnostic from the current ORACLE cursor 
   */ 
   INIT_SDESC(buf_dsc,sizeof(buf),buf); 
   dbl_oragtwy$getoramsg(&buf_dsc,&buf_dsc.dsc$w_length); 
   
   /* 
   ** Display error message 
   */ 
   printf("dbl_oragtwy$get_oracle_sku:ORA/OCI-%d,%.*s\n",status,buf_dsc.dsc$w_length,buf_dsc.dsc$a_pointer); 
   } 
 
  printf("ORATYPE:'%.*s',ORAITEM:'%.*s'\n",sizeof(ora.ORATYPE),ora.ORATYPE, 
   sizeof(ora.ORAITEM),ora.ORAITEM); 
 
 printf("dbl_oragtwy$item_catlist_*...\n"); 
  if ( status = dbl_oragtwy$item_catlist_oc(sku,sizeof(sku)-1,sup,sizeof(sup)-1) ) 
   printf("dbl_oragtwy$*_oc:ORA-%d\n",status); 
 
  if ( status = dbl_oragtwy$item_catlist_fd(short_name,sizeof(short_name)-1,feature_name,sizeof(feature_name)-1) ) 
   printf("dbl_oragtwy$*_fd:ORA-%d\n",status); 
 
  if ( status = dbl_oragtwy$item_catlist_cc() ) 
   printf("dbl_oragtwy$*_cc:ORA-%d\n",status); 
 
 printf("dbl_oragtwy$brand_catlist_*...\n"); 
  if ( status = dbl_oragtwy$brand_catlist_oc(sku,sizeof(sku)-1,sup,sizeof(sup)-1,config,sizeof(config)-1) ) 
   printf("dbl_oragtwy$*_oc:ORA-%d\n",status); 
 
  if ( status = dbl_oragtwy$brand_catlist_fd(short_name,sizeof(short_name)-1,feature_name,sizeof(feature_name)-1) ) 
   { 
   /* 
   ** Obtain a detail diagnostic from the current ORACLE cursor 
   */ 
   INIT_SDESC(buf_dsc,sizeof(buf),buf); 
   dbl_oragtwy$getoramsg(&buf_dsc,&buf_dsc.dsc$w_length); 
   
   /* 
   ** Display error message 
   */ 
   printf("dbl_oragtwy$*_fd:ORA/OCI-%d,%.*s\n",status,buf_dsc.dsc$w_length,buf_dsc.dsc$a_pointer); 
   } 
 
  if ( status = dbl_oragtwy$brand_catlist_cc() ) 
   printf("dbl_oragtwy$*_cc:ORA-%d\n",status); 
 
 /* 
 ** Deallocate resourses 
 */ 
 dbl_oragtwy$shut(); 
} 
 
      

Previous Contents Contents