2 rcs_id('$Id: ADODB.php,v 1.4 2004-04-26 20:44:34 rurban Exp $');
4 require_once('lib/WikiDB.php');
7 * WikiDB layer for ADODB, which does nothing more than calling the
8 * mysql-specific ADODB backend.
9 * Support for a newer adodb library, the adodb extension library
10 * and more databases will come with PhpWiki v1.3.10
12 * @author: Lawrence Akka, Reini Urban
14 class WikiDB_ADODB extends WikiDB
16 function WikiDB_ADODB ($dbparams) {
17 if (is_array($dbparams['dsn']))
18 $backend = $dbparams['dsn']['phptype'];
19 elseif (preg_match('/^(\w+):/', $dbparams['dsn'], $m))
21 // do we have a override? (currently only mysql)
22 // todo: don't use this if the used mysql database can do transactions
23 if (FindFile("lib/WikiDB/backend/ADODB_$backend.php",true)) {
24 $backend = 'ADODB_' . $backend;
28 include_once("lib/WikiDB/backend/$backend.php");
29 $backend_class = "WikiDB_backend_$backend";
30 $backend = new $backend_class($dbparams);
31 $this->WikiDB($backend, $dbparams);
35 * Determine whether page exists (in non-default form).
36 * @see WikiDB::isWikiPage
38 function isWikiPage ($pagename) {
40 if (empty($this->_iwpcache))
41 $this->_iwpcache = array_flip($this->_backend->get_all_pagenames());
42 return isset($this->_iwpcache[$pagename]);
45 if (!isset($this->_iwpcache[$pagename]))
46 $this->_iwpcache[$pagename] = $this->_backend->is_wiki_page($pagename);
47 return $this->_iwpcache[$pagename];
49 // Talk to the backend directly for max speed.
51 $pagedata = $this->_cache->get_pagedata($pagename);
52 return !empty($pagedata[':non_default']);
62 // c-hanging-comment-ender-p: nil
63 // indent-tabs-mode: nil