Re: A standard DB function group would be nice.
| From: | Sascha Schumann | Date: | Thu, 08 Apr 1999 21:21:09 +0000 |
| Subject: | Re: A standard DB function group would be nice. | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-4989@lists.php.net to get a copy of this message | ||
On Thu, Apr 08, 1999 at 03:00:47PM -0500, John Matzen wrote:
> I don't mean to sound gripy, but I run 3 DB engines here (mysql,
> postgresql, and Oracle 8), and it would be nice if PHP did not have a
> separate set of functions to access each one, because I've got to
> rewrite tons of code to make a program work on each different database.
> If PHP had something like Perl's DBI library, it would eliminate a lot
> of the work!
>
> Just an idea... :)
Check out PHPLIB's db abstraction layer. It features support for several
databases (Oracle, PostgreSQL, MySQL, mSQL, Sybase and generic ODBC), so you
might be interested into it.
http://phplib.shonline.de/
If you know DBI, using the classes should not be a problem. For example, a
simple Perl script could look like this
$dbh = DBI->connect($data_source);
$sth = $dbh->prepare($statement);
$sth->execute(@bind_values);
while(@row = $sth->fetchrow_array) {
print $row[0];
...
}
$sth->finish;
$dbh->disconnect;
The PHP3 equivalent using PHPLIB:
$dbh = new my_db;
$dbh->query($full_sql_statement);
while($dbh->next_record()) {
$row = $dbh->Record;
print $row[0];
...
}
--
Regards,
Sascha Schumann |
Consultant | finger sas@schell.de
| for PGP public key
--
PHP Development Mailing List http://www.php.net/
To unsubscribe send an empty message to php-dev-unsubscribe@lists.php.net
For help: php-dev-help@lists.php.net