OCILIB (C Driver for Oracle) 3.12.1
ocilib_types.h
00001 /*
00002     +-----------------------------------------------------------------------------------------+
00003     |                                                                                         |
00004     |                               OCILIB - C Driver for Oracle                              |
00005     |                                                                                         |
00006     |                                (C Wrapper for Oracle OCI)                               |
00007     |                                                                                         |
00008     |                              Website : http://www.ocilib.net                            |
00009     |                                                                                         |
00010     |             Copyright (c) 2007-2013 Vincent ROGIER <vince.rogier@ocilib.net>            |
00011     |                                                                                         |
00012     +-----------------------------------------------------------------------------------------+
00013     |                                                                                         |
00014     |             This library is free software; you can redistribute it and/or               |
00015     |             modify it under the terms of the GNU Lesser General Public                  |
00016     |             License as published by the Free Software Foundation; either                |
00017     |             version 2 of the License, or (at your option) any later version.            |
00018     |                                                                                         |
00019     |             This library is distributed in the hope that it will be useful,             |
00020     |             but WITHOUT ANY WARRANTY; without even the implied warranty of              |
00021     |             MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU           |
00022     |             Lesser General Public License for more details.                             |
00023     |                                                                                         |
00024     |             You should have received a copy of the GNU Lesser General Public            |
00025     |             License along with this library; if not, write to the Free                  |
00026     |             Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.          |
00027     |                                                                                         |
00028     +-----------------------------------------------------------------------------------------+
00029 */
00030 
00031 /* --------------------------------------------------------------------------------------------- *
00032  * $Id: ocilib_types.h, Vincent Rogier $
00033  * --------------------------------------------------------------------------------------------- */
00034 
00035 #ifndef OCILIB_OCILIB_TYPES_H_INCLUDED
00036 #define OCILIB_OCILIB_TYPES_H_INCLUDED
00037 
00038 #include "ocilib_defs.h"
00039 
00040 /* ********************************************************************************************* *
00041  *                             PRIVATE TYPES
00042  * ********************************************************************************************* */
00043 
00044 /*
00045  * OCI_Item : Internal list entry.
00046  *
00047  * The library needs to manage internal list of objects in order to be able to
00048  * free them if the application doest not.
00049  *
00050  * @note
00051  * Internal lists are using mutexes for resource locking in multithreaded
00052  * environments
00053  *
00054  */
00055 
00056 struct OCI_Item
00057 {
00058     void            *data; /* pointer to external data */
00059     struct OCI_Item *next; /* next element in list */
00060 };
00061 
00062 typedef struct OCI_Item OCI_Item;
00063 
00064 /*
00065  * OCI_List : Internal list object.
00066  *
00067  * The OCI_List object is used to maintain a collection of handles allocated
00068  * by user programs.
00069  *
00070  * Those handles are freed when the collection owner is destroyed.
00071  * So, we make sure that if OCI_Cleanup() is called, all allocated handles will
00072  * be destroyed even if the program does not free them.
00073  *
00074  */
00075 
00076 struct OCI_List
00077 {
00078     OCI_Item  *head;     /* pointer to first item */
00079     OCI_Mutex *mutex;    /* mutex handle */
00080     ub4        count;    /* number of elements in list */
00081     int        type;     /* type of list item */
00082 };
00083 
00084 typedef struct OCI_List OCI_List;
00085 
00086 /*
00087  * Server output object used to retrieve server dbms.output buffers
00088  *
00089  */
00090 
00091 struct OCI_ServerOutput
00092 {
00093     ub1           *arrbuf;         /* array buffer */
00094     unsigned int   arrsize;        /* array size */
00095     unsigned int   cursize;        /* number of filled items in the array */
00096     unsigned int   curpos;         /* current position in the array */
00097     unsigned int   lnsize;         /* line size */
00098     OCI_Statement *stmt;           /* pointer to statement object (dbms_output calls) */
00099 };
00100 
00101 typedef struct OCI_ServerOutput OCI_ServerOutput;
00102 
00103 /*
00104  * Connection trace information
00105  *
00106  */
00107 
00108 struct OCI_TraceInfo
00109 {
00110     mtext identifier[OCI_SIZE_TRACE_ID+1];
00111     mtext module[OCI_SIZE_TRACE_MODULE+1];
00112     mtext action[OCI_SIZE_TRACE_ACTION+1];
00113     mtext info[OCI_SIZE_TRACE_INF0+1];
00114 };
00115 
00116 typedef struct OCI_TraceInfo OCI_TraceInfo;
00117 
00118 /* ********************************************************************************************* *
00119  *                             PUBLIC TYPES
00120  * ********************************************************************************************* */
00121 
00122 struct OCI_Error
00123 {
00124     boolean         raise;                    /* Error flag */
00125     boolean         active;                   /* to avoid recursive exceptions */
00126     OCI_Connection *con;                      /* pointer to connection object */
00127     OCI_Statement  *stmt;                     /* pointer to statement object */
00128     sb4             ocode;                    /* Oracle OCI error code */
00129     int             icode;                    /* OCILIB internal error code */
00130     unsigned int    type;                     /* OCILIB error type */
00131     ub4             row;                      /* Error row offset (array DML) */
00132     boolean         warning;                  /* is it a warning */
00133     mtext           str[OCI_ERR_MSG_SIZE+1];  /* error message */
00134     mtext           padding[3];               /* dummy variable for alignment */ 
00135 };
00136 
00137 /*
00138  * Mutex object
00139  *
00140  * Mutexes have their own error handle to avoid conflict using OCIErrorGet()
00141  * from different threads
00142  *
00143  */
00144 
00145 struct OCI_Mutex
00146 {
00147     OCIThreadMutex *handle;   /* OCI Mutex handle */
00148     OCIError       *err;      /* OCI Error handle */
00149 };
00150 
00151 /*
00152  * Thread object
00153  *
00154  * Threads have their own error handle to avoid conflict using OCIErrorGet()
00155  *
00156  */
00157 
00158 struct OCI_Thread
00159 {
00160     OCIThreadHandle *handle;    /* OCI Thread handle */
00161     OCIThreadId     *id;        /* OCI Thread ID */
00162     OCIError        *err;       /* OCI Error handle */
00163     void            *arg;       /* thread routine argument */
00164     POCI_THREAD      proc;      /* thread routine */
00165 };
00166 
00167 /*
00168  * Thread key object
00169  *
00170  * Thread keys have their own error handle to avoid conflict using OCIErrorGet()
00171  * from differents threads
00172  *
00173  */
00174 
00175 struct OCI_ThreadKey
00176 {
00177     OCIThreadKey *handle;     /* OCI Thread key handle */
00178     OCIError     *err;        /* OCI Error handle */
00179 };
00180 
00181 typedef struct OCI_ThreadKey OCI_ThreadKey;
00182 
00183 /*
00184  * OCI_Library : Internal OCILIB library encapsulation.
00185  *
00186  * It's a static, local and unique object that collects all the global variables
00187  * needed by the library
00188  *
00189  */
00190 
00191 struct OCI_Library
00192 {
00193     OCI_List            *cons;                    /* list of connection objects */
00194     OCI_List            *pools;                   /* list of pools objects */
00195     OCI_List            *subs;                    /* list of subscription objects */
00196     OCI_List            *arrs;                    /* list of arrays objects */
00197     OCIError            *err;                     /* OCI error handle */
00198     OCIEnv              *env;                     /* OCI environment handle */
00199     POCI_ERROR           error_handler;           /* user defined error handler */
00200     unsigned int         version_compile;         /* OCI version used at compile time */
00201     unsigned int         version_runtime;         /* OCI version used at runtime */
00202     boolean              use_lob_ub8;             /* use 64 bits integers for lobs ? */
00203     boolean              use_xa;                   /* is xa enabled */
00204     boolean              use_scrollable_cursors;  /* use Oracle 9i fetch API */
00205     ub4                  env_mode;                /* default environment mode */
00206     boolean              loaded;                  /* OCILIB correctly loaded ? */
00207     boolean              nls_utf8;                /* is UFT8 enabled for data strings ? */
00208     boolean              warnings_on;             /* warnings enabled ? */
00209     OCI_Error            lib_err;                 /* Error used when OCILIB is not loaded */
00210     OCI_HashTable       *key_map;                 /* hash table for mapping name/key */
00211     OCI_ThreadKey       *key_errs;                /* Thread key to store thread errors */
00212     unsigned int         nb_hndlp;                /* number of OCI handles allocated */
00213     unsigned int         nb_descp;                /* number of OCI descriptors allocated */
00214     unsigned int         nb_objinst;              /* number of OCI objects allocated */
00215     OCI_HashTable       *sql_funcs;               /* hash table handle for sql function names */
00216     POCI_HA_HANDLER      ha_handler;              /* HA event callback*/
00217 #ifdef OCI_IMPORT_RUNTIME
00218     LIB_HANDLE           lib_handle;              /* handle of runtime shared library */
00219 #endif
00220 };
00221 
00222 typedef struct OCI_Library OCI_Library;
00223 
00224 /*
00225  * Pool object
00226  *
00227  */
00228 
00229 struct OCI_Pool
00230 {
00231     OCI_List    *cons;          /* list of connection objects */
00232     void        *handle;        /* OCI pool handle */
00233     void        *authp;         /* OCI authentification handle */
00234     OCIError    *err;           /* OCI context handle */
00235     mtext       *name;          /* pool name */
00236     mtext       *db;            /* database */
00237     mtext       *user;          /* user */
00238     mtext       *pwd;           /* password */
00239     OCI_Mutex   *mutex;         /* mutex handle */
00240     ub4          mode;          /* session mode */
00241     ub4          min;           /* minimum of objects */
00242     ub4          max;           /* maximum of objects */
00243     ub4          incr;          /* increment step of objects */
00244     unsigned int nb_busy;       /* number of busy objects */
00245     unsigned int nb_opened;     /* number of opened objects */
00246     unsigned int timeout;       /* connection idle timeout */
00247     boolean      nowait;        /* wait to retrieve object from pool ? */
00248     ub4          htype;         /* handle type of pool : connection / session */
00249     ub4          cache_size;    /* statement cache size */
00250 };
00251 
00252 /*
00253  * Connection object
00254  *
00255  */
00256 
00257 struct OCI_Connection
00258 {
00259     mtext            *db;           /* database */
00260     mtext            *user;         /* user */
00261     mtext            *pwd;          /* password */
00262     OCI_List         *stmts;        /* list of statements */
00263     OCI_List         *trsns;        /* list of transactions */
00264     OCI_List         *tinfs;        /* list of type info objects */
00265     OCI_Transaction  *trs;          /* pointer to current transaction object */
00266     OCI_Pool         *pool;         /* pointer to parent pool object */
00267     OCI_ServerOutput *svopt;        /* Pointer to server output object */
00268     OCIServer        *svr;          /* OCI server handle */
00269     OCIError         *err;          /* OCI context handle */
00270     OCIEnv           *env;          /* OCI environment handle */
00271     OCISession       *ses;          /* OCI session handle */
00272     OCISvcCtx        *cxt;          /* OCI context handle */
00273     boolean           autocom;      /* auto commit mode */
00274     unsigned int      nb_files;     /* number of OCI_File opened by the connection */
00275     boolean           alloc_handles;/* do new need to allocate OCI handles ? */
00276     unsigned int      mode;         /* session mode */
00277     int               cstate;       /* connection state */
00278     void             *usrdata;      /* user data */
00279     mtext            *fmt_date;     /* date string format for conversion */
00280     mtext            *fmt_num;      /* numeric string format for conversion */
00281     mtext            *ver_str;      /* string  server version*/
00282     unsigned int      ver_num;      /* numeric server version */
00283     OCI_TraceInfo    *trace;        /* trace information */
00284     mtext            *sess_tag;     /* session tag */
00285     POCI_TAF_HANDLER  taf_handler;  /* failover call back */
00286     mtext            *db_name;      /* session tag */
00287     mtext            *inst_name;    /* instance name */
00288     mtext            *service_name; /* server service name */
00289     mtext            *server_name;  /* server name (hostname) */
00290     mtext            *domain_name;  /* server domain name */
00291     OCI_Timestamp    *inst_startup; /* instance startup timestamp */
00292  };
00293 
00294 /*
00295  * Transaction object
00296  *
00297  */
00298 
00299 struct OCI_Transaction
00300 {
00301     OCI_Connection *con;        /* pointer to connection object */
00302     OCITrans       *htr;        /* OCI transaction handle */
00303     unsigned int    timeout;    /* timeout */
00304     unsigned int    mode;       /* transaction mode */
00305     boolean         local;      /* is local transaction ? */
00306     OCI_XID         xid;        /* global transaction identifier */
00307 };
00308 
00309 /*
00310  * Column object
00311  *
00312  */
00313 
00314 struct OCI_Column
00315 {
00316     /* 0racle infos */
00317     ub2    ocode;               /* Oracle SQL code */
00318     ub2    tcode;               /* Oracle type code */
00319     ub2    icode;               /* Internal translated Oracle SQL code */
00320     ub2    size;                /* SQL Size */
00321     sb2    prec;                /* SQL precision 1 (number prec, leading prec) */
00322     sb2    prec2;               /* SQL precision 2 (fractional prec) */
00323     sb1    scale;               /* SQL scale */
00324     ub1    type;                /* internal datatype */
00325     ub1    null;                /* is nullable */
00326     ub1    charused;            /* is column size expressed in characters */
00327     mtext *name;                /* column name */
00328     ub2    charsize;            /* SQL Size in character */
00329     ub1    csfrm;               /* charset form */
00330     ub1    dtype;               /* oracle handle type */
00331     /* OCILIB infos */
00332     ub4           bufsize;      /* element size */
00333     OCI_TypeInfo *typinf;       /* user type descriptor */
00334     ub4           subtype;      /* object type */
00335 };
00336 
00337 /*
00338  * OCI_Buffer : Internal input/output buffer
00339  *
00340  */
00341 
00342 struct OCI_Buffer
00343 {
00344     void        *handle;       /* OCI handle (bind or define) */
00345     void       **data;         /* data / array of data */
00346     void        *inds;         /* array of indicators */
00347     void        *lens;         /* array of lengths */
00348     dtext       *tmpbuf;       /* temporary buffer for string conversion */
00349     unsigned int tmpsize;      /* size of temporary buffer */
00350     ub4          count;        /* number of elements in the buffer */
00351     int          sizelen;      /* size of an element in the lens array */
00352     void       **obj_inds;     /* array of indicators structure object */
00353 };
00354 
00355 typedef struct OCI_Buffer OCI_Buffer;
00356 
00357 /*
00358  * OCI_Bind object
00359  *
00360  */
00361 
00362 struct OCI_Bind
00363 {
00364     OCI_Statement *stmt;        /* pointer to statement object */
00365     void         **input;       /* input values */
00366     mtext         *name;        /* name of the bind */
00367     sb4            size;        /* data size */
00368     ub2           *plrcds;      /* PL/SQL tables return codes */
00369     ub4            nbelem;      /* PL/SQL tables number of elements */
00370     OCI_TypeInfo  *typinf;      /* for object, collection and ref */
00371     ub1            type;        /* internal datatype */
00372     ub1            subtype;     /* internal subtype */
00373     ub2            code;        /* SQL datatype code */
00374     boolean        is_array;    /* is it an array bind ? */
00375     OCI_Buffer     buf;         /* place holder */
00376     ub2            dynpos;      /* index of the bind for dynamic binds */
00377     ub1            alloc;       /* is buffer allocated or mapped to input */
00378     ub1            csfrm;       /* charset form */
00379     ub1            direction;   /* in, out or in/out bind */
00380     char           padding[3];  /* dummy variable for alignment */ 
00381 }
00382 ;
00383 
00384 /*
00385  * OCI_Define : Internal Resultset column data implementation
00386  *
00387  */
00388 
00389 struct OCI_Define
00390 {
00391     OCI_Resultset *rs;             /* pointer to resultset object */
00392     void          *obj;            /* current OCILIB object instance */
00393     OCI_Column     col;            /* column object */
00394     OCI_Buffer     buf;            /* placeholder */
00395 };
00396 
00397 typedef struct OCI_Define OCI_Define;
00398 
00399 /*
00400  * Resultset object
00401  *
00402  */
00403 
00404 struct OCI_Resultset
00405 {
00406     OCI_Statement *stmt;            /* pointer to statement object */
00407     OCI_HashTable *map;             /* hash table handle for mapping name/index */
00408     OCI_Define    *defs;            /* array of define objects */
00409     ub4            nb_defs;         /* number of elements */
00410     ub4            row_cur;         /* actual position in the array of rows */
00411     ub4            row_abs;         /* absolute position in the resultset */
00412     ub4            row_count;       /* number of rows fetched so far */
00413     ub4            row_fetched;     /* rows fetched by last call (scrollable) */
00414     boolean        eof;             /* end of resultset reached ?  */
00415     boolean        bof;             /* beginning of resultset reached ?  */
00416     ub4            fetch_size;      /* internal array size */
00417     sword          fetch_status;    /* internal fetch status */
00418 };
00419 
00420 /*
00421  * OCI_Define : Internal Resultset column data implementation
00422  *
00423  */
00424 
00425 struct OCI_BatchErrors
00426 {
00427     OCI_Error *errs;               /* sub array of OCILIB errors(array DML) */
00428     ub4        cur;                /* current sub error index (array DML) */
00429     ub4        count;              /* number of errors (array DML) */
00430 };
00431 
00432 typedef struct OCI_BatchErrors OCI_BatchErrors;
00433 
00434 /*
00435  * Statement object
00436  *
00437  */
00438 
00439 struct OCI_Statement
00440 {
00441     OCIStmt         *stmt;              /* OCI statement handle */
00442     ub4              hstate;            /* object variable state */
00443     OCI_Resultset  **rsts;              /* pointer to resultset list */
00444     OCI_Connection  *con;               /* pointer to connection object */
00445     mtext           *sql;               /* SQL statement */
00446     OCI_Bind       **ubinds;            /* array of user bind objects */
00447     OCI_Bind       **rbinds;            /* array of register bind objects */
00448     OCI_HashTable   *map;               /* hash table handle for mapping bind name/index */
00449     ub2              nb_ubinds;         /* number of elements in the bind array */
00450     ub2              nb_rbinds;         /* number of output binds */
00451     boolean          bind_reuse;        /* rebind data allowed ? */
00452     unsigned int     bind_mode;         /* type of binding */
00453     unsigned int     bind_alloc_mode;   /* type of bind allocation */
00454     ub4              exec_mode;         /* type of execution */
00455     ub4              fetch_size;        /* fetch array size */
00456     ub4              prefetch_size;     /* pre-fetch size */
00457     ub4              prefetch_mem;      /* pre-fetch memory */
00458     ub4              long_size;         /* default size for LONG columns */
00459     ub1              long_mode;         /* LONG datatype handling mode */
00460     ub1              status;            /* statement status */
00461     ub2              type;              /* type of SQL statement */
00462     ub4              nb_iters;          /* current number of iterations for execution */
00463     ub4              nb_iters_init;     /* initial number of iterations for execution */
00464     ub4              nb_rs;             /* number of resultsets */
00465     ub2              cur_rs;            /* index of the current resultset */
00466     ub2              dynidx;            /* bind index counter for dynamic exec */
00467     boolean          bind_array;        /* has array binds ? */
00468     OCI_BatchErrors *batch;             /* error handling for array DML */
00469     ub2              err_pos;           /* error position in sql statement */
00470     char             padding[2];        /* dummy variable for alignment */ 
00471 };
00472 
00473 /*
00474  * Internal Large object
00475  *
00476  */
00477 
00478 struct OCI_Lob
00479 {
00480     OCILobLocator  *handle;         /* OCI handle */
00481     ub4             hstate;         /* object variable state */
00482     OCI_Connection *con;            /* pointer to connection object */
00483     ub4             type;           /* type of lob */
00484     big_uint        offset;         /* current offset for R/W */
00485 };
00486 
00487 /*
00488  * External Large object
00489  *
00490  */
00491 
00492 struct OCI_File
00493 {
00494     OCILobLocator  *handle;     /* OCI handle */
00495     ub4             hstate;     /* object variable state */
00496     OCI_Connection *con;        /* pointer to connection object */
00497     mtext          *dir;        /* directory name */
00498     mtext          *name;       /* file name */
00499     ub4             type;       /* type of file */
00500     big_uint        offset;     /* current offset for read */
00501 };
00502 
00503 /*
00504  * Long object
00505  *
00506  */
00507 
00508 struct OCI_Long
00509 {
00510     OCI_Statement *stmt;        /* pointer to statement object */
00511     ub4            hstate;      /* object variable state */
00512     OCI_Define    *def;         /* pointer to resultset define object */
00513     ub4            size;        /* size of the buffer read / written */
00514     unsigned int   type;        /* type of long */
00515     ub4            offset;      /* current offset for R/W */
00516     ub4            piecesize;   /* size of current fetched piece */
00517     ub4            maxsize;     /* size to R/W */
00518     ub1           *buffer;      /* fetched buffer */
00519 };
00520 
00521 /*
00522  * Date object
00523  *
00524  */
00525 
00526 struct OCI_Date
00527 {
00528     OCIDate        *handle;     /* OCI handle */
00529     ub4             hstate;     /* object variable state */
00530     OCI_Connection *con;        /* pointer to connection object */
00531     OCIError       *err;        /* OCI context handle */
00532     OCIEnv         *env;        /* OCI environment handle */
00533     ub4             allocated;  /* is handle allocated ? */
00534 };
00535 
00536 /*
00537  * Timestamp object
00538  *
00539  */
00540 
00541 struct OCI_Timestamp
00542 {
00543 #if OCI_VERSION_COMPILE >= OCI_9_0
00544     OCIDateTime *handle;        /* OCI handle */
00545 #else
00546     void *handle;               /* fake handle for alignment */
00547 #endif
00548     ub4             hstate;     /* object variable state */
00549     OCI_Connection *con;        /* pointer to connection object */
00550     OCIError       *err;        /* OCI context handle */
00551     OCIEnv         *env;        /* OCI environment handle */
00552     ub4             type;       /* sub type */
00553 };
00554 
00555 /*
00556  * Interval object
00557  *
00558  */
00559 
00560 struct OCI_Interval
00561 {
00562 #if OCI_VERSION_COMPILE >= OCI_9_0
00563     OCIInterval *handle;        /* OCI handle */
00564 #else
00565     void *handle;               /* fake handle for alignment */
00566 #endif
00567     ub4             hstate;     /* object variable state */
00568     OCI_Connection *con;        /* pointer to connection object */
00569     OCIError       *err;        /* OCI context handle */
00570     OCIEnv         *env;        /* OCI environment handle */
00571     ub4             type;       /* sub type */
00572 };
00573 
00574 /*
00575  * Oracle Named type object
00576  *
00577  */
00578 
00579 struct OCI_Object
00580 {
00581     void             *handle;       /* OCI handle */
00582     ub4               hstate;       /* object variable state */
00583     OCI_Connection   *con;          /* pointer to connection object */
00584     OCI_TypeInfo     *typinf;       /* pointer to type info object */
00585     void            **objs;         /* array of OCILIB sub objects */
00586     void             *buf;          /* buffer to store converted out string attribute */
00587     int               buflen;       /* buffer length */
00588     OCIObjectLifetime type;         /* object type */
00589     sb2              *tab_ind;      /* indicators for root instance */
00590     ub2               idx_ind;      /* instance indicator offset / indicator table */
00591     char              padding[2];   /* dummy variable for alignment */ 
00592 };
00593 
00594 /*
00595  * Oracle Collection Item object
00596  *
00597  */
00598 
00599 struct OCI_Elem
00600 {
00601     void           *handle;     /* OCI handle */
00602     ub4             hstate;     /* object variable state */
00603     OCI_Connection *con;        /* pointer to connection object */
00604     void           *obj;        /* OCILIB sub object */
00605     void           *buf;        /* buffer to store converted out string attribute */
00606     int             buflen;     /* buffer length */
00607     boolean         init;       /* underlying object has been initialized ? */
00608     OCI_TypeInfo   *typinf;     /* object type information */
00609     OCIInd         *pind;       /* indicator  pointer */
00610     OCIInd          ind;        /* internal temporary data state indicator */
00611     char            padding[2]; /* dummy variable for alignment */ 
00612 };
00613 
00614 /*
00615  * Oracle Collection object
00616  *
00617  */
00618 
00619 struct OCI_Coll
00620 {
00621     OCIColl        *handle;      /* OCI handle */
00622     ub4             hstate;      /* object variable state */
00623     OCI_Connection *con;         /* pointer to connection object */
00624     OCI_TypeInfo   *typinf;      /* pointer to type info object */
00625     OCI_Elem       *elem;        /* item object */
00626 };
00627 
00628 /*
00629  * Oracle Iterator object
00630  *
00631  */
00632 
00633 struct OCI_Iter
00634 {
00635     OCIIter  *handle;            /* OCI handle */
00636     OCI_Coll *coll;              /* pointer to connection object */
00637     OCI_Elem *elem;              /* item object */
00638     boolean   eoc;               /* end of collection */
00639     boolean   boc;               /* beginning of collection */
00640 };
00641 
00642 /*
00643  * Oracle REF object
00644  *
00645  */
00646 
00647 struct OCI_Ref
00648 {
00649     OCIRef         *handle;      /* OCI handle */
00650     ub4             hstate;      /* object variable state */
00651     OCI_Connection *con;         /* pointer to connection object */
00652     OCI_TypeInfo   *typinf;      /* pointer to type info object */
00653     OCI_Object     *obj;         /* Pinned object */
00654     boolean         pinned;      /* is the reference pinned */
00655 };
00656 
00657 /*
00658  * Type info object
00659  *
00660  */
00661 
00662 struct OCI_TypeInfo
00663 {
00664     OCI_Connection *con;         /* pointer to connection object */
00665     mtext          *name;        /* name of the type info object */
00666     mtext          *schema;      /* owner of the type info object */
00667     unsigned int    type;        /* type of type info handle */
00668     OCIType        *tdo;         /* datatype object type */
00669     ub2             tcode;       /* Oracle type code */
00670     ub2             ccode;       /* Oracle collection code */
00671     OCI_Column     *cols;        /* array of column datatype info */
00672     ub2             nb_cols;     /* number of columns */
00673     ub2             refcount;    /* reference counter */
00674     int            *offsets;     /* cached offsets */
00675     size_t          struct_size; /* cached structure size */
00676 };
00677 
00678 /*
00679  * OCI_DirPathColumn : Internal Direct Path column object
00680  *
00681  */
00682 
00683 struct OCI_DirPathColumn
00684 {
00685     ub4    format_size;           /* size of the column format */
00686     mtext *format;                /* date or numeric format */
00687     ub2    type;                  /* column type */
00688     ub2    sqlcode;               /* sql type */
00689     ub4   *lens;                  /* array of lengths */
00690     ub2    bufsize;               /* buffer size */
00691     ub2    index;                 /* ref index in the type info columns list */
00692     ub1   *data;                  /* array of data */
00693     ub1   *flags;                 /* array of row flags */
00694     ub2    maxsize;               /* input max size */
00695     char   padding[2];            /* dummy variable for alignment */ 
00696 };
00697 
00698 typedef struct OCI_DirPathColumn OCI_DirPathColumn;
00699 
00700 /*
00701  * Oracle Direct Path column object
00702  *
00703  */
00704 
00705 struct OCI_DirPath
00706 {
00707     OCI_Connection     *con;            /* pointer to connection object */
00708     OCI_TypeInfo       *typinf;         /* type info about table to load */
00709     OCIDirPathCtx      *ctx;            /* OCI DP context handle */
00710     OCIDirPathColArray *arr;            /* OCI DP column array handle */
00711     OCIDirPathStream   *strm;           /* OCI DP stream handle */
00712     OCI_DirPathColumn  *cols;           /* array of column info */
00713     ub4                 nb_processed;   /* number of row processed at last call */
00714     ub4                 nb_loaded;      /* number of row loaded so far */
00715     ub4                 nb_converted;   /* number of row converted so far */
00716     ub4                 nb_entries;     /* number of rows currently set */
00717     ub4                 status;         /* internal status */
00718     ub4                 nb_cur;         /* current number of row to load per stream */
00719     ub2                 nb_cols;        /* number of columns to load */
00720     ub2                 nb_rows;        /* maximum number of row to load per stream */
00721     ub2                 cvt_mode;       /* conversion mode */ 
00722     ub2                 idx_err_col;    /* index of current erred row */    
00723     ub4                 idx_err_row;    /* index of current erred column */
00724     ub4                 nb_err;         /* number of conversion errors since the last load */
00725     unsigned int        res_conv;       /* status of the last conversion */
00726     unsigned int        res_load;       /* status of the last load */
00727     ub4                *err_rows;       /* array of err rows index */
00728     ub2                *err_cols;       /* array of err col index */
00729     char                padding[2];     /* dummy variable for alignment */ 
00730 };
00731 
00732 /*
00733  * Oracle Event object
00734  *
00735  */
00736 
00737 struct OCI_Event
00738 {
00739     OCI_Subscription *sub;              /* OCILIB subscription handle */
00740     unsigned int      objname_size;     /* cached size of altered object name */
00741     unsigned int      rowid_size;       /* cached size of altered object row id */
00742     unsigned int      dbname_size;      /* cached size of the database name */
00743     unsigned int      type;             /* event type */
00744     ub4               op;               /* event object operation */
00745     dtext            *objname;          /* altered object name */
00746     dtext            *rowid;            /* altered row id */
00747     dtext            *dbname;           /* database name */
00748 };
00749 
00750 /*
00751  * Oracle Notification object
00752  *
00753  */
00754 
00755 struct OCI_Subscription
00756 {
00757     OCI_Connection  *con;            /* OCILIB connection handle */
00758     OCISubscription *subhp;          /* OCI subscription handle */
00759     OCIEnv          *env;            /* OCI environment handle */
00760     OCIError        *err;            /* OCI error handle  */
00761     mtext           *name;           /* notification name */
00762     unsigned int     type;           /* notification type */
00763     POCI_NOTIFY      handler;        /* user callback */
00764     ub4              timeout;        /* notification timetout */
00765     ub4              port;           /* port to use  */
00766     mtext           *saved_db;       /* database for reconnection if needed */
00767     mtext           *saved_user;     /* user for reconnection if needed */
00768     mtext           *saved_pwd;      /* password for reconnection if needed */
00769     OCI_Event        event;          /* event object for user callback */
00770 };
00771 
00772 /*
00773  * Oracle A/Q Agent
00774  *
00775  */
00776 
00777 struct OCI_Agent
00778 {
00779     OCIAQAgent     *handle;        /* OCI agent handle */
00780     ub4             hstate;        /* object variable state */
00781     OCI_Connection *con;           /* OCILIB connection handle */
00782     mtext          *address;       /* agent address */
00783     mtext          *name;          /* agent name */
00784 };
00785 
00786 /*
00787  * Oracle A/Q message
00788  *
00789  */
00790 
00791 struct OCI_Msg
00792 {
00793     OCI_TypeInfo       *typinf;        /* pointer to type info object */
00794     OCIAQMsgProperties *proph;         /* OCI message properties handle */
00795     void               *payload;       /* message payload (object handle or raw handle) */
00796     OCIRaw             *id;            /* message identifier */
00797     OCI_Date           *date;          /* enqueue date */
00798     mtext              *correlation;   /* correlation string */
00799     mtext              *except_queue;  /* exception queue name */
00800     OCI_Agent          *sender;        /* sender */
00801     OCI_Object         *obj;           /* OCILIB object handle for object payloads */
00802     OCIInd              ind;           /* message payload indicator pointer */
00803     char                padding[2];    /* dummy variable for alignment */ 
00804 };
00805 
00806 /*
00807  * Oracle A/Q enqueue
00808  *
00809  */
00810 
00811 struct OCI_Enqueue
00812 {
00813     OCI_TypeInfo    *typinf;         /* pointer to type info object */
00814     OCIAQEnqOptions *opth;           /* OCI enqueue options handle */
00815     mtext           *name;           /* queue name */
00816 };
00817 
00818 /*
00819  * Oracle A/Q Dequeue
00820  *
00821  */
00822 
00823 struct OCI_Dequeue
00824 {
00825     OCI_TypeInfo        *typinf;         /* pointer to type info object */
00826     OCIAQDeqOptions     *opth;           /* OCI dequeue options handle */
00827     mtext               *name;           /* queue name */
00828     mtext               *pattern;        /* queue name */
00829     mtext               *consumer;       /* consumer name */
00830     OCI_Msg             *msg;            /* message retrieved from queue */
00831     OCIAQAgent         **agent_list;     /* array of agents objects */
00832     ub4                  agent_count;    /* number of agents objects */
00833     OCI_Agent           *agent;          /* pointer to agent object for listen call */
00834     POCI_NOTIFY_AQ       callback;       /* user callback */
00835     OCISubscription     *subhp;          /* AQ subscription for async dequeueing */
00836 };
00837 
00838 /*
00839  * OCILIB array
00840  *
00841  */
00842 
00843 struct OCI_Array
00844 {
00845     OCI_Connection *con;            /* pointer to connection info object */
00846     unsigned int    elem_type;      /* array element type */
00847     unsigned int    elem_subtype;   /* array element subtype */
00848     unsigned int    elem_size;      /* array element handle size */
00849     unsigned int    nb_elem;        /* array size of number of elements */
00850     unsigned int    struct_size;    /* array element size */
00851     unsigned int    handle_type;    /* array element OCI handle type */
00852     void         ** tab_obj;        /* array of pointers to OCILIB objects */
00853     void          * mem_handle;     /* array OCI handles */
00854     void          * mem_struct;     /* array of OCILIB objects structures */
00855 
00856 };
00857 
00858 typedef struct OCI_Array OCI_Array;
00859 
00860 /*
00861  * Hash table object
00862  *
00863  */
00864 
00865 struct OCI_HashTable
00866 {
00867     OCI_HashEntry **items;        /* array of slots */
00868     unsigned int    size;         /* size of the slots array */
00869     unsigned int    count;        /* number of used slots */
00870     unsigned int    type;         /* type of data */
00871 };
00872 
00873 /*
00874  * OCI_Datatype : fake dummy structure for casting object with
00875  * handles for more compact code
00876  *
00877  */
00878 
00879 struct OCI_Datatype
00880 {
00881     void *handle;   /* OCI handle */
00882     ub4   hstate;   /* object variable state */
00883 };
00884 
00885 typedef struct OCI_Datatype OCI_Datatype;
00886 
00887 /*
00888  * OCI_SQLCmdInfo : Oracle SQL commands code and verbs
00889  *
00890  */
00891 
00892 struct OCI_SQLCmdInfo
00893 {
00894     unsigned int code; /* SQL command code */
00895     mtext       *verb; /* SQL command verb */
00896 };
00897 
00898 typedef struct OCI_SQLCmdInfo OCI_SQLCmdInfo;
00899 
00900 /* static and unique OCI_Library object */
00901 
00902 extern OCI_Library OCILib;
00903 extern OCI_SQLCmdInfo SQLCmds[];
00904 
00905 #endif /* OCILIB_OCILIB_TYPES_H_INCLUDED */
00906