]> git.mxchange.org Git - core.git/commitdiff
Renamed frontend to backend because it is a backend ...
authorRoland Häder <roland@mxchange.org>
Tue, 31 Jul 2012 14:40:01 +0000 (14:40 +0000)
committerRoland Häder <roland@mxchange.org>
Tue, 31 Jul 2012 14:40:01 +0000 (14:40 +0000)
13 files changed:
.gitattributes
inc/classes/interfaces/database/backend/.htaccess [new file with mode: 0644]
inc/classes/interfaces/database/backend/class_DatabaseBackendInterface.php [new file with mode: 0644]
inc/classes/interfaces/database/backend/class_DatabaseFrontendInterface.php [new file with mode: 0644]
inc/classes/interfaces/database/frontend/class_DatabaseFrontendInterface.php
inc/classes/main/criteria/dataset/class_DataSetCriteria.php
inc/classes/main/database/class_
inc/classes/main/database/class_BaseDatabaseBackend.php [new file with mode: 0644]
inc/classes/main/database/class_BaseDatabaseFrontend.php
inc/classes/main/database/class_BaseDatabaseWrapper.php
inc/classes/main/database/databases/class_LocalFileDatabase.php
inc/classes/main/result/class_DatabaseResult.php
inc/classes/middleware/database/class_DatabaseConnection.php

index b6132cd7d4fb7bd71ca4731b9b80d3b79ad64be6..f63ad9f0f9e6f30c68a558e6c0c2049a2a029f9c 100644 (file)
@@ -151,6 +151,9 @@ inc/classes/interfaces/criteria/extended/class_StoreableCriteria.php svneol=nati
 inc/classes/interfaces/crypto/.htaccess svneol=native#text/plain
 inc/classes/interfaces/crypto/class_Cryptable.php svneol=native#text/plain
 inc/classes/interfaces/database/.htaccess svneol=native#text/plain
+inc/classes/interfaces/database/backend/.htaccess svneol=native#text/plain
+inc/classes/interfaces/database/backend/class_DatabaseBackendInterface.php svneol=native#text/plain
+inc/classes/interfaces/database/backend/class_DatabaseFrontendInterface.php svneol=native#text/plain
 inc/classes/interfaces/database/class_FrameworkDatabaseInterface.php svneol=native#text/plain
 inc/classes/interfaces/database/class_Updateable.php svneol=native#text/plain
 inc/classes/interfaces/database/frontend/.htaccess svneol=native#text/plain
@@ -323,6 +326,7 @@ inc/classes/main/crypto/.htaccess svneol=native#text/plain
 inc/classes/main/crypto/class_CryptoHelper.php svneol=native#text/plain
 inc/classes/main/database/.htaccess svneol=native#text/plain
 inc/classes/main/database/class_ svneol=native#text/plain
+inc/classes/main/database/class_BaseDatabaseBackend.php svneol=native#text/plain
 inc/classes/main/database/class_BaseDatabaseFrontend.php svneol=native#text/plain
 inc/classes/main/database/class_BaseDatabaseWrapper.php svneol=native#text/plain
 inc/classes/main/database/databases/.htaccess svneol=native#text/plain
diff --git a/inc/classes/interfaces/database/backend/.htaccess b/inc/classes/interfaces/database/backend/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/inc/classes/interfaces/database/backend/class_DatabaseBackendInterface.php b/inc/classes/interfaces/database/backend/class_DatabaseBackendInterface.php
new file mode 100644 (file)
index 0000000..46a9d12
--- /dev/null
@@ -0,0 +1,68 @@
+<?php
+/**
+ * An interface for front-end database classes. The classes should prepare the
+ * objects for saving in the database. So for server-bases database classes SQL
+ * queries shall be generated and send to the backend classes. In case of local
+ * file databases the object shall be serialized and (maybe) transparently
+ * compressed before they got saved to a local file.
+ *
+ * @author             Roland Haeder <webmaster@ship-simu.org>
+ * @version            0.0.0
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2012 Core Developer Team
+ * @license            GNU GPL 3.0 or any newer version
+ * @link               http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+interface DatabaseBackendInterface extends FrameworkDatabaseInterface {
+       /**
+        * Makes sure that the database connection is up and alive
+        *
+        * @return      void
+        */
+       function connectToDatabase ();
+
+       /**
+        * Starts a SELECT query on the database by given return type, table name
+        * and search criteria
+        *
+        * @param       $tableName              Name of the database table
+        * @param       $criteria               Search criteria class
+        * @return      $resultData             Result data of the query
+        * @throws      UnsupportedCriteriaException    If the criteria is unsupported
+        * @throws      SqlException                                    If an SQL error occurs
+        */
+       function querySelect ($tableName, LocalSearchCriteria $criteriaInstance);
+
+       /**
+        * 'Inserts' a data set instance into a local file database folder
+        *
+        * @param       $dataSetInstance        A storeable data set
+        * @return      void
+        * @throws      SqlException    If an SQL error occurs
+        */
+       function queryInsertDataSet (StoreableCriteria $dataSetInstance);
+
+       /**
+        * 'Updates' a data set instance with a database layer
+        *
+        * @param       $dataSetInstance        A storeable data set
+        * @return      void
+        * @throws      SqlException    If an SQL error occurs
+        */
+       function queryUpdateDataSet (StoreableCriteria $dataSetInstance);
+}
+
+// [EOF]
+?>
diff --git a/inc/classes/interfaces/database/backend/class_DatabaseFrontendInterface.php b/inc/classes/interfaces/database/backend/class_DatabaseFrontendInterface.php
new file mode 100644 (file)
index 0000000..f551ef4
--- /dev/null
@@ -0,0 +1,3 @@
+<?php
+// @DEPRECATED
+?>
index 2689d285eddbfd7f79928b0a8e59fe5c1f8423ef..f551ef47b7591c74e7b59193e56a1fa6505a87ab 100644 (file)
@@ -1,68 +1,3 @@
 <?php
-/**
- * An interface for front-end database classes. The classes should prepare the
- * objects for saving in the database. So for server-bases database classes SQL
- * queries shall be generated and send to the backend classes. In case of local
- * file databases the object shall be serialized and (maybe) transparently
- * compressed before they got saved to a local file.
- *
- * @author             Roland Haeder <webmaster@ship-simu.org>
- * @version            0.0.0
- * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2012 Core Developer Team
- * @license            GNU GPL 3.0 or any newer version
- * @link               http://www.ship-simu.org
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-interface DatabaseFrontendInterface extends FrameworkDatabaseInterface {
-       /**
-        * Makes sure that the database connection is up and alive
-        *
-        * @return      void
-        */
-       function connectToDatabase ();
-
-       /**
-        * Starts a SELECT query on the database by given return type, table name
-        * and search criteria
-        *
-        * @param       $tableName              Name of the database table
-        * @param       $criteria               Search criteria class
-        * @return      $resultData             Result data of the query
-        * @throws      UnsupportedCriteriaException    If the criteria is unsupported
-        * @throws      SqlException                                    If an SQL error occurs
-        */
-       function querySelect ($tableName, LocalSearchCriteria $criteriaInstance);
-
-       /**
-        * 'Inserts' a data set instance into a local file database folder
-        *
-        * @param       $dataSetInstance        A storeable data set
-        * @return      void
-        * @throws      SqlException    If an SQL error occurs
-        */
-       function queryInsertDataSet (StoreableCriteria $dataSetInstance);
-
-       /**
-        * 'Updates' a data set instance with a database layer
-        *
-        * @param       $dataSetInstance        A storeable data set
-        * @return      void
-        * @throws      SqlException    If an SQL error occurs
-        */
-       function queryUpdateDataSet (StoreableCriteria $dataSetInstance);
-}
-
-// [EOF]
+// @DEPRECATED
 ?>
index d633e2afdc2e0ac69b8d4cbc8fafa900a17e63dd..869a2e1c39af4cf4fdba1c51cfa76efa86acff3a 100644 (file)
@@ -2,7 +2,6 @@
 /**
  * A set of data storeable in databases
  *
- * @see                        DatabaseFrontendInterface - An interface for database frontends (front-end to the application)
  * @author             Roland Haeder <webmaster@ship-simu.org>
  * @version            0.0.0
  * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2012 Core Developer Team
index 28f7caad0cd190569f1e4c9ed4321c6ac6211593..7c030cf8ad99f5b109a0ffa7bd229447e37f6d1f 100644 (file)
@@ -2,7 +2,7 @@
 /**
  * 
  *
- * @see                        DatabaseFrontendInterface - An interface for database frontends (front-end to the application)
+ * @see                        DatabaseBackendInterface - An interface for database backends
  * @author             Roland Haeder <webmaster@ship-simu.org>
  * @version            0.0.0
  * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2012 Core Developer Team
@@ -22,7 +22,7 @@
  * You should have received a copy of the GNU General Public License
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
-class  extends BaseDatabaseFrontend {
+class  extends BaseDatabaseBackend implements DatabaseBackendInterface {
        /**
         * Protected constructor
         *
diff --git a/inc/classes/main/database/class_BaseDatabaseBackend.php b/inc/classes/main/database/class_BaseDatabaseBackend.php
new file mode 100644 (file)
index 0000000..bd9fde9
--- /dev/null
@@ -0,0 +1,81 @@
+<?php
+/**
+ * An abstract database access class for handling database I/O requests
+ *
+ * @see                        DatabaseBackendInterface - An interface for database backends
+ * @author             Roland Haeder <webmaster@ship-simu.org>
+ * @version            0.0.0
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2012 Core Developer Team
+ * @license            GNU GPL 3.0 or any newer version
+ * @link               http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+abstract class BaseDatabaseBackend extends BaseFrameworkSystem implements DatabaseBackendInterface {
+       // Constants for exceptions
+       const EXCEPTION_SQL_QUERY = 0x140;
+
+       // Result array indexes
+       const RESULT_INDEX_ROWS      = 'rows';
+       const RESULT_INDEX_STATUS    = 'status';
+       const RESULT_INDEX_EXCEPTION = 'exception';
+
+       /**
+        * Last thrown exception or NULL if all is fine
+        */
+       private $lastException = NULL;
+
+       /**
+        * Protected constructor
+        *
+        * @param       $className      Name of the class
+        * @return      void
+        */
+       protected function __construct ($className) {
+               // Call parent constructor
+               parent::__construct($className);
+       }
+
+       /**
+        * Getter for last exception
+        *
+        * @return      $lastException  Last thrown exception
+        */
+       public final function getLastException () {
+               return $this->lastException;
+       }
+
+       /**
+        * Setter for last exception
+        *
+        * @param       $lastException  Last thrown exception
+        * @return      void
+        */
+       public final function setLastException (FrameworkException $exceptionInstance) {
+               $this->lastException = $exceptionInstance;
+       }
+
+       /**
+        * Reset the last exception instance. This should be done after a "query"
+        * was completed without any errors.
+        *
+        * @return      void
+        */
+       protected final function resetLastException () {
+               $this->lastException = NULL;
+       }
+}
+
+// [EOF]
+?>
index 820e4c3ab9b6d5a47f27ca88bd309a02b2781e0a..f551ef47b7591c74e7b59193e56a1fa6505a87ab 100644 (file)
@@ -1,81 +1,3 @@
 <?php
-/**
- * An abstract database access class for handling database I/O requests
- *
- * @see                        DatabaseFrontendInterface - An interface for database frontends (front-end to the application)
- * @author             Roland Haeder <webmaster@ship-simu.org>
- * @version            0.0.0
- * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2012 Core Developer Team
- * @license            GNU GPL 3.0 or any newer version
- * @link               http://www.ship-simu.org
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-abstract class BaseDatabaseFrontend extends BaseFrameworkSystem implements DatabaseFrontendInterface {
-       // Constants for exceptions
-       const EXCEPTION_SQL_QUERY = 0x140;
-
-       // Result array indexes
-       const RESULT_INDEX_ROWS      = 'rows';
-       const RESULT_INDEX_STATUS    = 'status';
-       const RESULT_INDEX_EXCEPTION = 'exception';
-
-       /**
-        * Last thrown exception or NULL if all is fine
-        */
-       private $lastException = NULL;
-
-       /**
-        * Protected constructor
-        *
-        * @param       $className      Name of the class
-        * @return      void
-        */
-       protected function __construct ($className) {
-               // Call parent constructor
-               parent::__construct($className);
-       }
-
-       /**
-        * Getter for last exception
-        *
-        * @return      $lastException  Last thrown exception
-        */
-       public final function getLastException () {
-               return $this->lastException;
-       }
-
-       /**
-        * Setter for last exception
-        *
-        * @param       $lastException  Last thrown exception
-        * @return      void
-        */
-       public final function setLastException (FrameworkException $exceptionInstance) {
-               $this->lastException = $exceptionInstance;
-       }
-
-       /**
-        * Reset the last exception instance. This should be done after a "query"
-        * was completed without any errors.
-        *
-        * @return      void
-        */
-       protected final function resetLastException () {
-               $this->lastException = NULL;
-       }
-}
-
-// [EOF]
+// @DEPRECATED
 ?>
index e925f38607e4ca88e9d0bd64d433420ecd7502dc..31a63a39d3d162a36db6066965bafbde4a5cb4cb 100644 (file)
@@ -169,8 +169,8 @@ class BaseDatabaseWrapper extends BaseFrameworkSystem {
                        } else {
                                // This invalid result must be wrapped
                                $result = array(
-                                       BaseDatabaseFrontend::RESULT_INDEX_STATUS    => 'invalid',
-                                       BaseDatabaseFrontend::RESULT_INDEX_EXCEPTION => $this->getDatabaseInstance()->getLastException()
+                                       BaseDatabaseBackend::RESULT_INDEX_STATUS    => 'invalid',
+                                       BaseDatabaseBackend::RESULT_INDEX_EXCEPTION => $this->getDatabaseInstance()->getLastException()
                                );
                        }
                }
index b6db990441dabd37cd30dadffd8336042725f7cc..d92c29b41d940278c3ce1df9be1abb67cdd80f7a 100644 (file)
@@ -23,7 +23,7 @@
  * You should have received a copy of the GNU General Public License
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
-class LocalFileDatabase extends BaseDatabaseFrontend implements DatabaseFrontendInterface {
+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;
@@ -110,7 +110,7 @@ class LocalFileDatabase extends BaseDatabaseFrontend implements DatabaseFrontend
        /**
         * Getter for last read file
         *
-        * @return      $lastFile               The last read file's name with full path
+        * @return      $lastFile       The last read file's name with full path
         */
        public final function getLastFile () {
                return $this->lastFile;
@@ -119,7 +119,7 @@ class LocalFileDatabase extends BaseDatabaseFrontend implements DatabaseFrontend
        /**
         * Setter for contents of the last read file
         *
-        * @param               $contents               An array with header and data elements
+        * @param               $contents       An array with header and data elements
         * @return      void
         */
        private final function setLastFileContents (array $contents) {
@@ -331,8 +331,8 @@ class LocalFileDatabase extends BaseDatabaseFrontend implements DatabaseFrontend
 
                        // Initialize the result data, this need to be rewritten e.g. if a local file cannot be read
                        $resultData = array(
-                               BaseDatabaseFrontend::RESULT_INDEX_STATUS => LocalfileDatabase::RESULT_OKAY,
-                               BaseDatabaseFrontend::RESULT_INDEX_ROWS   => array()
+                               BaseDatabaseBackend::RESULT_INDEX_STATUS => LocalfileDatabase::RESULT_OKAY,
+                               BaseDatabaseBackend::RESULT_INDEX_ROWS   => array()
                        );
 
                        // Initialize limit/skip
@@ -376,7 +376,7 @@ class LocalFileDatabase extends BaseDatabaseFrontend implements DatabaseFrontend
 
                                                        // Entry found!
                                                        //* NOISY-DEBUG: */ $this->debugOutput('DATABASE: indexKey=' . $this->getIndexKey() . ',idx=' . $idx . ',dataArray=' . print_r($dataArray, true));
-                                                       $resultData[BaseDatabaseFrontend::RESULT_INDEX_ROWS][] = $dataArray;
+                                                       $resultData[BaseDatabaseBackend::RESULT_INDEX_ROWS][] = $dataArray;
 
                                                        // Count found entries up
                                                        $limitFound++;
index 61d0769540608ca7f211bc2b9931afcf7f2d1a4b..1433dc8f6f6dc0121aeea905054f12cb81569ad7 100644 (file)
@@ -80,7 +80,7 @@ class DatabaseResult extends BaseFrameworkSystem implements SearchableResult, Up
                $resultInstance->setResultArray($resultArray);
 
                // Set affected rows
-               $resultInstance->setAffectedRows(count($resultArray[BaseDatabaseFrontend::RESULT_INDEX_ROWS]));
+               $resultInstance->setAffectedRows(count($resultArray[BaseDatabaseBackend::RESULT_INDEX_ROWS]));
 
                // Return the instance
                return $resultInstance;
@@ -109,7 +109,7 @@ class DatabaseResult extends BaseFrameworkSystem implements SearchableResult, Up
                // Now get the update criteria array and update all entries
                foreach ($updateInstance->getUpdateCriteria() as $criteriaKey => $criteriaValue) {
                        // Update data
-                       $this->resultArray[BaseDatabaseFrontend::RESULT_INDEX_ROWS][$entryKey][$criteriaKey] = $criteriaValue;
+                       $this->resultArray[BaseDatabaseBackend::RESULT_INDEX_ROWS][$entryKey][$criteriaKey] = $criteriaValue;
 
                        // Mark it as out-dated
                        $this->outDated[$criteriaKey] = 1;
@@ -130,7 +130,7 @@ class DatabaseResult extends BaseFrameworkSystem implements SearchableResult, Up
                if ($this->valid()) {
                        // Next entry found, so count one up and cache it
                        $this->currentPos++;
-                       $this->currentRow = $this->resultArray[BaseDatabaseFrontend::RESULT_INDEX_ROWS][$this->currentPos];
+                       $this->currentRow = $this->resultArray[BaseDatabaseBackend::RESULT_INDEX_ROWS][$this->currentPos];
                        $nextValid = true;
                } // END - if
 
@@ -165,9 +165,9 @@ class DatabaseResult extends BaseFrameworkSystem implements SearchableResult, Up
                $current = NULL;
 
                // Does the current enty exist?
-               if (isset($this->resultArray[BaseDatabaseFrontend::RESULT_INDEX_ROWS][$this->currentPos])) {
+               if (isset($this->resultArray[BaseDatabaseBackend::RESULT_INDEX_ROWS][$this->currentPos])) {
                        // Then get it
-                       $current = $this->resultArray[BaseDatabaseFrontend::RESULT_INDEX_ROWS][$this->currentPos];
+                       $current = $this->resultArray[BaseDatabaseBackend::RESULT_INDEX_ROWS][$this->currentPos];
                } // END - if
 
                // Return the result
@@ -184,7 +184,7 @@ class DatabaseResult extends BaseFrameworkSystem implements SearchableResult, Up
                $isValid = false;
 
                // Check if 
-               if (($this->ifStatusIsOkay()) && (isset($this->resultArray[BaseDatabaseFrontend::RESULT_INDEX_ROWS][($this->currentPos + 1)])) && (isset($this->resultArray[BaseDatabaseFrontend::RESULT_INDEX_ROWS][0]))) {
+               if (($this->ifStatusIsOkay()) && (isset($this->resultArray[BaseDatabaseBackend::RESULT_INDEX_ROWS][($this->currentPos + 1)])) && (isset($this->resultArray[BaseDatabaseBackend::RESULT_INDEX_ROWS][0]))) {
                        // All fine!
                        $isValid = true;
                } // END - if
@@ -199,7 +199,7 @@ class DatabaseResult extends BaseFrameworkSystem implements SearchableResult, Up
         * @return      $ifStatusOkay   Whether the status of the query was okay
         */
        public function ifStatusIsOkay () {
-               return ((isset($this->resultArray[BaseDatabaseFrontend::RESULT_INDEX_STATUS])) && ($this->resultArray[BaseDatabaseFrontend::RESULT_INDEX_STATUS] === LocalfileDatabase::RESULT_OKAY));
+               return ((isset($this->resultArray[BaseDatabaseBackend::RESULT_INDEX_STATUS])) && ($this->resultArray[BaseDatabaseBackend::RESULT_INDEX_STATUS] === LocalfileDatabase::RESULT_OKAY));
        }
 
        /**
index 8cb57d1d77fdfd998c9d91190a1954beaa13e129..3e3332c3da6ed66fe232aae16abc37b5fc80d57e 100644 (file)
@@ -49,7 +49,7 @@ class DatabaseConnection extends BaseMiddleware implements DatabaseConnector, Re
        }
 
        // Create new database connection layer
-       public static final function createDatabaseConnection (DebugMiddleware $debugInstance, DatabaseFrontendInterface $dbLayer) {
+       public static final function createDatabaseConnection (DebugMiddleware $debugInstance, DatabaseBackendInterface $dbLayer) {
                // Get instance
                $databaseInstance = new DatabaseConnection();
 
@@ -94,7 +94,7 @@ class DatabaseConnection extends BaseMiddleware implements DatabaseConnector, Re
         * @param       $dbLayer        An instance of the real database layer
         * @return      void
         */
-       public final function setDatabaseLayer (DatabaseFrontendInterface $dbLayer) {
+       public final function setDatabaseLayer (DatabaseBackendInterface $dbLayer) {
                $this->dbLayer = $dbLayer;
        }