?? otlhandle.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 + -