From e3b1c14542bd1cf17f1a437cd062b7fe89f9a622 Mon Sep 17 00:00:00 2001 From: Max Semenik Date: Sat, 10 Jul 2010 10:15:59 +0000 Subject: [PATCH] Fixed mysqlisms in Database.php comments, abstracted getSearchEngine() --- includes/db/Database.php | 11 ++++------- includes/db/DatabaseMysql.php | 13 +++++++++++++ 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/includes/db/Database.php b/includes/db/Database.php index 79cd8ba6ee..e4f278e355 100644 --- a/includes/db/Database.php +++ b/includes/db/Database.php @@ -4,7 +4,7 @@ * * @file * @ingroup Database - * This file deals with MySQL interface functions + * This file deals with database interface functions * and query specifics/optimisations */ @@ -2324,7 +2324,6 @@ abstract class DatabaseBase { * @param $lockName String: Name of lock to release * @param $method String: Name of method calling us * - * FROM MYSQL DOCS: http://dev.mysql.com/doc/refman/5.0/en/miscellaneous-functions.html#function_release-lock * @return Returns 1 if the lock was released, 0 if the lock was not established * by this thread (in which case the lock is not released), and NULL if the named * lock did not exist @@ -2355,14 +2354,12 @@ abstract class DatabaseBase { } /** - * Get search engine class. All subclasses of this - * need to implement this if they wish to use searching. + * Get search engine class. Subclasses that don't support a search engine + * should return 'SearchEngineDummy'. * * @return String */ - public function getSearchEngine() { - return "SearchMySQL"; - } + public abstract function getSearchEngine(); /** * Allow or deny "big selects" for this session only. This is done by setting diff --git a/includes/db/DatabaseMysql.php b/includes/db/DatabaseMysql.php index dcdfa2d58d..7e93734f79 100644 --- a/includes/db/DatabaseMysql.php +++ b/includes/db/DatabaseMysql.php @@ -383,6 +383,9 @@ class DatabaseMysql extends DatabaseBase { } } + /** + * FROM MYSQL DOCS: http://dev.mysql.com/doc/refman/5.0/en/miscellaneous-functions.html#function_release-lock + */ public function unlock( $lockName, $method ) { $lockName = $this->addQuotes( $lockName ); $result = $this->query( "SELECT RELEASE_LOCK($lockName) as lockstatus", $method ); @@ -410,6 +413,16 @@ class DatabaseMysql extends DatabaseBase { $this->query( "UNLOCK TABLES", $method ); } + /** + * Get search engine class. All subclasses of this + * need to implement this if they wish to use searching. + * + * @return String + */ + public function getSearchEngine() { + return 'SearchMySQL'; + } + public function setBigSelects( $value = true ) { if ( $value === 'default' ) { if ( $this->mDefaultBigSelects === null ) { -- 2.20.1