Пример #1
0
 /**
  * * returns interface to DBWrapper singleton
  * @param $host - - server host name
  * @param $dbname - - db name
  * @param $user - - db user name
  * @param $password - - db user password
  * @return IDBWrapper cast of DBWrapper object
  */
 public static function instance($host = NULL, $dbname = NULL, $user = NULL, $password = NULL)
 {
     DBG::log(__CLASS__, __FUNCTION__, 'before:', array($host, $dbname, $user));
     if (!isset(self::$dbwrapper)) {
         self::$dbwrapper = new DBWrapper($host, $dbname, $user, $password);
     }
     $cast = DBWrapper::castIDBWrapper(self::$dbwrapper);
     DBG::log(__CLASS__, __FUNCTION__, 'after:', array(self::$dbwrapper, $cast));
     return $cast;
 }