Code syncronized with shipsimu code base
[mailer.git] / inc / classes / middleware / database / class_DatabaseConnection.php
index fc8ea9135f5db01086c03492435d0dba57f91574..1d9fe9b43e45671eb24ed75597b79d134debb52a 100644 (file)
@@ -4,7 +4,7 @@
  *
  * @author             Roland Haeder <webmaster@ship-simu.org>
  * @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 <http://www.gnu.org/licenses/>.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
 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]