Exemplo n.º 1
0
 public static function DBDrop()
 {
     $bDropEntireDB = true;
     if (!empty(self::$m_sTablePrefix)) {
         // Do drop only tables corresponding to the sub-database (table prefix)
         //           then possibly drop the DB itself (if no table remain)
         foreach (CMDBSource::EnumTables() as $sTable) {
             // perform a case insensitive test because on Windows the table names become lowercase :-(
             if (strtolower(substr($sTable, 0, strlen(self::$m_sTablePrefix))) == strtolower(self::$m_sTablePrefix)) {
                 CMDBSource::DropTable($sTable);
             } else {
                 // There is at least one table which is out of the scope of the current application
                 $bDropEntireDB = false;
             }
         }
     }
     if ($bDropEntireDB) {
         CMDBSource::DropDB(self::$m_sDBName);
     }
 }
Exemplo n.º 2
0
 protected function DoPrepare()
 {
     $sDBHost = $this->GetDBHost();
     $sDBUser = $this->GetDBUser();
     $sDBPwd = $this->GetDBPwd();
     $sDBName = $this->GetDBName();
     CMDBSource::Init($sDBHost, $sDBUser, $sDBPwd);
     CMDBSource::SetCharacterSet();
     if (CMDBSource::IsDB($sDBName)) {
         CMDBSource::DropDB($sDBName);
     }
     CMDBSource::CreateDB($sDBName);
 }