// ==============================================================
// ORACLE, ODBC and DB2/CLI Template Library, Version 4.0.187,
// Copyright (C) Sergei Kuchin, 1996,2009
// Author: Sergei Kuchin
// This library is free software. Permission to use, copy,
// modify and redistribute it for any purpose is hereby granted
// without fee, provided that the above copyright notice appear
// in all copies.
// ==============================================================
#ifndef __OTL_H__
#define __OTL_H__
#if defined(OTL_INCLUDE_0)
#include "otl_include_0.h"
#endif
#define OTL_VERSION_NUMBER (0x0400C1L)
#if defined(_MSC_VER) && (_MSC_VER >= 1400)
#pragma warning (disable:4351)
#pragma warning (disable:4290)
#define OTL_STRCAT_S(dest,dest_sz,src) strcat_s(dest,dest_sz,src)
#define OTL_STRCPY_S(dest,dest_sz,src) strcpy_s(dest,dest_sz,src)
#define OTL_STRNCPY_S(dest,dest_sz,src,count) strncpy_s(dest,dest_sz,src,count)
#else
#define OTL_STRCAT_S(dest,dest_sz,src) strcat(dest,src)
#define OTL_STRCPY_S(dest,dest_sz,src) strcpy(dest,src)
#define OTL_STRNCPY_S(dest,dest_sz,src,count) strncpy(dest,src,count)
#endif
#include <string.h>
#include <ctype.h>
#include <stdlib.h>
#include <stdio.h>
//======================= CONFIGURATION #DEFINEs ===========================
// Uncomment the following line in order to include the OTL for ODBC:
//#define OTL_ODBC
// Uncomment the following line in order to include the OTL for
// MySQL/MyODBC for MyODBC 2.5 (pretty old). Otherwise, use OTL_ODBC
//#define OTL_ODBC_MYSQL
// Uncomment the following line in order to include the OTL for DB2 CLI:
//#define OTL_DB2_CLI
// Uncomment the following line in order to include the OTL for
// Oracle 7:
//#define OTL_ORA7
// Uncomment the following line in order to include the OTL for
// Oracle 8:
//#define OTL_ORA8
// Uncomment the following line in order to include the OTL for
// Oracle 8i:
//#define OTL_ORA8I
// Uncomment the following line in order to include the OTL for
// Oracle 9i:
//#define OTL_ORA9I
// Uncomment the following line in order to include the OTL for
// Oracle 10g Release 1:
//#define OTL_ORA10G
// Uncomment the following line in order to include the OTL for
// Oracle 10g Release 2:
//#define OTL_ORA10G_R2
// Uncomment the following line in order to include the OTL for
// Oracle 11g Release 1
//#define OTL_ORA11G
// The macro definitions may be also turned on via C++ compiler command line
// option, e.g.: -DOTL_ODBC, -DOTL_ORA7, -DOTL_ORA8, -DOTL_ORA8I, -DOTL_ODBC_UNIX
// -DOTL_ODBC_MYSQL, -DOTL_DB2_CLI
// this becomes the default from version 4.0.162 and on.
// the #define is not enabled for vc++ 6.0 in version 4.0.167 and higher.
#if !defined(OTL_UNCAUGHT_EXCEPTION_ON) && !(defined(_MSC_VER)&&(_MSC_VER==1200))
#define OTL_UNCAUGHT_EXCEPTION_ON
#endif
#if defined(OTL_ORA11G)
#define OTL_ORA10G_R2
#endif
#if defined(OTL_STREAM_LEGACY_BUFFER_SIZE_TYPE)
typedef short int otl_stream_buffer_size_type;
#else
typedef int otl_stream_buffer_size_type;
#endif
#if defined(OTL_ODBC_MULTI_MODE)
#define OTL_ODBC
#define OTL_ODBC_SQL_EXTENDED_FETCH_ON
#endif
#if defined(OTL_ODBC_MSSQL_2005)
#define OTL_ODBC
#endif
#if defined(OTL_ODBC_MSSQL_2008)
#define OTL_ODBC
#define OTL_ODBC_MSSQL_2005
#endif
#if defined(OTL_IODBC_BSD)
#define OTL_ODBC
#define OTL_ODBC_UNIX
#endif
#if defined(OTL_ODBC_TIMESTEN_WIN)
#define OTL_ODBC_TIMESTEN
#define OTL_ODBC
#define OTL_ODBC_SQL_EXTENDED_FETCH_ON
#define ODBCVER 0x0250
#include <timesten.h>
#endif
#if defined(OTL_ODBC_TIMESTEN_UNIX)
#define OTL_ODBC_TIMESTEN
#define OTL_ODBC
#define OTL_ODBC_UNIX
#define OTL_ODBC_SQL_EXTENDED_FETCH_ON
#include <timesten.h>
#endif
#if defined(OTL_ODBC_ENTERPRISEDB)
#define OTL_ODBC_POSTGRESQL
#endif
#if defined(OTL_ODBC_POSTGRESQL)
#define OTL_ODBC
#endif
// Comment out this #define when using pre-ANSI C++ compiler
#if !defined(OTL_ODBC_zOS) && !defined (OTL_ANSI_CPP)
#define OTL_ANSI_CPP
#endif
#if defined(OTL_ODBC_zOS)
#define OTL_ODBC_UNIX
#define OTL_ODBC_SQL_EXTENDED_FETCH_ON
#endif
#if defined(OTL_ORA8I)
#define OTL_ORA8
#define OTL_ORA8_8I_REFCUR
#define OTL_ORA8_8I_DESC_COLUMN_SCALE
#endif
#if defined(OTL_ORA10G)||defined(OTL_ORA10G_R2)
#define OTL_ORA9I
#define OTL_ORA_NATIVE_TYPES
#endif
#if defined(OTL_ORA9I)
#define OTL_ORA8
#define OTL_ORA8_8I_REFCUR
#define OTL_ORA8_8I_DESC_COLUMN_SCALE
#endif
#if defined(OTL_ODBC_MYSQL)
#define OTL_ODBC
#endif
#if defined(OTL_ODBC_XTG_IBASE6)
#define OTL_ODBC
#endif
#define OTL_VALUE_TEMPLATE
//#define OTL_ODBC_SQL_EXTENDED_FETCH_ON
#if defined(OTL_ODBC_UNIX) && !defined(OTL_ODBC)
#define OTL_ODBC
#endif
#if defined(OTL_BIND_VAR_STRICT_TYPE_CHECKING_ON)
#define OTL_CHECK_BIND_VARS \
if(strcmp(type_arr,"INT")==0|| \
strcmp(type_arr,"UNSIGNED")==0|| \
strcmp(type_arr,"SHORT")==0|| \
strcmp(type_arr,"LONG")==0|| \
strcmp(type_arr,"FLOAT")==0|| \
strcmp(type_arr,"DOUBLE")==0|| \
strcmp(type_arr,"TIMESTAMP")==0|| \
strcmp(type_arr,"TZ_TIMESTAMP")==0|| \
strcmp(type_arr,"LTZ_TIMESTAMP")==0|| \
strcmp(type_arr,"BIGINT")==0|| \
strcmp(type_arr,"CHAR")==0|| \
strcmp(type_arr,"CHARZ")==0|| \
strcmp(type_arr,"DB2DATE")==0|| \
strcmp(type_arr,"DB2TIME")==0|| \
strcmp(type_arr,"VARCHAR_LONG")==0|| \
strcmp(type_arr,"RAW_LONG")==0|| \
strcmp(type_arr,"RAW")==0|| \
strcmp(type_arr,"CLOB")==0|| \
strcmp(type_arr,"BLOB")==0|| \
strcmp(type_arr,"NCHAR")==0|| \
strcmp(type_arr,"NCLOB")==0|| \
strcmp(type_arr,"REFCUR")==0) \
; \
else \
return 0;
#else
#define OTL_CHECK_BIND_VARS
#endif
// ------------------- Namespace generation ------------------------
#if defined(OTL_EXPLICIT_NAMESPACES)
#if defined(OTL_DB2_CLI)
#define OTL_ODBC_NAMESPACE_BEGIN namespace db2 {
#define OTL_ODBC_NAMESPACE_PREFIX db2::
#define OTL_ODBC_NAMESPACE_END }
#else
#define OTL_ODBC_NAMESPACE_BEGIN namespace odbc {
#define OTL_ODBC_NAMESPACE_PREFIX odbc::
#define OTL_ODBC_NAMESPACE_END }
#endif
#define OTL_ORA7_NAMESPACE_BEGIN namespace oracle {
#define OTL_ORA7_NAMESPACE_PREFIX oracle::
#define OTL_ORA7_NAMESPACE_END }
#define OTL_ORA8_NAMESPACE_BEGIN namespace oracle {
#define OTL_ORA8_NAMESPACE_PREFIX oracle::
#define OTL_ORA8_NAMESPACE_END }
#else
// Only one OTL is being intantiated
#if defined(OTL_ODBC)&&!defined(OTL_ORA8)&& \
!defined(OTL_ORA7)&&!defined(OTL_DB2_CLI) \
|| !defined(OTL_ODBC)&&defined(OTL_ORA8)&& \
!defined(OTL_ORA7)&&!defined(OTL_DB2_CLI) \
|| !defined(OTL_ODBC)&&!defined(OTL_ORA8)&& \
defined(OTL_ORA7)&&!defined(OTL_DB2_CLI) \
|| !defined(OTL_ODBC)&&!defined(OTL_ORA8)&& \
!defined(OTL_ORA7)&&defined(OTL_DB2_CLI)
#define OTL_ODBC_NAMESPACE_BEGIN
#define OTL_ODBC_NAMESPACE_PREFIX
#define OTL_ODBC_NAMESPACE_END
#define OTL_ORA7_NAMESPACE_BEGIN
#define OTL_ORA7_NAMESPACE_PREFIX
#define OTL_ORA7_NAMESPACE_END
#define OTL_ORA8_NAMESPACE_BEGIN
#define OTL_ORA8_NAMESPACE_PREFIX
#define OTL_ORA8_NAMESPACE_END
#endif
// ================ Combinations of two OTLs =========================
#if defined(OTL_ODBC) && defined(OTL_ORA7) && \
!defined(OTL_ORA8) && !defined(OTL_DB2_CLI)
#define OTL_ODBC_NAMESPACE_BEGIN namespace odbc{
#define OTL_ODBC_NAMESPACE_PREFIX odbc::
#define OTL_ODBC_NAMESPACE_END }
#define OTL_ORA7_NAMESPACE_BEGIN namespace oracle {
#define OTL_ORA7_NAMESPACE_PREFIX oracle::
#define OTL_ORA7_NAMESPACE_END }
#define OTL_ORA8_NAMESPACE_BEGIN
#define OTL_ORA8_NAMESPACE_PREFIX
#define OTL_ORA8_NAMESPACE_END
#endif
#if defined(OTL_ODBC) && !defined(OTL_ORA7) && \
defined(OTL_ORA8) && !defined(OTL_DB2_CLI)
#define OTL_ODBC_NAMESPACE_BEG
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
跨数据库平台: 支持 oracle 的OCI 支持DB2的CLI 支持ODBC(通过ODBC,可支持SQL SERVER,MySQL等) 跨OS平台: 标准C++语言,支持 unix/linux/windows 使用简单: 只有一个头文件 接口简洁.otl_stream, otl_connect, otl_exception等就可以完成大部分工作 相对 ProC等嵌入式开发,代码能相应减少 性能: 直接访问数据库API接口,具有API接口的高效率,可靠性 稳定性: 开源代码,唯一的代码文件otlv4.h,可以了解所有基于数据库API的实现细节 从1996年开始,到今已10余年 可读性及可维护性: 标准C++代码,不需要任何预处理 使用流的形式,输入输出异常简洁 减少大量代码 代码结构更加简洁 参考资料:http://otl.sourceforge.net/
资源推荐
资源详情
资源评论
收起资源包目录
otl.rar (1个子文件)
otlv4.h 782KB
共 1 条
- 1
superlazy
- 粉丝: 28
- 资源: 18
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
- 3
- 4
- 5
前往页