Re: PHP Abstraction layers

From: Manuel Lemos <mlemos(at)acm(dot)org>
To: Francisco Reyes <lists(at)natserv(dot)com>
Cc: PostgresSQL PHP list <pgsql-php(at)postgresql(dot)org>
Subject: Re: PHP Abstraction layers
Date: 2002-01-22 04:02:10
Message-ID: 3C4CE442.62968CF8@acm.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-php

Hello,

Francisco Reyes wrote:
>
> I am seeking feedback/comments/recommendations on an abstraction layer to
> use for our development. So far I have found that the following layers
> exists:PHPLib, ADODB, PEAR DB, MetatData
>
> I have only seen examples from Pear and will try to see examples from the
> others, but I am wondering if anyone who has tried them could provide
> feedback.

If you are looking for a database abstraction package that provides true
database independence to your applications or components, you may want
to try Metabase (not Metadata).

Metabase provides true abstraction of database types. This means in
practice that from the point of view of the applications it always
handles data formatted in the same way regardless of how it is
represented in the database.

For instance, if your application deals with dates, it only sees them
formatted according to the ISO 9601 standard (YYYY-MM-DD) even if the
underlying databases represents dates in other format. Metabase will
take care of datatype conversions if necessary when storing or
retrieving data from the database.

A direct consequence of this, is that if you switch between databases
you will not need to touch your application.

Metabase was thought not only for database independence but also for Web
database programming in particular, so it offers some features that take
in consideration the constraints of Web programming.

Metabase pioneered the abstraction of things like providing a way to
offer the LIMIT clause functionality but in a way that works in all
supported database besides MySQL ( PostgreSQL, Oracle, MS SQL server,
Interbase, Informix, MiniSQL, ODBC, etc..). This is important for
display query results split in multiple pages. This class is based on
Metabase and takes advantage of this feature to display query results in
HTML tables eventually with a navigation bar that lets you go back and
forth between the different pages of the results.

http://phpclasses.upperdesign.com/browse.html/package/130

Metabase also pioneered the use of sequences in such way that it works
with databases that do not support sequences natively but support
auto-incremented table fields. This is important to insert entries with
unique id fields that are usually the table primary keys. The sequence
generation is always an atomic process, so no matter how many entries
may be entered into a table by simultaneous users, it is always done in
a consistent manner.

Another key feature of Metabase is the ability to install and maintain
database schemas. All you need to do is to describe your database
schemas in a custom XML file that specify the names and properties of
your tables, fields, indexes and sequences, all in a database
independent format.

Metabase manager class is able to process that schema description and
install it for you, no sweat. If some day you need to change that
schema, and often you need to, you just need to change the schema
description file. Then Metabase manager is able to process it and
compare with the previously installed schema to figure the changes that
were done and applying them safely to your schema. This is done without
affecting the data that was added after the first time the schema was
installed or updated for the last time.

A new release of Metabase was made just yesterday. It provides some
features that users were requesting like the ability to customize error
handling. It also provides yet another innovating features, which is the
SQL REPLACE implementation. This is a statement like SQL INSERT except
that if the values of the primary keys match the ones of an existing
row, it will update that row instead of inserting a new one. AFAIK, only
MySQL provides SQL REPLACE command, but Metabase provides a suitable
emulation that works the same way using transactions so it works also
with PostgreSQL, Oracle, MS-SQL server, Informix, Interbase, etc..

One important new feature is a set of new functions to fetch result set
data in a single call. These functions were contributed Lukas Smith and
Christopher Linn and are meant to end the complaints of some users that
claim that other PHP database abstraction packages are faster than
Metabase because they can fetch whole rows of data at once. These new
functions in Metabase should end those complaints.

Anyway, it is better for you to try it yourself. Metabase documentation
is through and very complete. There is also a small tutorial to get you
started quickly. If for some reason Metabase does not offer some
facility you need, you may want to contact me to tell about it, or
better implement it yourself and contribute your work to features
yourself in the hall of fame of Metabase contributors.

Metabase is free and is distributed with a BSD Open Source licence. For
those that don't know Metabase, you may find it here:

http://phpclasses.UpperDesign.com/browse.html/package/20

Regards,
Manuel Lemos

In response to

Responses

Browse pgsql-php by date

  From Date Subject
Next Message Christopher Kings-Lynne 2002-01-22 04:40:18 Re: PHP Abstraction layers
Previous Message Christopher Kings-Lynne 2002-01-22 01:30:32 Re: Long running queries and timeouts