mirror of
https://github.com/levinsv/pgadmin3.git
synced 2026-07-19 06:06:42 -06:00
Merge branch 'master' into linux
This commit is contained in:
commit
e13159e1dd
4 changed files with 67 additions and 15 deletions
|
|
@ -43,6 +43,7 @@ wxString pgscriptKeywords = wxT(" assert break columns continue date datetime fi
|
|||
BEGIN_EVENT_TABLE(ctlSQLBox, wxStyledTextCtrl)
|
||||
EVT_KEY_DOWN(ctlSQLBox::OnKeyDown)
|
||||
EVT_MENU(MNU_FIND, ctlSQLBox::OnSearchReplace)
|
||||
EVT_MENU(MNU_COPY, ctlSQLBox::OnCopy)
|
||||
EVT_MENU(MNU_AUTOCOMPLETE, ctlSQLBox::OnAutoComplete)
|
||||
EVT_KILL_FOCUS(ctlSQLBox::OnKillFocus)
|
||||
// EVT_ERASE_BACKGROUND(ctlSQLBox::OnBackGround)
|
||||
|
|
@ -192,10 +193,11 @@ void ctlSQLBox::Create(wxWindow *parent, wxWindowID id, const wxPoint &pos, cons
|
|||
SetFoldFlags(16);
|
||||
|
||||
// Setup accelerators
|
||||
wxAcceleratorEntry entries[2];
|
||||
wxAcceleratorEntry entries[3];
|
||||
entries[0].Set(wxACCEL_CTRL, (int)'F', MNU_FIND);
|
||||
entries[1].Set(wxACCEL_CTRL, WXK_SPACE, MNU_AUTOCOMPLETE);
|
||||
wxAcceleratorTable accel(2, entries);
|
||||
entries[2].Set(wxACCEL_CTRL, (int)'C', MNU_COPY);
|
||||
wxAcceleratorTable accel(3, entries);
|
||||
SetAcceleratorTable(accel);
|
||||
|
||||
// Autocompletion configuration
|
||||
|
|
@ -483,6 +485,9 @@ void ctlSQLBox::SetDefFunction(wxArrayString &name, wxArrayString &def) {
|
|||
m_name=&name;
|
||||
m_def=&def;
|
||||
}
|
||||
void ctlSQLBox::OnCopy(wxCommandEvent& ev) {
|
||||
Copy();
|
||||
}
|
||||
|
||||
void ctlSQLBox::OnKeyDown(wxKeyEvent &event)
|
||||
{
|
||||
|
|
@ -1296,14 +1301,14 @@ void ctlSQLBox::Copy() {
|
|||
l=1;
|
||||
if (!selText[k].IsAscii()) l++;
|
||||
int s=0;
|
||||
if (selText[k].GetValue()==9) s=5;
|
||||
if (selText[k].GetValue()==32) s=1;
|
||||
char c = selText[k].GetValue();
|
||||
if (c == '\r') { startp = startp + l; k++; continue; };
|
||||
if (c == '\n') { str += wxT("<br>"); startp = startp + l; k++; continue; };
|
||||
if (c==9) s=5;
|
||||
if (c==32) s=1;
|
||||
if (s>0) for (int tt=0;tt<s;tt++) str+=wxT(" ");
|
||||
else str+=selText[k];
|
||||
|
||||
if (str.EndsWith(wxT("\r\n"))) str+=wxT("<br>");
|
||||
startp=startp+l;
|
||||
k++;
|
||||
startp=startp+l; k++;
|
||||
}
|
||||
str=str+wxT("</font></div>");
|
||||
|
||||
|
|
|
|||
|
|
@ -405,28 +405,43 @@ int ctlSQLGrid::Copy(int gensql)
|
|||
if (sql.Len() == j) break;
|
||||
c = sql[j];
|
||||
}
|
||||
if (j>i) tn = sql.SubString(i, j - 1); // alias name
|
||||
if (j > i) {
|
||||
wxString al = sql.SubString(i, j - 1); // alias name
|
||||
if (al.StartsWith("where")
|
||||
|| al.StartsWith("order")
|
||||
|| al.StartsWith("limit")
|
||||
) break;
|
||||
tn = al;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (gensql == 2) linedelim = ",";
|
||||
else if(gensql == 3) linedelim = " or ";
|
||||
int lenrow = 0;
|
||||
|
||||
if (GetSelectedRows().GetCount())
|
||||
{
|
||||
AppendColumnHeader(str, 0, (GetNumberCols() - 1));
|
||||
|
||||
wxArrayInt rows = GetSelectedRows();
|
||||
|
||||
for (i = 0 ; i < rows.GetCount() ; i++)
|
||||
{
|
||||
tmp=GetExportLine(rows.Item(i));
|
||||
lenrow += tmp.Len()+linedelim.Len();
|
||||
if (tmp.IsEmpty()) continue;
|
||||
if (!tn.IsEmpty() && (generatesql == 1)) tmp.Replace("tbl", tn, false);
|
||||
str.Append(tmp);
|
||||
if (i < rows.GetCount() - 1 && (generatesql > 1)) str.Append(linedelim);
|
||||
if (rows.GetCount() > 1)
|
||||
str.Append(END_OF_LINE);
|
||||
{
|
||||
bool delim = true;
|
||||
if ((generatesql > 1) && (lenrow < 50))
|
||||
delim = false;
|
||||
else
|
||||
{ lenrow = 0;}
|
||||
if (delim) str.Append(END_OF_LINE);
|
||||
}
|
||||
}
|
||||
|
||||
copied = rows.GetCount();
|
||||
|
|
@ -441,11 +456,21 @@ int ctlSQLGrid::Copy(int gensql)
|
|||
for (i = 0 ; i < numRows ; i++)
|
||||
{
|
||||
tmp = GetExportLine(i, cols);
|
||||
lenrow += tmp.Len() + linedelim.Len();
|
||||
if (!tn.IsEmpty() && (generatesql == 1)) tmp.Replace("tbl", tn, false);
|
||||
str.Append(tmp);
|
||||
if (i<(numRows-1) && (generatesql > 1)) str.Append(linedelim);
|
||||
if (numRows > 1)
|
||||
str.Append(END_OF_LINE);
|
||||
{
|
||||
bool delim = true;
|
||||
if ((generatesql > 1) && (lenrow < 50))
|
||||
delim = false;
|
||||
else
|
||||
{
|
||||
lenrow = 0;
|
||||
}
|
||||
if (delim) str.Append(END_OF_LINE);
|
||||
}
|
||||
}
|
||||
copied = numRows;
|
||||
}
|
||||
|
|
@ -475,11 +500,21 @@ int ctlSQLGrid::Copy(int gensql)
|
|||
for (i = y1; i <= y2; i++)
|
||||
{
|
||||
tmp = GetExportLine(i, x1, x2);
|
||||
lenrow += tmp.Len() + linedelim.Len();
|
||||
if (!tn.IsEmpty() && (generatesql==1)) tmp.Replace("tbl", tn, false);
|
||||
str.Append(tmp);
|
||||
if (i < y2 && (generatesql > 1)) str.Append(linedelim);
|
||||
if (y2 > y1)
|
||||
str.Append(END_OF_LINE);
|
||||
{
|
||||
bool delim = true;
|
||||
if ((generatesql > 1) && (lenrow < 50))
|
||||
delim = false;
|
||||
else
|
||||
{
|
||||
lenrow = 0;
|
||||
}
|
||||
if (delim) str.Append(END_OF_LINE);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -533,10 +568,21 @@ int ctlSQLGrid::Copy(int gensql)
|
|||
}
|
||||
colsNum.Sort(compare_int);
|
||||
if (generatesql == 2) AppendColumnHeader(str, colsNum);
|
||||
str.Append(GetExportLine(curr_row, colsNum));
|
||||
tmp = GetExportLine(curr_row, colsNum);
|
||||
str.Append(tmp);
|
||||
lenrow += tmp.Len() + linedelim.Len();
|
||||
if ((next_row != 1000000000) && (generatesql == 3)) str.Append(linedelim);
|
||||
if ((next_row != 1000000000) && (generatesql == 2)) str.Append(") or ");
|
||||
str.Append(END_OF_LINE);
|
||||
{
|
||||
bool delim = true;
|
||||
if ((generatesql > 1) && (lenrow < 50))
|
||||
delim = false;
|
||||
else
|
||||
{
|
||||
lenrow = 0;
|
||||
}
|
||||
if (delim) str.Append(END_OF_LINE);
|
||||
}
|
||||
curr_row = next_row;
|
||||
copied++;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -55,6 +55,7 @@ public:
|
|||
void OnKeyDown(wxKeyEvent &event);
|
||||
void OnAutoComplete(wxCommandEvent &event);
|
||||
void OnSearchReplace(wxCommandEvent &event);
|
||||
void OnCopy(wxCommandEvent& ev);
|
||||
void OnKillFocus(wxFocusEvent &event);
|
||||
// void OnBackGround(wxEraseEvent &event);
|
||||
void SetQueryBook(ctlAuiNotebook *query_book);
|
||||
|
|
|
|||
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue