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