dropTable() public method

Drops a table from the database, if it exists.
public dropTable ( string $table ) : mixed
$table string The table name.
return mixed
Exemplo n.º 1
0
 /**
  * 
  * Creates the table and indexes in the database using $this->_table_cols
  * and $this->_index.
  * 
  * @return void
  * 
  */
 protected function _createTableAndIndexes()
 {
     /**
      * Create the table.
      */
     $this->_sql->createTable($this->_table_name, $this->_table_cols);
     /**
      * Create the indexes.
      */
     foreach ($this->_index as $name => $info) {
         try {
             // create this index
             $this->_sql->createIndex($this->_table_name, $info['name'], $info['type'] == 'unique', $info['cols']);
         } catch (Exception $e) {
             // cancel the whole deal.
             $this->_sql->dropTable($this->_table_name);
             throw $e;
         }
     }
 }