Update the GQB to demand load the contents of each schema individually. This requires...
authordpage <dpage@a7884b65-44f6-0310-8a51-81a127f17b15>
Thu, 16 Apr 2009 08:29:25 +0000 (08:29 +0000)
committerdpage <dpage@a7884b65-44f6-0310-8a51-81a127f17b15>
Thu, 16 Apr 2009 08:29:25 +0000 (08:29 +0000)
structural changes, but I think it's a good improvement.

git-svn-id: svn://svn.pgadmin.org/trunk/pgadmin3@7812 a7884b65-44f6-0310-8a51-81a127f17b15

18 files changed:
pgadmin/frm/frmQuery.cpp
pgadmin/gqb/gqbBrowser.cpp
pgadmin/gqb/gqbColumn.cpp
pgadmin/gqb/gqbController.cpp
pgadmin/gqb/gqbDatabase.cpp
pgadmin/gqb/gqbObject.cpp
pgadmin/gqb/gqbObjectCollection.cpp
pgadmin/gqb/gqbQueryObjs.cpp
pgadmin/gqb/gqbSchema.cpp
pgadmin/gqb/gqbTable.cpp
pgadmin/include/gqb/gqbBrowser.h
pgadmin/include/gqb/gqbColumn.h
pgadmin/include/gqb/gqbDatabase.h
pgadmin/include/gqb/gqbObject.h
pgadmin/include/gqb/gqbObjectCollection.h
pgadmin/include/gqb/gqbQueryObjs.h
pgadmin/include/gqb/gqbSchema.h
pgadmin/include/gqb/gqbTable.h

index 3331bc1b25c6b7743fa4eaa4d1d2bbbfa7e369ea..111c878a0c19a2a356d6585c877ce117b900c605 100644 (file)
@@ -873,14 +873,6 @@ void frmQuery::OnChangeConnection(wxCommandEvent &ev)
         //Refresh GQB Tree if used
         if(conn && !firstTime)
         {
-            wxString msg = _("Retrieving tables from database ") + wxString(conn->GetDbname());
-            wxBusyInfo waiting(msg, this);
-
-            // Give the UI a chance to redraw
-            wxSafeYield();
-            wxMilliSleep(100);
-            wxSafeYield();
-
             controller->getTablesBrowser()->refreshTables(conn);
             controller->getView()->Refresh();
         }
@@ -1021,14 +1013,6 @@ void frmQuery::OnChangeNotebook(wxNotebookEvent& event)
 
                 // Database related Stuffs.
                 // Create a server object and connect it.
-                wxString msg= _("Retrieving tables from database ") + wxString(conn->GetDbname());
-                wxBusyInfo waiting(msg, this);
-
-                // Give the UI a chance to redraw
-                wxSafeYield();
-                wxMilliSleep(100);
-                wxSafeYield();
-
                 controller->getTablesBrowser()->refreshTables(conn);
                 firstTime=false;
             }
index c9bbef5f71ad23c5279c439fb02d8168999eee8a..4baa3ae60f461783eb68686ff1e28f421dc74b6e 100644 (file)
@@ -46,6 +46,7 @@ gqbBrowser::gqbBrowser(wxWindow* parent, wxWindowID id, const wxPoint& pos, cons
     rootNode=(wxTreeItemId *)NULL;
 
     // Create normal images list of browser
+    // Remember to update enum gqbImages in gqbBrowser.h if changing the images!!
     imageList = new wxImageList(16, 16);
     imageList->Add(wxIcon(database_sm_xpm));
     imageList->Add(wxIcon(namespace_sm_xpm));
@@ -71,8 +72,8 @@ gqbBrowser::~gqbBrowser()
 wxTreeItemId& gqbBrowser::createRoot(wxString &Name)
 {
     rootNode=this->AddRoot(Name,0,0);
-    catalogsNode=this->AppendItem(rootNode, _("Catalogs"), 4, 4, NULL);
-    schemasNode=this->AppendItem(rootNode, _("Schemas"), 3, 3, NULL);
+    catalogsNode=this->AppendItem(rootNode, _("Catalogs"), GQB_IMG_CATALOGS, GQB_IMG_CATALOGS, NULL);
+    schemasNode=this->AppendItem(rootNode, _("Schemas"), GQB_IMG_NAMESPACES, GQB_IMG_NAMESPACES, NULL);
     return rootNode;
 }
 
@@ -82,22 +83,29 @@ void gqbBrowser::OnItemActivated(wxTreeEvent& event)
 {
     wxTreeItemId itemId = event.GetItem();
     gqbObject *object = (gqbObject *) GetItemData(itemId);
-    if(object!=NULL && (object->getType() == GQB_TABLE || object->getType() == GQB_VIEW))
+    if(object)
     {
-        gqbTable *item = (gqbTable *)  object;
-        controller->addTableToModel(item,wxPoint(10,10));
-        controller->getView()->Refresh();
+        if (object->getType() == GQB_TABLE || object->getType() == GQB_VIEW)
+        {
+            gqbTable *item = (gqbTable *)  object;
+            controller->addTableToModel(item,wxPoint(10,10));
+            controller->getView()->Refresh();
+        }
+        else if (GetChildrenCount(itemId) == 0 && object->getType() == GQB_SCHEMA)
+        {
+            gqbSchema *schema = (gqbSchema *)object;
+            schema->createObjects(this, schema->getOid(), itemId, GQB_IMG_TABLE, GQB_IMG_VIEW, GQB_IMG_EXTTABLE);
+        }
     }
+       
 }
 
-
 void gqbBrowser::refreshTables(pgConn *connection)
 {
     controller->emptyModel();
-    this->DeleteAllItems();                       // GQB-TODO: same as destructor
-    wxString a = wxString(wxT("Database Name Here"));
-    gqbDatabase *Data = new gqbDatabase(a, GQB_DATABASE);
-    Data->createObjects(this,connection);
+    this->DeleteAllItems();
+    gqbDatabase *Data = new gqbDatabase(wxEmptyString, connection);
+    Data->createObjects(this);
     this->Expand(rootNode);
 }
 
index bc345aab510b331f5b6739de319995e261f5ca58..183ee5ee3468dc430957cff546ebdaae88a85ca5 100644 (file)
 #include "gqb/gqbTable.h"
 #include "gqb/gqbArrayCollection.h"
 
-gqbColumn::gqbColumn(gqbObject *parent, wxString name, type_gqbObject type=GQB_COLUMN):
-gqbObject(name, type)
+gqbColumn::gqbColumn(gqbObject *parent, wxString name, pgConn *connection):
+gqbObject(name, parent, connection)
 {
-    this->setType(GQB_COLUMN);
-    this->setName(name);
-    this->setOwner(parent);
+    setType(GQB_COLUMN);
 }
index 42da27f9bb2282d7d0e1fcf530fbd864d8b479ef..7df04eeb16fb23b8b4e271dbf62a4738a9880ccd 100644 (file)
@@ -29,8 +29,8 @@
 
 wxWindowID CTL_NTBKPANELS = ::wxNewId();
 
-gqbController::gqbController(gqbModel *_model, wxWindow *gqbParent, wxNotebook *gridParent, wxSize size=wxSize(800,1280)):
-wxObject()
+gqbController::gqbController(gqbModel *_model, wxWindow *gqbParent, wxNotebook *gridParent, wxSize size=wxSize(800,1280))
+wxObject()
 {
     pparent = gqbParent;
     model=_model;
@@ -324,7 +324,7 @@ wxString gqbController::generateSQL()
         while(iteratorModel->HasNext())
         {
             sel=(gqbQueryObject *)iteratorModel->Next();
-            gqbSchema *schema = (gqbSchema *)&sel->parent->getOwner();
+            gqbSchema *schema = (gqbSchema *)sel->parent->getOwner();
             if(sel->getAlias().length()>0)
             {
                 sentence += wxT("  ") +
index bec59a3cebcb58d565d503e45d669cb534ce1251..107bf98366e75b1d242ae0c9229b66b0c09aa289 100644 (file)
 #include "gqb/gqbSchema.h"
 #include "schema/pgSchema.h"
 
-gqbDatabase::gqbDatabase(wxString name, type_gqbObject type=GQB_DATABASE):
-gqbObject(name,type)
+gqbDatabase::gqbDatabase(wxString name, pgConn *connection)
+: gqbObject(name, NULL, connection)
 {
-    this->setType(GQB_DATABASE);
-    this->setName(name);
-    this->setOwner(NULL);
-    conn=NULL;
+    setType(GQB_DATABASE);
 }
 
 
-void gqbDatabase::createObjects(gqbBrowser *_tablesBrowser,  pgConn *_conn)
+void gqbDatabase::createObjects(gqbBrowser *_tablesBrowser)
 {
 
-    wxString rootNodeString = wxString(_conn->GetDbname());
+    wxString rootNodeString = wxString(conn->GetDbname());
     // Create Root Node
     _tablesBrowser->createRoot(rootNodeString);
 
     // FillBrowser
-    createSchemas(_conn,_tablesBrowser,_tablesBrowser->getCatalogRootNode(),GQB_CATALOG,5);
-    createSchemas(_conn,_tablesBrowser,_tablesBrowser->getTablesRootNode(),GQB_OTHER,1);
+    createSchemas(_tablesBrowser, _tablesBrowser->getCatalogRootNode(), GQB_CATALOG, GQB_IMG_CATALOG);
+    createSchemas(_tablesBrowser, _tablesBrowser->getTablesRootNode(), GQB_OTHER, GQB_IMG_NAMESPACE);
 }
 
 
 // Use database connection to create all objects inside tree
-void gqbDatabase::createSchemas(pgConn *conn,  gqbBrowser *tablesBrowser, wxTreeItemId parentNode,typeSchema MetaType, int indexImage)
+void gqbDatabase::createSchemas(gqbBrowser *tablesBrowser, wxTreeItemId parentNode,typeSchema MetaType, int indexImage)
 {
 
     // Search Schemas and insert it
@@ -120,31 +117,31 @@ void gqbDatabase::createSchemas(pgConn *conn,  gqbBrowser *tablesBrowser, wxTree
                 continue;
             }
 
-            int tableImage = 2, viewImage = 7;
+            int tableImage = GQB_IMG_TABLE, viewImage = GQB_IMG_VIEW;
             gqbSchema *schema;
 
             if (MetaType == GQB_CATALOG)
             {
 
                 // Create Schema Object
-                schema = new gqbSchema(this, name, GQB_SCHEMA);
-                parent=tablesBrowser->AppendItem(parentNode, name , indexImage, indexImage, schema);
+                schema = new gqbSchema(this, name, conn, schemas->GetOid(wxT("oid")));
+                parent=tablesBrowser->AppendItem(parentNode, name, indexImage, indexImage, schema);
 
                 if(name != wxT("pg_catalog") && name != wxT("pgagent"))
                                {
-                    tableImage=5;
-                                       viewImage=5;
+                    tableImage=GQB_IMG_CATALOG_OBJ;
+                                       viewImage=GQB_IMG_CATALOG_OBJ;
                                }
             }
             else
             {
 
                 // Create Schema Object
-                schema = new gqbSchema(this, name, GQB_SCHEMA);
+                // Note that the schema will be populated when the node is expanded.
+                schema = new gqbSchema(this, name, conn, schemas->GetOid(wxT("oid")));
                 parent=tablesBrowser->AppendItem(parentNode, name , indexImage, indexImage, schema);
             }
 
-            schema->createObjects(tablesBrowser, conn, schemas->GetOid(wxT("oid")), parent, tableImage, viewImage, 8);
             schemas->MoveNext();
         }
 
index 74d402b9aaf92754d2f3a8d62fbf2af71c588e7c..c0bf85e6382151f74a521dfeee467b0164fad109 100644 (file)
 // App headers
 #include "gqb/gqbObject.h"
 
-gqbObject::gqbObject(wxString name, type_gqbObject type)
+gqbObject::gqbObject(wxString name, wxTreeItemData *owner, pgConn *connection, OID oid)
 {
-    this->Type=type;
-    this->Name=name;
+    Name = name;
+    Owner = owner;
+    conn = connection;
+    Oid = oid;
 }
 
 
 gqbObject::~gqbObject()
 {
 }
-
-
-void gqbObject::setName(wxString name)
-{
-    this->Name=name;
-}
-
-
-const wxString& gqbObject::getName()
-{
-    return Name;
-}
-
-
-void gqbObject::setOwner(wxTreeItemData *owner)
-{
-    this->Owner=owner;
-}
-
-
-const wxTreeItemData& gqbObject::getOwner()
-{
-    return (*Owner);
-}
-
-
-void gqbObject::setType(type_gqbObject tname)
-{
-    this->Type=tname;
-}
-
-
-const type_gqbObject gqbObject::getType()
-{
-    return this->Type;
-}
index 96b572c4f2d25b0034f816775dd3dc05816cd5b7..d8112f9923b9d97c4e2f587333752aad55a58b48 100644 (file)
@@ -21,8 +21,8 @@
 #include "gqb/gqbCollection.h"
 #include "gqb/gqbArrayCollection.h"
 
-gqbObjectCollection::gqbObjectCollection(wxString name, type_gqbObject type):
-gqbObject(name, type)
+gqbObjectCollection::gqbObjectCollection(wxString name, wxTreeItemData *owner, pgConn *connection, OID oid)
+: gqbObject(name, owner, connection, oid)
 {
        // Create the concrete implementation of the Collection, right now only one implementation not need parameter
     implementation = new gqbArrayCollection();
@@ -30,7 +30,6 @@ gqbObject(name, type)
        // Create the collection using the concrete implementation
        // use the array implementation of the collection
     objectsCollection =  new gqbCollection(implementation);
-    this->setOwner(NULL);
 }
 
 
index 76ae3e1ee96bfe79b834b42d01524f1e6a757fdc..c19b30ddba983f11dda5fba1b9b7d42dae4ca993 100644 (file)
 #include "gqb/gqbObjectCollection.h"
 #include "gqb/gqbViewPanels.h"
 
-const wxString wxEmptyStr = wxEmptyString;
-
 //
 // Collections of Tables inside a Query, data structured used for query storage & later generation of SQL sentence
 //
 
-gqbQueryObjs::gqbQueryObjs():
-gqbObjectCollection(wxT(""),GQB_QUERY)
+gqbQueryObjs::gqbQueryObjs()
+: gqbObjectCollection(wxT(""), NULL, NULL)
 {
-    this->setOwner(NULL);
+    setType(GQB_QUERY);
 }
 
 
@@ -77,10 +75,10 @@ void gqbQueryObjs::removeAllQueryObjs()
 //         Because this we can not use directly the base table object
 
 gqbQueryObject::gqbQueryObject(gqbTable *table)
-:gqbObjectCollection(table->getName(), GQB_QUERYOBJ)
+: gqbObjectCollection(table->getName(), table, table->getConnection())
 {
     selected=false;
-    parent=table;
+    parent = table;
 
        //GQB-TODO: Calculate a good initial position
     position.x=20;
@@ -89,6 +87,7 @@ gqbQueryObject::gqbQueryObject(gqbTable *table)
     haveRegisteredJoins=false;
     registeredCollection=NULL;
     joinsCollection=NULL;
+    setType(GQB_QUERYOBJ);
 }
 
 
@@ -296,8 +295,8 @@ bool gqbQueryObject::getHaveRegJoins()
 //
 //  A Join inside a query Object like Table or view [Stored at source, registered at destination]
 //  I need to store the owner, destination because columns it's share between multiple joins
-gqbQueryJoin::gqbQueryJoin(gqbQueryObject *_owner, gqbQueryObject *_destination, gqbColumn *sourceCol, gqbColumn *destCol, type_Join joinKind):
-gqbObject(wxT(""),GQB_JOIN)
+gqbQueryJoin::gqbQueryJoin(gqbQueryObject *_owner, gqbQueryObject *_destination, gqbColumn *sourceCol, gqbColumn *destCol, type_Join joinKind)
+: gqbObject(wxT(""), _owner, NULL)
 {
     kindofJoin=joinKind;
     sCol=sourceCol;
@@ -305,6 +304,7 @@ gqbObject(wxT(""),GQB_JOIN)
     owner=_owner;
     selected=false;
     destination=_destination;
+    setType(GQB_JOIN);
 }
 
 
@@ -348,36 +348,40 @@ gqbColumn* gqbQueryJoin::getSCol()
 }
 
 
-const wxString& gqbQueryJoin::getSourceTable()
+wxString gqbQueryJoin::getSourceTable()
 {
     if (!owner)
-        return wxEmptyStr;
-    gqbTable *s=(gqbTable*)&sCol->getOwner();
+        return wxEmptyString;
+
+    gqbTable *s=(gqbTable*)sCol->getOwner();
     return s->getName();
 }
 
 
-const wxString& gqbQueryJoin::getDestTable()
+wxString gqbQueryJoin::getDestTable()
 {
     if (!destination)
-        return wxEmptyStr;
-    gqbTable *d=(gqbTable*)&dCol->getOwner();
+        return wxEmptyString;
+
+    gqbTable *d=(gqbTable*)dCol->getOwner();
     return d->getName();
 }
 
 
-const wxString& gqbQueryJoin::getSourceCol()
+wxString gqbQueryJoin::getSourceCol()
 {
     if (!sCol)
-        return wxEmptyStr;
+        return wxEmptyString;
+
     return sCol->getName();
 }
 
 
-const wxString& gqbQueryJoin::getDestCol()
+wxString gqbQueryJoin::getDestCol()
 {
     if (!dCol)
-        return wxEmptyStr;
+        return wxEmptyString;
+
     return dCol->getName();
 }
 
@@ -442,20 +446,21 @@ enum
     QRtype
 };
 
-gqbQueryRestriction::gqbQueryRestriction():
-gqbObject(wxT(""),GQB_RESTRICTION)
+gqbQueryRestriction::gqbQueryRestriction()
+: gqbObject(wxT(""), NULL, NULL)
 {
     leftPart=wxT("");
     value_s=wxT("");
     connector=wxT("AND");
     restriction=wxT("=");
+    setType(GQB_RESTRICTION);
 }
 
 
-gqbRestrictions::gqbRestrictions():
-gqbObjectCollection(wxT(""),GQB_RESTRICTION)
+gqbRestrictions::gqbRestrictions()
+: gqbObjectCollection(wxT(""), NULL, NULL)
 {
-    this->setOwner(NULL);
+    setType(GQB_RESTRICTION);
 }
 
 
index 40d21f332ea570e98c8a37b9ff3d74ee4d4ebd06..fbc9094ea33573ebc47401ffbdb372ef5d9b2b22 100644 (file)
 #include "gqb/gqbTable.h"
 #include "gqb/gqbBrowser.h"
 
-gqbSchema::gqbSchema(gqbObject *parent, wxString name, type_gqbObject type=GQB_SCHEMA):
-gqbObject(name,type)
+gqbSchema::gqbSchema(gqbObject *parent, wxString name, pgConn *connection, OID oid)
+: gqbObject(name, parent, connection, oid)
 {
-    this->setType(GQB_SCHEMA);
-    this->setName(name);
-    this->setOwner(parent);
+    setType(GQB_SCHEMA);
 }
 
 
 // GQB-TODO: don't declare OID inside gqbBrowsear instead use the pgadmin one
-void gqbSchema::createObjects(gqbBrowser *tablesBrowser,  pgConn *conn, OID oidVal, wxTreeItemId parentNode, int tableImage, int viewImage, int xTableImage)
+void gqbSchema::createObjects(gqbBrowser *tablesBrowser, OID oidVal, wxTreeItemId parentNode, int tableImage, int viewImage, int xTableImage)
 {
-    createTables(conn, tablesBrowser, parentNode, oidVal, tableImage, viewImage, xTableImage);
+    createTables(tablesBrowser, parentNode, oidVal, tableImage, viewImage, xTableImage);
 }
 
-
-wxString gqbSchema::NumToStr(OID value)
-{
-    wxString result;
-    result.Printf(wxT("%lu"), (long)value);
-    return result;
-}
-
-
-void gqbSchema::createTables(pgConn *conn, gqbBrowser *tablesBrowser, wxTreeItemId parentNode, OID oidVal, int tableImage, int viewImage, int xTableImage)
+void gqbSchema::createTables(gqbBrowser *tablesBrowser, wxTreeItemId parentNode, OID oidVal, int tableImage, int viewImage, int xTableImage)
 { 
     wxString query;
     
@@ -67,18 +56,18 @@ void gqbSchema::createTables(pgConn *conn, gqbBrowser *tablesBrowser, wxTreeItem
             
             if (relkind == wxT("r")) // Table
             {
-                table = new gqbTable(this, tmpname, GQB_TABLE);
+                table = new gqbTable(this, tmpname, conn, GQB_TABLE, tables->GetOid(wxT("oid")));
                 parent=tablesBrowser->AppendItem(parentNode, tables->GetVal(wxT("relname")) , tableImage, tableImage, table);
             }
             else if (relkind == wxT("v"))
             {
-                table = new gqbTable(this, tmpname, GQB_VIEW);
+                table = new gqbTable(this, tmpname, conn, GQB_VIEW, tables->GetOid(wxT("oid")));
                 parent=tablesBrowser->AppendItem(parentNode, tables->GetVal(wxT("relname")) , viewImage, viewImage, table);
             }
             else if (relkind == wxT("x"))  // Greenplum external table
             {
-                table = new gqbTable(this, tmpname, GQB_TABLE);
-                parent=tablesBrowser->AppendItem(parentNode, tables->GetVal(wxT("relname")) , xTableImage, xTableImage, table);
+                table = new gqbTable(this, tmpname, conn, GQB_TABLE, tables->GetOid(wxT("oid")));
+                parent=tablesBrowser->AppendItem(parentNode, tables->GetVal(wxT("relname")), xTableImage, xTableImage, table);
             }
 
             // Create columns inside this table.
index ea92873b1231c826fe8ae4c5d0985dbafd24e0e9..8fb967d046d9dc5f052b0e2d7804b2b8179f5871 100644 (file)
 #include "gqb/gqbColumn.h"
 #include "gqb/gqbArrayCollection.h"
 
-gqbTable::gqbTable(gqbObject *parent, wxString name, type_gqbObject type=GQB_TABLE):
-gqbObjectCollection(name,type)
+gqbTable::gqbTable(gqbObject *parent, wxString name, pgConn *connection, type_gqbObject type, OID oid)
+: gqbObjectCollection(name, parent, connection, oid)
 {
-    this->setType(type);
-    this->setName(name);
-    this->setOwner(parent);
+    setType(type);
 }
 
 
@@ -47,15 +45,6 @@ void gqbTable::createObjects(gqbBrowser *_tablesBrowser,  pgConn *_conn, OID oid
     createColumns(_conn, _tablesBrowser, parentNode, oidVal);
 }
 
-
-wxString gqbTable::NumToStr(OID value)
-{
-    wxString result;
-    result.Printf(wxT("%lu"), (long)value);
-    return result;
-}
-
-
 void gqbTable::createColumns(pgConn *conn, gqbBrowser *tablesBrowser, wxTreeItemId parentNode,  OID oidVal)
 {
 
@@ -80,7 +69,7 @@ void gqbTable::createColumns(pgConn *conn, gqbBrowser *tablesBrowser, wxTreeItem
             {
                 //Disable, Column SHOULDN'T be added to tree only use for debug purposes tablesBrowser->AppendItem(parentNode, columns->GetVal(wxT("attname")) , -1, -1);
                 wxString tmpname = wxString(columns->GetVal(wxT("attname")));
-                gqbColumn *column = new gqbColumn(this,tmpname,GQB_COLUMN);
+                gqbColumn *column = new gqbColumn(this, tmpname, conn);
                 this->addColumn(column);
                 columns->MoveNext();
             }
index 9e9769f63ee95c9e43abb10b54cc182d7cb15af4..414ba434c566c8ee0321954f0f1a29d0412ce6d3 100644 (file)
 #ifndef GQBBROWSER_H
 #define GQBBROWSER_H
 
-// typedef unsigned long OID;
+enum gqbImages
+{
+    GQB_IMG_DATABASE = 0,
+    GQB_IMG_NAMESPACE = 1,
+    GQB_IMG_TABLE = 2,
+    GQB_IMG_NAMESPACES = 3,
+    GQB_IMG_CATALOGS = 4,
+    GQB_IMG_CATALOG = 5,
+    GQB_IMG_CATALOG_OBJ = 6,
+    GQB_IMG_VIEW = 7,
+    GQB_IMG_EXTTABLE = 8
+};
 
 class gqbController;
 
index d0408afcf8df13afb8d5d6234eeed1469b68ca73..e588903b54c665896591c2f7495e7132ef541374 100644 (file)
@@ -20,6 +20,6 @@
 class gqbColumn : public gqbObject
 {
 public:
-    gqbColumn(gqbObject *parent, wxString name, type_gqbObject type);
+    gqbColumn(gqbObject *parent, wxString name, pgConn *connection);
 };
 #endif
index 02d9b09f4dbb71081b52aa70e7b3dc12482ff8eb..464fcb83cde37df7f30cdaa000f1bd05ce8d7e97 100644 (file)
 class gqbDatabase : public gqbObject
 {
 public:
-    gqbDatabase(wxString name, type_gqbObject type);
-    void createObjects(gqbBrowser *_tablesBrowser,  pgConn *_conn);
+    gqbDatabase(wxString name, pgConn *connection);
+    void createObjects(gqbBrowser *_tablesBrowser);
 
 private:
-    pgConn *conn;
     enum typeSchema
     {
         GQB_CATALOG,
         GQB_OTHER
     };
-    void createSchemas(pgConn *conn,  gqbBrowser *tablesBrowser, wxTreeItemId parentNode,typeSchema MetaType, int indexImage);
+    void createSchemas(gqbBrowser *tablesBrowser, wxTreeItemId parentNode,typeSchema MetaType, int indexImage);
 };
 #endif
index 6d9c95a6b18224e280966893d60ea7babacc39bd..a368d6e1bf15419711c28714023b2b9e570ec689 100644 (file)
@@ -29,18 +29,22 @@ enum type_gqbObject
 class gqbObject : public wxTreeItemData
 {
 public:
-    gqbObject(wxString name, type_gqbObject type);
+    gqbObject(wxString name, wxTreeItemData *owner, pgConn *connection, OID oid = 0);
     virtual ~gqbObject();
-    void setName(wxString name);
-    const wxString& getName();
-    void setOwner(wxTreeItemData *owner);
-    const wxTreeItemData& getOwner();
-    void setType(type_gqbObject name);
-    const type_gqbObject getType();
+    const wxString& getName() { return Name; }
+    wxTreeItemData *getOwner() { return Owner; }
+    const type_gqbObject getType() { return Type; }
+    void setType(const type_gqbObject type) { Type = type; }
+    pgConn *getConnection() { return conn; }
+    OID getOid() { return Oid; }
+
+protected:
+    pgConn *conn;
 
 private:
     wxString Name;
     wxTreeItemData *Owner;
     type_gqbObject Type;
+    OID Oid;
 };
 #endif
index 445448a205e82a7527094a569392e8c0adcee5e1..e96a2a2d483e40dd8a14c2c1e10c04ae9850e170 100644 (file)
@@ -21,7 +21,7 @@
 class gqbObjectCollection : public gqbObject
 {
 public:
-    gqbObjectCollection(wxString name, type_gqbObject type);
+    gqbObjectCollection(wxString name, wxTreeItemData *owner, pgConn *connection, OID oid = 0);
     virtual ~gqbObjectCollection();
 
 protected:
index bc65c53f08ba8f28b69a293e4624d22904ce831c..e8d5ccfe294dce43456373f79492b644dfd9f1ef 100644 (file)
@@ -103,10 +103,10 @@ public:
     gqbQueryObject* getDestQTable();
     gqbColumn* getDCol();
     gqbColumn* getSCol();
-    const wxString& getSourceTable();
-    const wxString& getDestTable();
-    const wxString& getSourceCol();
-    const wxString& getDestCol();
+    wxString getSourceTable();
+    wxString getDestTable();
+    wxString getSourceCol();
+    wxString getDestCol();
     void setSourceAnchor(wxPoint pt);
     void setDestAnchor(wxPoint pt);
     wxPoint& getSourceAnchor();
index b4ea94e01ba6ebeac77a3529e116e94f48b997a9..52301df59fe0b68f4401a47a96a8ab94902894ce 100644 (file)
 class gqbSchema : public gqbObject
 {
 public:
-    gqbSchema(gqbObject *parent, wxString name, type_gqbObject type);
-    void createObjects(gqbBrowser *tablesBrowser,  pgConn *conn, OID oidVal, wxTreeItemId parentNode, int tableImage, int viewImage, int xTableImage);
+    gqbSchema(gqbObject *parent, wxString name, pgConn *connection, OID oid);
+    void createObjects(gqbBrowser *tablesBrowser, OID oidVal, wxTreeItemId parentNode, int tableImage, int viewImage, int xTableImage);
 
 private:
-    pgConn *conn;
-    wxString NumToStr(OID value);
-    void createTables(pgConn *conn, gqbBrowser *tablesBrowser, wxTreeItemId parentNode, OID oidVal, int tableImage, int viewImage, int xTableImage);
+    void createTables(gqbBrowser *tablesBrowser, wxTreeItemId parentNode, OID oidVal, int tableImage, int viewImage, int xTableImage);
 };
 #endif
index f290a97135e10814db9d5f212dc835abdd9a7572..85968f36fd95c6814d2f37fd681e1924ef107a75 100644 (file)
@@ -23,7 +23,7 @@ class gqbColumn;
 class gqbTable : public gqbObjectCollection
 {
 public:
-    gqbTable(gqbObject *parent, wxString name, type_gqbObject type);
+    gqbTable(gqbObject *parent, wxString name, pgConn *connection, type_gqbObject type, OID oid);
     void createObjects(gqbBrowser *_tablesBrowser,  pgConn *_conn, OID oidVal, wxTreeItemId parentNode);
     gqbIteratorBase* createColumnsIterator();
     int countCols();
@@ -31,7 +31,6 @@ public:
     int indexColumn(gqbColumn *col);
 
 private:
-    wxString NumToStr(OID value);
     void addColumn(gqbColumn *column);    // Used only as synonym for gqbObjectCollection addObject
     void createColumns(pgConn *conn, gqbBrowser *tablesBrowser, wxTreeItemId parentNode,  OID oidVal);