otlhandle.h

来自「一个利用OTL访问ORACLE数据库的例子」· C头文件 代码 · 共 73 行

H
73
字号
// 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 // Compile OTL 4/OCI8
//#define OTL_ODBC     // Compile OTL 4/OCI8
///////////////////////////////////////////////////
#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
#include "otlv4.h"   // include the OTL 4 header file

using namespace std;

class COtlHandle  
{
public:
	COtlHandle();
	virtual ~COtlHandle();
public:
	otl_connect m_db;
public:
    bool ConnectDB(const char * strConn); //建立数据库连接
	bool ExcuteSQL(const char * strSQL);  //直接执行
	bool GetDataSetFromDB(const char * strQuery,otl_stream * pDataSet);  
	void SetMaxLongSize( const int nSize )
	{
		m_db.set_max_long_size( nSize );
	}
private:
	void ini_otl();                       
	void fini_otl();
};

#endif // !defined(AFX_OTLHANDLE_H__F182EED1_51DA_408C_9552_7F7853265B24__INCLUDED_)

⌨️ 快捷键说明

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