mirror of
https://github.com/levinsv/pgadmin3.git
synced 2026-05-15 06:05:49 -06:00
Performance improvement and usability
Повышение производительности вывода результатов запроса и дерева объектов. Мелкие исправления.
This commit is contained in:
parent
2a4b4dc878
commit
debed953cf
5 changed files with 32 additions and 14 deletions
|
|
@ -49,7 +49,8 @@ void ctlSQLGrid::setresizedpi() {
|
|||
wxFont fntLabel(settings->GetSystemFont());
|
||||
fntLabel.SetWeight(wxBOLD);
|
||||
SetLabelFont(fntLabel);
|
||||
SetColLabelAlignment(wxALIGN_LEFT, wxALIGN_CENTER);
|
||||
SetColLabelAlignment(wxALIGN_LEFT, wxALIGN_CENTRE);
|
||||
SetDefaultCellAlignment(wxALIGN_LEFT, wxALIGN_TOP);
|
||||
SetRowLabelSize(FromDIP(50));
|
||||
|
||||
}
|
||||
|
|
@ -903,7 +904,7 @@ void ctlSQLGrid::AutoSizeColumn(int col, bool setAsMin, bool doLimit)
|
|||
|
||||
void ctlSQLGrid::AutoSizeColumns(bool setAsMin)
|
||||
{
|
||||
wxCoord newSize, oldSize, maxH=0;
|
||||
wxCoord newSize, oldSize, maxH=0, newSizeH=0;
|
||||
wxCoord maxSize, totalSize = 0, availSize;
|
||||
int col, nCols = GetNumberCols();
|
||||
int row, nRows = GetNumberRows();
|
||||
|
|
@ -933,6 +934,8 @@ void ctlSQLGrid::AutoSizeColumns(bool setAsMin)
|
|||
wxSize size = GetBestSize(row, col);
|
||||
if ( size.x > newSize )
|
||||
newSize = size.x;
|
||||
if (size.y > newSizeH)
|
||||
newSizeH = size.y;
|
||||
}
|
||||
// get column's label width
|
||||
wxCoord w, h;
|
||||
|
|
@ -959,7 +962,8 @@ void ctlSQLGrid::AutoSizeColumns(bool setAsMin)
|
|||
}
|
||||
SetColLabelSize(maxH+ FromDIP(EXTRAEXTENT_HEIGHT));
|
||||
availSize = GetClientSize().GetWidth() - GetRowLabelSize();
|
||||
|
||||
int newDef = GetDefaultRowSize()+FromDIP(1);
|
||||
SetDefaultRowSize(newDef, true);
|
||||
// Second pass: shrink wide columns if exceeded available width
|
||||
if (totalSize > availSize)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -201,10 +201,14 @@ void ctlSQLResult::DisplayData(bool single)
|
|||
table->initSort();
|
||||
SetSort(true);
|
||||
if (NumRows()<1000) {
|
||||
int h, v;
|
||||
GetDefaultCellAlignment(&h, &v);
|
||||
for(int row = 0; row < NumRows(); ++row) {
|
||||
if (row%2==0) {
|
||||
wxGridCellAttr* pAttr = new wxGridCellAttr;
|
||||
pAttr->SetBackgroundColour(wxColour(224,255,224));
|
||||
|
||||
pAttr->SetAlignment(h,v);
|
||||
SetRowAttr(row,pAttr);
|
||||
}
|
||||
|
||||
|
|
@ -1068,7 +1072,7 @@ wxString sqlResultTable::GetValue(int row, int col)
|
|||
{
|
||||
if (use_map) row=maplines[row];
|
||||
thread->DataSet()->Locate(row + 1);
|
||||
if (settings->GetIndicateNull() && thread->DataSet()->IsNull(col))
|
||||
if (c_IndicateNull && thread->DataSet()->IsNull(col))
|
||||
return wxT("<NULL>");
|
||||
else
|
||||
{
|
||||
|
|
@ -1077,14 +1081,14 @@ wxString sqlResultTable::GetValue(int row, int col)
|
|||
wxString s = thread->DataSet()->GetVal(col);
|
||||
|
||||
if(thread->DataSet()->ColTypClass(col) == PGTYPCLASS_NUMERIC &&
|
||||
settings->GetDecimalMark().Length() > 0)
|
||||
!c_DecimalMark.IsEmpty())
|
||||
{
|
||||
decimalMark = settings->GetDecimalMark();
|
||||
s.Replace(wxT("."), decimalMark);
|
||||
|
||||
}
|
||||
if (thread->DataSet()->ColTypClass(col) == PGTYPCLASS_NUMERIC &&
|
||||
settings->GetThousandsSeparator().Length() > 0)
|
||||
!c_ThousandsSeparator.IsEmpty())
|
||||
{
|
||||
/* Add thousands separator */
|
||||
size_t pos = s.find(decimalMark);
|
||||
|
|
@ -1094,7 +1098,7 @@ wxString sqlResultTable::GetValue(int row, int col)
|
|||
{
|
||||
pos -= 3;
|
||||
if (pos > 1 || !s.StartsWith(wxT("-")))
|
||||
s.insert(pos, settings->GetThousandsSeparator());
|
||||
s.insert(pos, c_ThousandsSeparator);
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
|
@ -1102,8 +1106,8 @@ wxString sqlResultTable::GetValue(int row, int col)
|
|||
{
|
||||
wxString data = thread->DataSet()->GetVal(col);
|
||||
|
||||
if (data.Length() > (size_t)settings->GetMaxColSize())
|
||||
return thread->DataSet()->GetVal(col).Left(settings->GetMaxColSize()) + wxT(" (...)");
|
||||
if (data.Length() > (size_t) c_MaxColSize)
|
||||
return thread->DataSet()->GetVal(col).Left(c_MaxColSize) + wxT(" (...)");
|
||||
else
|
||||
return thread->DataSet()->GetVal(col);
|
||||
}
|
||||
|
|
@ -1121,6 +1125,10 @@ sqlResultTable::sqlResultTable()
|
|||
colorder=NULL;
|
||||
maplines=NULL;
|
||||
use_map=false;
|
||||
c_MaxColSize = settings->GetMaxColSize();
|
||||
c_IndicateNull=settings->GetIndicateNull();
|
||||
c_ThousandsSeparator = settings->GetThousandsSeparator();
|
||||
c_DecimalMark = settings->GetDecimalMark();
|
||||
}
|
||||
|
||||
int sqlResultTable::GetNumberRows()
|
||||
|
|
|
|||
|
|
@ -198,14 +198,13 @@ int pgSet::ColNumber(const wxString &colname) const
|
|||
{
|
||||
int col;
|
||||
|
||||
if (needColQuoting)
|
||||
col = PQfnumber(res, colname.mb_str(conv));
|
||||
if (col < 0 && needColQuoting)
|
||||
{
|
||||
wxString quotedColName = colname;
|
||||
quotedColName.Replace(wxT("\""), wxT("\"\""));
|
||||
col = PQfnumber(res, (wxT("\"") + quotedColName + wxT("\"")).mb_str(conv));
|
||||
}
|
||||
else
|
||||
col = PQfnumber(res, colname.mb_str(conv));
|
||||
|
||||
if (col < 0)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -131,6 +131,9 @@ public:
|
|||
|
||||
private:
|
||||
pgQueryThread *thread;
|
||||
bool c_IndicateNull;
|
||||
int c_MaxColSize;
|
||||
wxString c_ThousandsSeparator, c_DecimalMark;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -400,6 +400,7 @@ void pgObject::ShowDependency(pgDatabase *db, ctlListView *list, const wxString
|
|||
|
||||
wxString typestr = set->GetVal(wxT("type"));
|
||||
pgaFactory *depFactory = 0;
|
||||
int icon=-1;
|
||||
switch ((wxChar)typestr.c_str()[0])
|
||||
{
|
||||
case 'c':
|
||||
|
|
@ -429,6 +430,10 @@ void pgObject::ShowDependency(pgDatabase *db, ctlListView *list, const wxString
|
|||
case 'v':
|
||||
depFactory = &viewFactory;
|
||||
break;
|
||||
case 'm':
|
||||
depFactory = &viewFactory;
|
||||
icon=viewFactory.GetMaterializedIconId();
|
||||
break;
|
||||
case 'x':
|
||||
depFactory = &extTableFactory;
|
||||
break;
|
||||
|
|
@ -505,11 +510,10 @@ void pgObject::ShowDependency(pgDatabase *db, ctlListView *list, const wxString
|
|||
refname += _refname;
|
||||
|
||||
wxString typname;
|
||||
int icon;
|
||||
if (depFactory)
|
||||
{
|
||||
typname = depFactory->GetTypeName();
|
||||
icon = depFactory->GetIconId();
|
||||
if (icon==-1) icon = depFactory->GetIconId();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue