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

📄 oracle_db8.h

📁 oracle数据库tpcc(在线事务处理能力)测试的源码
💻 H
📖 第 1 页 / 共 2 页
字号:
OCIDefine *c_id_dp1;
	OCIDefine *c_first_dp1;
	OCIDefine *c_first_dp2;
	OCIDefine *c_middle_dp1;
	OCIDefine *c_middle_dp2;
	OCIDefine *c_balance_dp1;
	OCIDefine *c_balance_dp2;
	OCIDefine *o_id_dp1;
	OCIDefine *o_id_dp2;
	OCIDefine *o_entry_d_dp1;
	OCIDefine *o_entry_d_dp2;
	OCIDefine *o_cr_id_dp1;
	OCIDefine *o_cr_id_dp2;
	OCIDefine *o_ol_cnt_dp1;
	OCIDefine *o_ol_cnt_dp2;
	OCIDefine *ol_d_d_dp;
	OCIDefine *ol_i_id_dp;
	OCIDefine *ol_supply_w_id_dp;
	OCIDefine *ol_quantity_dp;
	OCIDefine *ol_amount_dp;
	OCIDefine *ol_d_base_dp;
	OCIDefine *c_count_dp;
	OCIRowid *c_rowid_ptr[100];
	OCIRowid *middle_cust;
	int cs;
	int cust_idx;
	int norow;
	int rcount;
	int somerows;
};
typedef struct _ordctx ordctx;
struct _defctx {
boolean reexec;
ub4 count;
};
typedef struct _defctx defctx;
struct _payctx {
	OCIStmt *curpi;
	OCIStmt *curp0;
	OCIStmt *curp1;
	OCIBind *w_id_bp;
	OCIBind *w_id_bp1;
	sb2 w_id_ind;
	ub2 w_id_len;
	ub2 w_id_rc;
	OCIBind *d_id_bp;
	OCIBind *d_id_bp1;
	sb2 d_id_ind;
	ub2 d_id_len;
	ub2 d_id_rc;
	OCIBind *c_w_id_bp;
	OCIBind *c_w_id_bp1;
	sb2 c_w_id_ind;
	ub2 c_w_id_len;
	ub2 c_w_id_rc;
	OCIBind *c_d_id_bp;
	OCIBind *c_d_id_bp1;
	sb2 c_d_id_ind;
	ub2 c_d_id_len;
	ub2 c_d_id_rc;
	OCIBind *c_id_bp;
	OCIBind *c_id_bp1;
	sb2 c_id_ind;
	ub2 c_id_len;
	ub2 c_id_rc;
	OCIBind *h_amount_bp;
	OCIBind *h_amount_bp1;
	sb2 h_amount_ind;
	ub2 h_amount_len;
	ub2 h_amount_rc;
	OCIBind *c_last_bp;
	OCIBind *c_last_bp1;
	sb2 c_last_ind;
	ub2 c_last_len;
	ub2 c_last_rc;
	OCIBind *w_street_1_bp;
	OCIBind *w_street_1_bp1;
	sb2 w_street_1_ind;
	ub2 w_street_1_len;
	ub2 w_street_1_rc;
	OCIBind *w_street_2_bp;
	OCIBind *w_street_2_bp1;
	sb2 w_street_2_ind;
	ub2 w_street_2_len;
	ub2 w_street_2_rc;
	OCIBind *w_city_bp;
	OCIBind *w_city_bp1;
	sb2 w_city_ind;
	ub2 w_city_len;
	ub2 w_city_rc;
	OCIBind *w_state_bp;
	OCIBind *w_state_bp1;
	sb2 w_state_ind;
	ub2 w_state_len;
	ub2 w_state_rc;
	OCIBind *w_zip_bp;
	OCIBind *w_zip_bp1;
	sb2 w_zip_ind;
	ub2 w_zip_len;
	ub2 w_zip_rc;
	OCIBind *d_street_1_bp;
	OCIBind *d_street_1_bp1;
	sb2 d_street_1_ind;
	ub2 d_street_1_len;
	ub2 d_street_1_rc;
	OCIBind *d_street_2_bp;
	OCIBind *d_street_2_bp1;
	sb2 d_street_2_ind;
	ub2 d_street_2_len;
	ub2 d_street_2_rc;
	OCIBind *d_city_bp;
	OCIBind *d_city_bp1;
	sb2 d_city_ind;
	ub2 d_city_len;
	ub2 d_city_rc;
	OCIBind *d_state_bp;
	OCIBind *d_state_bp1;
	sb2 d_state_ind;
	ub2 d_state_len;
	ub2 d_state_rc;
	OCIBind *d_zip_bp;
	OCIBind *d_zip_bp1;
	sb2 d_zip_ind;
	ub2 d_zip_len;
	ub2 d_zip_rc;
	OCIBind *c_first_bp;
	OCIBind *c_first_bp1;
	sb2 c_first_ind;
	ub2 c_first_len;
	ub2 c_first_rc;
	OCIBind *c_middle_bp;
	OCIBind *c_middle_bp1;
	sb2 c_middle_ind;
	ub2 c_middle_len;
	ub2 c_middle_rc;
	OCIBind *c_street_1_bp;
	OCIBind *c_street_1_bp1;
	sb2 c_street_1_ind;
	ub2 c_street_1_len;
	ub2 c_street_1_rc;
	OCIBind *c_street_2_bp;
	OCIBind *c_street_2_bp1;
	sb2 c_street_2_ind;
	ub2 c_street_2_len;
	ub2 c_street_2_rc;
	OCIBind *c_city_bp;
	OCIBind *c_city_bp1;
	sb2 c_city_ind;
	ub2 c_city_len;
	ub2 c_city_rc;
	OCIBind *c_state_bp;
	OCIBind *c_state_bp1;
	sb2 c_state_ind;
	ub2 c_state_len;
	ub2 c_state_rc;
	OCIBind *c_zip_bp;
	OCIBind *c_zip_bp1;
	sb2 c_zip_ind;
	ub2 c_zip_len;
	ub2 c_zip_rc;
	OCIBind *c_phone_bp;
	OCIBind *c_phone_bp1;
	sb2 c_phone_ind;
	ub2 c_phone_len;
	ub2 c_phone_rc;
	OCIBind *c_since_bp;
	OCIBind *c_since_bp1;
	sb2 c_since_ind;
	ub2 c_since_len;
	ub2 c_since_rc;
	OCIBind *c_credit_bp;
	OCIBind *c_credit_bp1;
	sb2 c_credit_ind;
	ub2 c_credit_len;
	ub2 c_credit_rc;
	OCIBind *c_credit_lim_bp;
	OCIBind *c_credit_lim_bp1;
	sb2 c_credit_lim_ind;
	ub2 c_credit_lim_len;
	ub2 c_credit_lim_rc;
	OCIBind *c_discount_bp;
	OCIBind *c_discount_bp1;
	sb2 c_discount_ind;
	ub2 c_discount_len;
	b2 c_discount_rc;
	OCIBind *c_balance_bp;
	OCIBind *c_balance_bp1;
	sb2 c_balance_ind;
	ub2 c_balance_len;
	ub2 c_balance_rc;
	OCIBind *c_data_bp;
	OCIBind *c_data_bp1;
	sb2 c_data_ind;
	ub2 c_data_len;
	ub2 c_data_rc;
	OCIBind *h_date_bp;
	OCIBind *h_date_bp1;
	sb2 h_date_ind;
	ub2 h_date_len;
	ub2 h_date_rc;
	OCIBind *retries_bp;
	OCIBind *retries_bp1;
	sb2 retries_ind;
	ub2 retries_len;
	ub2 retries_rc;
	OCIBind *cr_date_bp;
	OCIBind *cr_date_bp1;
	sb2 cr_date_ind;
	ub2 cr_date_len;
	ub2 cr_date_rc;
	OCIBind *byln_bp;
	sb2 byln_ind;
	ub2 byln_len;
	ub2 byln_rc;
};
typedef struct _payctx payctx;
struct _stoctx {
	OCIStmt *curs;
	OCIBind *w_id_bp;
	OCIBind *d_id_bp;
	OCIBind *threshold_bp;
	OCIDefine *low_stock_bp;
	int norow;
};
typedef struct _stoctx stoctx;
/* temporary structures needed since oracle binds to some vars differently
than we store in our tpcc structures from tpccstruct.h */
typedef struct _deltemp {
	char cvtcr_date[DATE_SIZ];
	OCIDate cr_date;
} deltemp;
typedef struct _newtemp {
	char entry_date[DATE_SIZ + 1];
	OCIDate cr_date;
	int nol_i_id[MAX_OL];
	int nol_supply_w_id[MAX_OL];
	int nol_quantity[MAX_OL];
	char i_name[MAX_OL][25];
	int s_quantity[MAX_OL];
	int i_price[MAX_OL];
	int nol_amount[MAX_OL];
	char brand_generic[MAX_OL];
	double c_discount;
	double w_tax;
	double d_tax;
	int n_retry;
} newtemp;
typedef struct _ordtemp {
	OCIDate entry_date;
	char entry_date_str[DATE_SIZ + 1];
	int loc_ol_i_id[MAX_OL];
	int loc_ol_supply_w_id[MAX_OL];
	int loc_ol_quantity[MAX_OL];
	int loc_ol_amount[MAX_OL];
	OCIDate loc_ol_delivery_date[MAX_OL];
	char ol_delivery_date_str[MAX_OL][11];
} ordtemp;
typedef struct _paytemp {
	char h_date[DATE_SIZ];
	OCIDate customer_sdate;
	char c_since_str[11];
	OCIDate cr_date;
	double c_discount;
	int h_amount;
	int c_credit_lim;
	int p_retry;
} paytemp;
typedef struct _oracontext {
/* V8 handles for talking to Oracle */
	OCIEnv *tpcenv;
	OCIServer *tpcsrv;
	OCIError *errhp;
	OCIError *datecvterrhp;
	OCISvcCtx *tpcsvc;
	OCISession *tpcusr;
	OCIStmt *curi;
/* other V8 additions */
	dvoid *xmem;
/* are these really needed since we do not malloc and therefore do not
need to free in *txn*done ???*/
	int del_init;
	int new_init;
	int pay_init;
	int ord_init;
	int sto_init;
/* data areas where cursors will find data */
	TransactionData bindvars;
/* oracle structures for bind data information during a
transaction */
	ordctx octx;
	delctx dctx;
	delctx dctx2;
	newctx nctx;
	payctx pctx;
	stoctx sctx;
	defctx cbctx;
	amtctx actx;
/* temporary data areas for cursor data - oracle stores/binds
differently than tpcc */
	union {
		deltemp del;
		newtemp new;
		ordtemp ord;
		paytemp pay;
	      } tempvars;
} OraContext;
#define OCIERROR(p,function)\
ocierror(__FILE__,__LINE__,(p),(function))
#define OCIBND(stmp, bndp, p, sqlvar, progv, progvl, ftype)\
ocierror(__FILE__,__LINE__, (p), \
OCIBindByName((stmp), &(bndp), (p->errhp), \
(text *)(sqlvar), strlen((sqlvar)),\
(progv), (progvl),(ftype),0,0,0,0,0,OCI_DEFAULT))
#define OCIBNDRA(stmp,bndp,p,sqlvar,progv,progvl,ftype,indp,alen,arcode) \
ocierror(__FILE__,__LINE__,(p), \
OCIBindByName((stmp),&(bndp),(p->errhp),(text*)(sqlvar),strlen((sqlvar)),\
(progv),(progvl),(ftype),(indp),(alen),(arcode),0,0,OCI_DEFAULT))
#define OCIBNDRAD(stmp,bndp,p,sqlvar,progvl,ftype,indp,ctxp,cbf_nodata,cbf_data) \
ocierror(__FILE__,__LINE__,(p), \
OCIBindByName((stmp),&(bndp),(p->errhp),(text*)(sqlvar), \
strlen((sqlvar)),0,(progvl),(ftype), \
indp,0,0,0,0,OCI_DATA_AT_EXEC)); \
ocierror(__FILE__,__LINE__,(p), \
OCIBindDynamic((bndp),(p->errhp),(ctxp),(cbf_nodata),(ctxp),(cbf_data)))
#define OCIBNDR(stmp,bndp,p,sqlvar,progv,progvl,ftype,indp,alen,arcode) \
ocierror(__FILE__,__LINE__,(p), \
OCIBindByName((stmp),&(bndp),(p->errhp),(text*)(sqlvar),strlen((sqlvar)),\
(progv),(progvl),(ftype),(indp),(alen),(arcode),0,0,OCI_DEFAULT))
#define OCIBNDRAA(stmp,bndp,p,sqlvar,progv,progvl,ftype,indp,alen,arcode,ms,cu) \
ocierror(__FILE__,__LINE__,(p), \
OCIBindByName((stmp), &(bndp), (p->errhp), \
(text *)(sqlvar), strlen((sqlvar)),\
(progv), (progvl),(ftype),(indp),(alen),(arcode),\
(ms),(cu),OCI_DEFAULT))
#define OCIDEFINE(stmp,dfnp,errp,pos,progv,progvl,ftype)\
OCIDefineByPos((stmp),&(dfnp),(errp),(pos),(progv),(progvl),(ftype),\
0,0,0,OCI_DEFAULT)
#define OCIDEF(stmp,dfnp,errp,pos,progv,progvl,ftype) \
OCIDefineByPos((stmp),&(dfnp),(errp),(pos),(progv),(progvl),\
(ftype),NULL,NULL,NULL,OCI_DEFAULT)
#define OCIDFNRA(stmp,dfnp,errp,pos,progv,progvl,ftype,indp,alen,arcode) \
OCIDefineByPos((stmp),&(dfnp),(errp),(pos),(progv),\
(progvl),(ftype),(indp),(alen),\
(arcode),OCI_DEFAULT)
#define OCIDFNDYN(stmp,dfnp,errp,pos,progv,progvl,ftype,indp,ctxp,cbf_data)\
ocierror(__FILE__,__LINE__,(errp), \
OCIHandleAlloc((stmp),(dvoid**)&(dfnp),OCI_HTYPE_DEFINE,0,\
(dvoid**)0));\
ocierror(__FILE__,__LINE__,(errp), \
OCIDefineByPos((stmp),&(dfnp),(errp),(pos),(progv),(progvl),(ftype),\
(indp),NULL,NULL,OCI_DYNAMIC_FETCH));\
ocierror(__FILE__,__LINE__,(errp), \
OCIDefineDynamic((dfnp),(errp),(ctxp),(cbf_data)));
/* old defines for v7 */
/******
#define OBNDRV(lda,cursor,sqlvar,progv,progvl,ftype)\
if
(obndrv((cursor),(text*)(sqlvar),NA,(ub1*)(progv),(progvl),(ftype),
NA,\
(sb2 *)0, (text *)0, NA, NA))\
{ErrRpt(lda,cursor->rc);return(ERR_DB_ERROR);}\
else\
DISCARD 0
#define
OBNDRA(lda,cursor,sqlvar,progv,progvl,ftype,indp,alen,arcode)\
if
(obndra((cursor),(text*)(sqlvar),NA,(ub1*)(progv),(progvl),(ftype),
NA,\
(indp),(alen),(arcode),(ub4)0,(ub4*)0,(text*)0,NA,NA))\
{ErrRpt(lda,cursor->rc);return(ERR_DB_ERROR);}\
else\
DISCARD 0
#define
OBNDRAA(lda,cursor,sqlvar,progv,progvl,ftype,indp,alen,arcode,ms,cs
)\
if
(obndra((cursor),(text*)(sqlvar),NA,(ub1*)(progv),(progvl),(ftype),
NA,\
(indp),(alen),(arcode),(ub4)(ms),(ub4*)(cs),(text*)0,NA,NA))\
{ErrRpt(lda,cursor->rc);return(ERR_DB_ERROR);}\
else\
DISCARD 0
#define
ODEFIN(lda,cursor,pos,buf,bufl,ftype,scale,indp,fmt,fmtl,fmtt,rlen,
rcode)\
if
(odefin((cursor),(pos),(ub1*)(buf),(bufl),(ftype),(scale),(indp),\
(text*)(fmt),(fmtl),(fmtt),(rlen),(rcode)))\
{ErrRpt(lda,cursor->rc);return(ERR_DB_ERROR);}\
else\
DISCARD 0
#define OEXFET(lda,cursor,nrows,cancel,exact)\
if (oexfet((cursor),(nrows),(cancel),(exact)))\
{if ((cursor)->rc == 1403) DISCARD 0; \
else if (ErrRpt(lda,cursor->rc)==RECOVERR) \
{orol(lda);return(RECOVERR);} \
else{orol(lda);return(ERR_DB_ERROR);}}\
else\
DISCARD 0
#define OOPEN(lda,cursor)\
if (oopen((cursor),(lda),(text*)0,NA,NA,(text*)0,NA))\
{ErrRpt(lda,cursor->rc);return(ERR_DB_ERROR);}\
else\
DISCARD 0
#define OPARSE(lda,cursor,sqlstm,sqll,defflg,lngflg)\
if
(oparse((cursor),(sqlstm),(sb4)(sqll),(defflg),(ub4)(lngflg)))\
{ErrRpt(lda,cursor->rc);return(ERR_DB_ERROR);}\
else\
DISCARD 0
#define OFEN(lda,cursor,nrows)\
if (ofen((cursor),(nrows)))\
{if (ErrRpt(lda,cursor->rc)==RECOVERR) \
{orol(lda);return(RECOVERR);} \
else{orol(lda);return(ERR_DB_ERROR);}}\
else\
DISCARD 0
#define OEXEC(lda,cursor)\
if (oexec((cursor)))\
{if (ErrRpt(lda,cursor->rc)==RECOVERR) \
{orol(lda);return(RECOVERR);} \
else{orol(lda);return(ERR_DB_ERROR);}}\
else\
DISCARD 0
#define OCOM(lda,cursor)\
if (ocom((lda))) \
{ErrRpt(lda,cursor->rc);orol(lda);return(-1);}\
else\
DISCARD 0
#define OEXN(lda,cursor,iters,rowoff)\
if (oexn((cursor),(iters),(rowoff))) \
{if (ErrRpt(lda,cursor->rc)==RECOVERR) \
{orol(lda);return(RECOVERR);} \
else{orol(lda);return(-1);}}\
else\
DISCARD 0
****************/
/* prototypes */
extern int tkvcninit (NewOrderData *pNew,OraContext *p);
extern int tkvcn (NewOrderData *pNew, OraContext *p);
extern void tkvcndone (newctx *pnctx);
extern int tkvcpinit (PaymentData *pPay,OraContext *p);
extern int tkvcp (PaymentData *pPay, OraContext *p);
extern void tkvcpdone (payctx *ppctx);
extern int tkvcoinit(OrderStatusData *pOrd,OraContext *p);
extern int tkvco (OrderStatusData *pOrd, OraContext *p);
extern void tkvcodone (ordctx *poctx);
extern int tkvcsinit(StockLevelData *pOrd,OraContext *p);
extern int tkvcs (OraContext *p);
extern void tkvcsdone (stoctx *psctx);
extern int tkvcdinit (DeliveryData *pDel,OraContext *p);
extern int tkvcd (DeliveryData *pDel, OraContext *p);
extern void tkvcddone (delctx *pdctx);
int ocierror(char *fname, int lineno, OraContext *p, sword status);
extern int ErrRpt(Lda_Def *pLda, int rc);
void TPCCErr( char *fmt, ...);
void TPCCLog( char *fmt, ...);
#endif /* ORACLE_DB_H */

⌨️ 快捷键说明

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