mirror of
https://github.com/levinsv/pgadmin3.git
synced 2026-05-15 14:15:49 -06:00
Merge
This commit is contained in:
commit
9b579c15bd
8 changed files with 474 additions and 436 deletions
|
|
@ -32,14 +32,31 @@ MyCompareFunction(wxIntPtr item1, wxIntPtr item2, wxIntPtr WXUNUSED(sortData))
|
|||
}
|
||||
|
||||
ctlListView::ctlListView(wxWindow* p, int id, wxPoint pos, wxSize siz, long attr)
|
||||
: wxListView(p, id, pos, siz, attr | wxLC_REPORT)
|
||||
// : wxListView(p, id, pos, siz, attr | wxLC_REPORT)
|
||||
{
|
||||
nosort = false;
|
||||
autohint=false;
|
||||
order = 1;
|
||||
prev_col = -1;
|
||||
storelongstring = false;
|
||||
Connect(wxID_ANY, wxEVT_LIST_COL_CLICK, wxListEventHandler(ctlListView::OnSortGrid));
|
||||
#ifdef __WXGTK__
|
||||
if (id==CTL_STATUSLIST) {
|
||||
SetBackgroundStyle(wxBG_STYLE_TRANSPARENT);
|
||||
//SetBackgroundColour(wxTRANSPARENT);
|
||||
//SetBackgroundStyle(wxBG_STYLE_PAINT);
|
||||
|
||||
|
||||
}
|
||||
#endif
|
||||
Create(p, id, pos, siz, attr | wxLC_REPORT);
|
||||
|
||||
if (id!=CTL_STATUSLIST)
|
||||
Connect(wxID_ANY, wxEVT_LIST_COL_CLICK, wxListEventHandler(ctlListView::OnSortGrid));
|
||||
else {
|
||||
// SetDoubleBuffered(true);
|
||||
// SetBackgroundStyle(wxBG_STYLE_PAINT);
|
||||
// Bind(wxEVT_ERASE_BACKGROUND, [] (wxEraseEvent&) {} );
|
||||
}
|
||||
}
|
||||
#include <map>
|
||||
bool ctlListView::IsNumberColumn(const wxString& columnlabel) {
|
||||
|
|
|
|||
|
|
@ -1129,6 +1129,7 @@ void ctlSQLResult::ClearFilter()
|
|||
{
|
||||
size_t numRows = GetNumberRows();
|
||||
int sizerow=GetDefaultRowSize();
|
||||
Freeze();
|
||||
for (size_t i = 0 ; i < numRows; i++)
|
||||
{
|
||||
if (GetRowSize(i)>0) continue;
|
||||
|
|
@ -1137,6 +1138,7 @@ void ctlSQLResult::ClearFilter()
|
|||
|
||||
}
|
||||
SetGridLineColour(cg);
|
||||
Thaw();
|
||||
}
|
||||
wxString ctlSQLResult::SetFilter(int row,int col,bool reverse)
|
||||
{
|
||||
|
|
@ -1150,6 +1152,7 @@ wxString ctlSQLResult::SetFilter(int row,int col,bool reverse)
|
|||
bool eq;
|
||||
size_t numRows = GetNumberRows();
|
||||
int all=0,show=0,hide=0;
|
||||
if (!IsFrozen()) Freeze();
|
||||
for (size_t i = 0 ; i < numRows; i++)
|
||||
{
|
||||
//str.Append(GetExportLine(i, cols));
|
||||
|
|
@ -1165,6 +1168,7 @@ wxString ctlSQLResult::SetFilter(int row,int col,bool reverse)
|
|||
all++;
|
||||
|
||||
}
|
||||
Thaw();
|
||||
SetGridLineColour(wxColor(0,0,255));
|
||||
result.Printf(wxT("Show rows:%d hide:%d all:%d"), show,hide,all);
|
||||
return result;
|
||||
|
|
|
|||
|
|
@ -2320,7 +2320,8 @@ void frmQuery::OnGenerateInvoke(wxCommandEvent& ev)
|
|||
{
|
||||
wxString templ = body_template[id];
|
||||
s=sqlResult->GenerateTemplate(templ,0);
|
||||
SetStatusText(s, STATUSPOS_MSGS);
|
||||
|
||||
SetStatusText(s.substr(0,200), STATUSPOS_MSGS);
|
||||
}
|
||||
} else
|
||||
SetStatusText(s, STATUSPOS_MSGS);
|
||||
|
|
|
|||
|
|
@ -80,6 +80,8 @@ EVT_BUTTON(wxID_OK, frmReport::OnOK)
|
|||
EVT_BUTTON(wxID_CANCEL, frmReport::OnCancel)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
extern wxString dataDir;
|
||||
|
||||
typedef std::vector<double> vectord;
|
||||
template<typename A, typename B>
|
||||
std::pair<B, A> flip_pair(const std::pair<A, B>& p)
|
||||
|
|
@ -1872,9 +1874,12 @@ MyListSql::iterator iter2;
|
|||
#else
|
||||
wxString fDir=wxStandardPaths::Get().GetExecutablePath().BeforeLast('\\')+wxT("\\");
|
||||
#endif
|
||||
|
||||
wxString f=fDir+"textcompare_report.template";
|
||||
wxString buffer;
|
||||
|
||||
if (!wxFileExists(f)) {
|
||||
f=dataDir+wxFileName::GetPathSeparator()+"textcompare_report.template";
|
||||
}
|
||||
wxUtfFile file3(f, wxFile::read, wxFONTENCODING_UTF8);
|
||||
if (file3.IsOpened())
|
||||
{
|
||||
|
|
@ -1941,7 +1946,7 @@ MyListSql::iterator iter2;
|
|||
}
|
||||
|
||||
//head+="</div></body></html>";
|
||||
fDir=wxStandardPaths::Get().GetTempDir()+wxT("\\cmp.html");
|
||||
fDir=wxStandardPaths::Get().GetTempDir()+wxFileName::GetPathSeparator()+wxT("cmp.html");
|
||||
//fn="D:\\PostgreSQL\\cmp.html";
|
||||
fn=fDir;
|
||||
fn.MakeAbsolute();
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -391,7 +391,7 @@ bool pluginUtilityFactory::CheckEnable(pgObject *obj)
|
|||
{
|
||||
// If we need a specific server type, we can't enable unless
|
||||
// we have a connection.
|
||||
if (!obj || !(obj->GetConnection()->GetStatus() == PGCONN_OK))
|
||||
if (!obj || !(obj->GetConnection()) || (!(obj->GetConnection()->GetStatus() == PGCONN_OK)))
|
||||
return false;
|
||||
|
||||
// Get the server type.
|
||||
|
|
|
|||
|
|
@ -56,11 +56,37 @@ enum
|
|||
|
||||
|
||||
static wxCriticalSection gs_critsect;
|
||||
static wxCriticalSection thread_execute;
|
||||
|
||||
typedef struct SQL_exec {
|
||||
pgConn *conn=NULL;
|
||||
wxString query;
|
||||
pgSet *result=NULL;
|
||||
bool isError=false;
|
||||
bool isExecute=false;
|
||||
long long start=0;
|
||||
long long end=0;
|
||||
} SQL_exec, *SQL_exec_ptr;
|
||||
|
||||
// Class declarations
|
||||
//static wxSemaphore s_CloseLog(0, 1);
|
||||
|
||||
class ExecuteThread : public wxThread
|
||||
{
|
||||
public:
|
||||
//~ReadLogThread();
|
||||
ExecuteThread(wxWindow* p, wxMessageQueue<int> *queue, SQL_exec *arr_ptr)
|
||||
{
|
||||
theParent=p;
|
||||
q=queue;
|
||||
arr_point=arr_ptr;
|
||||
}
|
||||
virtual void* Entry();
|
||||
private:
|
||||
wxWindow *theParent;
|
||||
wxMessageQueue<int> *q;
|
||||
//SQL_exec array_exec[4];
|
||||
SQL_exec *arr_point;
|
||||
};
|
||||
class ReadLogThread : public wxThread
|
||||
{
|
||||
public:
|
||||
|
|
@ -121,7 +147,8 @@ private:
|
|||
void sendText(wxString s) {
|
||||
wxThreadEvent e(wxEVT_THREAD);
|
||||
e.SetString(s);
|
||||
theParent->GetEventHandler()->AddPendingEvent(e);
|
||||
//theParent->GetEventHandler()->AddPendingEvent(e);
|
||||
wxQueueEvent( theParent, e.Clone() );
|
||||
}
|
||||
wxMutex s_mutexDBLogReading;
|
||||
wxSemaphore s_goReadLog;
|
||||
|
|
@ -142,6 +169,7 @@ private:
|
|||
|
||||
};
|
||||
|
||||
|
||||
class frmStatus : public pgFrame
|
||||
{
|
||||
public:
|
||||
|
|
@ -150,18 +178,25 @@ public:
|
|||
void Go();
|
||||
bool getTextSqlbyQid(long long qid);
|
||||
ReadLogThread* logThread = NULL;
|
||||
void OnRefreshStatusTimer_After();
|
||||
private:
|
||||
wxAuiManager manager;
|
||||
|
||||
frmMain *mainForm;
|
||||
pgConn *connection, *locks_connection, *logconn;
|
||||
|
||||
int major; int minor;
|
||||
wxString logFormat,logFindString;
|
||||
bool logHasTimestamp, logFormatKnown;
|
||||
int logFmtPos;
|
||||
long logFinditem=-1;
|
||||
|
||||
|
||||
wxMessageQueue<wxString> log_queue;
|
||||
// execute SQL thread
|
||||
wxMessageQueue<int> queue_sql;
|
||||
SQL_exec array_exec[4]={};
|
||||
bool SendQueryExecute(int index,wxString &sql,pgConn *c);
|
||||
ExecuteThread* q_thread = NULL;
|
||||
|
||||
wxDateTime logfileTimestamp, latestTimestamp;
|
||||
wxString logDirectory, logfileName;
|
||||
|
||||
|
|
@ -264,6 +299,8 @@ private:
|
|||
void OnRefreshXactTimer(wxTimerEvent &event);
|
||||
void OnRefreshLogTimer(wxTimerEvent &event);
|
||||
void OnRefreshQuerystateTimer(wxTimerEvent &event);
|
||||
void OnRefreshQuerystateTimer_After();
|
||||
|
||||
|
||||
void SetColumnImage(ctlListView *list, int col, int image);
|
||||
void OnSortStatusGrid(wxListEvent &event);
|
||||
|
|
@ -325,7 +362,7 @@ private:
|
|||
void addLogFile(const wxString &filename, const wxDateTime timestamp, long len, long &read, bool skipFirst);
|
||||
void addLogLine(const wxString &str, bool formatted = true, bool csv_log_format = false);
|
||||
void checkConnection();
|
||||
|
||||
bool BackendMinimumVersion(int major, int minor);
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -9,6 +9,30 @@ my %function_help;
|
|||
|
||||
my %useref;
|
||||
my %section;
|
||||
my %my_help=(
|
||||
'@gen' =>'
|
||||
Скрипт генерации указывается в однострочном коментарии. Можно записать несколько скриптов для запроса.<br>
|
||||
<b>--@gen:Имя для генерации:@Колонка1@,@Колонка2[-1],ae@,@Колонка3[0],e@\tcol4=@col4@\n</b><br>
|
||||
<p>Имена колонок заключаются в "@" после имени, через запятую можно указать флаги.
|
||||
Значения колонок подставляются с учётом форматирования.<br>
|
||||
Глобальный флаг можно указать один раз в любой колонке. Разрешены спецпоследовательности <b>\n,\t,\r</b>.<br>
|
||||
Если все имена колонок присутсвуют в результате запроса то в контекстное меню результата добавляется
|
||||
имя генерации.<br>
|
||||
Генерация работает для выделенных строк либо для всех строк.<br>
|
||||
Можно ссылать на предудущие строки если индекс в квадратных скобках отрицательный или
|
||||
абсолютно если положительный. Первая строка имеет индекс 0.<br>
|
||||
Для первых двух скриптов можно применить быстрые клавиши <b>Ctrl+1</b>, <b>Ctrl+2</b>.<br>
|
||||
|
||||
</p>
|
||||
<p>Флаги:<br>
|
||||
<blockquote>
|
||||
<b>a</b> → глобальный флаг включающий выравнивание. Учитываются все переводы строк, первая строка как образец (см. Ctrl+Shift+A).<br>
|
||||
<b>e</b> → отключить форматирование. Значение колонки выводиться как есть.<br>
|
||||
</blockquote>
|
||||
</p>
|
||||
|
||||
'
|
||||
);
|
||||
my %ignorehtml=(
|
||||
'pgbench.html',
|
||||
|
||||
|
|
@ -307,6 +331,11 @@ print " Ok.\n" if $cc > 0;
|
|||
print " TD count $TDcount\n";
|
||||
open(F, '>', "_func.txt") or die $!;
|
||||
my $c0=0;
|
||||
#append my help
|
||||
#
|
||||
foreach my $key (sort keys %my_help) {
|
||||
$function_help{$key}=$my_help{$key};
|
||||
}
|
||||
foreach my $key (sort keys %useref) {
|
||||
|
||||
$function_help{$key}=$section{$key};
|
||||
|
|
@ -328,7 +357,7 @@ foreach my $key (sort keys %function_help) {
|
|||
}
|
||||
close(F);
|
||||
exit;
|
||||
|
||||
###################################################################
|
||||
sub parseTag
|
||||
{
|
||||
my $s=shift;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue