From: Roland Häder Date: Sun, 26 Aug 2012 18:43:53 +0000 (+0000) Subject: Moved constants to generic class for later database layer classes X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=ca915ca6e0366d10ffe557822a891f16c6b2171e;p=core.git Moved constants to generic class for later database layer classes --- diff --git a/inc/classes/main/database/class_BaseDatabaseBackend.php b/inc/classes/main/database/class_BaseDatabaseBackend.php index bd9fde97..7ec44c52 100644 --- a/inc/classes/main/database/class_BaseDatabaseBackend.php +++ b/inc/classes/main/database/class_BaseDatabaseBackend.php @@ -31,6 +31,14 @@ abstract class BaseDatabaseBackend extends BaseFrameworkSystem implements Databa const RESULT_INDEX_STATUS = 'status'; const RESULT_INDEX_EXCEPTION = 'exception'; + // Constants for MySQL backward-compatiblity (PLEASE FIX THEM!) + const DB_CODE_TABLE_MISSING = 0x100; + const DB_CODE_TABLE_UNWRITEABLE = 0x101; + const DB_CODE_DATA_FILE_CORRUPT = 0x102; + + // Status results + const RESULT_OKAY = 'ok'; + /** * Last thrown exception or NULL if all is fine */ diff --git a/inc/classes/main/database/databases/class_LocalFileDatabase.php b/inc/classes/main/database/databases/class_LocalFileDatabase.php index c6ab513e..655d1442 100644 --- a/inc/classes/main/database/databases/class_LocalFileDatabase.php +++ b/inc/classes/main/database/databases/class_LocalFileDatabase.php @@ -24,14 +24,6 @@ * along with this program. If not, see . */ class LocalFileDatabase extends BaseDatabaseBackend implements DatabaseBackendInterface { - // Constants for MySQL backward-compatiblity (PLEASE FIX THEM!) - const DB_CODE_TABLE_MISSING = 0x100; - const DB_CODE_TABLE_UNWRITEABLE = 0x101; - const DB_CODE_DATA_FILE_CORRUPT = 0x102; - - // Status results - const RESULT_OKAY = 'ok'; - /** * The file's extension */ @@ -331,7 +323,7 @@ class LocalFileDatabase extends BaseDatabaseBackend implements DatabaseBackendIn // Initialize the result data, this need to be rewritten e.g. if a local file cannot be read $resultData = array( - BaseDatabaseBackend::RESULT_INDEX_STATUS => LocalfileDatabase::RESULT_OKAY, + BaseDatabaseBackend::RESULT_INDEX_STATUS => self::RESULT_OKAY, BaseDatabaseBackend::RESULT_INDEX_ROWS => array() ); diff --git a/inc/classes/main/result/class_DatabaseResult.php b/inc/classes/main/result/class_DatabaseResult.php index aa09d11b..0fc85cd1 100644 --- a/inc/classes/main/result/class_DatabaseResult.php +++ b/inc/classes/main/result/class_DatabaseResult.php @@ -194,12 +194,12 @@ class DatabaseResult extends BaseFrameworkSystem implements SearchableResult, Up } /** - * Determines whether the status of the query was fine (LocalfileDatabase::RESULT_OKAY) + * Determines whether the status of the query was fine (BaseDatabaseBackend::RESULT_OKAY) * * @return $ifStatusOkay Whether the status of the query was okay */ public function ifStatusIsOkay () { - return ((isset($this->resultArray[BaseDatabaseBackend::RESULT_INDEX_STATUS])) && ($this->resultArray[BaseDatabaseBackend::RESULT_INDEX_STATUS] === LocalfileDatabase::RESULT_OKAY)); + return ((isset($this->resultArray[BaseDatabaseBackend::RESULT_INDEX_STATUS])) && ($this->resultArray[BaseDatabaseBackend::RESULT_INDEX_STATUS] === BaseDatabaseBackend::RESULT_OKAY)); } /**