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

📄 ocilib_types.h

📁 ORACLE编程的好东西,纯C写的OCI封装.很好用,支持数据池.
💻 H
📖 第 1 页 / 共 2 页
字号:

typedef struct OCI_Buffer {
    void            *handle;   /* OCI handle (bind or define) */
    void           **data;     /* data / array of data */
    void            *inds;     /* array of indicators */
    void            *lens;     /* array of lengths */
    dtext           *temp;     /* temporary buffer for string conversion */
    ub4              count;    /* number of elements in the buffer */
    int              sizelen;  /* size of an element in the lens array */
} OCI_Buffer;

/* 
 * OCI_Bind : Internal bind representation.
 *
 * A bind object is an object that holds all information about an Oracle
 * statement binding operation
 *
 */

typedef struct OCI_Bind {
    OCI_Statement   *stmt;      /* pointer to statement object */
    void           **input;     /* input values */
    mtext           *name;      /* name of the bind */
    ub1              mode;      /* in / out mode */
    ub1              type;      /* internal datatype */
    ub1              subtype;   /* internal subtype */
    ub1              alloc;     /* is buffer allocated or mapped to input */
    sb4              size;      /* data size */
    OCI_Buffer       buf;       /* place holder */
    ub2              code;      /* SQL datatype code */
    ub2              dynpos;    /* index of the bind for dynamic binds */
    ub2             *plsizes;   /* PL/SQL tables element sizes */
    ub2             *plrcds;    /* PL/SQL tables return codes */
    ub4              nbelem;    /* PL/SQL tables nb elements */
} OCI_Bind;

/*
 * OCI_Define : Internal Resultset column data implementation
 *
 */

typedef struct OCI_Define {
    OCI_Resultset   *rs;           /* pointer to resultset object */
    void            *obj;          /* current OCILIB object instance */
    OCI_Column       col;          /* column object */
    OCI_Buffer       buf;          /* placeholder */
} OCI_Define;

/* 
 * Resultset object
 *
 */

struct OCI_Resultset {
    OCI_Statement   *stmt;          /* pointer to statement object */
    OCI_HashTable   *map;           /* hash table handle for mapping name/index */
    OCI_Define      *defs;          /* array of define objects */
    ub4              nb_defs;       /* number of elements */
    ub4              row_cur;       /* actual position in the array of rows */
    ub4              row_abs;       /* absolute position in the resulset */
    ub4              row_count;     /* number of rows fetched so far */
    ub4              row_fetched;   /* rows fetched by last call (scrollable) */
    boolean          eof;           /* end of resultset reached ?  */
    boolean          bof;           /* beginning of resultset reached ?  */
    ub4              fetch_size;    /* internal array size */
    sword            fetch_status;  /* internal fetch status */

};

/*
 * Statement object 
 *
 */

struct OCI_Statement {
    OCIStmt         *stmt;          /* OCI statement handle */
    ub4              hstate;        /* object variable state */
    OCI_Resultset  **rsts;          /* pointer to resultset list */
    OCI_Connection  *con;           /* pointer to connection object */
    mtext           *sql;           /* SQL statement */
    OCI_Bind       **binds;         /* array of bind objects */
    ub2              nb_binds;      /* number of elememts in the bind array */
    ub2              nb_outbinds;   /* number of output binds */
    unsigned int     bind_mode;     /* type of binding */
    ub4              exec_mode;     /* type of execution */
    ub4              fetch_size;    /* fetch array size */
    ub4              prefetch_size; /* prefetch size */
    ub4              prefetch_mem;  /* prefetch memory */
    ub4              long_size;     /* default size for LONG columns */
    ub1              long_mode;     /* LONG datatype handling mode */
    ub1              status;        /* statement status */
    ub2              type;          /* type of SQL statement */
    ub4              nb_iters;      /* number of iterations for execution */
    ub4              nb_rs;         /* number of resulsets */
    ub2              cur_rs;        /* index of the current resulset */
    ub2              dynidx;        /* bind index counter for dynamic exec */
    ub2              err_pos;       /* error position in sql statement */
};

/*
 * Internal Large object 
 *
 */

struct OCI_Lob {
    OCILobLocator   *handle;    /* OCI handle */
    ub4              hstate;    /* object variable state */
    OCI_Connection  *con;       /* pointer to connection object */
    ub4              type;      /* type of lob */
    big_uint         offset;    /* current offset for R/W */
};

/* 
 * External Large object 
 *
 */

struct OCI_File {
    OCILobLocator   *handle;    /* OCI handle */
    ub4              hstate;    /* object variable state */
    OCI_Connection  *con;       /* pointer to connection object */
    mtext           *dir;       /* directory name */
    mtext           *name;      /* file name */
    ub4              type;      /* type of file */
    big_uint         offset;    /* current offset for read */
};

/* 
 * Long object 
 *
 */ 

struct OCI_Long {
    OCI_Statement   *stmt;      /* pointer to statement object */
    ub4              hstate;    /* object variable state */
    OCI_Define      *def;       /* pointer to resultset define object */
    ub4              size;      /* size of the buffer read / written */
    unsigned int     type;      /* type of long */
    ub4              offset;    /* current offset for R/W */
    ub4              piecesize; /* size of current fetched piece */
    ub4              maxsize;   /* current offset for R/W */
    ub1             *buffer;    /* fetched buffer */
};

/*
 * Date object 
 *
 */

struct OCI_Date {
    OCIDate         *handle;    /* OCI handle */
    ub4              hstate;    /* object variable state */
    OCI_Connection  *con;       /* pointer to connection object */
    OCIError        *err;       /* OCI context handle */
    ub4              allocated; /* is handle allocated ? */ 
};

/* 
 * Timestamp object 
 *
 */

struct OCI_Timestamp {
#if OCI_VERSION_COMPILE >= OCI_9
    OCIDateTime     *handle;    /* OCI handle */
#else
    void            *handle;    /* fake handle for alignment */
#endif
    ub4              hstate;    /* object variable state */
    OCI_Connection  *con;       /* pointer to connection object */
    OCIError        *err;       /* OCI context handle */
    ub4              type;      /* sub type */
};

/* 
 * Interval object 
 *
 */

struct OCI_Interval {
#if OCI_VERSION_COMPILE >= OCI_9
    OCIInterval     *handle;    /* OCI handle */
#else
    void            *handle;    /* fake handle for alignment */
#endif
    ub4              hstate;    /* object variable state */
    OCI_Connection  *con;       /* pointer to connection object */
    OCIError        *err;       /* OCI context handle */
    ub4              type;      /* sub type */
};

/*
 * Oracle Named type object 
 *
 */

struct OCI_Object { 
    void            *handle;   /* OCI handle */
    ub4              hstate;   /* object variable state */
    OCI_Connection  *con;      /* pointer to connection object */
    OCI_Schema      *nty;      /* pointer to schema object type */
    void           **objs;     /* array of OCILIB sub objects */
    void            *buf;      /* buffer to store converted out string attribute */ 
    int              buflen;   /* buffer len */
};

/*
 * Oracle Collection Item object 
 *
 */

struct OCI_Elem { 
    void            *handle;    /* OCI handle */
    ub4              hstate;    /* object variable state */
    OCI_Connection  *con;       /* pointer to connection object */
    OCIInd          *ind;       /* data state indicator */
    void            *obj;       /* OCILIB sub object */
    OCI_Column      *col;       /* datatype infos */
    void            *buf;      /* buffer to store converted out string attribute */ 
    int              buflen;   /* buffer len */
};

/*
 * Oracle Collection object 
 *
 */

struct OCI_Coll { 
    OCIColl           *handle;   /* OCI handle */
    ub4                hstate;   /* object variable state */
    OCI_Connection    *con;      /* pointer to connection object */
    OCI_Schema        *nty;      /* pointer to schema object type */
    OCI_Elem          *elem;     /* item object */
    sb4                size;     /* collection size */               
};

/*
 * Oracle Iterator object 
 *
 */

struct OCI_Iter { 
    OCIIter           *handle;   /* OCI handle */
    OCI_Coll          *coll;     /* pointer to connection object */
    OCI_Elem          *elem;     /* item object */
    boolean            eoc;      /* end of collection */
    boolean            boc;      /* beginning of collection */
};

/* 
 * Schema object 
 *
 */

struct OCI_Schema {
    OCI_Connection  *con;        /* pointer to connection object */
    mtext           *name;       /* name of the schema object */
    unsigned int     type;       /* type of schema handle */
    OCIType         *tdo;        /* datatype object type */
    ub2              tcode;      /* Oracle type code */
    ub2              ccode;      /* Oracle collection code */
    OCI_Column      *cols;       /* array of column datatype infos */
    ub2              nb_cols;    /* number of columns */
    ub2              dummy;      /* for padding alignment */
};

/* 
 * Hash table object 
 *
 */

struct OCI_HashTable {
    OCI_HashEntry    **items;     /* array of slots */
    unsigned int       size;      /* size of the slots array */
    unsigned int       count;     /* number of used slots */
    unsigned int       type;      /* type of data */
};

/*
 * OCI_Datatype : fake dummy structure for casting object with 
 * handles for more compact code
 *
 */

typedef struct OCI_Datatype
{
    void *handle;   /* OCI handle */
    ub4   hstate;   /* object variable state */
} OCI_Datatype;

/* static and unique OCI_Library object */

extern OCI_Library OCILib;

#endif /* OCILIB_OCILIB_TYPES_H_INCLUDED */

⌨️ 快捷键说明

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