Moved constants to generic class for later database layer classes
authorRoland Häder <roland@mxchange.org>
Sun, 26 Aug 2012 18:43:53 +0000 (18:43 +0000)
committerRoland Häder <roland@mxchange.org>
Sun, 26 Aug 2012 18:43:53 +0000 (18:43 +0000)
inc/classes/main/database/class_BaseDatabaseBackend.php
inc/classes/main/database/databases/class_LocalFileDatabase.php
inc/classes/main/result/class_DatabaseResult.php

index bd9fde9..7ec44c5 100644 (file)
@@ -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
         */
index c6ab513..655d144 100644 (file)
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
 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()
                        );
 
index aa09d11..0fc85cd 100644 (file)
@@ -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));
        }
 
        /**