WIP createdb dialog
This commit is contained in:
parent
c20427e10d
commit
d3080a08bb
10 changed files with 113 additions and 45 deletions
|
|
@ -23,29 +23,30 @@ QString PgDatabase::dropSql() const
|
|||
|
||||
QString PgDatabase::createSql() const
|
||||
{
|
||||
QString s = "CREATE DATABASE " % quotedObjectName()
|
||||
// TEMPLATE is missing as this is not stored in the catalog
|
||||
% "\n OWNER " % quoteIdent(ownerName())
|
||||
% "\n ENCODING " % escapeLiteral(encodingString)
|
||||
% "\n LC_COLLATE " % escapeLiteral(collate)
|
||||
% "\n LC_TYPE " % escapeLiteral(ctype);
|
||||
auto ns = getTablespaceDisplayString(catalog(), tablespace);
|
||||
if (ns != "pg_default")
|
||||
QString s = "CREATE DATABASE " % quotedObjectName();
|
||||
|
||||
if (hasOwner())
|
||||
s += "\n OWNER " % quoteIdent(ownerName());
|
||||
if (!dbTemplate.isEmpty())
|
||||
s += "\n TEMPLATE " % escapeLiteral(dbTemplate);
|
||||
if (!encodingString.isEmpty())
|
||||
s += "\n ENCODING " % escapeLiteral(encodingString);
|
||||
if (!collate.isEmpty())
|
||||
s += "\n LC_COLLATE " % escapeLiteral(collate);
|
||||
if (!ctype.isEmpty())
|
||||
s += "\n LC_TYPE " % escapeLiteral(ctype);
|
||||
if (tablespace != InvalidOid)
|
||||
{
|
||||
s += "\n TABLESPACE " % quoteIdent(ns);
|
||||
auto ns = getTablespaceDisplayString(catalog(), tablespace);
|
||||
if (ns != "pg_default")
|
||||
s += "\n TABLESPACE " % quoteIdent(ns);
|
||||
}
|
||||
if (!allowConn)
|
||||
{
|
||||
s += "\n ALLOW_CONNECTIONS FALSE";
|
||||
}
|
||||
if (connLimit >= 0)
|
||||
{
|
||||
s += "\n CONNECTION LIMIT " % QString::number(connLimit);
|
||||
}
|
||||
if (isTemplate)
|
||||
{
|
||||
s += "\n IS_TEMPLATE TRUE";
|
||||
}
|
||||
s += ";";
|
||||
return s;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue