summaryrefslogtreecommitdiff
path: root/database.inc
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2000-06-10 19:08:23 +0000
committerDries Buytaert <dries@buytaert.net>2000-06-10 19:08:23 +0000
commit4ce030b80dc29b93cc660f3e9cd69b6e09b71636 (patch)
tree8bc02bcbcbfc201d00cd3a00e30345eb0de5f2f3 /database.inc
parent9583c72c677ac6f57e57916cff03f46cc0dfc51d (diff)
downloadbrdo-4ce030b80dc29b93cc660f3e9cd69b6e09b71636.tar.gz
brdo-4ce030b80dc29b93cc660f3e9cd69b6e09b71636.tar.bz2
* 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* ;-)
Diffstat (limited to 'database.inc')
-rw-r--r--database.inc26
1 files changed, 26 insertions, 0 deletions
diff --git a/database.inc b/database.inc
new file mode 100644
index 000000000..52a436202
--- /dev/null
+++ b/database.inc
@@ -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);
+}
+
+?> \ No newline at end of file