📄 oracledb.h
字号:
/******************************************************** * OracleDB.h: interface for the CDatabase class. * */#ifndef ORACLEDB_H__INCLUDED_#define ORACLEDB_H__INCLUDED_#include "Typedef.h"#ifdef WIN32#define __STDC__ 1#endif#include <oratypes.h>/* LDA and CDA struct declarations */#include <ocidfn.h>#ifdef WIN32#include <ociap.h>#endif#include <ociapr.h>/*#ifdef __STDC__#include <ociapr.h>#else#include <ocikpr.h>#endif*//* demo constants and structs */#include <ocidem.h>#define MAX_ROWS_PER_INSERT 1000#define MAX_ROWS_PER_SELECT 1000/* oparse flags */#define NO_DEFER_PARSE 0#define DEFER_PARSE 1#define NATIVE 1#define VERSION_7 2#define ERROR_BUFFER_LEN 1024#define CS_NUMERIC double#define CS_UNUSED (CS_INT)(-99999)#define TYPE_CHAR "\x20"#define TYPE_BINARY "\x01"#define TYPE_LONGCHAR "\x02"#define TYPE_LONGBINARY "\x03"#define TYPE_TEXT "\x04"#define TYPE_IMAGE "\x05"#define TYPE_TINYINT "\x06"#define TYPE_SMALLINT "\x07"#define TYPE_INT "\x08"#define TYPE_REAL "\x09"#define TYPE_FLOAT "\x0a"#define TYPE_BIT "\x0b"#define TYPE_DATETIME "\x0c"#define TYPE_DATETIME4 "\x0d"#define TYPE_MONEY "\x0e"#define TYPE_MONEY4 "\x0f"#define TYPE_NUMERIC "\x10"#define TYPE_DECIMAL "\x11"#define TYPE_VARCHAR "\x12"#define TYPE_VARBINARY "\x13"#define TYPE_LONG "\x14"#define TYPE_SENSITIVITY "\x15"#define TYPE_BOUNDARY "\x16"#define TYPE_VOID "\x17"#define TYPE_USHORT "\x18"#define CS_ILLEGAL_TYPE (CS_INT)(-1)#define CS_CHAR_TYPE (CS_INT)0#define CS_BINARY_TYPE (CS_INT)1#define CS_LONGCHAR_TYPE (CS_INT)2#define CS_LONGBINARY_TYPE (CS_INT)3#define CS_TEXT_TYPE (CS_INT)4#define CS_IMAGE_TYPE (CS_INT)5#define CS_TINYINT_TYPE (CS_INT)6#define CS_SMALLINT_TYPE (CS_INT)7#define CS_INT_TYPE (CS_INT)8#define CS_REAL_TYPE (CS_INT)9#define CS_FLOAT_TYPE (CS_INT)10#define CS_BIT_TYPE (CS_INT)11#define CS_DATETIME_TYPE (CS_INT)12#define CS_DATETIME4_TYPE (CS_INT)13#define CS_MONEY_TYPE (CS_INT)14#define CS_MONEY4_TYPE (CS_INT)15#define CS_NUMERIC_TYPE (CS_INT)16#define CS_DECIMAL_TYPE (CS_INT)17#define CS_VARCHAR_TYPE (CS_INT)18#define CS_VARBINARY_TYPE (CS_INT)19#define CS_LONG_TYPE (CS_INT)20#define CS_SENSITIVITY_TYPE (CS_INT)21#define CS_BOUNDARY_TYPE (CS_INT)22#define CS_VOID_TYPE (CS_INT)23#define CS_USHORT_TYPE (CS_INT)24#ifndef MAX#define MAX(X,Y) (((X) > (Y)) ? (X) : (Y))#endif#ifndef MIN#define MIN(X,Y) (((X) < (Y)) ? (X) : (Y))#endif#if defined(__alpha) || (_MIPS_SZLONG == 64) || defined (__LP64__)typedef int CS_INT;typedef int CS_RETCODE;typedef int CS_BOOL;typedef unsigned int CS_UINT;#elsetypedef long CS_INT;typedef long CS_RETCODE;typedef long CS_BOOL;typedef unsigned long CS_UINT;#endiftypedef struct _cs_datetime{ CS_INT dtdays; /* number of days since 1/1/1900 */ CS_INT dttime; /* number 300th second since mid */} CS_DATETIME;typedef struct { double dValue; int nPrecision; int nScale;}CNumeric;typedef CNumeric CDecimal;typedef struct { int nYear; int nMonth; int nDay; int nHour; int nMinute; int nSecond;}CDateTime;typedef struct{ /* Buffer descriptor */ sword c_type; /* What type is this column fetched as */ ub1 *c_buf; /* The area to store the column */ ub2 c_size; /* Size of the storage area */ sb2 *c_indp; /* Indicator variable for this column */ ub2 *c_rlen; /* Fetched length of the column */ ub2 *c_rcode; /* array of return codes */ sb4 c_curlen; /* current length */}CColumn;/* COLUMN STRUCTURE */typedef struct{ Lda_Def m_lda; ub4 m_hda[HDA_SIZE/sizeof(ub4)]; Cda_Def m_cda; CColumn *m_pColumn; long m_nBlkRowCount; int m_nColumnCount; int m_nStatus; sb2 m_nIndicator[30]; BOOL m_bOpened; BOOL m_bBind; char m_szErrorBuffer[ERROR_BUFFER_LEN];}CDatabase; void DB_Construct(CDatabase *pDatabase); void DB_Destruct(CDatabase *pDatabase); BOOL DB_Open(CDatabase *pDatabase, char *pServerName, char *pDatabaseName, char *pUserName, char *pPassword); BOOL DB_Close(CDatabase *pDatabase, BOOL bForceClose); BOOL DB_IsOpen(CDatabase *pDatabase); BOOL DB_BeginTransaction(CDatabase *pDatabase); BOOL DB_CommitTransaction(CDatabase *pDatabase); BOOL DB_RollbackTransaction(CDatabase *pDatabase); BOOL DB_ExecuteSQL(CDatabase *pDatabase, char *pSQL); BOOL DB_SQLPrepare(CDatabase *pDatabase, char *pSQL, void *ppBindVar[], int cbVar); BOOL DB_SQLFetch(CDatabase *pDatabase); BOOL DB_SQLDone(CDatabase *pDatabase); BOOL DB_SQLBlkPrepare(CDatabase *pDatabase, char *pTableName, char *pWhereClause, void ***ppVar, long **nLenArray, int *npColumnCount); BOOL DB_SQLBlkFetch(CDatabase *pDatabase, int *npRowsFetched); BOOL DB_SQLBlkDone(CDatabase *pDatabase); BOOL DB_ExecuteDynamicSQL(CDatabase *pDatabase, char *pSQL, const unsigned char* pbParamInfo,...); BOOL DB_DynamicSQLPrepare(CDatabase *pDatabase, char *pSQL); BOOL DB_DynamicSQLSendParam(CDatabase *pDatabase, void *pParam, int nType, BOOL bByRef); BOOL DB_DynamicSQLExecute(CDatabase *pDatabase); BOOL DB_DynamicSQLDone(CDatabase *pDatabase); BOOL DB_BlkCopyInPrepare(CDatabase *pDatabase, char *pTableName, int nColumn); BOOL DB_BlkCopyInExecute(CDatabase *pDatabase, void *ppVarArray[], long nLenArray[]); BOOL DB_BlkCopyInDone(CDatabase *pDatabase); BOOL DB_ExecuteStoredProcedure(CDatabase *pDatabase, char *pRpcName, int *npStatus, const unsigned char* pbParamInfo,...); void DB_GetLastError(CDatabase *pDatabase, char *pErrorBuffer, int cbErrorBuffer); BOOL DB_ConvertNumericToLong(CDatabase *pDatabase, CS_NUMERIC* npSrc, long* lpDest, int nPrecision, int nScale); BOOL DB_ConvertNumericToDouble(CDatabase *pDatabase, CS_NUMERIC *npSrc, double* lpDest, int nPrecision, int nScale); void DB_SetLastError(CDatabase *pDatabase, char *pErrorMsg);#endif /* !defined(ORACLEDB_H__INCLUDED_) */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -