setPassword() public method

public setPassword ( $value )
示例#1
0
 /**
  * Creates the DB connection.
  * @param string the module ID for TDataSourceConfig
  * @return TDbConnection the created DB connection
  * @throws TConfigurationException if module ID is invalid or empty
  */
 protected function createDbConnection()
 {
     if ($this->_connID !== '') {
         $config = $this->getApplication()->getModule($this->_connID);
         if ($config instanceof TDataSourceConfig) {
             return $config->getDbConnection();
         } else {
             throw new TConfigurationException('dbcache_connectionid_invalid', $this->_connID);
         }
     } else {
         $db = new TDbConnection();
         if ($this->_connectionString !== '') {
             $db->setConnectionString($this->_connectionString);
             if ($this->_username !== '') {
                 $db->setUsername($this->_username);
             }
             if ($this->_password !== '') {
                 $db->setPassword($this->_password);
             }
         } else {
             // default to SQLite3 database
             $dbFile = $this->getApplication()->getRuntimePath() . '/sqlite3.cache';
             $db->setConnectionString('sqlite:' . $dbFile);
         }
         return $db;
     }
 }