-//---------------------------------------------------------------------------
+//----------------------------------------------------------------------------------------
// Name: BrowserDB.h,cpp
-// Purpose: a wxDB;
+// Purpose: a wxDB class
// Author: Mark Johnson, mj10777@gmx.net
// Modified by:
// Created: 19991127.mj10777
// Copyright: (c) Mark Johnson
// Licence: wxWindows license
-//---------------------------------------------------------------------------
+// RCS-ID: $Id$
+//----------------------------------------------------------------------------------------
//-- 1)
-//---------------------------------------------------------------------------
-//-- all #ifdefs that the whole Project needs. ------------------------------
-//---------------------------------------------------------------------------
+//----------------------------------------------------------------------------------------
+//-- all #ifdefs that the whole Project needs. -------------------------------------------
+//----------------------------------------------------------------------------------------
#ifdef __GNUG__
- #pragma implementation
- #pragma interface
+#pragma implementation
+#pragma interface
#endif
-//---------------------------------------------------------------------------
+//----------------------------------------------------------------------------------------
// For compilers that support precompilation, includes "wx/wx.h".
#include "wx/wxprec.h"
-//---------------------------------------------------------------------------
+//----------------------------------------------------------------------------------------
#ifdef __BORLANDC__
- #pragma hdrstop
+#pragma hdrstop
#endif
-//---------------------------------------------------------------------------
+//----------------------------------------------------------------------------------------
#ifndef WX_PRECOMP
- #include "wx/wx.h"
+#include "wx/wx.h"
#endif
-//---------------------------------------------------------------------------
-#include <wx/dbtable.h>
+//----------------------------------------------------------------------------------------
#include "std.h"
-//---------------------------------------------------------------------------
+//----------------------------------------------------------------------------------------
// Global structure for holding ODBC connection information
// - darf nur einmal im Projekte definiert werden ?? Extra Databasse Klasse ?
-struct DbStuff ConnectInf; // Für DBase
-//---------------------------------------------------------------------------
-extern DbList* WXDLLEXPORT PtrBegDbList; /* from db.cpp, used in getting back error results from db connections */
-//---------------------------------------------------------------------------
+wxDbConnectInf ConnectInf; // Für DBase
+//----------------------------------------------------------------------------------------
+extern WXDLLEXPORT_DATA(wxDbList*) PtrBegDbList; /* from db.cpp, used in getting back error results from db connections */
+//----------------------------------------------------------------------------------------
char *GetExtendedDBErrorMsg(char *ErrFile, int ErrLine)
{
static wxString msg;
// msg += "\n";
/* Scan through each database connection displaying
* any ODBC errors that have occured. */
- for (DbList *pDbList = PtrBegDbList; pDbList; pDbList = pDbList->PtrNext)
+ wxDbList *pDbList;
+ for (pDbList = PtrBegDbList; pDbList; pDbList = pDbList->PtrNext)
{
// Skip over any free connections
if (pDbList->Free)
msg += "\n";
return (char*) (const char*) msg;
} // GetExtendedDBErrorMsg
-//////////////////////////////////////////////////////////////////////////////////
-// BJO 20000115 : New stuff : dialog to ask for username and password
-//////////////////////////////////////////////////////////////////////////////////
-class UserDialog : public wxDialog
-{
- public:
- UserDialog(wxWindow* parent);
- virtual ~UserDialog();
- void OnOK(wxCommandEvent& event);
- wxString s_UserName, s_Password;
-
- private:
- wxButton *m_OK;
- wxStaticText *m_Label1, *m_Label2;
- wxTextCtrl *m_UserName, *m_Password;
-
-
- DECLARE_EVENT_TABLE()
-};
-//---------------------------------------------------------------------------
-BEGIN_EVENT_TABLE(UserDialog, wxDialog)
- EVT_BUTTON(wxID_OK, UserDialog::OnOK)
-END_EVENT_TABLE()
-//---------------------------------------------------------------------------
-UserDialog::UserDialog(wxWindow *parent):
- wxDialog(parent, -1, _("ODBC user"),wxDefaultPosition, wxSize(310, 300),wxDIALOG_MODAL | wxDEFAULT_DIALOG_STYLE)
-{
- wxLayoutConstraints* layout;
- SetAutoLayout(TRUE);
- //-----------------------------------------------
- m_OK = new wxButton(this, wxID_OK, _("Ok"));
- layout = new wxLayoutConstraints;
- layout->left.SameAs(this, wxLeft, 10);
- layout->top.SameAs(this, wxTop,10);
- layout->height.AsIs();
- layout->width.Absolute(75);
- m_OK->SetConstraints(layout);
-
- m_Label1 = new wxStaticText(this, -1, _("User name:"));
- layout = new wxLayoutConstraints;
- layout->left.SameAs(m_OK, wxLeft);
- layout->top.SameAs(m_OK, wxBottom, 10);
- layout->height.AsIs();
- layout->width.AsIs();
- m_Label1->SetConstraints(layout);
-
- m_UserName = new wxTextCtrl(this, -1, "");
- layout = new wxLayoutConstraints;
- layout->left.SameAs(m_OK, wxLeft);
- layout->top.SameAs(m_Label1, wxBottom, 3);
- layout->width.AsIs();
- layout->height.AsIs();
- m_UserName->SetConstraints(layout);
-
- m_Label2 = new wxStaticText(this, -1, _("Password:"));
- layout = new wxLayoutConstraints;
- layout->left.SameAs(m_OK, wxLeft);
- layout->top.SameAs(m_UserName, wxBottom, 10);
- layout->height.AsIs();
- layout->width.AsIs();
- m_Label2->SetConstraints(layout);
-
- m_Password = new wxTextCtrl(this, -1, "", wxDefaultPosition, wxDefaultSize, wxTE_PASSWORD);
- layout = new wxLayoutConstraints;
- layout->left.SameAs(m_OK, wxLeft);
- layout->width.AsIs();
- layout->top.SameAs(m_Label2, wxBottom, 3);
- layout->height.AsIs();
- m_Password->SetConstraints(layout);
-
- s_UserName = "";
- s_Password = "";
- Layout();
-}
-//---------------------------------------------------------------------------
-UserDialog::~UserDialog()
-{
-}
-//---------------------------------------------------------------------------
-void UserDialog::OnOK(wxCommandEvent& WXUNUSED(event))
-{
- strcpy(ConnectInf.Uid, m_UserName->GetValue());
- strcpy(ConnectInf.AuthStr, m_Password->GetValue());
- EndModal(1);
-}
-//////////////////////////////////////////////////////////////////////////////////
-// BJO 20000115 : end of new stuff
-//////////////////////////////////////////////////////////////////////////////////
-//---------------------------------------------------------------------------
+//----------------------------------------------------------------------------------------
BrowserDB::BrowserDB()
{
Zeiger_auf_NULL(0);
OnFillSqlTyp();
OnFilldbTyp();
} // BrowserDB Constructor
-//---------------------------------------------------------------------------
+//----------------------------------------------------------------------------------------
BrowserDB::~BrowserDB()
{
Zeiger_auf_NULL(1); // Clean up Tables and Databases (Commit, Close und delete)
} // BrowserDB destructor
-//--------------------------------------------------------------------------------------------
-bool BrowserDB::Initialize(int Quite)
+//----------------------------------------------------------------------------------------
+bool BrowserDB::Initialize(int Quiet)
{
- if (!OnStartDB(Quite))
+ if (!OnStartDB(Quiet))
{
wxLogMessage(_("\n\n-E-> BrowserDB::OnStartDB(%s) : Failed ! "),ODBCSource.c_str());
return FALSE;
}
return TRUE;
} // BrowserDB:Initialize
-//--------------------------------------------------------------------------------------------
-bool BrowserDB::OnStartDB(int Quite)
+//----------------------------------------------------------------------------------------
+bool BrowserDB::OnStartDB(int Quiet)
{
- if (!Quite)
+ wxStopWatch sw;
+ if (!Quiet)
wxLogMessage(_("\n-I-> BrowserDB::OnStartDB(%s) : Begin "),ODBCSource.c_str());
if (db_BrowserDB != NULL)
{
- if (!Quite)
+ if (!Quiet)
wxLogMessage(_("\n-I-> BrowserDB::OnStartDB() : DB is allready open."));
return TRUE;
}
// Initialize the ODBC Environment for Database Operations
if (SQLAllocEnv(&ConnectInf.Henv) != SQL_SUCCESS)
{
- if (!Quite)
+ if (!Quiet)
wxLogMessage(_("\n-E-> BrowserDB::OnStartDB() : DB CONNECTION ERROR : A problem occured while trying to get a connection to the data source"));
return FALSE;
}
- //---------------------------------------------------------------------------
+ //---------------------------------------------------------------------------------------
// Connect to datasource
- //---------------------------
- DlgUser p_Dlg(pDoc->p_MainFrame, "Username and Password", wxPoint(100, 100), wxSize(340, 170));
- p_Dlg.s_DSN = ODBCSource;
- p_Dlg.s_User = UserName;
- p_Dlg.s_Password = Password;
- p_Dlg.OnInit();
- if (p_Dlg.ShowModal() == wxID_OK)
+ //---------------------------------------------------------------------------------------
+ DlgUser *p_Dlg;
+ p_Dlg = new DlgUser(pDoc->p_MainFrame,pDoc,"");
+ p_Dlg->s_DSN = ODBCSource;
+ p_Dlg->s_User = UserName;
+ p_Dlg->s_Password = Password;
+ p_Dlg->OnInit();
+ p_Dlg->Fit();
+
+ bool OK = FALSE;
+ if (p_Dlg->ShowModal() == wxID_OK)
{
- (pDoc->p_DSN+i_Which)->Usr = p_Dlg.s_User;
- (pDoc->p_DSN+i_Which)->Pas = p_Dlg.s_Password;
- UserName = p_Dlg.s_User;
- Password = p_Dlg.s_Password;
+ (pDoc->p_DSN+i_Which)->Usr = p_Dlg->s_User;
+ (pDoc->p_DSN+i_Which)->Pas = p_Dlg->s_Password;
+ UserName = p_Dlg->s_User;
+ Password = p_Dlg->s_Password;
+ OK = TRUE;
}
- p_Dlg.Destroy();
- //---------------------------
- strcpy(ConnectInf.Dsn, ODBCSource); // ODBC data source name (created with ODBC Administrator under Win95/NT)
- strcpy(ConnectInf.Uid, UserName); // database username - must already exist in the data source
- strcpy(ConnectInf.AuthStr, Password); // password database username
- db_BrowserDB = GetDbConnection(&ConnectInf);
- // wxLogMessage(">>>%s<<<>>>%s<<<",UserName.c_str(),Password.c_str());
- if (db_BrowserDB == NULL)
+ delete p_Dlg;
+ if (OK)
{
- strcpy(ConnectInf.Dsn, "");
- strcpy(ConnectInf.Uid, "");
- strcpy(ConnectInf.AuthStr, "");
- if (!Quite)
+ //--------------------------------------------------------------------------------------
+ strcpy(ConnectInf.Dsn, ODBCSource); // ODBC data source name (created with ODBC Administrator under Win95/NT)
+ strcpy(ConnectInf.Uid, UserName); // database username - must already exist in the data source
+ strcpy(ConnectInf.AuthStr, Password); // password database username
+ db_BrowserDB = wxDbGetConnection(&ConnectInf);
+ // wxLogMessage(">>>%s<<<>>>%s<<<",UserName.c_str(),Password.c_str());
+ if (db_BrowserDB == NULL)
{
- wxLogMessage(_("\n-E-> BrowserDB::OnConnectDataSource() DB CONNECTION ERROR : Unable to connect to the data source.\n\nCheck the name of your data source to verify it has been correctly entered/spelled.\n\nWith some databases, the user name and password must\nbe created with full rights to the table prior to making a connection\n(using tools provided by the database manufacturer)"));
- wxLogMessage(_("-I-> BrowserDB::OnStartDB(%s) : End "),ODBCSource.c_str());
+ strcpy(ConnectInf.Dsn, "");
+ strcpy(ConnectInf.Uid, "");
+ strcpy(ConnectInf.AuthStr, "");
+ if (!Quiet)
+ {
+ wxLogMessage(_("\n-E-> BrowserDB::OnConnectDataSource() DB CONNECTION ERROR : Unable to connect to the data source.\n\nCheck the name of your data source to verify it has been correctly entered/spelled.\n\nWith some databases, the user name and password must\nbe created with full rights to the table prior to making a connection\n(using tools provided by the database manufacturer)"));
+ wxLogMessage(_("-I-> BrowserDB::OnStartDB(%s) : End - Time needed : %ld ms"),ODBCSource.c_str(),sw.Time());
+ }
+ return FALSE;
}
- return FALSE;
- }
- //--------------------------------------------------------------------------
- if (!Quite)
- {
- Temp1 = db_BrowserDB->GetDatabaseName();
- Temp2 = db_BrowserDB->GetDataSource();
- wxLogMessage(_("-I-> BrowserDB::OnGetDataSourceODBC() - DatabaseName(%s) ; DataSource(%s)"),Temp1.c_str(),Temp2.c_str());
- wxLogMessage(_("-I-> BrowserDB::OnStartDB(%s) : End "),ODBCSource.c_str());
- }
- return TRUE;
+ //--------------------------------------------------------------------------------------
+ if (!Quiet)
+ {
+ Temp1 = db_BrowserDB->GetDatabaseName();
+ Temp2 = db_BrowserDB->GetDataSource();
+ wxLogMessage(_("-I-> BrowserDB::OnGetDataSourceODBC() - DatabaseName(%s) ; DataSource(%s)"),Temp1.c_str(),Temp2.c_str());
+ wxLogMessage(_("-I-> BrowserDB::OnStartDB(%s) : End - Time needed : %ld ms"),ODBCSource.c_str(),sw.Time());
+ }
+ return TRUE;
+ } else return FALSE;
}
-//--------------------------------------------------------------------------------------------
-bool BrowserDB::OnCloseDB(int Quite)
+//----------------------------------------------------------------------------------------
+bool BrowserDB::OnCloseDB(int Quiet)
{
- if (!Quite)
+ if (!Quiet)
wxLogMessage(_("-I-> BrowserDB::OnCloseDB() : Begin "));
if (db_BrowserDB)
{
db_BrowserDB->Close();
- FreeDbConnection(db_BrowserDB);
+ wxDbFreeConnection(db_BrowserDB);
// Free Environment Handle that ODBC uses
if (SQLFreeEnv(&ConnectInf.Henv) != SQL_SUCCESS)
}
db_BrowserDB = NULL;
}
- if (!Quite)
+ if (!Quiet)
wxLogMessage(_("\n-I-> BrowserDB::OnCloseDB() : End "));
return TRUE;
}
//----------------------------------------------------------------------------------------
-bool BrowserDB::OnGetNext(int Cols,int Quite)
+bool BrowserDB::OnGetNext(int Cols,int Quiet)
{
SDWORD cb;
int i_dbDataType;
switch(i_dbDataType)
{
case DB_DATA_TYPE_VARCHAR:
- strcpy(s_temp,"");
- if (!db_BrowserDB->GetData(i+1,(cl_BrowserDB->pColFor+i)->i_dbDataType,&s_temp,sizeof(s_temp), &cb))
- {
- Temp0.Printf(_("\n-E-> BrowserDB::OnGetNext - ODBC-Error with GetNext of >%s<.\n-E-> "),(cl_BrowserDB+i)->tableName);
- Temp0 += GetExtendedDBErrorMsg(__FILE__,__LINE__);
- wxLogMessage(Temp0);
- }
- Temp0.Printf((cl_BrowserDB->pColFor+i)->s_Field,s_temp);
- strcpy((cl_BrowserDB+i)->tableName,Temp0.c_str());
- break;
+ strcpy(s_temp,"");
+ if (!db_BrowserDB->GetData(i+1,(cl_BrowserDB->pColFor+i)->i_dbDataType,&s_temp,sizeof(s_temp), &cb))
+ {
+ Temp0.Printf(_("\n-E-> BrowserDB::OnGetNext - ODBC-Error with GetNext of >%s<.\n-E-> "),(cl_BrowserDB+i)->tableName);
+ Temp0 += GetExtendedDBErrorMsg(__FILE__,__LINE__);
+ wxLogMessage(Temp0);
+ }
+ Temp0.Printf((cl_BrowserDB->pColFor+i)->s_Field,s_temp);
+ strcpy((cl_BrowserDB+i)->tableName,Temp0.c_str());
+ break;
case DB_DATA_TYPE_INTEGER:
- l_temp = 0;
- if (!db_BrowserDB->GetData(i+1,(cl_BrowserDB->pColFor+i)->i_sqlDataType,&l_temp,sizeof(l_temp), &cb))
- {
- Temp0.Printf(_("\n-E-> BrowserDB::OnGetData - ODBC-Error with GetNext \n-E-> "));
- Temp0 += GetExtendedDBErrorMsg(__FILE__,__LINE__);
- }
- else
- {
- Temp0.Printf((cl_BrowserDB->pColFor+i)->s_Field,l_temp);
- strcpy((cl_BrowserDB+i)->tableName,Temp0.c_str());
- }
- break;
+ l_temp = 0;
+ if (!db_BrowserDB->GetData(i+1,(cl_BrowserDB->pColFor+i)->i_sqlDataType,&l_temp,sizeof(l_temp), &cb))
+ {
+ Temp0.Printf(_("\n-E-> BrowserDB::OnGetData - ODBC-Error with GetNext \n-E-> "));
+ Temp0 += GetExtendedDBErrorMsg(__FILE__,__LINE__);
+ }
+ else
+ {
+ Temp0.Printf((cl_BrowserDB->pColFor+i)->s_Field,l_temp);
+ strcpy((cl_BrowserDB+i)->tableName,Temp0.c_str());
+ }
+ break;
case DB_DATA_TYPE_FLOAT:
- f_temp = 0;
- if (!db_BrowserDB->GetData(i+1,(cl_BrowserDB->pColFor+i)->i_sqlDataType,&f_temp,sizeof(f_temp), &cb))
- {
- Temp0.Printf(_("\n-E-> BrowserDB::OnGetData - ODBC-Error with GetNext \n-E-> "));
- Temp0 += GetExtendedDBErrorMsg(__FILE__,__LINE__);
- wxMessageBox(Temp0);
- }
- else
- {
- Temp0.Printf((cl_BrowserDB->pColFor+i)->s_Field,f_temp);
- strcpy((cl_BrowserDB+i)->tableName,Temp0.c_str());
- }
- break;
+ f_temp = 0;
+ if (!db_BrowserDB->GetData(i+1,(cl_BrowserDB->pColFor+i)->i_sqlDataType,&f_temp,sizeof(f_temp), &cb))
+ {
+ Temp0.Printf(_("\n-E-> BrowserDB::OnGetData - ODBC-Error with GetNext \n-E-> "));
+ Temp0 += GetExtendedDBErrorMsg(__FILE__,__LINE__);
+ wxMessageBox(Temp0);
+ }
+ else
+ {
+ Temp0.Printf((cl_BrowserDB->pColFor+i)->s_Field,f_temp);
+ strcpy((cl_BrowserDB+i)->tableName,Temp0.c_str());
+ }
+ break;
case DB_DATA_TYPE_DATE:
- t_temp.day = t_temp.month = t_temp.year = t_temp.hour = t_temp.minute = t_temp.second = t_temp.fraction = 0;
- if (!db_BrowserDB->GetData(i+1,(cl_BrowserDB->pColFor+i)->i_sqlDataType,&t_temp,sizeof(t_temp), &cb))
- {
- Temp0.Printf(_("\n-E-> BrowserDB::OnGetData - ODBC-Error with GetNext \n-E-> "));
- Temp0 += GetExtendedDBErrorMsg(__FILE__,__LINE__);
- }
- else
- {
- // i_Nation = 0 = timestamp , 1=EU, 2=UK, 3=International, 4=US
- if (((cl_BrowserDB->pColFor+i)->i_Nation == 0) || // TS YYYY-MM-DD
- ((cl_BrowserDB->pColFor+i)->i_Nation == 3)) // IT YYYY-MM-DD
- {
- Temp0.Printf((cl_BrowserDB->pColFor+i)->s_Field,t_temp.year,t_temp.month,t_temp.day,
+ t_temp.day = t_temp.month = t_temp.year = t_temp.hour = t_temp.minute = t_temp.second = t_temp.fraction = 0;
+ if (!db_BrowserDB->GetData(i+1,(cl_BrowserDB->pColFor+i)->i_sqlDataType,&t_temp,sizeof(t_temp), &cb))
+ {
+ Temp0.Printf(_("\n-E-> BrowserDB::OnGetData - ODBC-Error with GetNext \n-E-> "));
+ Temp0 += GetExtendedDBErrorMsg(__FILE__,__LINE__);
+ }
+ else
+ {
+ // i_Nation = 0 = timestamp , 1=EU, 2=UK, 3=International, 4=US
+ if (((cl_BrowserDB->pColFor+i)->i_Nation == 0) || // TS YYYY-MM-DD
+ ((cl_BrowserDB->pColFor+i)->i_Nation == 3)) // IT YYYY-MM-DD
+ {
+ Temp0.Printf((cl_BrowserDB->pColFor+i)->s_Field,t_temp.year,t_temp.month,t_temp.day,
t_temp.hour, t_temp.minute, t_temp.second, t_temp.fraction);
- strcpy((cl_BrowserDB+i)->tableName,Temp0.c_str());
- }
- if ( ((cl_BrowserDB->pColFor+i)->i_Nation == 1) || // EU DD.MM.YYYY
- ((cl_BrowserDB->pColFor+i)->i_Nation == 2)) // UK DD/MM/YYYY
- {
- Temp0.Printf((cl_BrowserDB->pColFor+i)->s_Field,t_temp.day,t_temp.month,t_temp.year,
+ strcpy((cl_BrowserDB+i)->tableName,Temp0.c_str());
+ }
+ if (((cl_BrowserDB->pColFor+i)->i_Nation == 1) || // EU DD.MM.YYYY
+ ((cl_BrowserDB->pColFor+i)->i_Nation == 2)) // UK DD/MM/YYYY
+ {
+ Temp0.Printf((cl_BrowserDB->pColFor+i)->s_Field,t_temp.day,t_temp.month,t_temp.year,
t_temp.hour, t_temp.minute, t_temp.second, t_temp.fraction);
- strcpy((cl_BrowserDB+i)->tableName,Temp0.c_str());
- }
- if ((cl_BrowserDB->pColFor+i)->i_Nation == 3) // US MM/DD/YYYY
- {
- Temp0.Printf((cl_BrowserDB->pColFor+i)->s_Field,t_temp.month,t_temp.day,t_temp.year,
+ strcpy((cl_BrowserDB+i)->tableName,Temp0.c_str());
+ }
+ if ((cl_BrowserDB->pColFor+i)->i_Nation == 3) // US MM/DD/YYYY
+ {
+ Temp0.Printf((cl_BrowserDB->pColFor+i)->s_Field,t_temp.month,t_temp.day,t_temp.year,
t_temp.hour, t_temp.minute, t_temp.second, t_temp.fraction);
- strcpy((cl_BrowserDB+i)->tableName,Temp0.c_str());
- }
- }
- break;
+ strcpy((cl_BrowserDB+i)->tableName,Temp0.c_str());
+ }
+ }
+ break;
default:
- AnzError++;
- if (AnzError <= 100)
- {
- Temp0 = (cl_BrowserDB+i)->colName;
- wxLogMessage(_("-E-> BrowserDB::OnGetNext - DB_DATA_TYPE_?? (%d) in Col(%s)"),(cl_BrowserDB->pColFor+i)->i_dbDataType,Temp0.c_str());
- }
- else
- return TRUE;
- Temp0.Printf(_("-E-> unknown Format(%d) - sql(%d)"),(cl_BrowserDB->pColFor+i)->i_dbDataType,(cl_BrowserDB->pColFor+i)->i_sqlDataType);
- strcpy((cl_BrowserDB+i)->tableName,Temp0.c_str());
- break;
+ AnzError++;
+ if (AnzError <= 100)
+ {
+ Temp0 = (cl_BrowserDB+i)->colName;
+ wxLogMessage(_("-E-> BrowserDB::OnGetNext - DB_DATA_TYPE_?? (%d) in Col(%s)"),(cl_BrowserDB->pColFor+i)->i_dbDataType,Temp0.c_str());
+ }
+ else
+ return TRUE;
+ Temp0.Printf(_("-E-> unknown Format(%d) - sql(%d)"),(cl_BrowserDB->pColFor+i)->i_dbDataType,(cl_BrowserDB->pColFor+i)->i_sqlDataType);
+ strcpy((cl_BrowserDB+i)->tableName,Temp0.c_str());
+ break;
};
}
}
return TRUE;
}
//----------------------------------------------------------------------------------------
-bool BrowserDB::OnSelect(wxString tb_Name, int Quite)
+bool BrowserDB::OnSelect(wxString tb_Name, int Quiet)
{
+ wxStopWatch sw;
wxString SQLStmt;
i_Records = 0;
- //--------------------------------------------------------------------------
+ //---------------------------------------------------------------------------------------
SQLStmt.sprintf("SELECT * FROM %s",tb_Name.c_str());
if (!db_BrowserDB->ExecSql((char *)(SQLStmt.GetData())))
{
wxMessageBox("-E-> BrowserDB::OnSelect - GetData()");
return FALSE;
}
- //--------------------------------------------------------------------------
+ //---------------------------------------------------------------------------------------
while (db_BrowserDB->GetNext())
{
i_Records++;
}
- //--------------------------------------------------------------------------
+ //---------------------------------------------------------------------------------------
if (!db_BrowserDB->ExecSql((char *)(SQLStmt.GetData())))
{
Temp0.Printf(_("\n-E-> BrowserDB::OnSelect - ODBC-Error with ExecSql of >%s<.\n-E-> "),tb_Name.c_str());
wxLogMessage(Temp0);
return FALSE;
}
- //--------------------------------------------------------------------------
+ //---------------------------------------------------------------------------------------
// SetColDefs ( 0,"NAME", DB_DATA_TYPE_VARCHAR, Name, SQL_C_CHAR, sizeof(Name), TRUE, TRUE); // Primary index
- //--------------------------------------------------------------------------
- if (!Quite)
+ //---------------------------------------------------------------------------------------
+ if (!Quiet)
{
- wxLogMessage(_("\n-I-> BrowserDB::OnSelect(%s) Records(%d): End "),tb_Name.c_str(),i_Records);
+ wxLogMessage(_("\n-I-> BrowserDB::OnSelect(%s) Records(%d): End - Time needed : %ld ms"),tb_Name.c_str(),i_Records,sw.Time());
}
return TRUE;
}
//----------------------------------------------------------------------------------------
-bool BrowserDB::OnExecSql(wxString SQLStmt, int Quite)
+bool BrowserDB::OnExecSql(wxString SQLStmt, int Quiet)
{
- //--------------------------------------------------------------------------
+ //---------------------------------------------------------------------------------------
if (!db_BrowserDB->ExecSql((char *)(SQLStmt.GetData())))
{
Temp0.Printf(_("\n-E-> BrowserDB::OnExecSQL - ODBC-Error with ExecSql of >%s<.\n-E-> "),SQLStmt.c_str());
Temp0 += GetExtendedDBErrorMsg(__FILE__,__LINE__);
- if (!Quite)
+ if (!Quiet)
wxLogMessage(Temp0);
else
wxMessageBox("-E-> BrowserDB::OnExecSql - ExecSql()");
return FALSE;
}
- if (!Quite)
+ if (!Quiet)
{
- // wxLogMessage(_("\n-I-> BrowserDB::OnExecSql(%s) - End "),SQLStmt.c_str());
+ // wxLogMessage(_("\n-I-> BrowserDB::OnExecSql(%s) - End - Time needed : %ld ms"),SQLStmt.c_str(),sw.Time());
}
return TRUE;
}
//----------------------------------------------------------------------------------------
-wxDbInf* BrowserDB::OnGetCatalog(int Quite)
+wxDbInf* BrowserDB::OnGetCatalog(int Quiet)
{
char UName[255];
strcpy(UName,UserName);
return ct_BrowserDB;
}
//----------------------------------------------------------------------------------------
-wxColInf* BrowserDB::OnGetColumns(char *tableName, int numCols,int Quite)
+wxDbColInf* BrowserDB::OnGetColumns(char *tableName, int numCols, int Quiet)
{
char UName[255];
int i;
strcpy(UName,UserName);
cl_BrowserDB = db_BrowserDB->GetColumns(tableName,&numCols,UName);
- cl_BrowserDB->pColFor = new wxColFor[numCols];
+ cl_BrowserDB->pColFor = new wxDbColFor[numCols];
for (i=0;i<numCols;i++)
{
(cl_BrowserDB->pColFor+i)->Format(1,(cl_BrowserDB+i)->dbDataType,(cl_BrowserDB+i)->sqlDataType,
- (cl_BrowserDB+i)->columnSize, (cl_BrowserDB+i)->decimalDigits);
+ (cl_BrowserDB+i)->columnSize, (cl_BrowserDB+i)->decimalDigits);
}
return cl_BrowserDB;
}
{
db_BrowserDB->CommitTrans();
db_BrowserDB->Close();
- CloseDbConnections();
+ wxDbCloseConnections();
delete db_BrowserDB;
}
}