📄 ocilib.h
字号:
#define mtslen wcslen
#define mtscmp wcscmp
#define mtscasecmp ociwcscasecmp
#define mtsprintf swprintf
#define mtstol wcstol
#else
#define mtsdup ocistrdup
#define mtscpy strcpy
#define mtsncpy strncpy
#define mtscat strcat
#define mtsncat strncat
#define mtslen strlen
#define mtscmp strcmp
#define mtscasecmp ocistrcasecmp
#define mtsprintf ocisprintf
#define mtstol strtol
#endif
#ifdef OCI_USERDATA_UNICODE
#define dtsdup ociwcsdup
#define dtscpy wcscpy
#define dtsncpy wcsncpy
#define dtscat wcscat
#define dtsncat wcsncat
#define dtslen wcslen
#define dtscmp wcscmp
#define dtscasecmp ociwcscasecmp
#define dtsprintf swprintf
#define dtstol wcstol
#else
#define dtsdup ocistrdup
#define dtscpy strcpy
#define dtsncpy strncpy
#define dtscat strcat
#define dtsncat strncat
#define dtslen strlen
#define dtscmp strcmp
#define dtscasecmp ocistrcasecmp
#define dtsprintf ocisprintf
#define dtstol strtol
#endif
/* string size macros */
#define mtextsize(s) (mtslen(s) * sizeof(mtext))
#define dtextsize(s) (dtslen(s) * sizeof(dtext))
#define msizeof(s) (sizeof(s) / sizeof(mtext))
#define dsizeof(s) (sizeof(s) / sizeof(dtext))
/**
* @}
*/
/**
* @defgroup g_objects Library objects and datatypes
* @{
*
* OCILIB implements:
*
* - Oracle Scalar datatypes through scalar C datatypes
* - Oracle opaque/complex objects though opaque library handles
* - Library objects for manipulating the database: connections, transactions,
* statements...
*
* @par Supported Oracle datatypes
*
* - All Database types are supported excluding REFs.
*
* Here is a summary of the supported datatypes:
*
* - Scalar types CHAR/NCHAR, VARCHAR2/NVARCHAR2, NUMBER, FLOAT, REAL, RAW, ...
* - Binary types: RAW, LONG RAW, VARRAW, ..
* - Larges Objects (Lobs and Files) : BLOB, CLOB, NCLOB, BFILE
* - LONG types: LONG, VAR LONG
* - Date, Timestamps et Intervals: DATE, TIMESTAMP, INTERVAL
* - PL/SQL types: Ref cursors, PL/SQL Tables
* - Named Types (by value): Builtin system objects and User defined objects
* - VARRAYs and Nested Tables
* - ROWIDs
*
* @par OCILIB library objects
*
* The public OCILIB library interface implements encapsulation for
* representing database objects (such as connections, statements, ...) through
* opaque structures (pointers to structures whose definition is kept private)
*
* Instead of directly manipulating the structures and their members, the library
* has functions to access the underlying members.
*
* It's designed to make the user code as more independant as possible of
* the library details.
*
**/
/**
* @struct OCI_ConnPool
*
* @brief
* Oracle Connection Pool
*
* A Connection pool is a set of connections
*
*/
typedef struct OCI_ConnPool OCI_ConnPool;
/**
* @struct OCI_Connection
*
* @brief
* Oracle physical connection.
*
* It holds all information about a connection such as error handling,
* associated statements, ...
* Error handling and transactions are embedded within a connection object.
*
* Multithreaded applications that use multiple connections should
* use one connection per thread as all statements associated with a
* connection share the same context.
*
*/
typedef struct OCI_Connection OCI_Connection;
/**
* @struct OCI_Statement
*
* @brief
* Oracle SQL or PL/SQL statement.
*
* A Statement object allows users to prepare, execute SQL orders or PL/SQL blocks
*
*/
typedef struct OCI_Statement OCI_Statement;
/**
* @struct OCI_Bind
*
* @brief
* Internal bind representation.
*
* A bind object is an object that holds all information about an Oracle
* statement binding operation
*
*/
typedef struct OCI_Bind OCI_Bind;
/**
* @struct OCI_Resultset
*
* @brief
* Collection of output columns from a select statement.
*
* A resultset object is the result of 'select' SQL Statement.
*
* It's a set of data (ordered in columns) that can be fetched row by row
* to get data returned by the SQL statement
*
*/
typedef struct OCI_Resultset OCI_Resultset;
/**
* @struct OCI_Column
*
* @brief
* Oracle SQL Column and Type member representation.
*
* A column object represents an output column from a select statement
*
*/
typedef struct OCI_Column OCI_Column;
/**
* @struct OCI_Lob
*
* @brief
* Oracle Internal Large objects:
*
* The following internal Larges Objects are supported :
*
* - BLOBs : Binary large objects
* - CLOBs / NCLOBs : Character large objects
*
* LOBs were introduced by OCI8 to replace Long datatypes.
*
* It's designed to store really larges objects (buffer, files) inside the database
*
* Oracle encourages programmers to use those objects instead of LONG, LONG RAW, ...
*
* OCILIB supports both LOBs and LONGs
*
*/
typedef struct OCI_Lob OCI_Lob;
/**
* @struct OCI_File
*
* @brief
* Oracle External Large objects:
*
* The following external Larges Objects are supported:
*
* - BFILEs : Binary files
* - CFILEs : Character files
*
* FILEs were introduced by OCI8 in order to store references to files located
* outside the database .
*
* @warning
* Only Read-only access is allowed on BFILEs
*
* Two way to use FILEs :
*
* - within statement context (query, binding)
* - without statement context (server files reading) through OCI_File properties
* functions
*
*/
typedef struct OCI_File OCI_File;
/**
* @struct OCI_Transaction
*
* @brief
* Oracle Transaction.
*
* A transaction can be:
*
* - Local : it's implicitly created by OCILIB
* - Global : it's explicitly created by the program
*
*/
typedef struct OCI_Transaction OCI_Transaction;
/**
* @struct OCI_Long
*
* @brief Oracle Long datatype.
*
* The following long Objects are supported:
*
* - LONG RAW : Binary long objects
* - LONG : Character long objects
*
* Those types were used in older versions of Oracle (before Oracle8i) to store
* large chunks of data in the database.
*
* It's now depreciated by Oracle that recommends using LOBs
*
* Many databases and applications are still designed to use LONGs that's why
* OCILIB supports Long Objects and piecewise operations
*
*/
typedef struct OCI_Long OCI_Long;
/**
* @struct OCI_Date
*
* @brief
* Oracle internal date representation.
*
*/
typedef struct OCI_Date OCI_Date;
/**
* @struct OCI_Timestamp
*
* @brief
* Oracle internal timestamp representation.
*
*/
typedef struct OCI_Timestamp OCI_Timestamp;
/**
* @struct OCI_Interval
*
* @brief
* Oracle internal interval representation.
*
*/
typedef struct OCI_Interval OCI_Interval;
/**
* @struct OCI_Object
*
* @brief
* Oracle Named types representation.
*
*/
typedef struct OCI_Object OCI_Object;
/**
* @struct OCI_Coll
*
* @brief
* Oracle Collections (VARRAYs and Nested Tables) representation.
*
*/
typedef struct OCI_Coll OCI_Coll;
/**
* @struct OCI_Elem
*
* @brief
* Oracle Collection item representation.
*
*/
typedef struct OCI_Elem OCI_Elem;
/**
* @struct OCI_Iter
*
* @brief
* Oracle Collection iterator representation.
*
*/
typedef struct OCI_Iter OCI_Iter;
/**
* @struct OCI_TypeInfo
*
* @brief
* Type info metadata handle.
*
*/
/**
* @struct OCI_Ref
*
* @brief
* Oracle REF type representation.
*
*/
typedef struct OCI_Ref OCI_Ref;
typedef struct OCI_TypeInfo OCI_TypeInfo;
/**
* @struct OCI_HashTable
*
* @brief
* OCILIB implementation of hash tables.
*
*/
typedef struct OCI_HashTable OCI_HashTable;
/**
* @struct OCI_Error
*
* @brief
* Encapsulates an Oracle or OCILIB exception.
*
* The error object is used to raise internal or oracle errors.
* When an error occurs, if the application has provided an error handler, an
* error object is constructed and passed to the handler
*
*/
typedef struct OCI_Error OCI_Error;
/**
* @struct OCI_Mutex
*
* @brief
* OCILIB encapsulation of OCI mutexes.
*
*/
typedef struct OCI_Mutex OCI_Mutex;
/**
* @struct OCI_Thread
*
* @brief
* OCILIB encapsulation of OCI Threads.
*
*/
typedef struct OCI_Thread OCI_Thread;
/**
* @struct OCI_DirPath
*
* @brief
* OCILIB encapsulation of OCI Direct Path handle.
*
*/
typedef struct OCI_DirPath OCI_DirPath;
/**
* @}
*/
/**
* @typedef POCI_ERROR
*
* @brief
* Error procedure prototype
*
*/
typedef void (*POCI_ERROR) (OCI_Error *err);
/**
* @typedef POCI_THREAD
*
* @brief
* Thread procedure prototype
*
*/
typedef void (*POCI_THREAD) (OCI_Thread *thread, void *arg);
/**
* @typedef POCI_THREADKEYDEST
*
* @brief
* Thread key destructor prototype.
*
* @note
* data is the thread key value
*
*/
typedef void (*POCI_THREADKEYDEST) (void *data);
/* public structures */
/**
* @struct OCI_XID
*
* @brief
* Global transaction identifier
*
*/
typedef struct OCI_XID {
long formatID;
long gtrid_length;
long bqual_length;
char data[128];
} OCI_XID;
/**
* @union OCI_Variant
*
* @brief
* Internal Variant type based on union C type.
*
* @note
* Helpful for generic buffer, it reduces the amount of casts
*
*/
typedef union OCI_Variant {
/* integers */
int num;
/* raw data */
unsigned char *p_bytes;
/* pointer to c natives types */
void *p_void;
int *p_int;
double *p_double;
dtext *p_dtext;
mtext *p_mtext;
/* ocilib object types */
OCI_Date *p_date;
OCI_Interval *p_interval;
OCI_Timestamp *p_timestamp;
OCI_Long *p_long;
OCI_Lob *p_lob;
OCI_File *p_file;
OCI_Statement *p_stmt;
OCI_Column *p_col;
OCI_Object *p_obj;
OCI_Coll *p_coll;
OCI_Iter *p_iter;
OCI_Elem *p_elem;
} OCI_Variant;
/**
* @struct OCI_HashValue
*
* @brief
* Hash table entry value
*
* OCILIB implementation of hash tables uses chaining method for
* dealing with collisions
*
*/
typedef struct OCI_HashValue {
OCI_Variant value;
struct OCI_HashValue *next;
} OCI_HashValue;
/**
* @struct OCI_HashEntry
*
* @brief
* Hash table entry
*
*/
typedef struct OCI_HashEntry {
mtext *key;
struct OCI_HashValue *values;
struct OCI_HashEntry *next;
} OCI_HashEntry;
/**
* @typedef big_int
*
* @brief
* big_int is a C scalar integer type (32 or 64 bits) depending on
* compiler support for 64bits integers
* big_uint is an usigned big_int
*
*/
/* check for long long support */
#if defined(LLONG_MAX)
/* C99 long long supported */
typedef long long big_int;
typedef unsigned long long big_uint;
#define OCI_BIG_UINT_ENABLED
#elif defined(_WINDOWS)
/* Microsoft extension supported */
typedef __int64 big_int;
typedef unsigned __int64 big_uint;
#define OCI_BIG_UINT_ENABLED
#else
typedef int big_int;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -