Le lundi 10 août 2009 à 15:17:17, Dave Page a écrit :
> On Mon, Aug 10, 2009 at 2:08 PM, Dave Page<[email protected]> wrote:
> > On Mon, Aug 10, 2009 at 2:03 PM, Dave Page<[email protected]> wrote:
> >>> If I can't use a pointer, I don't see how I can do this. Or should I
> >>> just remove the MessageBox?
> >>>
> >>> As per my understanding, you always can use reference in place of
> >>> pointer.
> >>
> >> Yes, just pass by reference:
> >>
> >> bool generateSQL(const wxString &query);
> >
> > Of course, you might want to leave out the const decoration.
>
> Looking at this a little more closely, why not just add a new function:
>
> int gqbController::getTableCount() { return model->tablesCount(); }
>
> and call that from frmQuery? Assuming it can't already see model....
Why didn't I think about this quite easy solution? no issue with pointer or
reference. So here is the patch.
Thanks Dave and Ashesh :)
--
Guillaume.
http://www.postgresqlfr.org
http://dalibo.com
Index: pgadmin/include/gqb/gqbViewController.h
===================================================================
--- pgadmin/include/gqb/gqbViewController.h (révision 8008)
+++ pgadmin/include/gqb/gqbViewController.h (copie de travail)
@@ -88,6 +88,7 @@
void emptyModel();
void calcGridColsSizes();
gqbQueryRestriction* addRestriction();
+ int getTableCount(){return model->tablesCount();};
protected:
gqbView *view; // owned by caller application shouldn't be destroy by this class
Index: pgadmin/frm/frmQuery.cpp
===================================================================
--- pgadmin/frm/frmQuery.cpp (révision 8008)
+++ pgadmin/frm/frmQuery.cpp (copie de travail)
@@ -1814,7 +1814,10 @@
// If the new query is empty, don't do anything
if (newQuery.IsEmpty())
{
- wxMessageBox(_("No SQL query was generated."), wxT("Graphical Query Builder"), wxICON_INFORMATION);
+ if (controller->getTableCount() > 0)
+ {
+ wxMessageBox(_("No SQL query was generated."), wxT("Graphical Query Builder"), wxICON_INFORMATION);
+ }
gqbUpdateRunning = false;
return false;
}
--
Sent via pgadmin-support mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-support