1 <?php rcs_id('$Id: SQL.php,v 1.9 2004-11-09 17:11:16 rurban Exp $');
3 require_once('lib/WikiDB.php');
4 //require_once('lib/WikiDB/backend/PearDB.php');
5 //require_once('DB.php'); // Always favor use our local pear copy
10 class WikiDB_SQL extends WikiDB
12 function WikiDB_SQL ($dbparams) {
13 $backend_type = 'PearDB';
14 if (is_array($dbparams['dsn']))
15 $backend_type = $dbparams['dsn']['phptype'];
16 elseif (preg_match('/^(\w+):/', $dbparams['dsn'], $m))
17 $backend_type = $m[1];
18 include_once ("lib/WikiDB/backend/PearDB_".$backend_type.".php");
19 $backend_class = "WikiDB_backend_PearDB_".$backend_type;
20 $backend = & new $backend_class($dbparams);
21 $this->_iwpcache = array();
23 $this->WikiDB($backend, $dbparams);
26 function view_dsn ($dsn = false) {
28 $dsninfo = DB::parseDSN($GLOBALS['DBParams']['dsn']);
30 $dsninfo = DB::parseDSN($dsn);
31 return sprintf("%s://%s:<not displayed>@%s/%s",
41 * Determine whether page exists (in non-default form).
42 * @see WikiDB::isWikiPage for the slow generic version
44 function isWikiPage ($pagename) {
45 $pagename = (string) $pagename;
46 if ($pagename === '') return false;
47 //if (empty($this->_iwpcache)) { $this->_iwpcache = array(); }
48 if (!array_key_exists($pagename, $this->_iwpcache)) {
49 $this->_iwpcache[$pagename] = $this->_backend->is_wiki_page($pagename);
51 return $this->_iwpcache[$pagename];
61 // c-hanging-comment-ender-p: nil
62 // indent-tabs-mode: nil