public function set($Explicit = false, $Drop = false)
{
/// Throw an event so that the structure can be overridden.
$this->EventArguments['Explicit'] = $Explicit;
$this->EventArguments['Drop'] = $Drop;
$this->fireEvent('BeforeSet');
try {
// Make sure that table and columns have been defined
if ($this->_TableName == '') {
throw new Exception(T('You must specify a table before calling DatabaseStructure::Set()'));
}
if (count($this->_Columns) == 0) {
throw new Exception(T('You must provide at least one column before calling DatabaseStructure::Set()'));
}
if ($this->tableExists()) {
if ($Drop) {
// Drop the table.
$this->drop();
// And re-create it.
return $this->_create();
}
// If the table already exists, go into modify mode.
return $this->_modify($Explicit, $Drop);
} else {
// If it doesn't already exist, go into create mode.
return $this->_create();
}
} catch (Exception $Ex) {
$this->reset();
throw $Ex;
}
}