Postgres::createSchema PHP Method

createSchema() public method

Creates a new schema.
public createSchema ( $schemaname, $authorization = '', $comment = '' )
$schemaname The name of the schema to create
$authorization (optional) The username to create the schema for.
$comment (optional) If omitted, defaults to nothing
    function createSchema($schemaname, $authorization = '', $comment = '')
    {
        $this->fieldClean($schemaname);
        $this->fieldClean($authorization);
        $sql = "CREATE SCHEMA \"{$schemaname}\"";
        if ($authorization != '') {
            $sql .= " AUTHORIZATION \"{$authorization}\"";
        }
        if ($comment != '') {
            $status = $this->beginTransaction();
            if ($status != 0) {
                return -1;
            }
        }
        // Create the new schema
        $status = $this->execute($sql);
        if ($status != 0) {
            $this->rollbackTransaction();
            return -1;
        }
        // Set the comment
        if ($comment != '') {
            $status = $this->setComment('SCHEMA', $schemaname, '', $comment);
            if ($status != 0) {
                $this->rollbackTransaction();
                return -1;
            }
            return $this->endTransaction();
        }
        return 0;
    }
Postgres