| Previous | Contents |
Close an ITEM_SUBLIST cursor.
status =dbl_oragtwy$item_sublist
VMS usage: type: longword integer access: read only mechanism: by value ORACLE OCI Error code
Close an ITEM_SUBLIST cursor by calling a corresponding SP.
0 Indicates successful completion Positive Non-critical SQL Error Negative Critical SQL Error
Fetch data from ITEM_SUBLIST cursor by calling an ORACLE SP ITEM_SUBLIST_FD:.
status =dbl_oragtwy$item_sublist_fd
sku1 ,sku1len ,sup1 ,sup1len ,type1 ,type1len ,sku2 ,sku2len ,sup2 ,sup2len ,type2 ,type2len
VMS usage: type: longword integer access: read only mechanism: by value ORACLE OCI Error code
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.
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.
0 Indicates successful completion Positive Non-critical SQL Error Negative Critical SQL Error
Rollback a current ORACLE transaction.
status =dbl_oragtwy$ora_rtc
VMS usage: type: longword integer access: read only mechanism: by value ORACLE OCI Error code
Rollback a current transaction by executing ORACLE ROLLBACK SQL statement.
0 Indicates successful completion Positive Non-critical SQL Error Negative Critical SQL Error
Commit a current ORACLE transaction.
status =dbl_oragtwy$ora_ctc
VMS usage: type: longword integer access: read only mechanism: by value ORACLE OCI Error code
Commit a current transaction by executing ORACLE COMMIT SQL statement.
0 Indicates successful completion Positive Non-critical SQL Error Negative Critical SQL Error
Fetch data by calling GET_ORACLE_SKU:.
status=dbl_oragtwy$item_sublist_fd sku ,skulen ,sup ,suplen ,ora
VMS usage: type: longword integer access: read only mechanism: by value ORACLE OCI Error code
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.
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.
This routine can fetch only one record at any time. |
0 Indicates successful completion Positive Non-critical SQL Error Negative Critical SQL Error
Open an ITEMLIST cursor.
status=dbl_oragtwy$itemlist_oc legacy_seq
legacy_seq
VMS usage: longword integer type: read only access: by value mechanism:
A legacy_seq parameter.
VMS usage: type: longword integer access: read only mechanism: by value ORACLE OCI Error code
Open a ITEMLIST cursor by calling a corresponding SP.
0 Indicates successful completion Positive Non-critical SQL Error Negative Critical SQL Error
Close an ITEMLIST cursor.
status =dbl_oragtwy$itemlist
VMS usage: type: longword integer access: read only mechanism: by value ORACLE OCI Error code
Close an ITEMLIST cursor by calling a corresponding SP.
0 Indicates successful completion Positive Non-critical SQL Error Negative Critical SQL Error
Fetch data from ITEMLIST cursor by calling an ORACLE SP ITEMLIST_FD:.
status=dbl_oragtwy$itemlist_fd ora
VMS usage: type: longword integer access: read only mechanism: by value ORACLE OCI Error code
ora
VMS usage: type: record access: write only mechanism: by reference
A record to accept fetched data.
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.
0 Indicates successful completion Positive Non-critical SQL Error Negative Critical SQL Error
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();
...
}
|
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.
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 |