- Temp1.Printf("TN(%s",(ct_BrowserDB->pTableInf+x)->tableName);
- //----
- (ct_BrowserDB->pTableInf+x)->pColInf = (pDoc->db_Br+i_Which)->OnGetColumns((ct_BrowserDB->pTableInf+x)->tableName,(ct_BrowserDB->pTableInf+x)->numCols,FALSE);
- //----
- if ((ct_BrowserDB->pTableInf+x)->pColInf)
- {
- if (TableType == 1) // Table
- {
- Temp0.Printf(_("Table-Name(%s) with (%d)Columns ; Remarks(%s)"), (ct_BrowserDB->pTableInf+x)->tableName,
- (ct_BrowserDB->pTableInf+x)->numCols,(ct_BrowserDB->pTableInf+x)->tableRemarks);
- Folder = AppendItem(Root,Temp0,TreeIc_TAB,TreeIc_TAB, new DBTreeData(Temp1));
- }
- if (TableType == 2) // View
- {
- Temp0.Printf(_("View-Name(%s) with (%d)Columns ; Remarks(%s)"), (ct_BrowserDB->pTableInf+x)->tableName,
- (ct_BrowserDB->pTableInf+x)->numCols,(ct_BrowserDB->pTableInf+x)->tableRemarks);
- Folder = AppendItem(Root,Temp0,TreeIc_VIEW,TreeIc_VIEW, new DBTreeData(Temp1));
- }
- for (y=0;y<(ct_BrowserDB->pTableInf+x)->numCols;y++)
- {
- Temp1.Printf("FN(%s",((ct_BrowserDB->pTableInf+x)->pColInf+y)->colName);
- // 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 = ((ct_BrowserDB->pTableInf+x)->pColInf+y)->PkTableName;
- if (Temp2 == "")
- Temp2 = _("None");
- Temp2.Printf(_("This Key is used in the following Tables : %s"),Temp2);
- 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(_("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"));
- }
+ wxStopWatch sw;
+ wxBeginBusyCursor();
+ ct_BrowserDB = (pDoc->db_Br+i_Which)->OnGetCatalog(false);
+ if (ct_BrowserDB)
+ { // Use the wxDatabase Information
+ Temp0.Printf(_T("%s - (%s) (%s)"), s_DSN.c_str(),ct_BrowserDB->catalog, ct_BrowserDB->schema);
+ Root = AddRoot(Temp0,TreeIc_DsnOpen,TreeIc_DsnOpen,new DBTreeData(_T("Root")));
+ for (x=0;x<ct_BrowserDB->numTables;x++)
+ {
+ wxYield();
+ TableType = 0; // TABLE = 1 ; VIEW = 2 ; 0 We are not interested in
+ if (!wxStrcmp((ct_BrowserDB->pTableInf+x)->tableType,_T("TABLE"))) // only TABLES
+ TableType = 1;
+ if (!wxStrcmp((ct_BrowserDB->pTableInf+x)->tableType,_T("VIEW"))) // and VIEWS
+ TableType = 2;
+ if (TableType) // only TABLES or Views
+ {
+ Temp1.Printf(_T("TN(%s"),(ct_BrowserDB->pTableInf+x)->tableName);
+ //----
+ (ct_BrowserDB->pTableInf+x)->pColInf = (pDoc->db_Br+i_Which)->OnGetColumns((ct_BrowserDB->pTableInf+x)->tableName,(ct_BrowserDB->pTableInf+x)->numCols,false);
+ //----
+ if ((ct_BrowserDB->pTableInf+x)->pColInf)
+ {
+ if (TableType == 1) // Table
+ {
+ Temp0.Printf(_("Table-Name(%s) with (%d)Columns ; Remarks(%s)"), (ct_BrowserDB->pTableInf+x)->tableName,
+ (ct_BrowserDB->pTableInf+x)->numCols,(ct_BrowserDB->pTableInf+x)->tableRemarks);
+ Folder = AppendItem(Root,Temp0,TreeIc_TAB,TreeIc_TAB, new DBTreeData(Temp1));
+ }
+ if (TableType == 2) // View
+ {
+ Temp0.Printf(_("View-Name(%s) with (%d)Columns ; Remarks(%s)"), (ct_BrowserDB->pTableInf+x)->tableName,
+ (ct_BrowserDB->pTableInf+x)->numCols,(ct_BrowserDB->pTableInf+x)->tableRemarks);
+ Folder = AppendItem(Root,Temp0,TreeIc_VIEW,TreeIc_VIEW, new DBTreeData(Temp1));
+ }
+ for (y=0;y<(ct_BrowserDB->pTableInf+x)->numCols;y++)
+ {
+ Temp1.Printf(_T("FN(%s"),((ct_BrowserDB->pTableInf+x)->pColInf+y)->colName);
+ // 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
+ {
+ Temp2.Printf(_T("(%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 == _T(""))
+ 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(_T("KEY")));
+ }
+ else
+ {
+ if (((ct_BrowserDB->pTableInf+x)->pColInf+y)->FkCol != 0) // Foreign Key
+ {
+ Temp2.Printf(_T("(%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(_T("KEYF")));
+ }
+ else
+ Docu = AppendItem(Folder,((ct_BrowserDB->pTableInf+x)->pColInf+y)->colName,TreeIc_COL,TreeIc_COL,new DBTreeData(Temp1));
+ }
+ SQL_TYPE.Printf(_T("SQL_C_???? (%d)"),((ct_BrowserDB->pTableInf+x)->pColInf+y)->sqlDataType);
+ DB_TYPE.Printf(_T("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])
+ {
+ SQL_TYPE.Printf(_T("%s(%d) ; "),(pDoc->db_Br+i_Which)->s_SqlTyp[i].c_str(),(pDoc->db_Br+i_Which)->i_SqlTyp[i]);
+ }
+ } // for (i=1;i<=i_SqlTyp[0];i++)
+ wxYield();
+ for (i=1;i<=(pDoc->db_Br+i_Which)->i_dbTyp[0];i++)
+ {
+ if (((ct_BrowserDB->pTableInf+x)->pColInf+y)->dbDataType == (pDoc->db_Br+i_Which)->i_dbTyp[i])
+ {
+ DB_TYPE.Printf(_T("%s(%d)"),(pDoc->db_Br+i_Which)->s_dbTyp[i].c_str(),(pDoc->db_Br+i_Which)->i_dbTyp[i]);
+ }
+ } // for (i=1;i<=i_dbTyp[0];i++)
+ wxYield();
+ SQL_TYPE += DB_TYPE;
+ Funkt = AppendItem(Docu,SQL_TYPE,TreeIc_DocClosed,TreeIc_DocOpen,new DBTreeData(SQL_TYPE));
+ SQL_TYPE.Printf(_T("%10s %d,%d"),((ct_BrowserDB->pTableInf+x)->pColInf+y)->typeName,
+ ((ct_BrowserDB->pTableInf+x)->pColInf+y)->columnSize,((ct_BrowserDB->pTableInf+x)->pColInf+y)->decimalDigits);
+ Funkt = AppendItem(Docu,SQL_TYPE,TreeIc_DocClosed,TreeIc_DocOpen,new DBTreeData(SQL_TYPE));
+ } // for (y=0;y<(ct_BrowserDB->pTableInf+x)->numCols;y++)
+ } // if ((ct_BrowserDB->pTableInf+x)->pColInf)
+ else
+ Folder = AppendItem(Root,Temp0,TreeIc_FolderClosed,TreeIc_FolderOpen, new DBTreeData(Temp1));
+ z++;
+// if (z % 10 == 0)
+ {
+#if wxUSE_STATUSBAR
+ Temp0.Printf(_("-I-> DBTree::OnPopulate(%s) - Table %6d (from %d) has been read."),(ct_BrowserDB->pTableInf+x)->tableName,z,ct_BrowserDB->numTables);
+ pDoc->p_MainFrame->SetStatusText(Temp0, 0);
+#endif // wxUSE_STATUSBAR
+ }
+ wxYield();
+ } // if ((ct_BrowserDB->pTableInf+x)->tableType == "TABLE" or VIEW)
+ // else
+ // wxLogMessage(_("\n-I-> if ! TABLE or VIEW >%s<"),(ct_BrowserDB->pTableInf+x)->tableType);
+ } // for (x=0;x<ct_BrowserDB->numTables;x++)
+ } // if (ct_BrowserDB)