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
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
--- /dev/null
+Deny from all
--- /dev/null
+<?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]
+?>
--- /dev/null
+<?php
+// @DEPRECATED
+?>
<?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
?>
/**
* 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
/**
*
*
- * @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
* 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
*
--- /dev/null
+<?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]
+?>
<?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
?>
} 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()
);
}
}
* 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;
/**
* 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;
/**
* 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) {
// 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
// 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++;
$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;
// 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;
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
$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
$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
* @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));
}
/**
}
// 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();
* @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;
}