]> git.mxchange.org Git - core.git/commitdiff
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 bd9fde97c02b3795798cbae2b89859672f29295e..7ec44c52278c433ecb23e86c632ac07ea0e97022 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 c6ab513e9f56bf22af0559ea62c0549bce088d6b..655d14420e259e4d73546e62de9784b76d3b2bdc 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 aa09d11b3fc019555388e8f64679380357d448f4..0fc85cd11befca1811b5efa19f41ce6869f6e945 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));
        }
 
        /**