function alterAggregate($aggrname, $aggrtype, $aggrowner, $aggrschema, $aggrcomment, $newaggrname, $newaggrowner, $newaggrschema, $newaggrcomment)
{
// Clean fields
$this->fieldClean($aggrname);
$this->fieldClean($aggrtype);
$this->fieldClean($aggrowner);
$this->fieldClean($aggrschema);
$this->fieldClean($newaggrname);
$this->fieldClean($newaggrowner);
$this->fieldClean($newaggrschema);
$this->beginTransaction();
// Change the owner, if it has changed
if ($aggrowner != $newaggrowner) {
$status = $this->changeAggregateOwner($aggrname, $aggrtype, $newaggrowner);
if ($status != 0) {
$this->rollbackTransaction();
return -1;
}
}
// Set the comment, if it has changed
if ($aggrcomment != $newaggrcomment) {
$status = $this->setComment('AGGREGATE', $aggrname, '', $newaggrcomment, $aggrtype);
if ($status) {
$this->rollbackTransaction();
return -2;
}
}
// Change the schema, if it has changed
if ($aggrschema != $newaggrschema) {
$status = $this->changeAggregateSchema($aggrname, $aggrtype, $newaggrschema);
if ($status != 0) {
$this->rollbackTransaction();
return -3;
}
}
// Rename the aggregate, if it has changed
if ($aggrname != $newaggrname) {
$status = $this->renameAggregate($newaggrschema, $aggrname, $aggrtype, $newaggrname);
if ($status != 0) {
$this->rollbackTransaction();
return -4;
}
}
return $this->endTransaction();
}