update pgadmin3.exe

This commit is contained in:
lsv 2026-01-16 18:35:52 +05:00
commit d22afab881
4 changed files with 41 additions and 19 deletions

View file

@ -1843,23 +1843,21 @@ wxString ctlSQLBox::TextToHtml(int start, int end,bool isAddNewLine, const std::
prevColor = tColor;
}
//str.append(str[k].GetValue());
l = 1;
wxUniChar c = selText[k];
if (!c.IsAscii()) l++;
startp=PositionRelative(startp,1);
int s = 0;
//wxUniChar c = selText[k].GetValue();
if (c == '\r') { startp = startp + l; k++; continue; };
if (c == '\r') { k++; continue; };
if (c == '\n') { lstr += newline; startp = startp + l; k++; continue; };
if (c == '\n') { lstr += newline; k++; continue; };
if (c == 9) s = 5;
if (c == 32) s = 1;
if (c == '<') { lstr+="&lt;"; startp = startp + l; k++; continue; };
if (c == '>') { lstr+="&gt;"; startp = startp + l; k++; continue; };
if (c == '&') { lstr+="&amp;"; startp = startp + l; k++; continue; };
if (c == '<') { lstr+="&lt;"; k++; continue; };
if (c == '>') { lstr+="&gt;"; k++; continue; };
if (c == '&') { lstr+="&amp;"; k++; continue; };
if (s > 0) for (int tt = 0; tt < s; tt++) lstr += "&nbsp;";
else lstr += c;
startp = startp + l; k++;
k++;
if ((k-1)>=pos) {
lenobj--;
if (lenobj==0) {

View file

@ -343,6 +343,7 @@ struct type_temp_flag {
uint8_t colvalue:1;
uint8_t colname:1;
uint8_t indexrow:1;
uint8_t no_quote:1;
};
struct ElementTempl {
wxString txt;
@ -366,12 +367,17 @@ wxString ctlSQLResult::GenerateTemplate(wxString &templ,int action)
ElementTempl e;
bool isvar=false;
wxString col;
int startvarpos=0;
while (pos<len)
{
c=templ[pos++];
if (c=='\\' && pos<len) {
c=templ[pos++];
if (c=='n') c='\n';
if (c=='t') c='\t';
if (c=='r') c='\r';
e.txt.Append(c);
continue;
}
if (isvar) {
if (c==',') {
@ -379,6 +385,12 @@ wxString ctlSQLResult::GenerateTemplate(wxString &templ,int action)
{
//if (c=='n') e.flags.colname=true;
if (c=='a') isalign=true;
else if (c=='e') e.flags.no_quote=true;
else {
wxString msg=wxString::Format(_("Incorrect flag at the %s column."),col);
if (action == 0) wxMessageBox(msg);
return msg;
}
}
}
if (c=='[') {
@ -396,10 +408,16 @@ wxString ctlSQLResult::GenerateTemplate(wxString &templ,int action)
}
if (c=='@') {
isvar=false;
if (col.Len()==0) {
wxString msg=wxString::Format(_("The column name empty. %s ."),templ.substr(startvarpos,pos-startvarpos));
if (action == 0) wxMessageBox(msg);
return msg;
}
int idx=colNames.Index(col);
if (idx==wxNOT_FOUND) {
if (action == 0) wxMessageBox(wxString::Format("Not found col name %s in result query.",col));
return wxEmptyString;
wxString msg=wxString::Format(_("The column name %s was not found in the query results."),col);
if (action == 0) wxMessageBox(msg);
return msg;
}
e.column=idx;
tmplvector.push_back(e);
@ -412,6 +430,7 @@ wxString ctlSQLResult::GenerateTemplate(wxString &templ,int action)
e.txt.Append(c);
} else {
isvar=true;
startvarpos=pos-1;
tmplvector.push_back(e);
e.txt.Clear();
col.Clear();
@ -420,8 +439,9 @@ wxString ctlSQLResult::GenerateTemplate(wxString &templ,int action)
}
if (isvar )
{
if (action == 0) wxMessageBox(wxString::Format("No close col name %s",col));
return wxEmptyString;
wxString msg=wxString::Format(_("The column name %s is not closed."),col);
if (action == 0) wxMessageBox(msg);
return msg;
}
else
{
@ -463,6 +483,7 @@ wxString ctlSQLResult::GenerateTemplate(wxString &templ,int action)
else if (qt == 2)
/* Quote everything */
needQuote = true;
if (e.flags.no_quote) needQuote = false;
if (needQuote) text.Replace(qtsimbol, qtsimbol2);
if (isnull) strrow.Append("null");
else

View file

@ -2231,17 +2231,20 @@ void frmQuery::OnLabelRightClick(wxGridEvent &event)
xmenu->Append(MNU_COPY_TABLEHTML, _("Copy table html format"), _("Copy table html format."));
if (body_template.Count()>0) {
//MNU_GENERATE_TEMPLATE
wxMenu *submenu = new wxMenu();
wxMenu *submenu = NULL;
//wxString t="begin @obj_id@ end";
int cnt=0;
for(int i=0;i<body_template.Count();i++) {
wxString s=sqlResult->GenerateTemplate(body_template[i],1);
if (s=="OK")
wxString s=sqlResult->GenerateTemplate(body_template[i],1);
if (s=="OK")
{
cnt++;
submenu->Append(MNU_GENERATESQL+cnt,title_template[i],body_template[i]);
}
if (submenu==NULL) submenu = new wxMenu();
cnt++;
submenu->Append(MNU_GENERATESQL+cnt,title_template[i],body_template[i]);
} else
SetStatusText(s, STATUSPOS_MSGS);
}
if (cnt>0) xmenu->Append(MNU_GENERATESQL,"Generate",submenu);
}
xmenu->AppendSeparator();

Binary file not shown.