]> git.mxchange.org Git - core.git/commitdiff
Added missing methods to interface and added newly one to class.
authorRoland Haeder <roland@mxchange.org>
Mon, 10 Feb 2014 20:44:37 +0000 (21:44 +0100)
committerRoland Haeder <roland@mxchange.org>
Mon, 10 Feb 2014 20:44:37 +0000 (21:44 +0100)
Signed-off-by: Roland Häder <roland@mxchange.org>
inc/classes/interfaces/database/middleware/class_DatabaseConnector.php
inc/classes/middleware/database/class_DatabaseConnection.php

index 4620df82e33e75cecd5e9150fed11166b60a8a39..aa633f061c32b5d7efcf7e18b88a97b828062d42 100644 (file)
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
 interface DatabaseConnector extends FrameworkDatabase {
+       /**
+        * Get an instance of this class (Singleton)
+        *
+        * @return      $selfInstance   An instance of this class
+        */
+       function getSelfInstance ();
+
+       /**
+        * Setter for database connection
+        *
+        * @param       $login  Login to database
+        * @param       $pass   Password (plain)
+        * @param       $dbase  Database to choose
+        * @param       $host   Hostname to use
+        * @return      void
+        */
+       function setConnectionData ($login, $pass, $dbase, $host='localhost');
+
+       /**
+        * Getter for connection data
+        *
+        * @return      $connectData    Connection data stored with this clas
+        */
+       function getConnectionData ();
+
+       /**
+        * Setter for the real database layer
+        * @param       $dbLayer        An instance of the real database layer
+        * @return      void
+        */
+       function setDatabaseLayer (DatabaseBackend $dbLayer);
+
+       /**
+        * Getter for index key
+        *
+        * @return      $indexKey       Index key
+        */
+       function getIndexKey ();
+
+       /**
+        * 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       $criteriaInstance       An instance of a Criteria class
+        * @return      $result                         The result as an array
+        */
+       function doSelectByTableCriteria ($tableName, Criteria $criteriaInstance);
+
+       /**
+        * Getter for last exception
+        *
+        * @return      $exceptionInstance      Last thrown exception
+        */
+       function getLastException ();
+
+       /**
+        * 'Inserts' a data set instance into a local file database folder
+        *
+        * @param       $dataSetInstance        A storeable data set
+        * @return      void
+        */
+       function queryInsertDataSet (StoreableCriteria $dataSetInstance);
+
+       /**
+        * 'Updates' a data set instance with a database layer
+        *
+        * @param       $dataSetInstance        A storeable data set
+        * @return      void
+        */
+       function queryUpdateDataSet (StoreableCriteria $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
+        */
+       function getPrimaryKeyOfTable ($tableName);
+
        /**
         * Removes non-public data from given array.
         *
index 318073c81b79d7da8034358645686530ae27a415..dd4ce3258c635e8e412c93354732b7c98c7a2a52 100644 (file)
@@ -177,6 +177,17 @@ 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) {
+               // Call database backend
+               return $this->dbLayer->removeNonPublicDataFromArray($data);
+       }
 }
 
 // [EOF]