home *** CD-ROM | disk | FTP | other *** search
- /* orafns.h
- *
- * Common declarations for the Oraperl functions
- */
- /* Copyright 1991 Kevin Stock.
- *
- * You may copy this under the terms of the GNU General Public License,
- * a copy of which should have accompanied your Perl kit.
- */
-
-
- /* public functions to be called by Perl programs */
-
- char *ora_login(),
- *ora_open(),
- *ora_close(),
- *ora_logoff();
-
- int ora_fetch();
-
-
- /* These functions are internal to the system, not for public consumption */
-
- struct cursor *ora_getcursor(),
- *ora_getlda();
-
- int ora_dropcursor(),
- ora_droplda();
-
-
- /* definition of the csrdef structure - taken from the oracle sample program */
-
- struct csrdef
- {
- short csrrc; /* return code */
- short csrft; /* function type */
- unsigned long csrrpc; /* rows processed count */
- short csrpeo; /* parse error offset */
- unsigned char csrfc; /* function code */
- unsigned char csrfil; /* filler */
- unsigned short csrarc; /* reserved, private */
- unsigned char csrwrn; /* warning flags */
- unsigned char csrflg; /* error flags */
- /* *** Operating system dependent *** */
- unsigned int csrcn; /* cursor number */
- struct { /* rowid structure */
- struct {
- unsigned long tidtrba; /* rba of first blockof table */
- unsigned short tidpid; /* partition id of table */
- unsigned char tidtbl; /* table id of table */
- } ridtid;
- unsigned long ridbrba; /* rba of datablock */
- unsigned short ridsqn; /* sequence number of row in block */
- } csrrid;
- unsigned int csrose; /* os dependent error code */
- unsigned char csrchk; /* check byte */
- unsigned char crsfill[26]; /* private, reserved fill */
- };
-
-
- /* data structure for the pool of cursors */
-
- struct cursor
- {
- struct csrdef *csr;
- char *hda, /* used if this cursor is an lda */
- **data; /* used to receive database contents */
- int nfields; /* number of fields to retrieve */
- struct cursor *next; /* list pointer */
- };
-
-
- /* functions that we use */
-
- long strtol();
- char *getenv(), *malloc();
-
-
- /* variables accesible to the outside world */
-
- EXT int ora_debug, ora_errno;
- EXT char **ora_result;
-
-
- /* Debugging calls.
- *
- * I've tried to give these some compatibility with Larry's -D flag,
- * but allowing some flexibility so that we can debug the oracle functions
- * without debugging perl as well.
- *
- * If your uperl.o was built with -DDEBUGGING, you can define PERL_DEBUGGING
- * and the oraperl debugging will be initialiased from the -D flag. If not,
- * you can still define DEBUGGING, but you will have to set ora_debug from
- * within your program.
- *
- * At present, the only flags used are:
- * 8 program execution - report function entry and exit
- * 128 use of malloc/free
- */
-
- #ifdef PERL_DEBUGGING
- # ifndef DEBUGGING
- # define DEBUGGING
- # endif
- #endif
-
- #ifdef DEBUGGING
- # define DEBUG(flag, stmt) { if (ora_debug & flag) { (stmt); } }
- # ifdef PERL_DEBUGGING
- extern int debug; /* exists in uperl.o */
- # else
- EXT int debug; /* need to create it ourselves */
- # endif
- #else
- # define DEBUG(flag, stmt)
- #endif
-
-
- /* error codes for ORAPERL
- *
- * These are higher than any possible ORACLE error code,
- * so that they can be distinguished
- */
-
- #define ORAP_ERRMIN 100000 /* lowest value allowed for an oraperl error */
-
- #define ORAP_NOMEM 100001 /* out of memory */
- #define ORAP_INVCSR 100002 /* invalid cursor supplied */
- #define ORAP_INVLDA 100003 /* invalid lda supplied */
- #define ORAP_NOSID 100004 /* couldn't set ORACLE_SID */
-