Re: [PHP] database abstraction layer

[email protected] ("Michael A. Peters")
Newsgroups php.general
Message-ID <[email protected]>
Lars Nielsen wrote:
> Hi List
> 
> I am trying to make a Database Abstraction Layer so I can which the DB
> of my application between MySQL and Postgresql. I have been looking at
> the way phpBB does it, and it seems that it is only then php-functions
> which are different. The SQL seems to be the same.
> 
> Is it save to assume that I can use the same SQL, or should i make some
> exceptions?

Is there a reason why you want to write your own instead of using 
something like Pear MDB2?

With Pear MDB2 - if your SQL syntax is database specific it will work in 
the specific database but MDB2 will not try to port a specialized SQL 
string to another database.

It will port some features to some databases, IE if you use the MDB2 
facilities for prepared statements (highly recommended) and the target 
database does not support prepared statements, it will emulate them (I 
think, haven't tried, that's what I recall reading anyway) but for your 
actual SQL syntax it is best to stick to standard SQL.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.