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;
}