OTL翻译(3) -- OTL的主要类

原文地址:http://blog.sina.com.cn/s/blog_79d599dc0100rk6v.html

 

 

OTL的类

相比于传统的C++类库而言,OTL更像是一个代码容器,里面复杂,但对外的接口简单。OTL在处理程序方面受到了STL的影响。

OTL有一个模板框架,它实现了otl_stream的概念。该框架由模板类和内联函数组成。模板类把普通的类型作为参数,这些参数的类型提供了对数据库API的详细操作。

对于已有的数据库API,OTL提供如下的数据库API支持:

·       Oracle Call Interface for Oracle 7/8/8i /9i/10g/10gR2/11g (OCI7/8/8i/9i/10g/10gR2/11g)

·       Open Data Base Connectivity (ODBC)

·       MS SQL Server 2005/2008's SQL Native Client (SNAC)

·       DB2 Call Level Interface (CLI)

·       Informix CLI

·       TimesTen CLI

·       SAP DB CLI

OTL适配器通过经量级的封装数据库API,并且由于OTL适配器是直接的与模板框架进行通信,所以OTL能够提供近乎直接调用数据库API的性能。

OTL的模板框架提供了如下的OTL类:

Otl_stream

Otl_connect

Otl_exception

Otl_long_string

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
OTL介绍: OTL 是 Oracle, Odbc and DB2-CLI Template Library 的缩写,是一个C++操控关系数据库的模板库,最新版本4.0.104,参见http://otl.sourceforge.net/ 优点:a. 跨平台 b. 运行效率高,与C语言直接调用API相当 c. 开发效率高,起码比ADO.net使用起来更简单,更简洁 d. 部署容易,不需要ADO组件,不需要.net framework 等 缺点: a. 只有C++才可以使用她 b. 说明以及范例不足(已附带了686个实例) 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 of OTL streams. The OTL-adapters are thin wrappers around the database APIs and are used as class 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-compliant stream iterators, and natively supports the STL std::string's in otl_stream's. OTL integrates with ACE, 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 support 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.
SQLAlchemy 是一个 SQL 工具包和对象关系映射(ORM)库,用于 Python 编程语言。它提供了一个高级的 SQL 工具和对象关系映射工具,允许开发者以 Python 和对象的形式操作数据库,而无需编写大量的 SQL 语句。SQLAlchemy 建立在 DBAPI 之上,支持多种数据库后端,如 SQLite, MySQL, PostgreSQL 等。 SQLAlchemy 的核心功能: 对象关系映射(ORM): SQLAlchemy 允许开发者使用 Python 来表示数据库表,使用的实例表示表中的行。 开发者可以定义之间的关系(如一对多、多对多),SQLAlchemy 会自动处理这些关系在数据库中的映射。 通过 ORM,开发者可以像操作 Python 对象一样操作数据库,这大大简化了数据库操作的复杂性。 表达式语言: SQLAlchemy 提供了一个丰富的 SQL 表达式语言,允许开发者以 Python 表达式的方式编写复杂的 SQL 查询。 表达式语言提供了对 SQL 语句的灵活控制,同时保持了代码的可读性和可维护性。 数据库引擎和连接池: SQLAlchemy 支持多种数据库后端,并且为每种后端提供了对应的数据库引擎。 它还提供了连接池管理功能,以优化数据库连接的创建、使用和释放。 会话管理: SQLAlchemy 使用会话(Session)来管理对象的持久化状态。 会话提供了一个工作单元(unit of work)和身份映射(identity map)的概念,使得对象的状态管理和查询更加高效。 事件系统: SQLAlchemy 提供了一个事件系统,允许开发者在 ORM 的各个生命周期阶段插入自定义的钩子函数。 这使得开发者可以在对象加载、修改、删除等操作时执行额外的逻辑。
SQLAlchemy 是一个 SQL 工具包和对象关系映射(ORM)库,用于 Python 编程语言。它提供了一个高级的 SQL 工具和对象关系映射工具,允许开发者以 Python 和对象的形式操作数据库,而无需编写大量的 SQL 语句。SQLAlchemy 建立在 DBAPI 之上,支持多种数据库后端,如 SQLite, MySQL, PostgreSQL 等。 SQLAlchemy 的核心功能: 对象关系映射(ORM): SQLAlchemy 允许开发者使用 Python 来表示数据库表,使用的实例表示表中的行。 开发者可以定义之间的关系(如一对多、多对多),SQLAlchemy 会自动处理这些关系在数据库中的映射。 通过 ORM,开发者可以像操作 Python 对象一样操作数据库,这大大简化了数据库操作的复杂性。 表达式语言: SQLAlchemy 提供了一个丰富的 SQL 表达式语言,允许开发者以 Python 表达式的方式编写复杂的 SQL 查询。 表达式语言提供了对 SQL 语句的灵活控制,同时保持了代码的可读性和可维护性。 数据库引擎和连接池: SQLAlchemy 支持多种数据库后端,并且为每种后端提供了对应的数据库引擎。 它还提供了连接池管理功能,以优化数据库连接的创建、使用和释放。 会话管理: SQLAlchemy 使用会话(Session)来管理对象的持久化状态。 会话提供了一个工作单元(unit of work)和身份映射(identity map)的概念,使得对象的状态管理和查询更加高效。 事件系统: SQLAlchemy 提供了一个事件系统,允许开发者在 ORM 的各个生命周期阶段插入自定义的钩子函数。 这使得开发者可以在对象加载、修改、删除等操作时执行额外的逻辑。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值