]> git.saurik.com Git - wxWidgets.git/blobdiff - demos/dbbrowse/dbtree.cpp
Lotta stuff for drawing etc.
[wxWidgets.git] / demos / dbbrowse / dbtree.cpp
index 3937e1c7bd9a5adfc3127a8adca1b691eb58d0b9..33bc980d71e24dc7c0e6ea231892f958a1842652 100644 (file)
@@ -107,12 +107,13 @@ DBTree::~DBTree()
 int  DBTree::OnPopulate()
 {
  wxTreeItemId Root, Folder, Docu, Funkt;
- int i,x,y, TableType;
+ int i,x,y,z=0, TableType;
  wxString SQL_TYPE, DB_TYPE;
  SetFont(* pDoc->ft_Doc);
  //---------------------------------------------------------------------------------------
  if ((pDoc->db_Br+i_Which)->Initialize(FALSE))
  {
+  wxStopWatch sw;
   wxBeginBusyCursor();
   ct_BrowserDB = (pDoc->db_Br+i_Which)->OnGetCatalog(FALSE);
   if (ct_BrowserDB)
@@ -153,23 +154,28 @@ int  DBTree::OnPopulate()
        // Here is where we find out if the Column is a Primary / Foreign Key
        if (((ct_BrowserDB->pTableInf+x)->pColInf+y)->PkCol != 0)  // Primary Key
        {
-        Docu = AppendItem(Folder,((ct_BrowserDB->pTableInf+x)->pColInf+y)->colName,TreeIc_KEY,TreeIc_KEY,new DBTreeData(Temp1));
-        Temp2.Printf(_("This Key is used in the following Tables : %s"),((ct_BrowserDB->pTableInf+x)->pColInf+y)->PkTableName);
+        Temp2.Printf("(%d) - %s",((ct_BrowserDB->pTableInf+x)->pColInf+y)->PkCol,((ct_BrowserDB->pTableInf+x)->pColInf+y)->colName);
+        Docu = AppendItem(Folder,Temp2,TreeIc_KEY,TreeIc_KEY,new DBTreeData(Temp1));
+        Temp2 = ((ct_BrowserDB->pTableInf+x)->pColInf+y)->PkTableName;
+        if (Temp2 == "")
+         Temp2 = _("None");
+        Temp2.Printf(_("This Primary Key is used in the following Tables : %s"),Temp2.c_str());
         Funkt = AppendItem(Docu,Temp2,TreeIc_DocClosed,TreeIc_DocOpen,new DBTreeData("KEY"));
        }
        else
        {
         if (((ct_BrowserDB->pTableInf+x)->pColInf+y)->FkCol != 0) // Foreign Key
         {
-         Docu = AppendItem(Folder,((ct_BrowserDB->pTableInf+x)->pColInf+y)->colName,TreeIc_KEYF,TreeIc_KEYF,new DBTreeData(Temp1));
+         Temp2.Printf("(%d) - %s",((ct_BrowserDB->pTableInf+x)->pColInf+y)->FkCol,((ct_BrowserDB->pTableInf+x)->pColInf+y)->colName);
+         Docu = AppendItem(Folder,Temp2,TreeIc_KEYF,TreeIc_KEYF,new DBTreeData(Temp1));
          Temp2.Printf(_("This Foreign Key comes from the following Table : %s"),((ct_BrowserDB->pTableInf+x)->pColInf+y)->FkTableName);
          Funkt = AppendItem(Docu,Temp2,TreeIc_DocClosed,TreeIc_DocOpen,new DBTreeData("KEYF"));
         }
         else
          Docu = AppendItem(Folder,((ct_BrowserDB->pTableInf+x)->pColInf+y)->colName,TreeIc_COL,TreeIc_COL,new DBTreeData(Temp1));
        }
-       SQL_TYPE.Printf(_("SQL_C_???? (%d)"),((ct_BrowserDB->pTableInf+x)->pColInf+y)->sqlDataType);
-       DB_TYPE.Printf(_("DB_DATA_TYPE_???? (%d)"),((ct_BrowserDB->pTableInf+x)->pColInf+y)->dbDataType);
+       SQL_TYPE.Printf("SQL_C_???? (%d)",((ct_BrowserDB->pTableInf+x)->pColInf+y)->sqlDataType);
+       DB_TYPE.Printf("DB_DATA_TYPE_???? (%d)",((ct_BrowserDB->pTableInf+x)->pColInf+y)->dbDataType);
        for (i=1;i<=(pDoc->db_Br+i_Which)->i_SqlTyp[0];i++)
        {
         if (((ct_BrowserDB->pTableInf+x)->pColInf+y)->sqlDataType == (pDoc->db_Br+i_Which)->i_SqlTyp[i])
@@ -193,6 +199,12 @@ int  DBTree::OnPopulate()
      }   // if ((ct_BrowserDB->pTableInf+x)->pColInf)
      else
       Folder = AppendItem(Root,Temp0,TreeIc_FolderClosed,TreeIc_FolderOpen, new DBTreeData(Temp1));
+     z++;
+     if (z % 10 == 0)
+     {
+      Temp0.Printf(_("-I-> DBTree::OnPopulate(%s) - Table %6d has been read."),(ct_BrowserDB->pTableInf+x)->tableName,z);
+      pDoc->p_MainFrame->SetStatusText(Temp0, 0);
+     }
     }    // if ((ct_BrowserDB->pTableInf+x)->tableType == "TABLE" or VIEW)
     // else
     //  wxLogMessage(_("\n-I-> if ! TABLE or VIEW  >%s<"),(ct_BrowserDB->pTableInf+x)->tableType);
@@ -201,6 +213,9 @@ int  DBTree::OnPopulate()
   else
    wxLogMessage(_("\n-E-> DBTree::OnPopulate() : Invalid Catalog Pointer : Failed"));
   wxEndBusyCursor();
+  Temp0.Printf(_("-I-> DBTree::OnPopulate() - %6d Tables have been read. - Time needed : %ld ms"),z,sw.Time());
+  wxLogMessage(Temp0);
+  pDoc->p_MainFrame->SetStatusText(Temp0, 0);
  }       // if((pDoc->db_Br+i_Which)->Initialize(FALSE))
  else
  {