/**
* Database selector class
*
- * @author Roland Haeder <webmaster@ship-simu.org>
+ * @author Roland Haeder <webmaster@shipsimu.org>
* @version 0.0.0
- * @copyright Copyright (c) 2007 - 2009 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2013 Core Developer Team
* @license GNU GPL 3.0 or any newer version
- * @link http://www.ship-simu.org
+ * @link http://www.shipsimu.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 real database layer
- private $dbLayer = null;
+ private $dbLayer = NULL;
// An instance of this class
- private static $thisInstance = null;
+ private static $selfInstance = NULL;
/**
* Protected constructor
*
* @return void
*/
- protected function __construct() {
+ protected function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
}
// Create new database connection layer
- public final static function createDatabaseConnection (DebugMiddleware $debugInstance, DatabaseFrontendInterface $dbLayer) {
+ public static final function createDatabaseConnection (DebugMiddleware $debugInstance, DatabaseBackend $dbLayer) {
// Get instance
- $dbInstance = new DatabaseConnection();
-
- // Set debug output handler
- $dbInstance->setDebugInstance($debugInstance);
+ $databaseInstance = new DatabaseConnection();
// Set database layer
- $dbInstance->setDatabaseLayer($dbLayer);
+ $databaseInstance->setDatabaseLayer($dbLayer);
// Set db instance
- self::$thisInstance = $dbInstance;
+ self::$selfInstance = $databaseInstance;
// Return instance
- return $dbInstance;
+ return $databaseInstance;
}
// Get an instance of this class
- public final static function getInstance () {
- return self::$thisInstance;
+ public static final function getSelfInstance () {
+ return self::$selfInstance;
}
// Public setter for database connection
* @param $dbLayer An instance of the real database layer
* @return void
*/
- public final function setDatabaseLayer (DatabaseFrontendInterface $dbLayer) {
+ public final function setDatabaseLayer (DatabaseBackend $dbLayer) {
$this->dbLayer = $dbLayer;
}
}
/**
- * Runs a "select" statement on the database layer with given table name
+ * Runs a 'select' statement on the database layer with given table name
* and criteria. If this doesn't fail the result will be returned
*
- * @param $tableName Name of the "table" we shall query
+ * @param $tableName Name of the 'table' we shall query
* @param $criteriaInstance An instance of a Criteria class
* @return $result The result as an array
*/
$this->dbLayer->connectToDatabase();
// Get result from query
- $result = $this->dbLayer->querySelect("array", $tableName, $criteriaInstance);
+ $result = $this->dbLayer->querySelect($tableName, $criteriaInstance);
// Return the result
return $result;
}
/**
- * "Inserts" a data set instance into a local file database folder
+ * 'Inserts' a data set instance into a local file database folder
*
* @param $dataSetInstance A storeable data set
* @return void
}
/**
- * "Updates" a data set instance with a database layer
+ * 'Updates' a data set instance with a database layer
*
* @param $dataSetInstance A storeable data set
* @return void
// Return the value
return $primaryKey;
}
+
+ /**
+ * Removes non-public data from given array.
+ *
+ * @param $data An array with possible non-public data that needs to be removed.
+ * @return $data A cleaned up array with only public data.
+ */
+ public function removeNonPublicDataFromArray (array $data) {
+ // Call database backend
+ return $this->dbLayer->removeNonPublicDataFromArray($data);
+ }
}
// [EOF]