X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Fmain%2Fmiddleware%2Fdatabase%2Fclass_DatabaseConnection.php;h=d6e847cc2f80efb0021613bab8882ce8dbcf86ef;hb=6ea45449c5eaed1a37f2a33009a66c672444a333;hp=82cc428b2bdf48e9db3c1824d88926128640cd50;hpb=fe28fd87dd0c4e129cef6ee7bd4e257a3f3ba280;p=core.git diff --git a/inc/main/middleware/database/class_DatabaseConnection.php b/inc/main/middleware/database/class_DatabaseConnection.php index 82cc428b..d6e847cc 100644 --- a/inc/main/middleware/database/class_DatabaseConnection.php +++ b/inc/main/middleware/database/class_DatabaseConnection.php @@ -1,4 +1,11 @@ '', - 'pass' => '', - 'dbase' => '', - 'host' => '' + 'login' => '', + 'pass' => '', + 'dbase' => '', + 'host' => '' ); - // The real database layer + /** + * The real database layer + */ private $dbLayer = NULL; - // An instance of this class + /** + * An instance of this class + */ private static $selfInstance = NULL; /** * Protected constructor - * - * @return void */ protected function __construct () { // Call parent constructor parent::__construct(__CLASS__); } - // Create new database connection layer + /** + * Creates a new database connection layer + * + * @param $debugInstance An instance of a DebugMiddleware class + * @param $dbLayer An instance of a DatabaseBackend class + */ public static final function createDatabaseConnection (DebugMiddleware $debugInstance, DatabaseBackend $dbLayer) { // Get instance $databaseInstance = new DatabaseConnection(); @@ -63,13 +77,26 @@ class DatabaseConnection extends BaseMiddleware implements DatabaseConnector, Re return $databaseInstance; } - // Get an instance of this class + /** + * Getter for this class + * + * @return $selfInstance An instance of this class + */ public static final function getSelfInstance () { return self::$selfInstance; } - // Public setter for database connection - public final function setConnectionData ($login, $pass, $dbase, $host='localhost') { + /** + * Setter for all database connection data. All these parameters may be + * supported by the underlaying backend. + * + * @param $login Login name to database + * @param $pass Passwort for above login + * @param $dbase Name of used database + * @param $host Host to connect to (default: 127.0.0.1) + * @return void + */ + public final function setConnectionData ($login, $pass, $dbase, $host = '127.0.0.1') { // Transfer connection data $this->connectData['login'] = (string) $login; $this->connectData['pass'] = (string) $pass; @@ -212,7 +239,5 @@ class DatabaseConnection extends BaseMiddleware implements DatabaseConnector, Re // Return the value return $count; } -} -// [EOF] -?> +}