PHP头条
热点:

一次编写,随处运行


关于 php(做为现在的主流开发语言) 的数据库 API 对于不同的数据库有不同的函数,一直以来就有人尝试使用 php(做为现在的主流开发语言) 的面向对象的功能进行一些封装。其中有比较着名的ADODB,php(做为现在的主流开发语言)LIB。后来举世瞩目的 PEAR 项目中的 PEAR DB 更是其中的佼佼者。这些用面向对象对数据库 API 进行的封装的包一般称为数据库抽象层。

本文介绍的是 PEAR 中对 PEAR DB 进行融合 Metabase 库的一些优秀功能之后产生的注重效率,而且简单易用,功能非常强大的 MDB 的一个非常好的介绍。作者就是 MDB 的主创人员。

想获得我最近关注的 php(做为现在的主流开发语言)/PEAR 的最新原创和译文,请访问我的主页

Write once - run anywhere
一次编写——随处运行

PEAR MDB Database Abstraction Layer
PEAR MDB 数据库抽象层

作者:Lukas Smith
译者:taowen

While this is a Java marketing phrase it is also a key feature of php(做为现在的主流开发语言). Many business models depend on operation system independence to ensure that products can be sold to a wide range of customers. So why lock yourself in with a specific database vendor? Database abstraction layers allow you to develop your application independent of a database. But often they eat more performance than you are willing to give or they do not abstract enough to eliminate all database specific code.
这是Java的一句行销口号,但是它同时也是php(做为现在的主流开发语言)的关键特性之一。许多商业模型依赖于操作系统无关性来保证产品能够销售给广泛的客户群体。因而,为什么要把你自己绑在某种数据库厂商的身上呢?数据库抽象层使得你能够与数据库独立的开发你的应用程序。但是,通常情况下它们对性能的影响超过了你所希望的,要么他们并不足够抽象以消除所有和特定数据库相关的代码。

What will this article teach me?
这篇文章将教给我什么?

This article will give a good introduction to the database abstraction package PEAR MDB. The focus will be explaining the more advanced features of MDB like data type abstraction and the xml(标准化越来越近了) based schema management that go beyond what other similar packages offer. A basic level of understanding of php(做为现在的主流开发语言) and SQL is recommended.
这篇文章将对数据库抽象包 PEAR MDB 有一个很好的介绍。文章的焦点将是对 MDB 超越类似包所提供的更先进的特性,例如数据类型抽象和基于 xml(标准化越来越近了) 的 schema 管理。对 php(做为现在的主流开发语言) 和 SQL 的基本理解是推荐的。

Why another database class?
为什么另外再要一个数据库类?

Often, web projects are added to existing IT infrastructures, where the client already made a choice of what RDBMS (relational database management system) to work with. Even if that is not the case different budgets might affect what database you chose for deployment. Finally, you as the developer simply might prefer not to lock yourself in with a specific vendor. So far this meant to keep multiple versions for each supported database or giving up more performance and ease of use than necessary: Enter PEAR MDB.
通常, web 工程在客户已经确定了要使用那种 RDBMS (关系型数据库管理系统)之后被添加给已经存在的 IT 基础结构。即使那并不是因为不同的预算可能影响的你选择何种数据用于部署的情况。最终,你作为开发者可能简单的偏好于不把自己绑在某个厂商身上。自此,意味着给每个支持的数据保持版本或者牺牲更多性能但是获得多于必须的易用性:走入 PEAR MDB 吧。

MDB is a database abstraction layer that aims to make writing RDBMS independent php(做为现在的主流开发语言) application development a straightforward process. Most other so called database abstraction layers for php(做为现在的主流开发语言) only provide a common API for all supported databases and only very limited abstraction (mostly only for sequences). MDB on the other hand can be used to abstract all data being send and received from the database. Even database schemas can be defined in a RDBMS independent format. But it does this while retaining a high level of performance and ease of use. This was achieved by closely examining two popular database abstraction layers, PEAR DB and Metabase, and merging them. But during the merging the opportunity was also used to clean up their merged APIs as well as any performance hindering design patterns.

www.phpzy.comtrue/phprm/32762.htmlTechArticle一次编写,随处运行 关于 php (做为现在的主流开发语言) 的数据库 API 对于不同的数据库有不同的函数,一直以来就有人尝试使用 php (做为现在的主流开发语言) 的面向对象的功能进行一...

相关文章

    暂无相关文章

PHP之友评论

今天推荐