]> CyberLeo.Net >> Repos - SourceForge/phpwiki.git/blob - lib/WikiDB/backend/PearDB_mysql.php
Jeff's hacks II.
[SourceForge/phpwiki.git] / lib / WikiDB / backend / PearDB_mysql.php
1 <?php // -*-php-*-
2 rcs_id('$Id: PearDB_mysql.php,v 1.1 2001-09-18 19:16:23 dairiki Exp $');
3
4 require_once('lib/WikiDB/backend/PearDB.php');
5
6 class WikiDB_backend_mysql
7 extends WikiDB_backend_PearDB
8 {
9     /**
10      * Pack tables.
11      */
12     function optimize() {
13         $dbh = &$this->_dbh;
14         foreach ($this->_table_names as $table) {
15             $dbh->query("OPTIMIZE TABLE $table");
16         }
17     }
18
19     /**
20      * Lock tables.
21      */
22     function _lock_tables($write_lock = true) {
23         $lock_type = $write_lock ? "WRITE" : "READ";
24         foreach ($this->_table_names as $table) {
25             $tables[] = "$table $lock_type";
26         }
27         $this->_dbh->query("LOCK TABLES " . join(",", $tables));
28     }
29
30     /**
31      * Release all locks.
32      */
33     function _unlock_tables() {
34         $this->_dbh->query("UNLOCK TABLES");
35     }
36 };
37
38 // (c-file-style: "gnu")
39 // Local Variables:
40 // mode: php
41 // tab-width: 8
42 // c-basic-offset: 4
43 // c-hanging-comment-ender-p: nil
44 // indent-tabs-mode: nil
45 // End:   
46 ?>