• Main Page
  • Modules
  • Data Structures
  • Files
  • File List

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

Generated on Mon Dec 13 2010 22:32:02 for OCILIB (C Driver for Oracle) by  doxygen 1.7.2