* @version 0.0.0
* @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
- * @link http://www.ship-simu.org
+ * @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
* 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 DatabaseConnection extends BaseMiddleware implements DatabaseConnector, LimitableObject {
+class DatabaseConnection extends BaseMiddleware implements DatabaseConnector, Registerable {
/**
* Array for connection data
*/
$this->setObjectDescription("Datenbank-Mittelschicht");
// Create an unique ID
- $this->createUniqueID();
+ $this->generateUniqueId();
}
// Create new database connection layer
}
/**
- * Save a whole object or parts of it to the database or local file
+ * Getter for connection data
*
- * @param $object The object we shall save
- * @return void
+ * @return $connectData Connection data stored with this clas
*/
- public function saveObject ($object) {
- // Connect to the database
- $this->dbLayer->connectToDatabase();
-
- // For now just pipe it through to the database layer
- $this->dbLayer->saveObject($object);
+ public final function getConnectionData () {
+ return $this->connectData;
}
/**
- * Set a limitation for the saving process. This shall be done before
- * saveObject() is called else saveObject() shall save the whole object.
- *
- * @param $limitInstance An instance of ObjectLimits which contains
- * elements we shall exclusivly include in
- * saving process
+ * Setter for the real database layer
+ * @param $dbLayer An instance of the real database layer
* @return void
*/
- public function limitObject (ObjectLimits $limitInstance) {
- // Connect to the database
- $this->dbLayer->connectToDatabase();
-
- // For now we pipe this through to the real database instance
- $this->dbLayer->limitObject($limitInstance);
+ public final function setDatabaseLayer (DatabaseFrontendInterface $dbLayer) {
+ $this->dbLayer = $dbLayer;
}
/**
return $this->dbLayer->isUniqueIdUsed($uniqueID, $inConstructor);
}
- /**
- * Gets cached data from the database layer and if not found fetch it from
- * the database again. This method does not return the header stuff because
- * the underlaying database class will return only the requested content.
- *
- * @param $idNumber The ID number which we need for looking up
- * the requested data
- * @return $cachedArray The maybe cached data from the database
- */
- public function getObjectFromCachedData ($idNumber) {
- // Connect to the database
- $this->dbLayer->connectToDatabase();
-
- // Pass the returning result through
- return $this->dbLayer->getObjectFromCachedData($idNumber);
- }
-
- /**
- * Setter for the real database layer
- * @param $dbLayer An instance of the real database layer
- * @return void
- */
- public final function setDatabaseLayer (DatabaseFrontendInterface $dbLayer) {
- $this->dbLayer = $dbLayer;
- }
-
/**
* Runs a "select" statement on the database layer with given table name
* and criteria. If this doesn't fail the result will be returned
$exceptionInstance = $this->dbLayer->getLastException();
return $exceptionInstance;
}
+
+ /**
+ * "Inserts" a data set instance into a local file database folder
+ *
+ * @param $dataSetInstance A storeable data set
+ * @return void
+ */
+ public function queryInsertDataSet (StoreableCriteria $dataSetInstance) {
+ // Connect to the database
+ $this->dbLayer->connectToDatabase();
+
+ // Ask the database layer
+ $this->dbLayer->queryInsertDataSet($dataSetInstance);
+ }
+
+ /**
+ * "Updates" a data set instance with a database layer
+ *
+ * @param $dataSetInstance A storeable data set
+ * @return void
+ */
+ public function queryUpdateDataSet (StoreableCriteria $dataSetInstance) {
+ // Connect to the database
+ $this->dbLayer->connectToDatabase();
+
+ // Ask the database layer
+ $this->dbLayer->queryUpdateDataSet($dataSetInstance);
+ }
}
// [EOF]