PHP Database Abstraction Layer
| From: | Luke Woollard | Date: | Thu, 06 Feb 2003 05:12:45 +0000 |
| Subject: | PHP Database Abstraction Layer | ||
| References: | 1 | Groups: | php.db php.general |
| Request: | Send a blank email to php-general+get-134542@lists.php.net to get a copy of this message | ||
I once read a great article in the first or second issue of
http://www.phparch.com/ on database abstraction layers. At
which point I
used the tutorial as a starting point for creating a very similar structure
I named dbWave. There are only minor differences and a postgresql driver is
now included for the most common pg_* functions.
I was just wondering if anyone has developed a database abstraction layer
that allows you to separate your SQL queries from your application logic
like dbWave does? I'm looking for a more advanced way of doing this?
Attached is dbWave for anyone to look at/use. To run it you need to use the
following tags in your file:
// DBWave include files
include( "[attached_filename].php" );
To instantiate the dbWave object you use the following code in a file name
connect.php
<?php
/* This file instantiates dbWave using our chosen API */
/* It is automatically generated by the database setup program */
// Instantiate dbWave using the MySQL API
$dbWave = new Mysql();
// Connect to the database
$dbWave->connect( 'yourhost', 'yourport', 'yourdbname',
'yourdbuser',
'yourdbpass' );
?>
Thanks,
Luke Woollard
Programmer / Analyst
TABORVISION.com