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

📄 orabfile.cpp

📁 在动态库中实现异步导出大数据量的oracle数据
💻 CPP
字号:
#include "stdafx.h"

#define __OCICPP_INTERNAL_USE_


#include "OraError.h"
#include "BFile.h"
#include "OraBFile.h"
#include "OraError.h"
#include "BFile.h"

/*!
  \class OCICPP::OraBFile
  \brief Client-side representation of bfile cells within the Oracle server
 */

OCICPP::OraBFile::OraBFile(OCIEnv *envhp,OCIError *errhp,OCIParam *param,OCISvcCtx *svc,ub2 lob_type,int rows): 
				OraType(envhp,errhp,param,lob_type,rows),lob(0),svchp(svc)
{
	ReqType=lob_type;
	size=0;
	lob=(OCILobLocator **)calloc(nRows,sizeof(OCILobLocator *));
	for(int i=0;i<nRows;i++) {
		if(OCIDescriptorAlloc((void *)envhp,(void **)&lob[i],OCI_DTYPE_FILE,0,0)!=OCI_SUCCESS) {
				throw OraError("OCICPPLIB: Cannot make new BFILE: Handle Allocation failed",OCICPPERROR);
		}
	}
}

OCICPP::OraBFile::~OraBFile() {

	for(int i=0;i<nRows;i++) {
		OCIDescriptorFree(lob[i],OCI_DTYPE_FILE);
	}
	free(lob);
	OCIHandleFree(definehp,OCI_HTYPE_DEFINE);
}

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

void OCICPP::OraBFile::getFILE(OCICPP::BFile &bfile,int row) {
	bfile.init(svchp,lob[row],err);
}

void OCICPP::OraBFile::getStr(std::string &str,int row) {
	str.assign(typeName);
}

⌨️ 快捷键说明

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