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

📄 otlhandle.h

📁 一个利用OTL编写的数据库编程访问接口类
💻 H
字号:
// OtlHandle.h: interface for the COtlHandle class.
// 
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_OTLHANDLE_H__F182EED1_51DA_408C_9552_7F7853265B24__INCLUDED_)
#define AFX_OTLHANDLE_H__F182EED1_51DA_408C_9552_7F7853265B24__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
/////////////////////////////////////
#include <iostream>
#include <stdio.h>
#include <string>

#define  OTL_ORA9I     //OTL_ORA10G // Compile OTL 4/OCI8
//#define OTL_ODBC     // Compile OTL 4/OCI8
#include <otlv4.h>     // include the OTL 4 header file
///////////////////////////////////////////////////
#ifndef _MSC_VER
#define _MSC_VER
#endif

#if defined(_MSC_VER) // VC++
#define OTL_BIGINT __int64
#define OTL_STR_TO_BIGINT(str,n)  \
{                                 \
   n = _atoi64(str);              \
}

#define OTL_BIGINT_TO_STR(n,str)  \
{                                 \
   _i64toa(n,str,10);             \
}
#endif
//
#if defined(__GNUC__) // GNU C++
#include <stdlib.h>
#define OTL_BIGINT long long
#define OTL_STR_TO_BIGINT(str,n)      \
{                                     \  
   n = strtoll(str,0,10);             \
}
#define OTL_BIGINT_TO_STR(n,str)      \
{                                     \  
   sprintf(str,"%lld",n);             \
}
#endif
using namespace std;

//************************************
#ifndef OTL_ODBC
#define NO_TABLESPACE  "ORA-01653"
#define TABLE_NO_EXIST "ORA-00942"
#define CONNECT_LOSED  "ORA-03135"
#define NO_CONNECT     "ORA-03114"
#define ENVI_NO_INIT   "ORA-24324"
#endif        
//************************************
#ifdef OTL_ODBC
#define NO_TABLESPACE  "01653"
#define TABLE_NO_EXIST "42S02"
#define CONNECT_LOSED  "01000"
#define NO_CONNECT     "01000"
#define ENVI_NO_INIT   "24324"
#endif
//
class COtlHandle  
{
public:
	COtlHandle();
	virtual ~COtlHandle();
public:
	otl_connect m_db;
	//init(std::string& strDbType){m_strDbType = strDbType;};
	//std::string& GetDbType(std::string& strDbType){strDbType = m_strDbType};
public:
    bool ConnectDB(const char * strConn,std::string& strErr); //建立数据库连接
	bool ReConnect(std::string& strErr);                      //重连数据库
	bool ExcuteSQL(const char * strSQL,std::string& strErr);  //直接执行
	bool GetDataSetFromDB(const char * strQuery,otl_stream * pDataSet);
	bool ErrHandle(const std::string& strErr);                //错误判断和处理
	
private:
	void ini_otl();     //                  
	void fini_otl();
private:
	std::string m_strConnStr;
	std::string m_strDbType;//oracle / sqlserver

};


#endif // !defined(AFX_OTLHANDLE_H__F182EED1_51DA_408C_9552_7F7853265B24__INCLUDED_)

⌨️ 快捷键说明

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