Re: Perl-like DBI and generic SQL
| From: | Michael Kimsal | Date: | Mon, 15 Jan 2001 14:30:22 +0000 |
| Subject: | Re: Perl-like DBI and generic SQL | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-34623@lists.php.net to get a copy of this message | ||
Dean Hall wrote:
> I read once on this list that PHP supports a DBI-like database access object (such as the one
> in Perl). Is this true? Does anyone know where I can find documentation for it? I can't seem to
> find it in the manual.
>
> Also, how do you all handle generic SQL for multiple DBMSs? I'd like (ideally) to write
> SQL that is DBMS-independent, although that's probably not possible. I'm very familiar
> with mysql and not much else; as far as I'm aware, mysql is the primary DBMS that has problems
> with standard SQL (like nested queries and such). Does anyone even worry about this?
>
> I'm writing a little piece of software that I'd like to be as extensible as possible
> and as usable as possible for people using any DBMS, including mysql.
>
> Anyway, if I can't find a generic built-in database interface in PHP, it'll all be
> moot. I'd really rather not use phplib; I'd like to use an interface built in to the
> interpreter rather than something that's interpreted on every page access.
>
You won't find one. The 'benefit' of PHP is that is, for the most part, uses native
db drivers for access to each db. Should be a bit faster and allows access to the specific features
of each db.
There is a PEAR repository which offers something similar to DBI, afaik, but it's not widely
discussed, from what I can see. PEAR is a set of files that comes with a distribution, and there is
a README. People on shared host environments may be out of luck here, though, with respect to a
README (d/l the file and read it manualyl I guess).
"metabase" from manuel lemos purports to be a single interface to multiple dbs - write one
SQL statement and it'd do the necessary translation on the SQL to be specific to whatever db
you are using. Haven't used it, but heard nice things about it. But, it violates your
'not interpreted' clause.
Good luck.
>
> Thanks for the help.
> Dean.