MINOR Fixed Database class PHP notices caused by a missing array index when running dev/build to create a new table

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@72750 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Sean Harvey 2009-03-10 02:02:14 +00:00
parent 8960c03376
commit c5d1a53281

View File

@ -292,17 +292,20 @@ abstract class Database extends Object {
if(!isset($this->tableList[strtolower($table)])) $newTable = true;
if(!$newTable && !isset($this->indexList[$table])) {
if(!$newTable && !isset($this->indexList[$table])) {
$this->indexList[$table] = $this->indexList($table);
}
//Fix up the index for database purposes
$index=DB::getConn()->getDbSqlDefinition($table, $index, null, true);
if(is_array($this->indexList[$table][$index]))
$array_spec=$this->indexList[$table][$index]['spec'];
else
$array_spec=$this->indexList[$table][$index];
if(!$newTable) {
if(is_array($this->indexList[$table][$index])) {
$array_spec = $this->indexList[$table][$index]['spec'];
} else {
$array_spec = $this->indexList[$table][$index];
}
}
if($newTable || !isset($this->indexList[$table][$index])) {
$this->transCreateIndex($table, $index, $spec);
@ -361,10 +364,14 @@ abstract class Database extends Object {
// We need to get db-specific versions of the ID column:
if($spec_orig==DB::getConn()->IdColumn())
$specValue=DB::getConn()->IdColumn(true);
if(is_array($this->fieldList[$table][$field]))
$fieldValue=$this->fieldList[$table][$field]['data_type'];
else $fieldValue=$this->fieldList[$table][$field];
if(!$newTable) {
if(is_array($this->fieldList[$table][$field])) {
$fieldValue = $this->fieldList[$table][$field]['data_type'];
} else {
$fieldValue = $this->fieldList[$table][$field];
}
}
// Get the version of the field as we would create it. This is used for comparison purposes to see if the
// existing field is different to what we now want