]> CyberLeo.Net >> Repos - SourceForge/phpwiki.git/blob - lib/WikiDB/ADODB.php
* revert to the wikidb ref passing. there's no memory abuse there.
[SourceForge/phpwiki.git] / lib / WikiDB / ADODB.php
1 <?php // -*-php-*-
2 rcs_id('$Id: ADODB.php,v 1.6 2004-11-09 17:11:16 rurban Exp $');
3
4 require_once('lib/WikiDB.php');
5
6 /**
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
11  *
12  * @author: Lawrence Akka, Reini Urban
13  */
14 class WikiDB_ADODB extends WikiDB
15 {
16     function WikiDB_ADODB ($dbparams) {
17         if (is_array($dbparams['dsn']))
18             $backend = $dbparams['dsn']['phptype'];
19         elseif (preg_match('/^(\w+):/', $dbparams['dsn'], $m))
20             $backend = $m[1];
21         // Do we have a override? (currently: mysql, sqlite, oracle, mssql)
22         // TODO: pgsql, mysqlt (innodb or bdb)
23         if (FindFile("lib/WikiDB/backend/ADODB_$backend.php",true)) {
24             $backend = 'ADODB_' . $backend;
25         } else {
26             $backend = 'ADODB';
27         }
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);
32     }
33     
34     /**
35      * Determine whether page exists (in non-default form).
36      * @see WikiDB::isWikiPage
37      */
38     function isWikiPage ($pagename) {
39         $pagename = (string) $pagename;
40         if ($pagename === '') return false;
41         if (!array_key_exists($pagename, $this->_cache->_id_cache)) {
42             $this->_cache->_id_cache[$pagename] = $this->_backend->is_wiki_page($pagename);
43         }
44         return $this->_cache->_id_cache[$pagename];
45     }
46 };
47   
48 // For emacs users
49 // Local Variables:
50 // mode: php
51 // tab-width: 8
52 // c-basic-offset: 4
53 // c-hanging-comment-ender-p: nil
54 // indent-tabs-mode: nil
55 // End:
56 ?>