PHP中轻型的数据库抽象类:ADODB Lite

作者:网络 来源:佚名 更新时间:2008-07-07 00:38:28 点击:

在php项目开发中,很多架构都是:smarty + adodb来做的,因为smarty功能强大,超过了任何模板处理类,特别是缓存技术。adodb功能强大,远远超过了pear::db处理类,所以大部分人都选择adodb做数据库抽象类,但是adodb类库非常庞大,运行速度非常慢,这样也是部分开发人员选择pear db的原因。

但是,现在为止,这个现象要改变了,因为出来了一个adodb的小型版: adodb lite

据官方网站介绍说:

支持了所有php能支持的流行数据库.而且据说比原来的老版本快了很多.
只需要完整版的1/6内存,完全兼容adodb,据官方说法,可以完全不要改动代码的情况下移植到adodb lite下。

看官方网站的说法:

adodb lite was a result of a need for a very small, fast adodb library for a browser based game we have been working on for over two years called alien assault traders.

we noticed that the adodb package was consuming over 640k of ram for each http access. this was even greater than the amount used by the biggest php program file used in the game. in effect the adodb library was consuming vastly more resources than the game itself. this greatly restricts the number of players that can be online at the same time in respect to the amount of memory required by each client.

currently, adodb lite uses 80-85k of system ram for each http access. this is about an 87% smaller memory footprint. a side benefit is an increase in speed. the speed increase will vary depending upon the database. this is also a great replacement for extremely high traffic web sites.

we decided to create an ado database library that was compatible with adodb and used far less memory when executed. this library has a very restricted command set and eliminates most of the esoteric commands that will not be used by most websites.

adodb lite is a drop in replacement for adodb as long as you are not using unsupported commands on your website.

the following databases are supported:
databasetype designator (database name)
fbsq (frontbase)
maxdb (max db)
msql (mini sql)
mssql (microsoft sql)
mysql (mysql)
mysqli (mysql improved)
mysqlt (mysql w/transactions)
postgres (postgres)
postgres64 (postgres 6.4)
postgres7 (postgres 7)
sqlite (sqlite)
sybase (sybase)


the only databases that have been fully tested are the mysql databases. drivers have been provided for the other databases and they should work. i would appreciate it if users would report how well the other database drivers function.

简直是。。。呵呵,我想是许多php开发者的喜欢,因为解决了速度问题。

adodb lite 目前最新版本是:0.0.6

官方网站:http://adodblite.sourceforge.net/