]> git.mxchange.org Git - core.git/blobdiff - inc/classes/middleware/database/class_DatabaseConnection.php
Added some new stuff.
[core.git] / inc / classes / middleware / database / class_DatabaseConnection.php
index 318073c81b79d7da8034358645686530ae27a415..d3225c410d6a5a9915404af922c430a082517607 100644 (file)
@@ -4,7 +4,7 @@
  *
  * @author             Roland Haeder <webmaster@shipsimu.org>
  * @version            0.0.0
- * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2013 Core Developer Team
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2015 Core Developer Team
  * @license            GNU GPL 3.0 or any newer version
  * @link               http://www.shipsimu.org
  *
@@ -177,6 +177,41 @@ class DatabaseConnection extends BaseMiddleware implements DatabaseConnector, Re
                // 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) {
+               // Connect to the database
+               $this->dbLayer->connectToDatabase();
+
+               // Call database backend
+               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('DB-CONNECTION[' . $this->__toString() . ']: Calling this->dbLayer->removeNonPublicDataFromArray(data) ...');
+               $data = $this->dbLayer->removeNonPublicDataFromArray($data);
+
+               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('DB-CONNECTION[' . $this->__toString() . ']: data[]=' . gettype($data));
+               return $data;
+       }
+
+       /**
+        * Count total table rows
+        *
+        * @param       $tableName      Table name
+        * @return      $count          Total row count
+        */
+       public function countTotalRows ($tableName) {
+               // Connect to the database
+               $this->dbLayer->connectToDatabase();
+
+               // Ask the database layer
+               $count = $this->dbLayer->countTotalRows($tableName);
+
+               // Return the value
+               return $count;
+       }
 }
 
 // [EOF]