From de58074c74bcff052b00bb04a742c746952d88fa Mon Sep 17 00:00:00 2001 From: Chad Horohoe Date: Fri, 27 Jun 2008 17:06:34 +0000 Subject: [PATCH] Refactoring (un)lock. All the subclasses are currently returning true, except for mySQL. Makes more sense to put the no-op in the parent class then just subclass it as needed. Other things could maybe do this too. --- includes/db/Database.php | 38 +++++++++++++++++++++++--------- includes/db/DatabaseMssql.php | 10 --------- includes/db/DatabaseOracle.php | 10 --------- includes/db/DatabasePostgres.php | 9 -------- includes/db/DatabaseSqlite.php | 10 --------- 5 files changed, 27 insertions(+), 50 deletions(-) diff --git a/includes/db/Database.php b/includes/db/Database.php index b6a8c8bde6..2ba8c2076d 100644 --- a/includes/db/Database.php +++ b/includes/db/Database.php @@ -2235,6 +2235,32 @@ class Database { return 'CONCAT(' . implode( ',', $stringList ) . ')'; } + /** + * Acquire a lock, no-op to be overridden + * by subclasses as needed. + */ + public function lock( $lockName, $method ) { + return true; + } + /** + * Release a lock, no-op to be overridden + * by subclasses as needed. + */ + public function unlock( $lockName, $method ) { + return true; + } +} + +/** + * Database abstraction object for mySQL + * Inherit all methods and properties of Database::Database(), + * except for locking. + * + * @ingroup Database + * @see Database + */ +class DatabaseMysql extends Database { + /** * Acquire a lock * @@ -2258,6 +2284,7 @@ class Database { return false; } } + /** * Release a lock. * @@ -2274,17 +2301,6 @@ class Database { } } -/** - * Database abstraction object for mySQL - * Inherit all methods and properties of Database::Database() - * - * @ingroup Database - * @see Database - */ -class DatabaseMysql extends Database { - # Inherit all -} - /****************************************************************************** * Utility classes *****************************************************************************/ diff --git a/includes/db/DatabaseMssql.php b/includes/db/DatabaseMssql.php index 7334244d89..a6dda2573f 100755 --- a/includes/db/DatabaseMssql.php +++ b/includes/db/DatabaseMssql.php @@ -997,16 +997,6 @@ class DatabaseMssql extends Database { $this->query("$sql $matches[1],$matches[2])"); } } - - /** - * No-op lock functions - */ - public function lock( $lockName, $method ) { - return true; - } - public function unlock( $lockName, $method ) { - return true; - } } diff --git a/includes/db/DatabaseOracle.php b/includes/db/DatabaseOracle.php index d03298ea74..8d2a6750dc 100644 --- a/includes/db/DatabaseOracle.php +++ b/includes/db/DatabaseOracle.php @@ -706,15 +706,5 @@ echo "error!\n"; function getServer() { return $this->mServer; } - - /** - * No-op lock functions - */ - public function lock( $lockName, $method ) { - return true; - } - public function unlock( $lockName, $method ) { - return true; - } } // end DatabaseOracle class diff --git a/includes/db/DatabasePostgres.php b/includes/db/DatabasePostgres.php index a0d3d6962e..8f8488b9ae 100644 --- a/includes/db/DatabasePostgres.php +++ b/includes/db/DatabasePostgres.php @@ -1327,13 +1327,4 @@ END; return implode( ' || ', $stringList ); } - /* These are not used yet, but we know we don't want the default version */ - - public function lock( $lockName, $method ) { - return true; - } - public function unlock( $lockName, $method ) { - return true; - } - } // end DatabasePostgres class diff --git a/includes/db/DatabaseSqlite.php b/includes/db/DatabaseSqlite.php index 5299c68810..8b4466ecaf 100644 --- a/includes/db/DatabaseSqlite.php +++ b/includes/db/DatabaseSqlite.php @@ -373,16 +373,6 @@ class DatabaseSqlite extends Database { $this->query("$sql $matches[1],$matches[2])"); } } - - /** - * No-op lock functions - */ - public function lock( $lockName, $method ) { - return true; - } - public function unlock( $lockName, $method ) { - return true; - } } -- 2.20.1