⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ocidef.h

📁 ORACLE访问接口
💻 H
📖 第 1 页 / 共 3 页
字号:
 
/* macros to check cursors and LDA's.  */
/* macros to set error codes	       */

# define CRSCHK(c)     if ((c->csrchk != CSRCHECK)\
                            && !bit(c->csrflg, CSRFREFC))\
			  return(ocir32(c, OER(1001)))
# define ldaerr(l, e)  ( l->csrrc = (b2)(-( l->csrarc = (ub2)(e)) ) )
# define LDACHK(l)     if (l->csrchk != LDACHECK) \
			  return(ldaerr(l, OER(1001)))
 

/************************************************/
/*     	   OCI PROCEDURE DECLARATIONS  	        */
/************************************************/ 




/*****************************/
/*  Database logon/logout    */
/*****************************/
sword ocilog( /*_ ldadef *lda, struct hstdef *hst, text *uid, sword uidl, 
                  text *psw, sword pswl, text* conn, sword connl,
                  ub4 mode _*/);
sword ocilon( /*_ ldadef *lda, text *uid, word uidl, text *psw, word pswl,
                  word audit _*/);
sword  ocilgi( /*_ ldadef *lda, b2 areacount _*/ );
sword ocirlo( /*_ ldadef *lda, struct hstdef *hst, text *uid, word uidl,
	    text *psw, word pswl, word audit _*/ );
     /* ocilon - logon to oracle
     ** ocilgi - version 2 compatible ORACLE logon call.
     **          no login to ORACLE is performed: the LDA is initialized
     ** ocirlo - version 5 compatible ORACLE Remote Login call,
     **          oracle login is executed.
     **	  lda     - pointer to ldadef
     **	  uid	  - user id [USER[/PASSWORD]]
     **	  uidl	  - length of uid, if -1 strlen(uid) is used
     **   psw	  - password string; ignored if specified in uid
     **   pswl	  - length of psw, if -1 strlen(psw) is used
     **   audit   - is not supported; the only permissible value is 0
     **   areacount - unused
     */

sword ocilof( /*_ ldadef *lda _*/ );
     /*
     ** ocilof - disconnect from ORACLE
     **	  lda     - pointer to ldadef
     */


/*********************/
/*   Error Messages  */
/*********************/
sword ocierr( /*_ ldadef *lda, b2 rcode, text *buffer, word bufl _*/ );
sword ocidhe( /*_ b2 rcode, text *buffer _*/ );
    /* 
    ** Move the text explanation for an ORACLE error to a user defined buffer
    **  ocierr - will return the message associated with the hstdef stored 
    **           in the lda.
    **  ocidhe - will return the message associated with the default host.
    **    lda    - lda associated with the login session
    **    rcode  - error code as returned by V3 call interface
    **	  buffer - address of a user buffer of at least 132 characters
    */


/***********************/
/*  Cursor Open/Close  */
/***********************/
sword ociope( /*_ struct csrdef *cursor, ldadef *lda, text *dbn, word dbnl, 
                 word areasize, text *uid, word uidl _*/ );

sword ociclo( /*_ struct csrdef *cursor _*/ );
   /* 
   ** open or close a cursor.
   **   cursor - pointer to csrdef
   **	ldadef - pointer to ldadef
   **   dbn    - unused
   **	dbnl   - unused
   **   areasize - if (areasize == -1)	areasize <- system default initial size
   **              else if (areasize IN [1..256]) areasize <- areasize * 1024;
   **              most applications should use the default size since context
   **              areas are extended as needed until memory is exhausted.
   **   uid    - user id
   **   uidl   - userid length
   */

/***********************************/
/*	CONTROL AND OPTIONS	   */
/***********************************/
sword ocibre( /*_ ldadef *lda _*/ );
   /*
   **  ocibrk - Oracle Call Interface send BReaK Sends a break to
   **  oracle.  If oracle is  active,  the  current  operation  is
   **  cancelled.  May be called  asynchronously.   DOES  NOT  SET
   **  OERRCD in the hst.  This is because ocibrk  may  be  called
   **  asynchronously.  Callers must test the return code.
   **    lda  - pointer to a ldadef 
   */

sword ocican( /*_ struct csrdef *cursor _*/ );
   /*
   **  cancel the operation on the cursor, no additional OFETCH calls
   **  will be issued for the existing cursor without an intervening 
   **  OEXEC call.
   **   cursor  - pointer to csrdef
   */

sword ocisfe( /*_ struct csrdef *cursor, word erropt, word waitopt _*/ );
   /* 
   ** ocisfe - user interface set error options
   ** set the error and cursor options.
   ** allows user to set the options for dealing with fatal dml errors
   ** and other cursor related options
   ** see oerdef for valid settings
   **   cursor  - pointer to csrdef
   **	erropt  - error optionsn
   **   waitopr - wait options
   */


/***************************************/
/* COMMIT/ROLLBACK/AUTOCOMMIT	       */
/***************************************/
sword   ocicom( /*_ ldadef *lda _*/ );
sword   ocirol( /*_ ldadef *lda _*/ );
   /*
   ** ocicom - commit the current transaction
   ** ocirol - roll back the current transaction
   */
 
sword   ocicon( /*_ ldadef *lda _*/ );
sword   ocicof( /*_ ldadef *lda _*/ );
   /*
   ** ocicon - auto Commit ON
   ** ocicof - auto Commit OFf
   */


 
/************************/
/*     parsing		*/
/************************/
sword	 ocisq3( /*_ struct csrdef *cursor, text *sqlstm, word sqllen _*/ );
   /*
   ** ocisq3 - user interface parse sql statement
   **	cursor - pointer to csrdef
   **	sqlstm - pointer to SQL statement
   **	sqllen - length of SQL statement.  if -1, strlen(sqlstm) is used
   */



/***************************/
/*	BINDING 	   */
/***************************/
/* these are for the opcode in ocibndps, ocidfnps */
#define OCI_PCWS 0
#define OCI_SKIP 1

sword ocibin( /*_ struct csrdef *cursor, text *sqlvar, word sqlvl, ub1 *progv,
	   word progvl, word ftype, word scale, text *fmt, word fmtl,
	   word fmtt _*/ );
sword  ocibrv( /*_ struct csrdef *cursor, text *sqlvar, word sqlvl, ub1 *progv,
  	         word progvl, word ftype, word scale, b2 *indp, text *fmt,
		 word fmtl, word fmtt _*/ );
sword  ocibra( /*_ struct csrdef *cursor, text *sqlvar, word sqlvl, ub1 *progv,
  	         word progvl, word ftype, word scale, b2 *indp, ub2 *aln,
                 ub2 *rcp, ub4 mal, ub4 *cal, text *fmt,
		 word fmtl, word fmtt _*/ );
sword  ocibndps( /*_ struct csrdef *cursor, ub1 opcode, text *sqlvar, sb4 sqlvl, 
		   ub1 *progv, sb4 progvl, word ftype, word scale, b2 *indp, 
		   ub2 *aln, ub2 *rcp, 
		   sb4 pv_skip, sb4 ind_skip, sb4 len_skip, sb4 rc_skip,
		   ub4 mal, ub4 *cal, text *fmt, sb4 fmtl, word fmtt _*/ );
sword ocibnn ( /*_ struct csrdef *cursor, ub2 sqlvn, ub1 *progv, word progvl,
             word ftype, word scale, text *fmt, word fmtl, word fmtt _*/ );
sword  ocibrn( /*_ struct csrdef *cursor, word sqlvn, ub1 *progv, word progvl,
                  word ftype, word scale, b2 *indp, text *fmt, word fmtl, 
		  word fmtt _*/ );
    /*
    ** ocibin - bind by value by name
    ** ocibrv - bind by reference by name
    ** ocibra - bind by reference by name (array)
    ** ocibndps - bind by reference by name (array) piecewise or with skips
    ** ocibnn - bind by value numeric
    ** ocibrn - bind by reference numeric
    **
    ** the contents of storage specified in bind-by-value calls are
    ** evaluated immediately.
    ** the addresses of storage specified in bind-by-reference calls are
    ** remembered, and the contents are examined at every execute.
    **
    **  cursor	- pointer to csrdef
    **  sqlvn	- the number represented by the name of the bind variables
    **		  for variables of the form :n or &n for n in [1..256)
    **		  (i.e. &1, :234).  unnecessarily using larger numbers
    **		  in the range wastes space.
    **  sqlvar	- the name of the bind variable (:name or &name)
    **  sqlval	- the length of the name;
    **		  in bindif -1, strlen(bvname) is used
    **  progv	- pointer to the object to bind.
    **  progvl	- length of object to bind.
    **		  in bind-by-value if specified as -1 then strlen(bfa) is
    **		    used (really only makes sends with character types)
    **		  in bind-by-value, if specified as -1 then UB2MAXVAL
    **		    is used.  Again this really makes sense only with
    **		    SQLT_STR.
    **  ftype	- datatype of object
    **  indp	- pointer to indicator variable.
    **		    -1	   means to ignore bfa/bfl and bind NULL;
    **		    not -1 means to bind the contents of bfa/bfl
    **		    bind the contents pointed to by bfa
    **  aln     - Alternate length pointer
    **  rcp     - Return code pointer
    **  mal     - Maximum array length
    **  cal     - Current array length pointer
    **  fmt	- format string
    **  fmtl	- length of format string; if -1, strlen(fmt) is used
    **  fmtt	- desired output type after applying forat mask. Not
    **		  really yet implemented
    **  scale   - number of decimal digits in a cobol packed decimal (type 7)
    **
    ** Note that the length of bfa when bound as SQLT_STR is reduced
    ** to strlen(bfa).
    ** Note that trailing blanks are stripped of storage of SQLT_STR.
    */
    
/***************************/
/*        DESCRIBING       */
/***************************/
sword ocidsc ( /*_ struct csrdef *cursor, word pos, b2 *dbsize, b2 *fsize,
             b2 *rcode, b2 *dtype, b1 *buf, b2 *bufl, b2 *dsize _*/ );
sword ocidsr( /*_ struct csrdef *cursor, word pos, b2 *dbsize, b2 *dtype, 
	    b2 *fsize _*/ );
sword	ocinam( /*_ struct csrdef *cursor, word pos, b1 *tbuf, b2 *tbufl,
	        b1 *buf, b2 *bufl _*/);
    /*
    **  ocidsc, ocidsr: Obtain information about a column
    **  ocinam : get the name of a column
    **   cursor	 - pointer to csrdef
    **	 pos	 - position in select list from [1..N]
    **   dbsize	 - place to store the database size
    **   fsize   - place to store the fetched size
    **   rcode   - place to store the fetched column returned code
    **   dtype   - place to store the data type
    **   buf     - array to store the column name
    **   bufl    - place to store the column name length
    **   dsize   - maximum display size
    **	 tbuf	 - place to store the table name
    **	 tbufl	 - place to store the table name length
    */

sword ocidsp ( /*_ struct csrdef *cursor, word pos, b4 *dbsize, b2 *dbtype,
                   b1 *cbuf, b4 *cbufl, b4 *dsize, sb2 *pre, sb2 *scl,
                   sb2 *nul _*/);

sword ocidpr(/*_ ldadef *lda, text *object_name, size_t object_length,
                ptr_t reserved1, size_t reserved1_length, ptr_t reserved2,
                size_t reserved2_length, ub2 *overload, ub2 *position,
                ub2 *level, text **argument_name, ub2 *argument_length, 
                ub2 *datatype, ub1 *default_supplied, ub1 *in_out, 
                ub4 *length, sb2 *precision, sb2 *scale, ub1 *radix, 
                ub4 *spare, ub4 *total_elements _*/);
   /*
   ** OCIDPR - User Program Interface: Describe Stored Procedure
   **
   ** This routine is used to obtain information about the calling
   ** arguments of a stored procedure.  The client provides the 
   ** name of the procedure using "object_name" and "database_name"
   ** (database name is optional).  The client also supplies the 
   ** arrays for OCIDPR to return the values and indicates the 
   ** length of array via the "total_elements" parameter.  Upon return
   ** the number of elements used in the arrays is returned in the 
   ** "total_elements" parameter.  If the array is too small then 
   ** an error will be returned and the contents of the return arrays 
   ** are invalid.
   **
   **
   **   EXAMPLE :
   **
   **   Client provides -
   **
   **   object_name    - SCOTT.ACCOUNT_UPDATE@BOSTON
   **   total_elements - 100
   **   
   **
   **   ACCOUNT_UPDATE is an overloaded function with specification :
   **
   **     type number_table is table of number index by binary_integer;
   **     table account (account_no number, person_id number,
   **                    balance number(7,2))
   **     table person  (person_id number(4), person_nm varchar2(10))
   **
   **      function ACCOUNT_UPDATE (account number, 
   **         person person%rowtype, amounts number_table,
   **         trans_date date) return accounts.balance%type;
   **
   **      function ACCOUNT_UPDATE (account number, 
   **         person person%rowtype, amounts number_table,
   **         trans_no number) return accounts.balance%type;
   **
   **
   **   Values returned -
   **
   **   overload position   argument  level  datatype length prec scale rad
   **   -------------------------------------------------------------------
   **          0        0                0   NUMBER     22    7     2   10
   **          0        1   ACCOUNT      0   NUMBER     22    0     0    0
   **          0        2   PERSON       0   RECORD      0    0     0    0
   **          0        2     PERSON_ID  1   NUMBER     22    4     0   10
   **          0        2     PERSON_NM  1   VARCHAR2   10    0     0    0
   **          0        3   AMOUNTS      0   TABLE       0    0     0    0
   **          0        3                1   NUMBER     22    0     0    0
   **          0        4   TRANS_NO     0   NUMBER     22    0     0    0
   **
   **          1        0                0   NUMBER     22    7     2   10
   **          1        1   ACCOUNT      0   NUMBER     22    0     0    0
   **          1        2   PERSON       0   RECORD      0    0     0    0
   **          1        2    PERSON_ID   1   NUMBER     22    4     0   10

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -