* databases.inc is a new file that will serve as a database abstraction

layer.  My new files already take advantage of the abstraction layer
  though no attempt is made to port the existing files: this is sheduled
  for a future v0.40 release (see http://beta.drop.org/docs/roadmap.php).
  Anyway, with the abstraction layer it should be theoretically possible
  to run drop on top of every database, even on top of a home-brewed
  file-based system.  *wink-to-UnConeD* ;-)
3-00
Dries Buytaert 2000-06-10 19:08:23 +00:00
parent 9583c72c67
commit 4ce030b80d
1 changed files with 26 additions and 0 deletions

26
database.inc Normal file
View File

@ -0,0 +1,26 @@
<?
function db_connect() {
include "config.inc";
mysql_pconnect($dbhost, $dbuname, $dbpass) or die(mysql_Error());
mysql_select_db("$dbname") or die ("Unable to select database");
}
function db_query($query, $debug = false) {
### perform query:
$qid = mysql_query($query);
### debug output (if required):
if ($debug || empty($qid)) {
print "<PRE>query: ". htmlspecialchars($query) ."<BR>error message: ". mysql_error() ."</PRE>";
}
### return result from query:
return $qid;
}
function db_fetch_object($qid) {
if ($qid) return mysql_fetch_object($qid);
}
?>