Hello,

Richard Ellerbrock wrote:
> >> I'm planning to write a database application for  MySQL, and then port
> >> it
> > to
> >> PostrgeSQL.
> >> Is there any library or class that could help me to write/maintain just
> > one
> >> source code for both MySQL and PostgreSQL ?
> >
> > I think your best (if not the only) option in PHP is Metabase.
> >
> > http://www.phpclasses.org/metabase
> >
> > <snip spam>
> >
> > you could also use PEAR (http://pear.php.net/) which has a more than
> > adequate abstraction layer for various databases.
> 
> Another alternative (that does not require you to login before you can
> download) and that promises all the functionality that Metabase does and
> more is AdoDB (http://php.weblogs.com). It is also released under the LGPL which
> allows you to use it in commercial applications.

I notice a few inaccuracies here.

1) ADODB still has to "run" a lot until it has all the functionality of
Metabase, especially when it comes to portable database development.
Just a few examples:

- Schema management - Metabase is the only database abstraction package
(in PHP or anything else) that lets you define a database independent
schema definition of tables, fields, indexes and sequences using XML.

>From them on, Metabase installs and maintains the schema for you in your
database of choice. If you want to migrate a schema and any data already
stored in a database installed by Metabase, it can export the schema and
data in a single XML file of the same format so you can use it and
re-install it in a new database without loosing information. This
directly addresses a need of the original poster.

This is a remarkable and unique capability of Metabase. Soon there will
be even a book written by several developers about PHP and XML that has
a whole chapter dedicated to Metabase and this outstanding use of XML
for a very useful purpose.


- Prepared queries - this is meant to execute queries that are
pre-compiled. After you process a prepared query you may execute it once
or more times eventually changing the values of some constant parameters
in the query.

Metabase prepared queries support may convert data types so the values
match the underlying database data type representation format.

Prepared queries in practice are the same as what John Lim calls in this
document http://php.weblogs.com/portable_sql as "binding", except that
he doesn't seem to be aware that it is the same thing, so he says that
only some database can use it! :-) Metabase handles prepared queries
with ALL supported databases.

- LOB data streaming - Large OBject fields (AKA LOBs) are fields meant
to store large amounts of data. ADODB has limited supported to LOBs.
Either you have all data in memory or in a file. This is inadequate
because if you need to insert large ammounts of data, you may simply
exhaust your computer memory.

Metabase has a streaming interface for LOBs. You can read or write data
to LOBs in data chunks of limited size so you don't take too much
memory. You can even query a table with LOB fields and update or insert
in another fields pulling data directly from the selected field.

Metabase implements LOB in all supported databases that have this kind
of fields, which is what matters to the original poster.

2) LGPL is not a good Open Source license for commercial companies. It
lets you use LGPL'd software in commercial companies without
contaminating them, but if the company needs to change anything in the
LGPL, you are required to publish those changes. Like RMS says, it's
Free as in freedom of speech, not as in free beer! So, basically it has
a cost for companies that is to have to disclose the know how and work
time invested on the changes that they make.

A better license for companies that sell commercial applications using
Open Source software is BSD. It is better because it is not tying as
LGPL. You can do anything with the code including modify and distribute
(sell) it with the modifications without have contribute back your
changes. Metabase uses the BSD license.


Last but not least, PHP ADODB is an attempt of John Lim to develop
something of his own copying ideas and names from everywhere and cash on
it by selling PHPLens. He copied Microsoft ADODB to appeal better to
Windows users. But since ADODB was not meant specifically for portable
Web development, he still needed to copy features of Metabase like
auto-incremented integer sequence values and limiting the range of rows
returned in select queries result sets. Some of these things that were
copied had their names changes to not look so obvious but they are still
copies of Metabase features because only Metabase provided them before.

Anyway, if you are thinking of using something that is just a limited
copy of something, why not use Metabase, the original, and stil benefit
of all the features that PHP ADO DB misses?

Regards,
Manuel Lemos

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to