mirror of
https://github.com/levinsv/pgadmin3.git
synced 2026-05-15 14:15:49 -06:00
Correct dlgProcedure
This commit is contained in:
parent
e5b88a2d09
commit
b32c886876
6 changed files with 54 additions and 25 deletions
Binary file not shown.
|
|
@ -134,7 +134,6 @@ dlgFunction::dlgFunction(pgaFactory *f, frmMain *frame, pgFunction *node, pgSche
|
|||
schema = sch;
|
||||
function = node;
|
||||
isProcedure = false;
|
||||
|
||||
seclabelPage = new ctlSeclabelPanel(nbNotebook);
|
||||
|
||||
txtArguments->Disable();
|
||||
|
|
@ -167,7 +166,9 @@ dlgFunction::dlgFunction(pgaFactory *f, frmMain *frame, pgFunction *node, pgSche
|
|||
|
||||
dlgProperty *pgProcedureFactory::CreateDialog(frmMain *frame, pgObject *node, pgObject *parent)
|
||||
{
|
||||
return new dlgProcedure(this, frame, (pgFunction *)node, (pgSchema *)parent);
|
||||
dlgProcedure *p= new dlgProcedure(this, frame, (pgFunction *)node, (pgSchema *)parent);
|
||||
//p->isProcedure=true;
|
||||
return p;
|
||||
}
|
||||
|
||||
dlgProcedure::dlgProcedure(pgaFactory *f, frmMain *frame, pgFunction *node, pgSchema *sch)
|
||||
|
|
@ -233,12 +234,12 @@ int dlgFunction::Go(bool modal)
|
|||
if (isProcedure)
|
||||
{
|
||||
if (function && !connection->EdbMinimumVersion(8, 2))
|
||||
txtName->Disable();
|
||||
cbOwner->Disable();
|
||||
// txtName->Disable();
|
||||
//cbOwner->Disable();
|
||||
//cbLanguage->Disable();
|
||||
chkStrict->Disable();
|
||||
chkWindow->Disable();
|
||||
chkSecureDefiner->Disable();
|
||||
//chkSecureDefiner->Disable();
|
||||
chkSetof->Disable();
|
||||
cbVolatility->Disable();
|
||||
cbParallel->Disable();
|
||||
|
|
@ -604,7 +605,12 @@ void dlgFunction::CheckChange()
|
|||
{
|
||||
if (seclabelPage && connection->BackendMinimumVersion(9, 1))
|
||||
enable = enable || !(seclabelPage->GetSqlForSecLabels().IsEmpty());
|
||||
EnableOK(enable && !GetSql().IsEmpty());
|
||||
wxString s=GetSql();
|
||||
bool noempty=true;
|
||||
if (s.IsEmpty()) {
|
||||
noempty=false;
|
||||
}
|
||||
EnableOK(enable && noempty);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -870,21 +876,21 @@ wxString dlgFunction::GetSql()
|
|||
|
||||
bool isC = cbLanguage->GetValue().IsSameAs(wxT("C"), false);
|
||||
bool didChange = !function
|
||||
|| cbLanguage->GetValue() != function->GetLanguage()
|
||||
|| cbVolatility->GetValue() != function->GetVolatility()
|
||||
|| cbParallel->GetValue() != function->GetParallel()
|
||||
|| cbLanguage->GetValue() != function->GetLanguage() && !isProcedure
|
||||
|| cbVolatility->GetValue() != function->GetVolatility() && !isProcedure
|
||||
|| cbParallel->GetValue() != function->GetParallel() && !isProcedure
|
||||
|| chkSecureDefiner->GetValue() != function->GetSecureDefiner()
|
||||
|| chkStrict->GetValue() != function->GetIsStrict()
|
||||
|| GetArgs() != function->GetArgListWithNames()
|
||||
|| chkLeakProof->GetValue() != function->GetIsLeakProof()
|
||||
|| (isC && (txtObjectFile->GetValue() != function->GetBin() || txtLinkSymbol->GetValue() != function->GetSource()))
|
||||
|| chkStrict->GetValue() != function->GetIsStrict() && !isProcedure
|
||||
|| GetArgs() != function->GetArgListWithNames() && !isProcedure
|
||||
|| chkLeakProof->GetValue() != function->GetIsLeakProof() && !isProcedure
|
||||
|| (isC && (txtObjectFile->GetValue() != function->GetBin()&& !isProcedure || txtLinkSymbol->GetValue() != function->GetSource()))
|
||||
|| (!isC && txtSqlBox->GetText() != function->GetSource());
|
||||
|
||||
if (connection->BackendMinimumVersion(8, 3))
|
||||
{
|
||||
didChange = (didChange ||
|
||||
txtCost->GetValue() != NumToStr(function->GetCost()) ||
|
||||
(chkSetof->GetValue() && txtRows->GetValue() != NumToStr(function->GetRows())));
|
||||
txtCost->GetValue() != NumToStr(function->GetCost())&& !isProcedure ||
|
||||
(chkSetof->GetValue()&& !isProcedure && txtRows->GetValue() != NumToStr(function->GetRows())));
|
||||
}
|
||||
|
||||
if (function)
|
||||
|
|
|
|||
|
|
@ -339,7 +339,7 @@ int dlgProperty::Go(bool modal)
|
|||
|
||||
wxString typeName = factory->GetTypeName();
|
||||
SetTitle(wxString(wxGetTranslation(typeName)) + wxT(" ") + GetObject()->GetFullIdentifier());
|
||||
if (typeName==wxT("Function")) {
|
||||
if (typeName==wxT("Function")||typeName==wxT("Procedure")) {
|
||||
if (nbNotebook)
|
||||
nbNotebook->SetSelection(4);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -179,6 +179,7 @@ BEGIN_EVENT_TABLE(frmQuery, pgFrame)
|
|||
EVT_PGQUERYRESULT(QUERY_COMPLETE, frmQuery::OnQueryComplete)
|
||||
EVT_MENU(PGSCRIPT_COMPLETE, frmQuery::OnScriptComplete)
|
||||
EVT_AUINOTEBOOK_PAGE_CHANGED(CTL_NTBKCENTER, frmQuery::OnChangeNotebook)
|
||||
EVT_AUINOTEBOOK_PAGE_CHANGED(CTL_NTBKGQB, frmQuery::OnChangeNotebookOutpane)
|
||||
EVT_AUINOTEBOOK_PAGE_CHANGED(CTL_SQLQUERYBOOK, frmQuery::OnSqlBookPageChanged)
|
||||
EVT_AUINOTEBOOK_PAGE_CHANGING(CTL_SQLQUERYBOOK, frmQuery::OnSqlBookPageChanging)
|
||||
EVT_AUINOTEBOOK_PAGE_CLOSE(CTL_SQLQUERYBOOK, frmQuery::OnSqlBookPageClose)
|
||||
|
|
@ -542,7 +543,6 @@ frmQuery::frmQuery(frmMain *form, const wxString &_title, pgConn *_conn, const w
|
|||
msgResult->SetFont(settings->GetSQLFont());
|
||||
msgHistory = new wxTextCtrl(outputPane, CTL_MSGHISTORY, wxT(""), wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE | wxTE_READONLY | wxTE_DONTWRAP);
|
||||
msgHistory->SetFont(settings->GetSQLFont());
|
||||
|
||||
// Graphical Canvas
|
||||
// initialize values
|
||||
model = new gqbModel();
|
||||
|
|
@ -1284,7 +1284,27 @@ void frmQuery::OnSaveHistory(wxCommandEvent &event)
|
|||
delete dlg;
|
||||
|
||||
}
|
||||
void frmQuery::OnChangeNotebookOutpane(wxAuiNotebookEvent &event)
|
||||
{
|
||||
if (outputPane->GetPageCount() > 0)
|
||||
{
|
||||
size_t curpage = outputPane->GetSelection();
|
||||
if (wxDynamicCast(outputPane->GetPage(curpage), wxTextCtrl))
|
||||
{
|
||||
|
||||
wxTextCtrl *hist = wxDynamicCast(outputPane->GetPage(curpage), wxTextCtrl);
|
||||
//hist->SetInsertionPointEnd();
|
||||
//outputPane->Get
|
||||
if (outputPane->GetPageText(curpage)==_("History")) {
|
||||
///showMessage(hist->GetName());
|
||||
hist->ShowPosition(99999999);
|
||||
}
|
||||
//showMessage();
|
||||
}
|
||||
//hist->CmdKeyExecute(wxSTC_CMD_TAB);
|
||||
}
|
||||
|
||||
}
|
||||
void frmQuery::OnChangeNotebook(wxAuiNotebookEvent &event)
|
||||
{
|
||||
// A bug in wxGTK prevents us to show a modal dialog within a
|
||||
|
|
@ -1923,7 +1943,7 @@ void frmQuery::OnPositionStc(wxStyledTextEvent &event)
|
|||
int selFrom, selTo, selCount;
|
||||
sqlQuery->GetSelection(&selFrom, &selTo);
|
||||
selCount = selTo - selFrom;
|
||||
|
||||
editMenu->Enable(MNU_AUTOEDITOBJECT, selCount > 0);
|
||||
wxString pos;
|
||||
pos.Printf(_("Ln %d, Col %d, Ch %d"), sqlQuery->LineFromPosition(sqlQuery->GetCurrentPos()) + 1, sqlQuery->GetColumn(sqlQuery->GetCurrentPos()) + 1, sqlQuery->GetCurrentPos() + 1);
|
||||
SetStatusText(pos, STATUSPOS_POS);
|
||||
|
|
|
|||
|
|
@ -154,6 +154,7 @@ private:
|
|||
wxString *querys;
|
||||
//GQB related
|
||||
void OnChangeNotebook(wxAuiNotebookEvent &event);
|
||||
void OnChangeNotebookOutpane(wxAuiNotebookEvent &event);
|
||||
void OnAdjustSizesTimer(wxTimerEvent &event);
|
||||
void OnResizeHorizontally(wxSplitterEvent &event);
|
||||
void adjustGQBSizes();
|
||||
|
|
|
|||
|
|
@ -390,7 +390,7 @@ void pgFunction::ShowTreeDetail(ctlTree *browser, frmMain *form, ctlListView *pr
|
|||
if (!GetIsProcedure())
|
||||
properties->AppendItem(_("Return type"), GetReturnType());
|
||||
properties->AppendItem(_("Language"), GetLanguage());
|
||||
properties->AppendYesNoItem(_("Returns a set?"), GetReturnAsSet());
|
||||
if (!GetIsProcedure()) properties->AppendYesNoItem(_("Returns a set?"), GetReturnAsSet());
|
||||
if (GetLanguage().IsSameAs(wxT("C"), false))
|
||||
{
|
||||
properties->AppendItem(_("Object file"), GetBin());
|
||||
|
|
@ -399,20 +399,20 @@ void pgFunction::ShowTreeDetail(ctlTree *browser, frmMain *form, ctlListView *pr
|
|||
else
|
||||
properties->AppendItem(_("Source"), firstLineOnly(GetSource()));
|
||||
|
||||
if (GetConnection()->BackendMinimumVersion(8, 3))
|
||||
if (GetConnection()->BackendMinimumVersion(8, 3)&&!GetIsProcedure())
|
||||
{
|
||||
properties->AppendItem(_("Estimated cost"), GetCost());
|
||||
if (GetReturnAsSet())
|
||||
properties->AppendItem(_("Estimated rows"), GetRows());
|
||||
}
|
||||
|
||||
properties->AppendItem(_("Volatility"), GetVolatility());
|
||||
properties->AppendItem(_("Parallel"), GetParallel());
|
||||
if (GetConnection()->BackendMinimumVersion(9, 2))
|
||||
if (!GetIsProcedure()) properties->AppendItem(_("Volatility"), GetVolatility());
|
||||
if (!GetIsProcedure()) properties->AppendItem(_("Parallel"), GetParallel());
|
||||
if (GetConnection()->BackendMinimumVersion(9, 2)&&(!GetIsProcedure()))
|
||||
properties->AppendYesNoItem(_("Leak proof?"), GetIsLeakProof());
|
||||
properties->AppendYesNoItem(_("Security of definer?"), GetSecureDefiner());
|
||||
properties->AppendYesNoItem(_("Strict?"), GetIsStrict());
|
||||
if (GetConnection()->BackendMinimumVersion(8, 4))
|
||||
if (!GetIsProcedure()) properties->AppendYesNoItem(_("Strict?"), GetIsStrict());
|
||||
if (GetConnection()->BackendMinimumVersion(8, 4)&&!GetIsProcedure())
|
||||
properties->AppendYesNoItem(_("Window?"), GetIsWindow());
|
||||
|
||||
size_t i;
|
||||
|
|
@ -489,6 +489,8 @@ wxString pgProcedure::GetSql(ctlTree *browser)
|
|||
}
|
||||
|
||||
|
||||
sql += wxT("\n")
|
||||
+ GetOwnerSql(11, 0, wxT("PROCEDURE ") + qtSig);
|
||||
sql += GetGrant(wxT("X"), wxT("PROCEDURE ") + qtSig);
|
||||
|
||||
if (!GetComment().IsNull())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue