[pmwiki-users] RFC- Database access via cookbook - agnostic? Re: SelectQuery development: database records as pages?

Ben Wilson dausha at gmail.com
Sat Sep 30 13:41:59 CDT 2006

On 9/30/06, Pico <pmwiki at ben-amotz.com> wrote:
> Crisses wrote:
> > Does anyone object to the use of a tool like ADODB for some recipes?  1)
> > same license as PmWiki 2) 2.7 MB installed (currently) 3) one of the
> > better open-source database abstraction layers 4) supports MANY
> > databases: http://phplens.com/adodb/supported.databases.html (some only
> > on Windows, or with a plug-in)  (may even include LDAP, but they're not
> > very clear on that one)
> How does ADOdb compare with Pear db?

Pear DB is no longer actively supported as it has been merged into
MDB2.[1] You also have to download other modules to actually use MDB2,
one for each database you want to support. So, as part of the goal is
to provide a common denominator that works on several databases, MDB2
presents some challenges.

I personally tend to abstract from SQL anyway. An example of how I
would tend to do things is the Slash code, where you can feed a hash
for insert or update and only those columns are changed. The only
thing I wasn't able to abstract away was the where clauses. But, my
last heavy work with RDBMS was 2004, before school.[2]

> While the temptation is to focus on issues like speed and functionality
> (in which case I gather from some quick google searches that ADOdb may
> have the advantage), I suggest that equally, if not more important, in
> this context are issues of availability, installation, and size.

MDB2 is only ~100KB before you add other, necessary modules for
specific databases (compressed). ADODB is 450KB (compressed), but Xes
pointed out this is 2.7MB uncompressed. Typically, web host providers
offer in the 100s or 1000s of MB, so this would represent either a 3
percent or per-mil hit. The web host I use offers 12GB for ~$10/m, so
size doesn't matter.

> Specifically, the most important issue, in my view, would be which tool
> is more commonly available on shared hosting servers.  I gather from
> past posts that both of you, including Ben W. ;-), maintain, or have
> access to your own servers and, thus I thought it was important to raise
> this issue explicitly.

I host just like everybody else; I use home servers for development
only. This is in part because (detailed discussion aside) my state
legislature created a felony to violate a data providers TOS by
imperfectly incorporating the state-DCMA laws---and public web hosting
is a violation of my data providers TOS.[3] I host with ImHosted,
which tends to offer a lot, but its current SSH policy is a little

> Most shared hosting servers provide php and mySQL, but I do not know the
> extent to which ADOdb or Pear db are included and, if not, whether they
> must be installed by the hosting provider (since shared hosting accounts
> typically have no command line access and ability to install executables).

ADODB assumes local installation. My experience with other Pear
modules is a local install is acceptable.

> > So essentially I'm asking cookbook authors if we can all agree on one
> > database abstraction layer for PmWiki -- for use when we're going to
> > deal with external databases.  It would be quite helpful if we all
> > agreed, and greatly extend the cookbook's support for a variety of data
> > sources.
> That sounds like a great idea.

Ben Wilson

[1]: http://pear.php.net/package/MDB2
[2]: Eighty-one days and I'm done!
[3]: They merged the old theft-of-cable law with the model state-DCMA,
which left in felony penalties but added in "in violation of data
providers terms of service." The sponsor claimed an intent
requirement, but intent is shown by possession, so the liability is
strict. Calling the cable company they acknowledged their power, but
said they would not abuse it.

More information about the pmwiki-users mailing list