Adding placeholder method to DboMysql to handle alteration of table parameter statement generation.

This commit is contained in:
mark_story 2009-10-03 16:49:01 -04:00
parent 2fe877e527
commit 0b6d6cee6c

View file

@ -248,7 +248,7 @@ class DboMysqlBase extends DboSource {
$out = ''; $out = '';
$colList = array(); $colList = array();
foreach ($compare as $curTable => $types) { foreach ($compare as $curTable => $types) {
$indexes = array(); $indexes = $tableParameters = array();
if (!$table || $table == $curTable) { if (!$table || $table == $curTable) {
$out .= 'ALTER TABLE ' . $this->fullTableName($curTable) . " \n"; $out .= 'ALTER TABLE ' . $this->fullTableName($curTable) . " \n";
foreach ($types as $type => $column) { foreach ($types as $type => $column) {
@ -256,6 +256,10 @@ class DboMysqlBase extends DboSource {
$indexes[$type] = $column['indexes']; $indexes[$type] = $column['indexes'];
unset($column['indexes']); unset($column['indexes']);
} }
if (isset($column['tableParameters'])) {
$tableParameters[$type] = $column['tableParameters'];
unset($column['tableParameters']);
}
switch ($type) { switch ($type) {
case 'add': case 'add':
foreach ($column as $field => $col) { foreach ($column as $field => $col) {
@ -284,6 +288,7 @@ class DboMysqlBase extends DboSource {
} }
} }
$colList = array_merge($colList, $this->_alterIndexes($curTable, $indexes)); $colList = array_merge($colList, $this->_alterIndexes($curTable, $indexes));
$colList = array_merge($colList, $this->_alterTableParameters($curTable, $tableParameters));
$out .= "\t" . join(",\n\t", $colList) . ";\n\n"; $out .= "\t" . join(",\n\t", $colList) . ";\n\n";
} }
} }
@ -312,6 +317,18 @@ class DboMysqlBase extends DboSource {
return $out; return $out;
} }
/**
* Generate MySQL table parameter alteration statementes for a table.
*
* @param string $table Table to alter parameters for.
* @param array $parameters Parameters to add & drop.
* @return array Array of table property alteration statementes.
* @todo Implement this method.
**/
function _alterTableParameters($table, $parameters) {
return array();
}
/** /**
* Generate MySQL index alteration statements for a table. * Generate MySQL index alteration statements for a table.
* *