原文
This document describes the Oracle, ODBC and DB2-CLI Template Library, Version 4.0 (OTL 4.0). OTL 4.0 is a C++ library based on C++ templates.
OTL 4.0 was designed as a combination of a C++ template framework and OTL-adapters. The framework is a generic implementation of the concept ofOTL streams. The OTL-adapters are thin wrappers around the database APIs and are used asclass type parameters to be passed into the template framework.
OTL 4.0 covers the functionality of a full featured C++ database access library with just a handful of classes:otl_stream, otl_connect,otl_exception, otl_long_string, and several template PL/SQL (Oracle) table container classes, generated from the template framework and the OTL-adapters.
The OTL code gets expanded into direct database API function calls, so it provides very decent performance (only 10-15% overhead, compared with the database APIs themselves) and reliability in multi-processor environments as well as traditional batch programs. OTL 4.0, being a template library, is highly portable since it is self-sufficient and compact enough.
OTL 4.0 is ANSI C++ compliant (ANSI C++ typecasts, clean templatized code, etc.), tightly integrated with the Standard Template Library (STL) via STL-compliantstream iterators, and natively supports the STL std::string's in otl_stream's. OTL integrates withACE, and supports ACE_TStrings.
OTL 4.0 supports all versions of Oracle starting with 7.3 (natively via the corresponding version of the OCI), DB2 UDB LUW / zOS (natively via DB2 CLI), MS SQL Server 2005/2008 (natively via SNAC), Informix 11 (natively via Informix CLI), TimesTen 7 and higher (natively TimesTen CLI), SAP-MAX/DB (natively via SAP/DB CLI), ODBC 3.x as well as ODBC 2.5 (for legacy applications) compliant data sources in MS Windows, Linux/Unix/Mac OS X (via unixodbc and iODBC driver managers): Sybase, MySQL, PostgreSQL, EnterpriseDB, SQLite, MS ACCESS, Firebird, etc. The list of supported database back ends is growing.
In the last few years, transition from the 32-bit platforms to the 64-bit platforms has occurred: OTL's source code is portable, and it supports both 32-bit and 64-bit C++ compilers. Also, OTL supports UTF-8 and UTF-16 for Oracle, and UTF-16 for the rest of the database types, when the underlying database API / ODBC driver supports it.
翻译:
该文档说明的是4.0版本的ORACLE/ODBC和DB2-CLI模板库(OTL)。OTL4.0(后面简称OTL)模板库是基于C++的模板的。
OTL4.0是组合了C++的模板框架和OTL适配器。框架是一个简单的OTL_stream的概念,OTL适配器则是一个基于数据库API的经量级的类库,并且作为参数传给OTL的框架参数。
OTL4.0仅通过otl_stream,otl_connect,otl_exception,olt_long_string和几个简单的ORACLE数据库的从模板框架和OTL适配器派生的的table_container类便包含了所有其他的C++数据库访问类库的所有优点。
因为OTL的代码里面是直接调用数据库的API操作的,所以相比于原生的数据库API操作,OTL的性能上仅低10-15%左右,并且还能良好的支持多进程。OTL4.0因为专业与精简的类库,具有非常高的通用性。
OTL是ANSI编码的,与STL具有非常紧密的联系。并且支持STL的string在otl_stream里面;还整合了ACE通过支持ACE_TString。
OTL支持的数据库有,ORACLE7.3以上的版本、DB2 UDB LUW / Zos、MS SQL SERVER 2005/2008、Informix 11、TimesTen 7以上版本、SAP-MAX/DB、ODBC 2.5和3.0(通过unixodbc或iODBC)、Sybase、MySql、PostgreSQL、EnterpriseDB、SQLite、MS ACCESS、Firebird等等,后续还会添加更多支持。
在过去的一段时间里面,OTL在字符集方面作了一些修改。添加了64位平台的支持,现在OTL已经开始同时支持32和64位平台。并且在数据库的API或ODBC支持的情况下对ORACLE来讲还支持UTF-8和UTF16字符集,对其他的数据库则支持UTF-16字符集。