This commit was manufactured by cvs2svn to create tag 'WX_2_2_9'.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/tags/WX_2_2_9@13364 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Bryan Petty
2002-01-04 16:15:08 +00:00
parent dc3d889d0b
commit f7f6abe24d
2324 changed files with 375095 additions and 121526 deletions

203
samples/db/DbVC.dsp Normal file
View File

@@ -0,0 +1,203 @@
# Microsoft Developer Studio Project File - Name="DbVC" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Application" 0x0101
CFG=DbVC - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "DbVC.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "DbVC.mak" CFG="DbVC - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "DbVC - Win32 Release" (based on "Win32 (x86) Application")
!MESSAGE "DbVC - Win32 Debug" (based on "Win32 (x86) Application")
!MESSAGE "DbVC - Win32 Debug DLL" (based on "Win32 (x86) Application")
!MESSAGE "DbVC - Win32 Release DLL" (based on "Win32 (x86) Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
MTL=midl.exe
RSC=rc.exe
!IF "$(CFG)" == "DbVC - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
# ADD CPP /nologo /MD /W3 /GX /O1 /Ob2 /I "../../include" /I "../../contrib/include" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "__WINDOWS__" /D "__WXMSW__" /D "__WIN95__" /D "__WIN32__" /D WINVER=0x0400 /D "STRICT" /FD /c
# SUBTRACT CPP /YX
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
# ADD BASE RSC /l 0x809 /d "NDEBUG"
# ADD RSC /l 0x809 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib winmm.lib /nologo /subsystem:windows /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib rpcrt4.lib wsock32.lib winmm.lib wx.lib xpm.lib png.lib zlib.lib jpeg.lib tiff.lib /nologo /subsystem:windows /machine:I386 /nodefaultlib:"libc.lib" /nodefaultlib:"libci.lib" /nodefaultlib:"msvcrtd.lib" /out:"Release/dbtest.exe" /libpath:"../../lib" /libpath:"../../contrib/lib"
!ELSEIF "$(CFG)" == "DbVC - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "../../include" /I "../../contrib/include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "__WINDOWS__" /D "__WXMSW__" /D DEBUG=1 /D "__WXDEBUG__" /D "__WIN95__" /D "__WIN32__" /D WINVER=0x0400 /D "STRICT" /Yu"wx/wxprec.h" /FD /c
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32
# ADD BASE RSC /l 0x809 /d "_DEBUG"
# ADD RSC /l 0x809 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib winmm.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib rpcrt4.lib wsock32.lib winmm.lib wxd.lib xpmd.lib pngd.lib zlibd.lib jpegd.lib tiffd.lib /nologo /subsystem:windows /debug /machine:I386 /nodefaultlib:"libcd.lib" /nodefaultlib:"libcid.lib" /nodefaultlib:"msvcrt.lib" /out:"Debug/dbtest.exe" /pdbtype:sept /libpath:"../../lib" /libpath:"../../contrib/lib"
!ELSEIF "$(CFG)" == "DbVC - Win32 Debug DLL"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "DebugDLL"
# PROP BASE Intermediate_Dir "DebugDLL"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "DebugDLL"
# PROP Intermediate_Dir "DebugDLL"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "../../include" /I "../../contrib/include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "__WINDOWS__" /D "__WXMSW__" /D DEBUG=1 /D "__WXDEBUG__" /D "__WIN95__" /D "__WIN32__" /D WINVER=0x0400 /D "STRICT" /D WXUSINGDLL=1 /Yu"wx/wxprec.h" /FD /c
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32
# ADD BASE RSC /l 0x809 /d "_DEBUG"
# ADD RSC /l 0x809 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib winmm.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib rpcrt4.lib wsock32.lib winmm.lib wx22_9d.lib /nologo /subsystem:windows /debug /machine:I386 /nodefaultlib:"libcd.lib" /nodefaultlib:"libcid.lib" /out:"DebugDLL/dbtest.exe" /pdbtype:sept /libpath:"../../lib" /libpath:"../../contrib/lib"
!ELSEIF "$(CFG)" == "DbVC - Win32 Release DLL"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "ReleaseDLL"
# PROP BASE Intermediate_Dir "ReleaseDLL"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "ReleaseDLL"
# PROP Intermediate_Dir "ReleaseDLL"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
# ADD CPP /nologo /MD /W3 /GX /O1 /Ob2 /I "../../include" /I "../../contrib/include" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "__WINDOWS__" /D "__WXMSW__" /D "__WIN95__" /D "__WIN32__" /D WINVER=0x0400 /D "STRICT" /D WXUSINGDLL=1 /FD /c
# SUBTRACT CPP /YX
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
# ADD BASE RSC /l 0x809 /d "NDEBUG"
# ADD RSC /l 0x809 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib winmm.lib /nologo /subsystem:windows /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib rpcrt4.lib wsock32.lib winmm.lib wx22_9.lib /nologo /subsystem:windows /machine:I386 /nodefaultlib:"libc.lib" /nodefaultlib:"libci.lib" /out:"ReleaseDLL/dbtest.exe" /libpath:"../../lib" /libpath:"../../contrib/lib"
!ENDIF
# Begin Target
# Name "DbVC - Win32 Release"
# Name "DbVC - Win32 Debug"
# Name "DbVC - Win32 Debug DLL"
# Name "DbVC - Win32 Release DLL"
# Begin Source File
SOURCE=.\dbtest.cpp
!IF "$(CFG)" == "DbVC - Win32 Release"
!ELSEIF "$(CFG)" == "DbVC - Win32 Debug"
# SUBTRACT CPP /YX /Yc /Yu
!ELSEIF "$(CFG)" == "DbVC - Win32 Debug DLL"
# SUBTRACT BASE CPP /YX /Yc /Yu
# SUBTRACT CPP /YX /Yc /Yu
!ELSEIF "$(CFG)" == "DbVC - Win32 Release DLL"
!ENDIF
# End Source File
# Begin Source File
SOURCE=.\dbtest.h
# End Source File
# Begin Source File
SOURCE=.\dbtest.rc
# ADD BASE RSC /l 0x809
# ADD RSC /l 0x809 /i "../../include" /i "../../contrib/include"
# End Source File
# Begin Source File
SOURCE=.\listdb.cpp
!IF "$(CFG)" == "DbVC - Win32 Release"
!ELSEIF "$(CFG)" == "DbVC - Win32 Debug"
# SUBTRACT CPP /YX /Yc /Yu
!ELSEIF "$(CFG)" == "DbVC - Win32 Debug DLL"
# SUBTRACT BASE CPP /YX /Yc /Yu
# SUBTRACT CPP /YX /Yc /Yu
!ELSEIF "$(CFG)" == "DbVC - Win32 Release DLL"
!ENDIF
# End Source File
# Begin Source File
SOURCE=.\listdb.h
# End Source File
# End Target
# End Project

29
samples/db/DbVC.dsw Normal file
View File

@@ -0,0 +1,29 @@
Microsoft Developer Studio Workspace File, Format Version 5.00
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
###############################################################################
Project: "DbVC"=.\DbVC.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Global:
Package=<5>
{{{
}}}
Package=<3>
{{{
}}}
###############################################################################

File diff suppressed because it is too large Load Diff

View File

@@ -20,9 +20,11 @@
enum DialogModes {mView,mCreate,mEdit,mSearch};
// ID for the menu quit command
#define FILE_CREATE 100
#define FILE_EXIT 199
#define EDIT_PARAMETERS 200
#define FILE_CREATE 100
#define FILE_RECREATE_TABLE 110
#define FILE_RECREATE_INDEXES 120
#define FILE_EXIT 199
#define EDIT_PARAMETERS 200
#define ABOUT_DEMO 300
// this seems to be missing, Robert Roebling (?)
@@ -74,9 +76,9 @@ class CstructContact : public wxObject
//
// NOTE: Ccontact inherits wxTable, which gives access to all the database functionality
// NOTE: Ccontact inherits wxDbTable, which gives access to all the database functionality
//
class Ccontact : public wxTable, public CstructContact
class Ccontact : public wxDbTable, public CstructContact
{
private:
bool freeDbConn;
@@ -86,7 +88,7 @@ class Ccontact : public wxTable, public CstructContact
wxString whereStr;
wxString qryWhereStr; // Where string returned from the query dialog
Ccontact(wxDB *pwxDB=NULL);
Ccontact(wxDb *pwxDb=NULL);
~Ccontact();
void Initialize();
@@ -129,11 +131,13 @@ class DatabaseDemoFrame: public wxFrame
void OnCloseWindow(wxCloseEvent& event);
void OnCreate(wxCommandEvent& event);
void OnRecreateTable(wxCommandEvent& event);
void OnRecreateIndexes(wxCommandEvent& event);
void OnExit(wxCommandEvent& event);
void OnEditParameters(wxCommandEvent& event);
void OnAbout(wxCommandEvent& event);
void CreateDataTable();
void CreateDataTable(bool recreate);
void BuildEditorDialog();
void BuildParameterDialog(wxWindow *parent);
@@ -147,8 +151,8 @@ DECLARE_EVENT_TABLE()
class CeditorDlg : public wxPanel
{
private:
bool widgetPtrsSet;
wxString saveName;
bool widgetPtrsSet;
wxString saveName;
// Pointers to all widgets on the dialog
wxButton *pCreateBtn, *pEditBtn, *pDeleteBtn, *pCopyBtn, *pSaveBtn, *pCancelBtn;
@@ -163,8 +167,9 @@ class CeditorDlg : public wxPanel
wxStaticText *pNativeLangMsg;
public:
enum DialogModes mode;
Ccontact *Contact; // this is the table object that will be being manipulated
bool initialized;
enum DialogModes mode;
Ccontact *Contact; // this is the table object that will be being manipulated
CeditorDlg(wxWindow *parent);
@@ -173,6 +178,7 @@ class CeditorDlg : public wxPanel
void OnCommand(wxWindow& win, wxCommandEvent& event);
void OnActivate(bool) {}; // necessary for hot keys
bool Initialize();
void FieldsEditable();
void SetMode(enum DialogModes m);
bool PutData();
@@ -307,11 +313,11 @@ char * const langQRY_BETWEEN = "column BETWEEN value AND value";
class CqueryDlg : public wxDialog
{
private:
wxColInf *colInf; // Column inf. returned by db->GetColumns()
wxTable *dbTable;
wxDbColInf *colInf; // Column inf. returned by db->GetColumns()
wxDbTable *dbTable;
char *masterTableName;
char *pWhere; // A pointer to the storage for the resulting where clause
wxDB *pDB;
wxDb *pDB;
public:
bool widgetPtrsSet;
@@ -343,9 +349,9 @@ class CqueryDlg : public wxDialog
wxStaticBox *pQueryHintGrp;
wxStaticText *pQueryHintMsg;
wxTextCtrl *pFocusTxt;
wxTextCtrl *pFocusTxt;
CqueryDlg(wxWindow *parent, wxDB *pDb, char *tblName[], char *pWhereArg);
CqueryDlg(wxWindow *parent, wxDb *pDb, char *tblName[], char *pWhereArg);
~CqueryDlg();
void OnButton( wxCommandEvent &event );

View File

@@ -30,7 +30,7 @@
data table/object for building the list.
The data table record access is all handled through the routines
in this module, interfacing with the methods defined in wxTable.
in this module, interfacing with the methods defined in wxDbTable.
All objects which use data table access must be initialized and
have opened the table prior to passing them in the dialog
@@ -64,7 +64,7 @@ extern wxDbList WXDLLEXPORT *PtrBegDbList; /* from db.cpp, used in getting ba
extern wxDbConnectInf DbConnectInf;
// Global database connection
extern wxDB *READONLY_DB;
extern wxDb *READONLY_DB;
// Used for passing the selected listbox selection back to the calling
@@ -93,9 +93,10 @@ const int LISTDB_NO_SPACES_BETWEEN_COLS = 3;
* NOTE: The value returned by this function is for temporary use only and
* should be copied for long term use
*/
char *GetExtendedDBErrorMsg2(char *ErrFile, int ErrLine)
const char *GetExtendedDBErrorMsg2(char *ErrFile, int ErrLine)
{
static wxString msg;
msg = "";
wxString tStr;
@@ -105,7 +106,7 @@ char *GetExtendedDBErrorMsg2(char *ErrFile, int ErrLine)
msg += ErrFile;
msg += " Line: ";
tStr.Printf("%d",ErrLine);
msg += tStr.GetData();
msg += tStr.c_str();
msg += "\n";
}
@@ -126,20 +127,23 @@ char *GetExtendedDBErrorMsg2(char *ErrFile, int ErrLine)
if (pDbList->PtrDb->errorList[i])
{
msg.Append(pDbList->PtrDb->errorList[i]);
if (strcmp(pDbList->PtrDb->errorList[i],"") != 0)
if (wxStrcmp(pDbList->PtrDb->errorList[i],"") != 0)
msg.Append("\n");
// Clear the errmsg buffer so the next error will not
// end up showing the previous error that have occurred
wxStrcpy(pDbList->PtrDb->errorList[i],"");
}
}
}
msg += "\n";
return (char*) (const char*) msg;
return /*(char*) (const char*) msg*/msg.c_str();
} // GetExtendedDBErrorMsg
// Clookup constructor
Clookup::Clookup(char *tblName, char *colName) : wxTable(READONLY_DB, tblName, 1, NULL, !QUERY_ONLY, DbConnectInf.defaultDir)
Clookup::Clookup(char *tblName, char *colName) : wxDbTable(READONLY_DB, tblName, 1, NULL, !wxDB_QUERY_ONLY, DbConnectInf.defaultDir)
{
SetColDefs (0, colName, DB_DATA_TYPE_VARCHAR, lookupCol, SQL_C_CHAR, LOOKUP_COL_LEN+1, FALSE, FALSE);
@@ -148,14 +152,14 @@ Clookup::Clookup(char *tblName, char *colName) : wxTable(READONLY_DB, tblName, 1
// Clookup2 constructor
Clookup2::Clookup2(char *tblName, char *colName1, char *colName2, wxDB *pDb)
: wxTable(pDb, tblName, (1 + (strlen(colName2) > 0)), NULL, !QUERY_ONLY, DbConnectInf.defaultDir)
Clookup2::Clookup2(char *tblName, char *colName1, char *colName2, wxDb *pDb)
: wxDbTable(pDb, tblName, (1 + (wxStrlen(colName2) > 0)), NULL, !wxDB_QUERY_ONLY, DbConnectInf.defaultDir)
{
int i = 0;
SetColDefs (i, colName1, DB_DATA_TYPE_VARCHAR, lookupCol1, SQL_C_CHAR, LOOKUP_COL_LEN+1, FALSE, FALSE);
if (strlen(colName2) > 0)
if (wxStrlen(colName2) > 0)
SetColDefs (++i, colName2, DB_DATA_TYPE_VARCHAR, lookupCol2, SQL_C_CHAR, LOOKUP_COL_LEN+1, FALSE, FALSE);
} // Clookup2()
@@ -174,7 +178,7 @@ ClookUpDlg::ClookUpDlg(wxWindow *parent, char *windowTitle, char *tableName, cha
{
wxBeginBusyCursor();
strcpy(ListDB_Selection,"");
wxStrcpy(ListDB_Selection,"");
widgetPtrsSet = FALSE;
lookup = 0;
lookup2 = 0;
@@ -204,8 +208,8 @@ ClookUpDlg::ClookUpDlg(wxWindow *parent, char *windowTitle, char *tableName, cha
return;
}
lookup->orderBy = orderBy;
lookup->where = where;
lookup->SetOrderByClause(orderBy);
lookup->SetWhereClause(where);
if (!lookup->Query())
{
wxMessageBox("ODBC error during Query()","ODBC Error...");
@@ -264,16 +268,16 @@ ClookUpDlg::ClookUpDlg(wxWindow *parent, char *windowTitle, char *tableName, cha
//
ClookUpDlg::ClookUpDlg(wxWindow *parent, char *windowTitle, char *tableName,
char *dispCol1, char *dispCol2, char *where, char *orderBy, bool distinctValues,
char *selectStmt, int maxLenCol1, wxDB *pDb, bool allowOk) : wxDialog (parent, LOOKUP_DIALOG, "Select...", wxPoint(-1, -1), wxSize(400, 290))
char *selectStmt, int maxLenCol1, wxDb *pDb, bool allowOk) : wxDialog (parent, LOOKUP_DIALOG, "Select...", wxPoint(-1, -1), wxSize(400, 290))
{
wxBeginBusyCursor();
strcpy(ListDB_Selection,"");
strcpy(ListDB_Selection2,"");
wxStrcpy(ListDB_Selection,"");
wxStrcpy(ListDB_Selection2,"");
widgetPtrsSet = FALSE;
lookup = 0;
lookup2 = 0;
noDisplayCols = (strlen(dispCol2) ? 2 : 1);
noDisplayCols = (wxStrlen(dispCol2) ? 2 : 1);
col1Len = 0;
wxFont fixedFont(12,wxMODERN,wxNORMAL,wxNORMAL);
@@ -314,14 +318,14 @@ ClookUpDlg::ClookUpDlg(wxWindow *parent, char *windowTitle, char *tableName,
else
{
maxColLen = LOOKUP_COL_LEN;
if (strlen(dispCol2))
if (wxStrlen(dispCol2))
{
wxString q = "SELECT MAX({fn LENGTH(";
q += dispCol1;
q += ")}), NULL";
q += " FROM ";
q += tableName;
if (strlen(where))
if (wxStrlen(where))
{
q += " WHERE ";
q += where;
@@ -340,7 +344,7 @@ ClookUpDlg::ClookUpDlg(wxWindow *parent, char *windowTitle, char *tableName,
}
// Query the actual record set
if (selectStmt && strlen(selectStmt)) // Query by sql stmt passed in
if (selectStmt && wxStrlen(selectStmt)) // Query by sql stmt passed in
{
if (!lookup2->QueryBySqlStmt(selectStmt))
{
@@ -351,8 +355,8 @@ ClookUpDlg::ClookUpDlg(wxWindow *parent, char *windowTitle, char *tableName,
}
else // Query using where and order by clauses
{
lookup2->orderBy = orderBy;
lookup2->where = where;
lookup2->SetOrderByClause(orderBy);
lookup2->SetWhereClause(where);
if (!lookup2->Query(FALSE, distinctValues))
{
wxMessageBox("ODBC error during Query()","ODBC Error...");
@@ -366,9 +370,9 @@ ClookUpDlg::ClookUpDlg(wxWindow *parent, char *windowTitle, char *tableName,
while (lookup2->GetNext())
{
s = lookup2->lookupCol1;
if (strlen(dispCol2)) // Append the optional column 2
if (wxStrlen(dispCol2)) // Append the optional column 2
{
s.Append(' ', (maxColLen + LISTDB_NO_SPACES_BETWEEN_COLS - strlen(lookup2->lookupCol1)));
s.Append(' ', (maxColLen + LISTDB_NO_SPACES_BETWEEN_COLS - wxStrlen(lookup2->lookupCol1)));
s.Append(lookup2->lookupCol2);
}
pLookUpSelectList->Append(s);
@@ -407,8 +411,10 @@ void ClookUpDlg::OnClose(wxCloseEvent& event)
if (lookup2)
delete lookup2;
SetReturnCode(1);
while (wxIsBusy()) wxEndBusyCursor();
event.Skip();
event.Skip();
// return TRUE;
@@ -434,25 +440,25 @@ void ClookUpDlg::OnCommand(wxWindow& win, wxCommandEvent& event)
if (pLookUpSelectList->GetSelection() != -1)
{
if (noDisplayCols == 1)
strcpy (ListDB_Selection, pLookUpSelectList->GetStringSelection());
wxStrcpy (ListDB_Selection, pLookUpSelectList->GetStringSelection());
else // 2 display columns
{
wxString s = pLookUpSelectList->GetStringSelection();
// Column 1
s = s.SubString(0, col1Len-1);
s = s.Strip();
strcpy(ListDB_Selection, s);
wxStrcpy(ListDB_Selection, s);
// Column 2
s = pLookUpSelectList->GetStringSelection();
s = s.Mid(col1Len + LISTDB_NO_SPACES_BETWEEN_COLS);
s = s.Strip();
strcpy(ListDB_Selection2, s);
wxStrcpy(ListDB_Selection2, s);
}
}
else
{
strcpy(ListDB_Selection,"");
strcpy(ListDB_Selection2,"");
wxStrcpy(ListDB_Selection,"");
wxStrcpy(ListDB_Selection2,"");
}
Close();
} // OK Button
@@ -460,8 +466,8 @@ void ClookUpDlg::OnCommand(wxWindow& win, wxCommandEvent& event)
// Cancel Button
if (widgetName == pLookUpCancelBtn->GetName())
{
strcpy (ListDB_Selection,"");
strcpy (ListDB_Selection2,"");
wxStrcpy (ListDB_Selection,"");
wxStrcpy (ListDB_Selection2,"");
Close();
} // Cancel Button
}

View File

@@ -26,10 +26,10 @@
const int LOOKUP_COL_LEN = 250;
// Global database connection
extern wxDB *READONLY_DB;
extern wxDb *READONLY_DB;
// Clookup class
class Clookup : public wxTable
class Clookup : public wxDbTable
{
public:
@@ -40,14 +40,14 @@ class Clookup : public wxTable
}; // Clookup
// Clookup2 class
class Clookup2 : public wxTable
class Clookup2 : public wxDbTable
{
public:
char lookupCol1[LOOKUP_COL_LEN+1];
char lookupCol2[LOOKUP_COL_LEN+1];
Clookup2(char *tblName, char *colName1, char *colName2, wxDB *pDb);
Clookup2(char *tblName, char *colName1, char *colName2, wxDb *pDb);
}; // Clookup2
@@ -109,7 +109,7 @@ class ClookUpDlg : public wxDialog
bool distinctValues, // e.g. SELECT DISTINCT ...
char *selectStmt = 0, // If you wish to query by SQLstmt (complicated lookups)
int maxLenCol1 = 0, // Mandatory if querying by SQLstmt
wxDB *pDb = READONLY_DB, // Database connection pointer
wxDb *pDb = READONLY_DB, // Database connection pointer
bool allowOk = TRUE); // is the OK button enabled
void OnButton( wxCommandEvent &event );