Show SQL for database
Also improvements to the SQL for tables and views.
This commit is contained in:
parent
b5a706a2a2
commit
3158a4364b
12 changed files with 172 additions and 58 deletions
|
|
@ -1,6 +1,51 @@
|
|||
#include "PgDatabase.h"
|
||||
#include "PgDatabaseCatalog.h"
|
||||
#include "SqlFormattingUtils.h"
|
||||
#include <QStringBuilder>
|
||||
|
||||
QString PgDatabase::typeName() const
|
||||
{
|
||||
return "DATABASE";
|
||||
return "DATABASE";
|
||||
}
|
||||
|
||||
QString PgDatabase::aclAllPattern() const
|
||||
{
|
||||
// Create
|
||||
// Connect
|
||||
// Temporary
|
||||
return "CcT";
|
||||
}
|
||||
|
||||
QString PgDatabase::dropSql() const
|
||||
{
|
||||
return "DROP DATABASE " % quotedObjectName() % ";";
|
||||
}
|
||||
|
||||
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")
|
||||
{
|
||||
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