diff --git a/pgadmin/ctl/ctlSQLResult.cpp b/pgadmin/ctl/ctlSQLResult.cpp index bdd9ad7..ed8a5e2 100644 --- a/pgadmin/ctl/ctlSQLResult.cpp +++ b/pgadmin/ctl/ctlSQLResult.cpp @@ -317,7 +325,26 @@ wxString sqlResultTable::GetValue(int row, int col) if (settings->GetIndicateNull() && thread->DataSet()->IsNull(col)) return wxT(""); else - return thread->DataSet()->GetVal(col); + { + if (thread->DataSet()->ColTypClass(col) == PGTYPCLASS_NUMERIC && + settings->GetThousandsSeparator().Length() > 0) + { + /* Add thousands separator */ + wxString s = thread->DataSet()->GetVal(col); + size_t pos = s.find(wxT(".")); + if (pos == wxString::npos) + pos = s.length(); + while (pos > 3) + { + pos -= 3; + if (pos > 1 || !s.StartsWith(wxT("-"))) + s.insert(pos, settings->GetThousandsSeparator()); + } + return s; + } + else + return thread->DataSet()->GetVal(col); + } } else return thread->DataSet()->ColName(col); diff --git a/pgadmin/frm/frmOptions.cpp b/pgadmin/frm/frmOptions.cpp index c8676bd..1ad00ad 100644 --- a/pgadmin/frm/frmOptions.cpp +++ b/pgadmin/frm/frmOptions.cpp @@ -87,6 +87,7 @@ #define cbCopySeparator CTRL_COMBOBOX("cbCopySeparator") #define chkStickySql CTRL_CHECKBOX("chkStickySql") #define chkIndicateNull CTRL_CHECKBOX("chkIndicateNull") +#define txtThousandsSeparator CTRL_TEXT("txtThousandsSeparator") #define chkAutoRollback CTRL_CHECKBOX("chkAutoRollback") #define chkDoubleClickProperties CTRL_CHECKBOX("chkDoubleClickProperties") #define chkShowNotices CTRL_CHECKBOX("chkShowNotices") @@ -301,6 +302,7 @@ frmOptions::frmOptions(frmMain *parent) chkStickySql->SetValue(settings->GetStickySql()); chkIndicateNull->SetValue(settings->GetIndicateNull()); + txtThousandsSeparator->SetValue(settings->GetThousandsSeparator()); chkAutoRollback->SetValue(settings->GetAutoRollback()); chkDoubleClickProperties->SetValue(settings->GetDoubleClickProperties()); chkShowNotices->SetValue(settings->GetShowNotices()); @@ -666,6 +668,7 @@ void frmOptions::OnOK(wxCommandEvent &ev) settings->SetStickySql(chkStickySql->GetValue()); settings->SetIndicateNull(chkIndicateNull->GetValue()); + settings->SetThousandsSeparator(txtThousandsSeparator->GetValue()); settings->SetAutoRollback(chkAutoRollback->GetValue()); settings->SetDoubleClickProperties(chkDoubleClickProperties->GetValue()); settings->SetShowNotices(chkShowNotices->GetValue()); diff --git a/pgadmin/include/utils/sysSettings.h b/pgadmin/include/utils/sysSettings.h index 072b2fc..762f85b 100644 --- a/pgadmin/include/utils/sysSettings.h +++ b/pgadmin/include/utils/sysSettings.h @@ -349,6 +349,16 @@ public: { WriteBool(wxT("frmQuery/IndicateNull"), newval); } + wxString GetThousandsSeparator() const + { + wxString s; + Read(wxT("frmQuery/ThousandsSeparator"), &s, wxEmptyString); + return s; + } + void SetThousandsSeparator(const wxString &newval) + { + Write(wxT("frmQuery/ThousandsSeparator"), newval); + } bool GetAutoRollback() const { bool b; diff --git a/pgadmin/ui/frmOptions.xrc b/pgadmin/ui/frmOptions.xrc index 8097e1f..cf136c6 100644 --- a/pgadmin/ui/frmOptions.xrc +++ b/pgadmin/ui/frmOptions.xrc @@ -856,6 +856,21 @@ wxEXPAND|wxALIGN_CENTER_VERTICAL|wxTOP|wxLEFT|wxRIGHT 4 + + + + + wxALIGN_CENTER_VERTICAL|wxTOP|wxLEFT|wxRIGHT + 4 + + + + + 0 + + wxEXPAND|wxALIGN_CENTER_VERTICAL|wxTOP|wxLEFT|wxRIGHT + 4 + wxEXPAND|wxALIGN_CENTER_VERTICAL|wxTOP|wxLEFT|wxRIGHT