RE: [PHP] Database abstraction
| From: | Manuel Lemos | Date: | Wed, 30 Aug 2000 00:52:37 +0000 |
| Subject: | RE: [PHP] Database abstraction | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-14297@lists.php.net to get a copy of this message | ||
Hello Andrew,
On 24-Aug-00 10:41:23, you wrote:
>Or you could just use ODBC, as this is what it is intended for... :)
I'm afraid ODBC does not do enough for complete database abstraction.
Metabase goes farther. Not only it abstracts access, but it also abstracts
the installation of databases. In this context, when I say databases, I
don't mean just the tables and fields, but also indexes and sequences.
While trying to implement a Metabase driver to use ODBC, I got stuck
while trying to implement sequences support. The problem is that I can't
figure if the underlying database supports any sort of sequences system.
Not all DBMS support sequences, but most of those that don't support them,
they support at least one auto-incremented field per table. Metabase
emulates sequences with such fields in separate tables for those databases.
My problem with ODBC is that not only I don't know how to figure what
support to sequences/auto-increment the database of a given ODBC data
source may provide.
Another puzzling doubt is about how to retrieve a limited range of rows of
a result set, like you can use LIMIT clause in MySQL. Metabase provides a
way to achive this very easily in a database independent manner, just by
calling MetabaseSetSelectedRowRange before executing a query.
I have no idea how to figure what support the underlying database has in
ODBC. I have to default to skiping any initial page rows and emulate a
result set that is limited to the specified row limit if smaller, but I'm
afraid this won't prevent the server from hogging the CPU fecthing large
result sets.
If you have any idea about these ODBC puzzles, please let me know. If not,
I usually discourage the use of ODBC under PHP despite there is significant
demand.
Regards,
Manuel Lemos
Web Programming Components using PHP Classes.
Look at: http://phpclasses.UpperDesign.com/?user=mlemos@acm.org
--
E-mail: mlemos@acm.org
URL: http://www.mlemos.e-na.net/
PGP key: http://www.mlemos.e-na.net/ManuelLemos.pgp
--