Postgres::updateSchema PHP Method

updateSchema() public method

Updates a schema.
public updateSchema ( $schemaname, $comment, $name, $owner )
$schemaname The name of the schema to drop
$comment The new comment for this schema
$owner The new owner for this schema
    function updateSchema($schemaname, $comment, $name, $owner)
    {
        $this->fieldClean($schemaname);
        $this->fieldClean($name);
        $this->fieldClean($owner);
        $status = $this->beginTransaction();
        if ($status != 0) {
            $this->rollbackTransaction();
            return -1;
        }
        $status = $this->setComment('SCHEMA', $schemaname, '', $comment);
        if ($status != 0) {
            $this->rollbackTransaction();
            return -1;
        }
        $schema_rs = $this->getSchemaByName($schemaname);
        /* Only if the owner change */
        if ($schema_rs->fields['ownername'] != $owner) {
            $sql = "ALTER SCHEMA \"{$schemaname}\" OWNER TO \"{$owner}\"";
            $status = $this->execute($sql);
            if ($status != 0) {
                $this->rollbackTransaction();
                return -1;
            }
        }
        // Only if the name has changed
        if ($name != $schemaname) {
            $sql = "ALTER SCHEMA \"{$schemaname}\" RENAME TO \"{$name}\"";
            $status = $this->execute($sql);
            if ($status != 0) {
                $this->rollbackTransaction();
                return -1;
            }
        }
        return $this->endTransaction();
    }
Postgres