function alterTablespace($spcname, $name, $owner, $comment = '')
{
$this->fieldClean($spcname);
$this->fieldClean($name);
$this->fieldClean($owner);
// Begin transaction
$status = $this->beginTransaction();
if ($status != 0) {
return -1;
}
// Owner
$sql = "ALTER TABLESPACE \"{$spcname}\" OWNER TO \"{$owner}\"";
$status = $this->execute($sql);
if ($status != 0) {
$this->rollbackTransaction();
return -2;
}
// Rename (only if name has changed)
if ($name != $spcname) {
$sql = "ALTER TABLESPACE \"{$spcname}\" RENAME TO \"{$name}\"";
$status = $this->execute($sql);
if ($status != 0) {
$this->rollbackTransaction();
return -3;
}
$spcname = $name;
}
// Set comment if it has changed
if (trim($comment) != '' && $this->hasSharedComments()) {
$status = $this->setComment('TABLESPACE', $spcname, '', $comment);
if ($status != 0) {
return -4;
}
}
return $this->endTransaction();
}