Display comments in the list of databases
This commit is contained in:
parent
2724586f4e
commit
f21a59e030
4 changed files with 16 additions and 6 deletions
|
|
@ -52,6 +52,9 @@ QVariant DatabasesTableModel::headerData(int section, Qt::Orientation orientatio
|
||||||
case TablespaceCol:
|
case TablespaceCol:
|
||||||
v = tr("Tablespace");
|
v = tr("Tablespace");
|
||||||
break;
|
break;
|
||||||
|
case CommentCol:
|
||||||
|
v = tr("Comment");
|
||||||
|
break;
|
||||||
case SizeCol:
|
case SizeCol:
|
||||||
v = tr("Size");
|
v = tr("Size");
|
||||||
break;
|
break;
|
||||||
|
|
@ -102,6 +105,7 @@ Oid DatabasesTableModel::getType(int column) const
|
||||||
case DbaCol:
|
case DbaCol:
|
||||||
case NameCol:
|
case NameCol:
|
||||||
case TablespaceCol:
|
case TablespaceCol:
|
||||||
|
case CommentCol:
|
||||||
oid = varchar_oid;
|
oid = varchar_oid;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
@ -146,6 +150,9 @@ QVariant DatabasesTableModel::getData(const QModelIndex &index) const
|
||||||
// todo lookup tablespace name
|
// todo lookup tablespace name
|
||||||
v = getTablespaceDisplayString(*m_catalog, db.tablespace);
|
v = getTablespaceDisplayString(*m_catalog, db.tablespace);
|
||||||
break;
|
break;
|
||||||
|
case CommentCol:
|
||||||
|
v = db.description;
|
||||||
|
break;
|
||||||
case SizeCol:
|
case SizeCol:
|
||||||
v = db.sizeBytes;
|
v = db.sizeBytes;
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ class DatabasesTableModel : public BaseTableModel
|
||||||
public:
|
public:
|
||||||
enum e_Columns : int { NameCol, DbaCol, EncodingCol, CollateCol,
|
enum e_Columns : int { NameCol, DbaCol, EncodingCol, CollateCol,
|
||||||
CTypeCol, IsTemplateCol, AllowConnCol, ConnLimitCol,
|
CTypeCol, IsTemplateCol, AllowConnCol, ConnLimitCol,
|
||||||
TablespaceCol, SizeCol, AclCol, COL_COUNT };
|
TablespaceCol, CommentCol, SizeCol, AclCol, COL_COUNT };
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,7 @@ public:
|
||||||
int connLimit;
|
int connLimit;
|
||||||
Oid tablespace;
|
Oid tablespace;
|
||||||
int64_t sizeBytes;
|
int64_t sizeBytes;
|
||||||
|
QString description;
|
||||||
|
|
||||||
using PgServerObject::PgServerObject;
|
using PgServerObject::PgServerObject;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,10 +3,12 @@
|
||||||
|
|
||||||
std::string PgDatabaseContainer::getLoadQuery() const
|
std::string PgDatabaseContainer::getLoadQuery() const
|
||||||
{
|
{
|
||||||
return "SELECT oid,datname,datdba,encoding,pg_encoding_to_char(encoding),datcollate \n"
|
return
|
||||||
",datctype,datistemplate,datallowconn,"
|
"SELECT oid, datname, datdba, encoding, pg_encoding_to_char(encoding), datcollate,\n"
|
||||||
"datconnlimit,dattablespace,pg_database_size(oid),datacl "
|
" datctype, datistemplate, datallowconn, datconnlimit, dattablespace, pg_database_size(oid),\n"
|
||||||
"FROM pg_database";
|
" d.description, datacl\n"
|
||||||
|
"FROM pg_database\n"
|
||||||
|
" LEFT JOIN pg_catalog.pg_shdescription AS d ON (objoid=pg_database.oid)";
|
||||||
}
|
}
|
||||||
|
|
||||||
PgDatabase PgDatabaseContainer::loadElem(const Pgsql::Row &row)
|
PgDatabase PgDatabaseContainer::loadElem(const Pgsql::Row &row)
|
||||||
|
|
@ -17,7 +19,7 @@ PgDatabase PgDatabaseContainer::loadElem(const Pgsql::Row &row)
|
||||||
QString name = col.nextValue();
|
QString name = col.nextValue();
|
||||||
PgDatabase v(m_catalog, oid, name);
|
PgDatabase v(m_catalog, oid, name);
|
||||||
col >> v.dba >> v.encoding >> v.encodingString >> v.collate >> v.ctype >> v.isTemplate
|
col >> v.dba >> v.encoding >> v.encodingString >> v.collate >> v.ctype >> v.isTemplate
|
||||||
>> v.allowConn >> v.connLimit >> v.tablespace >> v.sizeBytes;
|
>> v.allowConn >> v.connLimit >> v.tablespace >> v.sizeBytes >> v.description;
|
||||||
|
|
||||||
AclList acl_list;
|
AclList acl_list;
|
||||||
col >> acl_list;
|
col >> acl_list;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue