X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Fclasses%2Fmiddleware%2Fdatabase%2Fclass_DatabaseConnection.php;h=1d9fe9b43e45671eb24ed75597b79d134debb52a;hb=c59dccf46c5d0e3b7f2687370b2b15023b1ecdfe;hp=fc8ea9135f5db01086c03492435d0dba57f91574;hpb=e2767d5148436d0c90ed66ed9290416353ae6e60;p=hub.git diff --git a/inc/classes/middleware/database/class_DatabaseConnection.php b/inc/classes/middleware/database/class_DatabaseConnection.php index fc8ea9135..1d9fe9b43 100644 --- a/inc/classes/middleware/database/class_DatabaseConnection.php +++ b/inc/classes/middleware/database/class_DatabaseConnection.php @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @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 * @@ -19,7 +19,7 @@ * 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 . + * along with this program. If not, see . */ class DatabaseConnection extends BaseMiddleware implements DatabaseConnector, Registerable { /** @@ -46,12 +46,6 @@ class DatabaseConnection extends BaseMiddleware implements DatabaseConnector, Re protected function __construct() { // Call parent constructor parent::__construct(__CLASS__); - - // Set description - $this->setObjectDescription("Datenbank-Mittelschicht"); - - // Create an unique ID - $this->generateUniqueId(); } // Create new database connection layer @@ -165,6 +159,37 @@ class DatabaseConnection extends BaseMiddleware implements DatabaseConnector, Re // 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); + } + + /** + * Getter for primary key column of specified table name + * + * @param $tableName Name of table we need the primary key column from + * @return $primaryKey Primary key column of requested table + */ + public function getPrimaryKeyOfTable ($tableName) { + // Connect to the database + $this->dbLayer->connectToDatabase(); + + // Ask the database layer + $primaryKey = $this->dbLayer->getPrimaryKeyOfTable($tableName); + + // Return the value + return $primaryKey; + } } // [EOF]