orarowid.cpp

来自「在动态库中实现异步导出大数据量的oracle数据」· C++ 代码 · 共 44 行

CPP
44
字号
#include "stdafx.h"

#define __OCICPP_INTERNAL_USE_
#include "OraRowID.h"

/*! \class OCICPP::OraRowID
  \brief Client-side representation of a unique identifier for a row within the Oracle server
 */

OCICPP::OraRowID::OraRowID(OCIEnv *envhp,OCIError *errhp,OCIParam *param,ub2 type,int rows) :
	OraType(env,errhp,param,type,rows),rowid(0)
{
	ReqType=SQLT_RDD; /* request Oracle 8 RowID */
	size=0;
	rowid=(OCIRowid **)calloc(nRows,sizeof(OCIRowid *));
	for(int i=0;i<nRows;i++) {
		if(OCIDescriptorAlloc((void *)envhp,(void **)&rowid[i],OCI_DTYPE_ROWID,0,0)!=OCI_SUCCESS) {
			throw OraError("OCICPPLIB: Cannot make new ROWID: Handle Allocation failed",OCICPPERROR);
		}
	}
}

OCICPP::OraRowID::~OraRowID() {
	for(int i=0;i<nRows;i++) {
		OCIDescriptorFree(rowid[i],OCI_DTYPE_ROWID);
	}
	free(rowid);
	OCIHandleFree(definehp,OCI_HTYPE_DEFINE);
}

void OCICPP::OraRowID::define(OCIStmt *stmt,int col) {
	CHECKERR(err, OCIDefineByPos(stmt,&definehp, err, col+1, rowid, -1,ReqType,
					(dvoid *) null, 0, (ub2 *)0, OCI_DEFAULT));
}

void OCICPP::OraRowID::getStr(std::string &str,int row) {
	str.assign(typeName);
}
/*
void OCICPP::OraRowID::getRowID(RowID &rid) {
	rid.init(this);
}
*/

⌨️ 快捷键说明

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