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:
|
||||
v = tr("Tablespace");
|
||||
break;
|
||||
case CommentCol:
|
||||
v = tr("Comment");
|
||||
break;
|
||||
case SizeCol:
|
||||
v = tr("Size");
|
||||
break;
|
||||
|
|
@ -102,6 +105,7 @@ Oid DatabasesTableModel::getType(int column) const
|
|||
case DbaCol:
|
||||
case NameCol:
|
||||
case TablespaceCol:
|
||||
case CommentCol:
|
||||
oid = varchar_oid;
|
||||
break;
|
||||
default:
|
||||
|
|
@ -146,6 +150,9 @@ QVariant DatabasesTableModel::getData(const QModelIndex &index) const
|
|||
// todo lookup tablespace name
|
||||
v = getTablespaceDisplayString(*m_catalog, db.tablespace);
|
||||
break;
|
||||
case CommentCol:
|
||||
v = db.description;
|
||||
break;
|
||||
case SizeCol:
|
||||
v = db.sizeBytes;
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ class DatabasesTableModel : public BaseTableModel
|
|||
public:
|
||||
enum e_Columns : int { NameCol, DbaCol, EncodingCol, CollateCol,
|
||||
CTypeCol, IsTemplateCol, AllowConnCol, ConnLimitCol,
|
||||
TablespaceCol, SizeCol, AclCol, COL_COUNT };
|
||||
TablespaceCol, CommentCol, SizeCol, AclCol, COL_COUNT };
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ public:
|
|||
int connLimit;
|
||||
Oid tablespace;
|
||||
int64_t sizeBytes;
|
||||
QString description;
|
||||
|
||||
using PgServerObject::PgServerObject;
|
||||
|
||||
|
|
|
|||
|
|
@ -3,10 +3,12 @@
|
|||
|
||||
std::string PgDatabaseContainer::getLoadQuery() const
|
||||
{
|
||||
return "SELECT oid,datname,datdba,encoding,pg_encoding_to_char(encoding),datcollate \n"
|
||||
",datctype,datistemplate,datallowconn,"
|
||||
"datconnlimit,dattablespace,pg_database_size(oid),datacl "
|
||||
"FROM pg_database";
|
||||
return
|
||||
"SELECT oid, datname, datdba, encoding, pg_encoding_to_char(encoding), datcollate,\n"
|
||||
" datctype, datistemplate, datallowconn, datconnlimit, dattablespace, pg_database_size(oid),\n"
|
||||
" 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)
|
||||
|
|
@ -17,7 +19,7 @@ PgDatabase PgDatabaseContainer::loadElem(const Pgsql::Row &row)
|
|||
QString name = col.nextValue();
|
||||
PgDatabase v(m_catalog, oid, name);
|
||||
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;
|
||||
col >> acl_list;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue