Adjusted demo to reflect class name changes
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_2_BRANCH@7052 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -90,9 +90,9 @@ BrowserDB::~BrowserDB()
|
|||||||
Zeiger_auf_NULL(1); // Clean up Tables and Databases (Commit, Close und delete)
|
Zeiger_auf_NULL(1); // Clean up Tables and Databases (Commit, Close und delete)
|
||||||
} // BrowserDB destructor
|
} // 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());
|
wxLogMessage(_("\n\n-E-> BrowserDB::OnStartDB(%s) : Failed ! "),ODBCSource.c_str());
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@@ -100,21 +100,21 @@ bool BrowserDB::Initialize(int Quite)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
} // BrowserDB:Initialize
|
} // BrowserDB:Initialize
|
||||||
//----------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------
|
||||||
bool BrowserDB::OnStartDB(int Quite)
|
bool BrowserDB::OnStartDB(int Quiet)
|
||||||
{
|
{
|
||||||
wxStopWatch sw;
|
wxStopWatch sw;
|
||||||
if (!Quite)
|
if (!Quiet)
|
||||||
wxLogMessage(_("\n-I-> BrowserDB::OnStartDB(%s) : Begin "),ODBCSource.c_str());
|
wxLogMessage(_("\n-I-> BrowserDB::OnStartDB(%s) : Begin "),ODBCSource.c_str());
|
||||||
if (db_BrowserDB != NULL)
|
if (db_BrowserDB != NULL)
|
||||||
{
|
{
|
||||||
if (!Quite)
|
if (!Quiet)
|
||||||
wxLogMessage(_("\n-I-> BrowserDB::OnStartDB() : DB is allready open."));
|
wxLogMessage(_("\n-I-> BrowserDB::OnStartDB() : DB is allready open."));
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
// Initialize the ODBC Environment for Database Operations
|
// Initialize the ODBC Environment for Database Operations
|
||||||
if (SQLAllocEnv(&ConnectInf.Henv) != SQL_SUCCESS)
|
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"));
|
wxLogMessage(_("\n-E-> BrowserDB::OnStartDB() : DB CONNECTION ERROR : A problem occured while trying to get a connection to the data source"));
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@@ -152,7 +152,7 @@ bool BrowserDB::OnStartDB(int Quite)
|
|||||||
strcpy(ConnectInf.Dsn, "");
|
strcpy(ConnectInf.Dsn, "");
|
||||||
strcpy(ConnectInf.Uid, "");
|
strcpy(ConnectInf.Uid, "");
|
||||||
strcpy(ConnectInf.AuthStr, "");
|
strcpy(ConnectInf.AuthStr, "");
|
||||||
if (!Quite)
|
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(_("\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());
|
wxLogMessage(_("-I-> BrowserDB::OnStartDB(%s) : End - Time needed : %ld ms"),ODBCSource.c_str(),sw.Time());
|
||||||
@@ -160,7 +160,7 @@ bool BrowserDB::OnStartDB(int Quite)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
if (!Quite)
|
if (!Quiet)
|
||||||
{
|
{
|
||||||
Temp1 = db_BrowserDB->GetDatabaseName();
|
Temp1 = db_BrowserDB->GetDatabaseName();
|
||||||
Temp2 = db_BrowserDB->GetDataSource();
|
Temp2 = db_BrowserDB->GetDataSource();
|
||||||
@@ -171,9 +171,9 @@ bool BrowserDB::OnStartDB(int Quite)
|
|||||||
} else return FALSE;
|
} else return FALSE;
|
||||||
}
|
}
|
||||||
//----------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------
|
||||||
bool BrowserDB::OnCloseDB(int Quite)
|
bool BrowserDB::OnCloseDB(int Quiet)
|
||||||
{
|
{
|
||||||
if (!Quite)
|
if (!Quiet)
|
||||||
wxLogMessage(_("-I-> BrowserDB::OnCloseDB() : Begin "));
|
wxLogMessage(_("-I-> BrowserDB::OnCloseDB() : Begin "));
|
||||||
if (db_BrowserDB)
|
if (db_BrowserDB)
|
||||||
{
|
{
|
||||||
@@ -187,12 +187,12 @@ bool BrowserDB::OnCloseDB(int Quite)
|
|||||||
}
|
}
|
||||||
db_BrowserDB = NULL;
|
db_BrowserDB = NULL;
|
||||||
}
|
}
|
||||||
if (!Quite)
|
if (!Quiet)
|
||||||
wxLogMessage(_("\n-I-> BrowserDB::OnCloseDB() : End "));
|
wxLogMessage(_("\n-I-> BrowserDB::OnCloseDB() : End "));
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
//----------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------
|
||||||
bool BrowserDB::OnGetNext(int Cols,int Quite)
|
bool BrowserDB::OnGetNext(int Cols,int Quiet)
|
||||||
{
|
{
|
||||||
SDWORD cb;
|
SDWORD cb;
|
||||||
int i_dbDataType;
|
int i_dbDataType;
|
||||||
@@ -326,7 +326,7 @@ bool BrowserDB::OnGetNext(int Cols,int Quite)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
//----------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------
|
||||||
bool BrowserDB::OnSelect(wxString tb_Name, int Quite)
|
bool BrowserDB::OnSelect(wxString tb_Name, int Quiet)
|
||||||
{
|
{
|
||||||
wxStopWatch sw;
|
wxStopWatch sw;
|
||||||
wxString SQLStmt;
|
wxString SQLStmt;
|
||||||
@@ -357,34 +357,34 @@ bool BrowserDB::OnSelect(wxString tb_Name, int Quite)
|
|||||||
//---------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------
|
||||||
// SetColDefs ( 0,"NAME", DB_DATA_TYPE_VARCHAR, Name, SQL_C_CHAR, sizeof(Name), TRUE, TRUE); // Primary index
|
// 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 - Time needed : %ld ms"),tb_Name.c_str(),i_Records,sw.Time());
|
wxLogMessage(_("\n-I-> BrowserDB::OnSelect(%s) Records(%d): End - Time needed : %ld ms"),tb_Name.c_str(),i_Records,sw.Time());
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
//----------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------
|
||||||
bool BrowserDB::OnExecSql(wxString SQLStmt, int Quite)
|
bool BrowserDB::OnExecSql(wxString SQLStmt, int Quiet)
|
||||||
{
|
{
|
||||||
//---------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------
|
||||||
if (!db_BrowserDB->ExecSql((char *)(SQLStmt.GetData())))
|
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.Printf(_("\n-E-> BrowserDB::OnExecSQL - ODBC-Error with ExecSql of >%s<.\n-E-> "),SQLStmt.c_str());
|
||||||
Temp0 += GetExtendedDBErrorMsg(__FILE__,__LINE__);
|
Temp0 += GetExtendedDBErrorMsg(__FILE__,__LINE__);
|
||||||
if (!Quite)
|
if (!Quiet)
|
||||||
wxLogMessage(Temp0);
|
wxLogMessage(Temp0);
|
||||||
else
|
else
|
||||||
wxMessageBox("-E-> BrowserDB::OnExecSql - ExecSql()");
|
wxMessageBox("-E-> BrowserDB::OnExecSql - ExecSql()");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
if (!Quite)
|
if (!Quiet)
|
||||||
{
|
{
|
||||||
// wxLogMessage(_("\n-I-> BrowserDB::OnExecSql(%s) - End - Time needed : %ld ms"),SQLStmt.c_str(),sw.Time());
|
// wxLogMessage(_("\n-I-> BrowserDB::OnExecSql(%s) - End - Time needed : %ld ms"),SQLStmt.c_str(),sw.Time());
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
//----------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------
|
||||||
wxDbInf* BrowserDB::OnGetCatalog(int Quite)
|
wxDbInf* BrowserDB::OnGetCatalog(int Quiet)
|
||||||
{
|
{
|
||||||
char UName[255];
|
char UName[255];
|
||||||
strcpy(UName,UserName);
|
strcpy(UName,UserName);
|
||||||
@@ -392,13 +392,13 @@ wxDbInf* BrowserDB::OnGetCatalog(int Quite)
|
|||||||
return ct_BrowserDB;
|
return ct_BrowserDB;
|
||||||
}
|
}
|
||||||
//----------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------
|
||||||
wxColInf* BrowserDB::OnGetColumns(char *tableName, int numCols,int Quite)
|
wxDbColInf* BrowserDB::OnGetColumns(char *tableName, int numCols, int Quiet)
|
||||||
{
|
{
|
||||||
char UName[255];
|
char UName[255];
|
||||||
int i;
|
int i;
|
||||||
strcpy(UName,UserName);
|
strcpy(UName,UserName);
|
||||||
cl_BrowserDB = db_BrowserDB->GetColumns(tableName,&numCols,UName);
|
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++)
|
for (i=0;i<numCols;i++)
|
||||||
{
|
{
|
||||||
(cl_BrowserDB->pColFor+i)->Format(1,(cl_BrowserDB+i)->dbDataType,(cl_BrowserDB+i)->sqlDataType,
|
(cl_BrowserDB->pColFor+i)->Format(1,(cl_BrowserDB+i)->dbDataType,(cl_BrowserDB+i)->sqlDataType,
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
//----------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------
|
||||||
// Name: browsedb.h
|
// Name: browsedb.h
|
||||||
// Purpose: a wxDB class
|
// Purpose: a wxDb class
|
||||||
// Author: Mark Johnson, mj10777@gmx.net
|
// Author: Mark Johnson, mj10777@gmx.net
|
||||||
// Modified by:
|
// Modified by:
|
||||||
// Created: 19991127.mj10777
|
// Created: 19991127.mj10777
|
||||||
@@ -26,24 +26,24 @@ class BrowserDB
|
|||||||
// for user login names and passwords, getting workstation settings, etc.
|
// for user login names and passwords, getting workstation settings, etc.
|
||||||
// ---> IMPORTANT <---
|
// ---> IMPORTANT <---
|
||||||
//
|
//
|
||||||
// For each database object created which uses this wxDB pointer
|
// For each database object created which uses this wxDb pointer
|
||||||
// connection to the database, when a CommitTrans() or RollBackTrans()
|
// connection to the database, when a CommitTrans() or RollBackTrans()
|
||||||
// will commit or rollback EVERY object which uses this wxDB pointer.
|
// will commit or rollback EVERY object which uses this wxDb pointer.
|
||||||
//
|
//
|
||||||
// To allow each table object (those derived from wxTable) to be
|
// To allow each table object (those derived from wxDbTable) to be
|
||||||
// individually committed or rolled back, you MUST use a different
|
// individually committed or rolled back, you MUST use a different
|
||||||
// instance of wxDB in the constructor of the table. Doing so creates
|
// instance of wxDb in the constructor of the table. Doing so creates
|
||||||
// more overhead, and will use more database connections (some DBs have
|
// more overhead, and will use more database connections (some DBs have
|
||||||
// connection limits...), so use connections sparringly.
|
// connection limits...), so use connections sparringly.
|
||||||
//
|
//
|
||||||
// It is recommended that one "main" database connection be created for
|
// It is recommended that one "main" database connection be created for
|
||||||
// the entire program to use for READ-ONLY database accesses, but for each
|
// the entire program to use for READ-ONLY database accesses, but for each
|
||||||
// table object which will do a CommitTrans() or RollbackTrans() that a
|
// table object which will do a CommitTrans() or RollbackTrans() that a
|
||||||
// new wxDB object be created and used for it.
|
// new wxDb object be created and used for it.
|
||||||
//---------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------
|
||||||
wxDB* db_BrowserDB;
|
wxDb* db_BrowserDB;
|
||||||
wxDbInf* ct_BrowserDB;
|
wxDbInf* ct_BrowserDB;
|
||||||
wxColInf* cl_BrowserDB;
|
wxDbColInf* cl_BrowserDB;
|
||||||
wxString ODBCSource, UserName, Password;
|
wxString ODBCSource, UserName, Password;
|
||||||
MainDoc *pDoc;
|
MainDoc *pDoc;
|
||||||
//---------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------
|
||||||
@@ -61,15 +61,15 @@ class BrowserDB
|
|||||||
BrowserDB();
|
BrowserDB();
|
||||||
~BrowserDB();
|
~BrowserDB();
|
||||||
void Zeiger_auf_NULL(int Art);
|
void Zeiger_auf_NULL(int Art);
|
||||||
bool Initialize(int Quite);
|
bool Initialize(int Quiet);
|
||||||
//---------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------
|
||||||
bool OnStartDB(int Quite);
|
bool OnStartDB(int Quiet);
|
||||||
bool OnCloseDB(int Quite);
|
bool OnCloseDB(int Quiet);
|
||||||
bool OnSelect(wxString tb_Name,int Quite);
|
bool OnSelect(wxString tb_Name,int Quiet);
|
||||||
bool OnExecSql(wxString SQLStmt,int Quite);
|
bool OnExecSql(wxString SQLStmt,int Quiet);
|
||||||
bool OnGetNext(int Cols,int Quite);
|
bool OnGetNext(int Cols,int Quiet);
|
||||||
wxDbInf* OnGetCatalog(int Quite);
|
wxDbInf* OnGetCatalog(int Quiet);
|
||||||
wxColInf* OnGetColumns(char *tableName, int numCols,int Quite);
|
wxDbColInf* OnGetColumns(char *tableName, int numCols,int Quiet);
|
||||||
void OnFillSqlTyp();
|
void OnFillSqlTyp();
|
||||||
void OnFilldbTyp();
|
void OnFilldbTyp();
|
||||||
//---------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------
|
||||||
|
Reference in New Issue
Block a user