1998-07-28 05:43:44 -04:00
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: dbtest.h
|
2004-05-25 07:20:37 -04:00
|
|
|
// Purpose: wxWidgets database demo app
|
1998-07-28 05:43:44 -04:00
|
|
|
// Author: George Tasker
|
|
|
|
// Modified by:
|
|
|
|
// Created: 1998
|
|
|
|
// RCS-ID: $Id$
|
|
|
|
// Copyright: (c) 1998 Remstar International, Inc.
|
|
|
|
// Licence: wxWindows licence
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2003-06-24 16:00:40 -04:00
|
|
|
#if defined(__GNUG__) && !defined(__APPLE__)
|
1998-07-28 05:43:44 -04:00
|
|
|
#pragma interface "dbtest.h"
|
1998-12-30 12:40:53 -05:00
|
|
|
#endif
|
1998-07-28 05:43:44 -04:00
|
|
|
|
2002-08-31 18:36:13 -04:00
|
|
|
#include "wx/string.h"
|
|
|
|
#include "wx/dbtable.h"
|
1998-07-28 05:43:44 -04:00
|
|
|
|
2000-01-25 11:18:40 -05:00
|
|
|
enum DialogModes {mView,mCreate,mEdit,mSearch};
|
1998-07-28 05:43:44 -04:00
|
|
|
|
|
|
|
// ID for the menu quit command
|
2004-02-08 06:53:48 -05:00
|
|
|
#define FILE_CREATE_ID 100
|
2000-08-08 02:11:51 -04:00
|
|
|
#define FILE_RECREATE_TABLE 110
|
|
|
|
#define FILE_RECREATE_INDEXES 120
|
2004-05-17 22:43:53 -04:00
|
|
|
|
|
|
|
#if wxUSE_GRID
|
2001-06-10 13:12:56 -04:00
|
|
|
#define FILE_DBGRID_TABLE 130
|
|
|
|
#endif
|
2000-08-08 02:11:51 -04:00
|
|
|
#define FILE_EXIT 199
|
|
|
|
#define EDIT_PARAMETERS 200
|
2001-05-14 20:58:09 -04:00
|
|
|
#define HELP_ABOUT 300
|
1998-07-28 05:43:44 -04:00
|
|
|
|
1999-10-09 09:32:40 -04:00
|
|
|
// this seems to be missing, Robert Roebling (?)
|
1999-11-07 10:06:13 -05:00
|
|
|
#ifndef MAX_PATH
|
2001-02-03 12:52:58 -05:00
|
|
|
#if defined(__WXMAC__)
|
|
|
|
#define MAX_PATH 260 /* max. length of full pathname */
|
|
|
|
#else /* _MAC */
|
|
|
|
#define MAX_PATH 256 /* max. length of full pathname */
|
|
|
|
#endif
|
1999-11-07 10:06:13 -05:00
|
|
|
#endif
|
1998-07-28 05:43:44 -04:00
|
|
|
|
|
|
|
// Name of the table to be created/opened
|
2004-02-08 06:53:48 -05:00
|
|
|
const wxChar CONTACT_TABLE_NAME[] = wxT("contacts");
|
1998-07-28 05:43:44 -04:00
|
|
|
|
2004-05-12 10:03:23 -04:00
|
|
|
#define wxODBC_BLOB_SUPPORT
|
2001-04-11 10:20:56 -04:00
|
|
|
|
2001-02-03 12:52:58 -05:00
|
|
|
// Number of columns in the CONTACT table
|
2004-05-12 10:03:23 -04:00
|
|
|
#ifdef wxODBC_BLOB_SUPPORT
|
|
|
|
const int CONTACT_NO_COLS = 13; // 0-12
|
2001-04-11 10:20:56 -04:00
|
|
|
#else
|
2004-05-12 10:03:23 -04:00
|
|
|
const int CONTACT_NO_COLS = 12; // 0-11
|
2001-04-11 10:20:56 -04:00
|
|
|
#endif
|
2001-02-03 12:52:58 -05:00
|
|
|
|
2004-02-08 06:53:48 -05:00
|
|
|
const wxChar PARAM_FILENAME[] = wxT("dbtest.cfg");
|
1998-07-28 05:43:44 -04:00
|
|
|
|
|
|
|
|
|
|
|
enum Language {langENGLISH, langFRENCH, langGERMAN, langSPANISH, langOTHER};
|
|
|
|
|
|
|
|
// Forward class declarations
|
|
|
|
class CeditorDlg;
|
|
|
|
class CparameterDlg;
|
|
|
|
|
2001-05-15 09:12:36 -04:00
|
|
|
|
|
|
|
// Used for displaying many of the database capabilites
|
|
|
|
// and usage statistics on a database connection
|
|
|
|
void DisplayDbDiagnostics(wxDb *pDb);
|
|
|
|
|
|
|
|
|
2001-02-03 12:52:58 -05:00
|
|
|
//
|
|
|
|
// This class contains the actual data members that are used for transferring
|
2004-10-06 16:54:57 -04:00
|
|
|
// data back and forth from the database to the program.
|
2001-02-03 12:52:58 -05:00
|
|
|
//
|
|
|
|
// NOTE: The object described in this class is just for example purposes, and has no
|
|
|
|
// real meaning other than to show each type of field being used by the database
|
|
|
|
//
|
1998-07-28 05:43:44 -04:00
|
|
|
class CstructContact : public wxObject
|
|
|
|
{
|
2000-01-25 11:18:40 -05:00
|
|
|
public:
|
2001-02-03 12:52:58 -05:00
|
|
|
wxChar Name[50+1]; // Contact's name
|
|
|
|
wxChar Addr1[50+1];
|
|
|
|
wxChar Addr2[50+1];
|
|
|
|
wxChar City[25+1];
|
|
|
|
wxChar State[25+1];
|
|
|
|
wxChar PostalCode[15+1];
|
|
|
|
wxChar Country[20+1];
|
2004-05-25 07:20:37 -04:00
|
|
|
TIMESTAMP_STRUCT JoinDate; // Date on which this person joined the wxWidgets project
|
2000-01-25 11:18:40 -05:00
|
|
|
Language NativeLanguage; // Enumerated type indicating person's native language
|
2001-04-11 10:20:56 -04:00
|
|
|
wxChar Picture[50000];
|
2004-05-25 07:20:37 -04:00
|
|
|
bool IsDeveloper; // Is this person a developer for wxWidgets, or just a subscriber
|
2000-01-25 11:18:40 -05:00
|
|
|
UCHAR Contributions; // Something to show off an integer field
|
|
|
|
ULONG LinesOfCode; // Something to show off a 'long' field
|
1998-07-28 05:43:44 -04:00
|
|
|
}; // CstructContact
|
|
|
|
|
|
|
|
|
|
|
|
//
|
2001-02-03 12:52:58 -05:00
|
|
|
// The Ccontact class derives from wxDbTable, so we have access to all
|
|
|
|
// of the database table functions and the local memory variables that
|
|
|
|
// the database classes will store the data into (and read the data from)
|
|
|
|
// all combined in this one class.
|
1998-07-28 05:43:44 -04:00
|
|
|
//
|
2000-07-15 15:51:35 -04:00
|
|
|
class Ccontact : public wxDbTable, public CstructContact
|
2004-10-06 16:54:57 -04:00
|
|
|
{
|
2000-01-25 11:18:40 -05:00
|
|
|
private:
|
2001-02-03 12:52:58 -05:00
|
|
|
// Used to keep track of whether this class had a wxDb instance
|
2004-10-06 16:54:57 -04:00
|
|
|
// passed in to it or not. If an existing wxDb instance was not
|
2001-02-03 12:52:58 -05:00
|
|
|
// passed in at Ccontact creation time, then when the Ccontact
|
|
|
|
// instance is deleted, the connection will be freed as Ccontact
|
|
|
|
// created its own connection when it was created.
|
2000-01-25 11:18:40 -05:00
|
|
|
bool freeDbConn;
|
2001-02-03 12:52:58 -05:00
|
|
|
|
|
|
|
// Calls wxDbTable::SetColDefs() once for each column that is
|
|
|
|
// to be associated with some member variable for use with
|
|
|
|
// this database object.
|
2000-01-25 11:18:40 -05:00
|
|
|
void SetupColumns();
|
1998-07-28 05:43:44 -04:00
|
|
|
|
2000-01-25 11:18:40 -05:00
|
|
|
public:
|
2004-10-06 16:54:57 -04:00
|
|
|
// Used in places where we need to construct a WHERE clause to
|
2001-02-03 12:52:58 -05:00
|
|
|
// be passed to the SetWhereClause() function. From example,
|
|
|
|
// where building the WHERE clause requires using ::Printf()
|
|
|
|
// to build the string.
|
2000-01-25 11:18:40 -05:00
|
|
|
wxString whereStr;
|
2001-02-03 12:52:58 -05:00
|
|
|
|
|
|
|
// WHERE string returned from the query dialog
|
|
|
|
wxString qryWhereStr;
|
1998-07-28 05:43:44 -04:00
|
|
|
|
2000-07-15 15:51:35 -04:00
|
|
|
Ccontact(wxDb *pwxDb=NULL);
|
2000-01-25 11:18:40 -05:00
|
|
|
~Ccontact();
|
1998-07-28 05:43:44 -04:00
|
|
|
|
2000-01-25 11:18:40 -05:00
|
|
|
void Initialize();
|
2001-02-03 12:52:58 -05:00
|
|
|
|
|
|
|
// Contains all the index definitions and calls to wxDbTable::CreateIndex()
|
|
|
|
// required to create all the indexes we wish to define for this table.
|
2001-05-23 09:48:04 -04:00
|
|
|
bool CreateIndexes(bool recreate);
|
2001-02-03 12:52:58 -05:00
|
|
|
|
|
|
|
// Since we do not wish to have duplicate code blocks all over our program
|
|
|
|
// for a common query/fetch that we will need to do in many places, we
|
|
|
|
// include this member function that does it all for us in one place.
|
|
|
|
bool FetchByName(const wxString &name);
|
1998-07-28 05:43:44 -04:00
|
|
|
|
|
|
|
}; // Ccontact class definition
|
|
|
|
|
|
|
|
|
|
|
|
typedef struct Cparameters
|
|
|
|
{
|
2001-02-03 12:52:58 -05:00
|
|
|
wxChar ODBCSource[SQL_MAX_DSN_LENGTH+1];
|
|
|
|
wxChar UserName[SQL_MAX_USER_NAME_LEN+1];
|
|
|
|
wxChar Password[SQL_MAX_AUTHSTR_LEN+1];
|
2001-02-01 15:17:15 -05:00
|
|
|
wxChar DirPath[MAX_PATH+1];
|
1998-07-28 05:43:44 -04:00
|
|
|
} Cparameters;
|
|
|
|
|
|
|
|
|
|
|
|
// Define a new frame type
|
|
|
|
class DatabaseDemoFrame: public wxFrame
|
2004-10-06 16:54:57 -04:00
|
|
|
{
|
2000-01-25 11:18:40 -05:00
|
|
|
private:
|
|
|
|
CeditorDlg *pEditorDlg;
|
|
|
|
CparameterDlg *pParamDlg;
|
1998-07-28 05:43:44 -04:00
|
|
|
|
2000-01-25 11:18:40 -05:00
|
|
|
public:
|
|
|
|
DatabaseDemoFrame(wxFrame *frame, const wxString& title, const wxPoint& pos, const wxSize& sz);
|
2001-05-15 09:12:36 -04:00
|
|
|
~DatabaseDemoFrame();
|
1998-07-28 05:43:44 -04:00
|
|
|
|
2000-01-25 11:18:40 -05:00
|
|
|
void OnCloseWindow(wxCloseEvent& event);
|
1998-12-30 12:40:53 -05:00
|
|
|
void OnCreate(wxCommandEvent& event);
|
2000-08-08 02:11:51 -04:00
|
|
|
void OnRecreateTable(wxCommandEvent& event);
|
|
|
|
void OnRecreateIndexes(wxCommandEvent& event);
|
1998-12-30 12:40:53 -05:00
|
|
|
void OnExit(wxCommandEvent& event);
|
|
|
|
void OnEditParameters(wxCommandEvent& event);
|
|
|
|
void OnAbout(wxCommandEvent& event);
|
2004-05-17 22:43:53 -04:00
|
|
|
#if wxUSE_GRID
|
2001-06-10 13:12:56 -04:00
|
|
|
void OnDbGridTable( wxCommandEvent& );
|
2004-10-06 16:54:57 -04:00
|
|
|
#endif
|
2001-06-10 13:12:56 -04:00
|
|
|
void CreateDataTable(bool recreate);
|
2000-01-25 11:18:40 -05:00
|
|
|
void BuildEditorDialog();
|
|
|
|
void BuildParameterDialog(wxWindow *parent);
|
1998-12-30 12:40:53 -05:00
|
|
|
|
|
|
|
DECLARE_EVENT_TABLE()
|
1998-07-28 05:43:44 -04:00
|
|
|
}; // DatabaseDemoFrame
|
|
|
|
|
|
|
|
|
2004-05-17 22:43:53 -04:00
|
|
|
#if wxUSE_GRID
|
2001-06-10 13:12:56 -04:00
|
|
|
|
|
|
|
// *************************** DBGridFrame ***************************
|
|
|
|
|
|
|
|
class DbGridFrame : public wxFrame
|
|
|
|
{
|
|
|
|
public:
|
2002-03-17 09:16:03 -05:00
|
|
|
bool initialized;
|
2001-06-10 13:12:56 -04:00
|
|
|
|
2002-03-17 09:16:03 -05:00
|
|
|
DbGridFrame(wxWindow *parent);
|
2001-06-10 13:12:56 -04:00
|
|
|
|
2002-03-17 09:16:03 -05:00
|
|
|
void OnCloseWindow(wxCloseEvent& event);
|
|
|
|
bool Initialize();
|
2001-06-10 13:12:56 -04:00
|
|
|
|
2002-03-17 09:16:03 -05:00
|
|
|
DECLARE_EVENT_TABLE()
|
2001-06-10 13:12:56 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
2001-02-03 12:52:58 -05:00
|
|
|
// Define a new application type
|
|
|
|
class DatabaseDemoApp: public wxApp
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
// These are the parameters that are stored in the "PARAM_FILENAME" file
|
|
|
|
// that are read in at startup of the program that indicate the connection
|
|
|
|
// parameters to be used for connecting to the ODBC data source.
|
|
|
|
Cparameters params;
|
|
|
|
|
|
|
|
// Pointer to the main frame used by the App
|
|
|
|
DatabaseDemoFrame *DemoFrame;
|
|
|
|
|
|
|
|
// Pointer to the main database connection used in the program. This
|
|
|
|
// pointer would normally be used for doing things as database lookups
|
|
|
|
// for user login names and passwords, getting workstation settings, etc.
|
2004-10-06 16:54:57 -04:00
|
|
|
//
|
2001-02-03 12:52:58 -05:00
|
|
|
// ---> IMPORTANT <---
|
2004-10-06 16:54:57 -04:00
|
|
|
//
|
2001-02-03 12:52:58 -05:00
|
|
|
// For each database object created which uses this wxDb pointer
|
|
|
|
// connection to the database, when a CommitTrans() or RollBackTrans()
|
|
|
|
// will commit or rollback EVERY object which uses this wxDb pointer.
|
2004-10-06 16:54:57 -04:00
|
|
|
//
|
|
|
|
// To allow each table object (those derived from wxDbTable) to be
|
2001-02-03 12:52:58 -05:00
|
|
|
// individually committed or rolled back, you MUST use a different
|
2004-10-06 16:54:57 -04:00
|
|
|
// instance of wxDb in the constructor of the table. Doing so creates
|
2001-02-03 12:52:58 -05:00
|
|
|
// more overhead, and will use more database connections (some DBs have
|
|
|
|
// connection limits...), so use connections sparringly.
|
2004-10-06 16:54:57 -04:00
|
|
|
//
|
2001-02-03 12:52:58 -05:00
|
|
|
// It is recommended that one "main" database connection be created for
|
|
|
|
// the entire program to use for READ-ONLY database accesses, but for each
|
|
|
|
// table object which will do a CommitTrans() or RollbackTrans() that a
|
|
|
|
// new wxDb object be created and used for it.
|
|
|
|
wxDb *READONLY_DB;
|
|
|
|
|
2004-10-06 16:54:57 -04:00
|
|
|
// Contains the ODBC connection information used by
|
2001-02-03 12:52:58 -05:00
|
|
|
// all database connections
|
|
|
|
wxDbConnectInf *DbConnectInf;
|
|
|
|
|
|
|
|
bool OnInit();
|
|
|
|
|
|
|
|
// Read/Write ODBC connection parameters to the "PARAM_FILENAME" file
|
|
|
|
bool ReadParamFile(Cparameters ¶ms);
|
|
|
|
bool WriteParamFile(Cparameters ¶ms);
|
|
|
|
|
|
|
|
void CreateDataTable(bool recreate);
|
2001-05-14 20:58:09 -04:00
|
|
|
|
|
|
|
// Pointer to the wxDbTable instance that is used to manipulate
|
|
|
|
// the data in memory and in the database
|
|
|
|
Ccontact *Contact;
|
|
|
|
|
2001-02-03 12:52:58 -05:00
|
|
|
}; // DatabaseDemoApp
|
|
|
|
|
|
|
|
|
|
|
|
DECLARE_APP(DatabaseDemoApp)
|
|
|
|
|
1998-07-28 05:43:44 -04:00
|
|
|
|
|
|
|
// *************************** CeditorDlg ***************************
|
|
|
|
|
|
|
|
class CeditorDlg : public wxPanel
|
|
|
|
{
|
2000-01-25 11:18:40 -05:00
|
|
|
private:
|
2001-02-03 12:52:58 -05:00
|
|
|
// Used to indicate whether all of the widget pointers (defined
|
2004-10-06 16:54:57 -04:00
|
|
|
// below) have been initialized to point to the memory for
|
2001-02-03 12:52:58 -05:00
|
|
|
// the named widget. Used as a safeguard from using the widget
|
|
|
|
// before it has been initialized.
|
2000-08-08 02:11:51 -04:00
|
|
|
bool widgetPtrsSet;
|
2001-02-03 12:52:58 -05:00
|
|
|
|
2004-10-06 16:54:57 -04:00
|
|
|
// Used when the EDIT button has been pressed to maintain the
|
|
|
|
// original name that was displayed in the editor before the
|
2001-02-03 12:52:58 -05:00
|
|
|
// EDIT button was pressed, so that if CANCEL is pressed, a
|
|
|
|
// FetchByName() can be done to retrieve the original data
|
|
|
|
// to repopulate the dialog.
|
2000-08-08 02:11:51 -04:00
|
|
|
wxString saveName;
|
2000-01-25 11:18:40 -05:00
|
|
|
|
|
|
|
// Pointers to all widgets on the dialog
|
|
|
|
wxButton *pCreateBtn, *pEditBtn, *pDeleteBtn, *pCopyBtn, *pSaveBtn, *pCancelBtn;
|
|
|
|
wxButton *pPrevBtn, *pNextBtn, *pQueryBtn, *pResetBtn, *pDoneBtn, *pHelpBtn;
|
|
|
|
wxButton *pNameListBtn;
|
2001-05-23 09:48:04 -04:00
|
|
|
wxButton *pCatalogBtn, *pDataTypesBtn, *pDbDiagsBtn;
|
2000-01-25 11:18:40 -05:00
|
|
|
wxTextCtrl *pNameTxt, *pAddress1Txt, *pAddress2Txt,*pCityTxt, *pStateTxt, *pCountryTxt,*pPostalCodeTxt;
|
|
|
|
wxStaticText *pNameMsg, *pAddress1Msg, *pAddress2Msg,*pCityMsg, *pStateMsg, *pCountryMsg,*pPostalCodeMsg;
|
|
|
|
wxTextCtrl *pJoinDateTxt,*pContribTxt, *pLinesTxt;
|
|
|
|
wxStaticText *pJoinDateMsg,*pContribMsg, *pLinesMsg;
|
|
|
|
wxRadioBox *pDeveloperRadio;
|
|
|
|
wxChoice *pNativeLangChoice;
|
|
|
|
wxStaticText *pNativeLangMsg;
|
|
|
|
|
|
|
|
public:
|
2001-02-03 12:52:58 -05:00
|
|
|
// Indicates if the editor dialog has been initialized yet (used to
|
|
|
|
// help trap if the Initialize() function failed to load all required
|
|
|
|
// resources or not.
|
2000-08-08 02:11:51 -04:00
|
|
|
bool initialized;
|
2001-02-03 12:52:58 -05:00
|
|
|
|
2000-08-08 02:11:51 -04:00
|
|
|
enum DialogModes mode;
|
2001-02-03 12:52:58 -05:00
|
|
|
|
2000-01-25 11:18:40 -05:00
|
|
|
CeditorDlg(wxWindow *parent);
|
|
|
|
|
|
|
|
void OnCloseWindow(wxCloseEvent& event);
|
|
|
|
void OnButton( wxCommandEvent &event );
|
|
|
|
void OnCommand(wxWindow& win, wxCommandEvent& event);
|
|
|
|
void OnActivate(bool) {}; // necessary for hot keys
|
|
|
|
|
2000-08-08 02:11:51 -04:00
|
|
|
bool Initialize();
|
2001-02-03 12:52:58 -05:00
|
|
|
|
|
|
|
// Sets wxStaticText fields to be editable or not depending
|
|
|
|
// on the current value of 'mode'
|
2000-01-25 11:18:40 -05:00
|
|
|
void FieldsEditable();
|
2001-02-03 12:52:58 -05:00
|
|
|
|
|
|
|
// Sets the editor mode, determining what state widgets
|
|
|
|
// on the dialog are to be in based on the operation
|
|
|
|
// being performed.
|
2000-01-25 11:18:40 -05:00
|
|
|
void SetMode(enum DialogModes m);
|
2001-02-03 12:52:58 -05:00
|
|
|
|
|
|
|
// Update/Retrieve data from the widgets on the dialog
|
2000-01-25 11:18:40 -05:00
|
|
|
bool PutData();
|
|
|
|
bool GetData();
|
2001-02-03 12:52:58 -05:00
|
|
|
|
|
|
|
// Inserts/updates the database with the current data
|
|
|
|
// retrieved from the editor dialog
|
2000-01-25 11:18:40 -05:00
|
|
|
bool Save();
|
2001-02-03 12:52:58 -05:00
|
|
|
|
2004-10-06 16:54:57 -04:00
|
|
|
// Database functions for changing the data that is to
|
2001-02-03 12:52:58 -05:00
|
|
|
// be displayed on the dialog. GetNextRec()/GetPrevRec()
|
|
|
|
// provide database independent methods that do not require
|
|
|
|
// backward scrolling cursors to obtain the record that
|
|
|
|
// is prior to the current record in the search sequence.
|
2000-01-25 11:18:40 -05:00
|
|
|
bool GetNextRec();
|
|
|
|
bool GetPrevRec();
|
2001-02-03 12:52:58 -05:00
|
|
|
bool GetRec(const wxString &whereStr);
|
2004-10-06 16:54:57 -04:00
|
|
|
|
1999-01-12 12:53:45 -05:00
|
|
|
DECLARE_EVENT_TABLE()
|
1998-07-28 05:43:44 -04:00
|
|
|
}; // CeditorDlg
|
|
|
|
|
1998-12-30 12:40:53 -05:00
|
|
|
#define EDITOR_DIALOG 199
|
|
|
|
|
|
|
|
// Editor dialog control ids
|
|
|
|
#define EDITOR_DIALOG_FN_GROUP 200
|
|
|
|
#define EDITOR_DIALOG_SEARCH_GROUP 201
|
|
|
|
#define EDITOR_DIALOG_CREATE 202
|
|
|
|
#define EDITOR_DIALOG_EDIT 203
|
|
|
|
#define EDITOR_DIALOG_DELETE 204
|
|
|
|
#define EDITOR_DIALOG_COPY 205
|
|
|
|
#define EDITOR_DIALOG_SAVE 206
|
|
|
|
#define EDITOR_DIALOG_CANCEL 207
|
|
|
|
#define EDITOR_DIALOG_PREV 208
|
|
|
|
#define EDITOR_DIALOG_NEXT 209
|
|
|
|
#define EDITOR_DIALOG_QUERY 211
|
|
|
|
#define EDITOR_DIALOG_RESET 212
|
|
|
|
#define EDITOR_DIALOG_NAME_MSG 213
|
|
|
|
#define EDITOR_DIALOG_NAME_TEXT 214
|
|
|
|
#define EDITOR_DIALOG_LOOKUP 215
|
|
|
|
#define EDITOR_DIALOG_ADDRESS1_MSG 216
|
|
|
|
#define EDITOR_DIALOG_ADDRESS1_TEXT 217
|
|
|
|
#define EDITOR_DIALOG_ADDRESS2_MSG 218
|
|
|
|
#define EDITOR_DIALOG_ADDRESS2_TEXT 219
|
|
|
|
#define EDITOR_DIALOG_CITY_MSG 220
|
|
|
|
#define EDITOR_DIALOG_CITY_TEXT 221
|
|
|
|
#define EDITOR_DIALOG_COUNTRY_MSG 222
|
|
|
|
#define EDITOR_DIALOG_COUNTRY_TEXT 223
|
|
|
|
#define EDITOR_DIALOG_POSTAL_MSG 224
|
|
|
|
#define EDITOR_DIALOG_POSTAL_TEXT 225
|
|
|
|
#define EDITOR_DIALOG_LANG_MSG 226
|
|
|
|
#define EDITOR_DIALOG_LANG_CHOICE 227
|
|
|
|
#define EDITOR_DIALOG_DATE_MSG 228
|
|
|
|
#define EDITOR_DIALOG_DATE_TEXT 229
|
|
|
|
#define EDITOR_DIALOG_CONTRIB_MSG 230
|
|
|
|
#define EDITOR_DIALOG_CONTRIB_TEXT 231
|
|
|
|
#define EDITOR_DIALOG_LINES_MSG 232
|
|
|
|
#define EDITOR_DIALOG_LINES_TEXT 233
|
|
|
|
#define EDITOR_DIALOG_STATE_MSG 234
|
|
|
|
#define EDITOR_DIALOG_STATE_TEXT 235
|
|
|
|
#define EDITOR_DIALOG_DEVELOPER 236
|
|
|
|
#define EDITOR_DIALOG_JOIN_MSG 237
|
|
|
|
#define EDITOR_DIALOG_JOIN_TEXT 238
|
2001-05-23 09:48:04 -04:00
|
|
|
#define EDITOR_DIALOG_CATALOG 240
|
2001-05-15 09:12:36 -04:00
|
|
|
#define EDITOR_DIALOG_DATATYPES 250
|
|
|
|
#define EDITOR_DIALOG_DB_DIAGS 260
|
1998-07-28 05:43:44 -04:00
|
|
|
|
|
|
|
// *************************** CparameterDlg ***************************
|
|
|
|
|
1998-12-30 12:40:53 -05:00
|
|
|
class CparameterDlg : public wxDialog
|
1998-07-28 05:43:44 -04:00
|
|
|
{
|
2000-01-25 11:18:40 -05:00
|
|
|
private:
|
2001-02-03 12:52:58 -05:00
|
|
|
// Used to indicate whether all of the widget pointers (defined
|
2004-10-06 16:54:57 -04:00
|
|
|
// below) have been initialized to point to the memory for
|
2001-02-03 12:52:58 -05:00
|
|
|
// the named widget. Used as a safeguard from using the widget
|
|
|
|
// before it has been initialized.
|
2000-01-25 11:18:40 -05:00
|
|
|
bool widgetPtrsSet;
|
2001-02-03 12:52:58 -05:00
|
|
|
|
2000-01-25 11:18:40 -05:00
|
|
|
enum DialogModes mode;
|
2001-02-03 12:52:58 -05:00
|
|
|
|
2004-10-06 16:54:57 -04:00
|
|
|
// Have the parameters been saved yet, or do they
|
2001-02-03 12:52:58 -05:00
|
|
|
// need to be saved to update the params on disk
|
2000-01-25 11:18:40 -05:00
|
|
|
bool saved;
|
2001-02-03 12:52:58 -05:00
|
|
|
|
|
|
|
// Original params
|
2000-01-25 11:18:40 -05:00
|
|
|
Cparameters savedParamSettings;
|
|
|
|
|
|
|
|
// Pointers to all widgets on the dialog
|
|
|
|
wxStaticText *pParamODBCSourceMsg;
|
|
|
|
wxListBox *pParamODBCSourceList;
|
|
|
|
wxStaticText *pParamUserNameMsg, *pParamPasswordMsg, *pParamDirPathMsg;
|
|
|
|
wxTextCtrl *pParamUserNameTxt, *pParamPasswordTxt, *pParamDirPathTxt;
|
|
|
|
wxButton *pParamSaveBtn, *pParamCancelBtn;
|
|
|
|
|
|
|
|
public:
|
|
|
|
CparameterDlg(wxWindow *parent);
|
|
|
|
|
|
|
|
void OnCloseWindow(wxCloseEvent& event);
|
|
|
|
void OnButton( wxCommandEvent &event );
|
|
|
|
void OnCommand(wxWindow& win, wxCommandEvent& event);
|
|
|
|
void OnActivate(bool) {}; // necessary for hot keys
|
|
|
|
|
2001-02-03 12:52:58 -05:00
|
|
|
// Update/Retrieve data from the widgets on the dialog
|
2000-01-25 11:18:40 -05:00
|
|
|
bool PutData();
|
|
|
|
bool GetData();
|
2001-02-03 12:52:58 -05:00
|
|
|
|
|
|
|
// Stores the defined parameter for connecting to the selected ODBC
|
|
|
|
// data source to the config file name in "PARAM_FILENAME"
|
2000-01-25 11:18:40 -05:00
|
|
|
bool Save();
|
2001-02-03 12:52:58 -05:00
|
|
|
|
|
|
|
// Populates the 'pParamODBCSourceList' listbox with the names of all
|
|
|
|
// ODBC datasource defined for use at the current workstation
|
2000-01-25 11:18:40 -05:00
|
|
|
void FillDataSourceList();
|
1998-07-28 05:43:44 -04:00
|
|
|
|
1999-02-05 18:55:04 -05:00
|
|
|
DECLARE_EVENT_TABLE()
|
1998-07-28 05:43:44 -04:00
|
|
|
}; // CparameterDlg
|
|
|
|
|
1998-12-30 12:40:53 -05:00
|
|
|
#define PARAMETER_DIALOG 400
|
|
|
|
|
|
|
|
// Parameter dialog control ids
|
|
|
|
#define PARAMETER_DIALOG_SOURCE_MSG 401
|
|
|
|
#define PARAMETER_DIALOG_SOURCE_LISTBOX 402
|
|
|
|
#define PARAMETER_DIALOG_NAME_MSG 403
|
|
|
|
#define PARAMETER_DIALOG_NAME_TEXT 404
|
|
|
|
#define PARAMETER_DIALOG_PASSWORD_MSG 405
|
|
|
|
#define PARAMETER_DIALOG_PASSWORD_TEXT 406
|
2000-01-25 11:18:40 -05:00
|
|
|
#define PARAMETER_DIALOG_DIRPATH_MSG 407
|
|
|
|
#define PARAMETER_DIALOG_DIRPATH_TEXT 408
|
1999-10-07 07:04:06 -04:00
|
|
|
#define PARAMETER_DIALOG_SAVE 409
|
|
|
|
#define PARAMETER_DIALOG_CANCEL 410
|
1998-07-28 05:43:44 -04:00
|
|
|
|
|
|
|
// *************************** CqueryDlg ***************************
|
|
|
|
|
|
|
|
|
|
|
|
// QUERY DIALOG
|
|
|
|
enum qryOp
|
|
|
|
{
|
2000-01-25 11:18:40 -05:00
|
|
|
qryOpEQ,
|
|
|
|
qryOpLT,
|
|
|
|
qryOpGT,
|
|
|
|
qryOpLE,
|
|
|
|
qryOpGE,
|
|
|
|
qryOpBEGINS,
|
|
|
|
qryOpCONTAINS,
|
|
|
|
qryOpLIKE,
|
|
|
|
qryOpBETWEEN
|
1998-07-28 05:43:44 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// Query strings
|
2004-02-08 06:53:48 -05:00
|
|
|
wxChar * const langQRY_EQ = wxT("column = column | value");
|
|
|
|
wxChar * const langQRY_LT = wxT("column < column | value");
|
|
|
|
wxChar * const langQRY_GT = wxT("column > column | value");
|
|
|
|
wxChar * const langQRY_LE = wxT("column <= column | value");
|
|
|
|
wxChar * const langQRY_GE = wxT("column >= column | value");
|
|
|
|
wxChar * const langQRY_BEGINS = wxT("columns that BEGIN with the string entered");
|
|
|
|
wxChar * const langQRY_CONTAINS = wxT("columns that CONTAIN the string entered");
|
|
|
|
wxChar * const langQRY_LIKE = wxT("% matches 0 or more of any char; _ matches 1 char");
|
|
|
|
wxChar * const langQRY_BETWEEN = wxT("column BETWEEN value AND value");
|
1998-07-28 05:43:44 -04:00
|
|
|
|
|
|
|
|
1998-12-30 12:40:53 -05:00
|
|
|
class CqueryDlg : public wxDialog
|
1998-07-28 05:43:44 -04:00
|
|
|
{
|
2000-01-25 11:18:40 -05:00
|
|
|
private:
|
2001-02-03 12:52:58 -05:00
|
|
|
wxDbColInf *colInf; // Column inf. returned by db->GetColumns()
|
|
|
|
wxDbTable *dbTable; // generic wxDbTable object for attaching to the table to query
|
|
|
|
wxChar *masterTableName; // Name of the table that 'dbTable' will be associated with
|
2001-02-04 11:01:33 -05:00
|
|
|
wxString pWhere; // A pointer to the storage for the resulting where clause
|
2000-07-15 15:51:35 -04:00
|
|
|
wxDb *pDB;
|
2000-01-25 11:18:40 -05:00
|
|
|
|
|
|
|
public:
|
2001-02-03 12:52:58 -05:00
|
|
|
// Used to indicate whether all of the widget pointers (defined
|
2004-10-06 16:54:57 -04:00
|
|
|
// below) have been initialized to point to the memory for
|
2001-02-03 12:52:58 -05:00
|
|
|
// the named widget. Used as a safeguard from using the widget
|
|
|
|
// before it has been initialized.
|
2000-01-25 11:18:40 -05:00
|
|
|
bool widgetPtrsSet;
|
|
|
|
|
|
|
|
// Widget pointers
|
|
|
|
wxStaticText *pQueryCol1Msg;
|
|
|
|
wxChoice *pQueryCol1Choice;
|
|
|
|
wxStaticText *pQueryNotMsg;
|
|
|
|
wxCheckBox *pQueryNotCheck;
|
|
|
|
wxStaticText *pQueryOperatorMsg;
|
|
|
|
wxChoice *pQueryOperatorChoice;
|
|
|
|
wxStaticText *pQueryCol2Msg;
|
|
|
|
wxChoice *pQueryCol2Choice;
|
|
|
|
wxStaticText *pQueryValue1Msg;
|
|
|
|
wxTextCtrl *pQueryValue1Txt;
|
|
|
|
wxStaticText *pQueryValue2Msg;
|
|
|
|
wxTextCtrl *pQueryValue2Txt;
|
|
|
|
wxStaticText *pQuerySqlWhereMsg;
|
|
|
|
wxTextCtrl *pQuerySqlWhereMtxt;
|
|
|
|
wxButton *pQueryAddBtn;
|
|
|
|
wxButton *pQueryAndBtn;
|
|
|
|
wxButton *pQueryOrBtn;
|
|
|
|
wxButton *pQueryLParenBtn;
|
|
|
|
wxButton *pQueryRParenBtn;
|
|
|
|
wxButton *pQueryDoneBtn;
|
|
|
|
wxButton *pQueryClearBtn;
|
|
|
|
wxButton *pQueryCountBtn;
|
|
|
|
wxButton *pQueryHelpBtn;
|
|
|
|
wxStaticBox *pQueryHintGrp;
|
|
|
|
wxStaticText *pQueryHintMsg;
|
|
|
|
|
2000-08-08 02:11:51 -04:00
|
|
|
wxTextCtrl *pFocusTxt;
|
2000-01-25 11:18:40 -05:00
|
|
|
|
2001-02-04 11:01:33 -05:00
|
|
|
CqueryDlg(wxWindow *parent, wxDb *pDb, wxChar *tblName[], const wxString &pWhereArg);
|
2004-10-06 16:54:57 -04:00
|
|
|
~CqueryDlg(){};
|
2000-01-25 11:18:40 -05:00
|
|
|
|
|
|
|
void OnButton( wxCommandEvent &event );
|
|
|
|
void OnCommand(wxWindow& win, wxCommandEvent& event);
|
|
|
|
void OnCloseWindow(wxCloseEvent& event);
|
|
|
|
void OnActivate(bool) {}; // necessary for hot keys
|
|
|
|
|
2001-02-01 15:17:15 -05:00
|
|
|
void AppendToWhere(wxChar *s);
|
2000-01-25 11:18:40 -05:00
|
|
|
void ProcessAddBtn();
|
|
|
|
void ProcessCountBtn();
|
|
|
|
bool ValidateWhereClause();
|
1998-07-28 05:43:44 -04:00
|
|
|
|
1999-01-12 12:53:45 -05:00
|
|
|
DECLARE_EVENT_TABLE()
|
1998-07-28 05:43:44 -04:00
|
|
|
}; // CqueryDlg
|
1998-12-30 12:40:53 -05:00
|
|
|
|
|
|
|
#define QUERY_DIALOG 300
|
|
|
|
|
|
|
|
// Parameter dialog control ids
|
|
|
|
#define QUERY_DIALOG_COL_MSG 301
|
|
|
|
#define QUERY_DIALOG_COL_CHOICE 302
|
|
|
|
#define QUERY_DIALOG_NOT_MSG 303
|
|
|
|
#define QUERY_DIALOG_NOT_CHECKBOX 304
|
|
|
|
#define QUERY_DIALOG_OP_MSG 305
|
|
|
|
#define QUERY_DIALOG_OP_CHOICE 306
|
|
|
|
#define QUERY_DIALOG_COL2_MSG 307
|
|
|
|
#define QUERY_DIALOG_COL2_CHOICE 308
|
|
|
|
#define QUERY_DIALOG_WHERE_MSG 309
|
|
|
|
#define QUERY_DIALOG_WHERE_TEXT 310
|
|
|
|
#define QUERY_DIALOG_ADD 311
|
|
|
|
#define QUERY_DIALOG_AND 312
|
|
|
|
#define QUERY_DIALOG_OR 313
|
|
|
|
#define QUERY_DIALOG_LPAREN 314
|
|
|
|
#define QUERY_DIALOG_RPAREN 315
|
|
|
|
#define QUERY_DIALOG_DONE 316
|
|
|
|
#define QUERY_DIALOG_CLEAR 317
|
|
|
|
#define QUERY_DIALOG_COUNT 318
|
|
|
|
#define QUERY_DIALOG_VALUE1_MSG 319
|
|
|
|
#define QUERY_DIALOG_VALUE1_TEXT 320
|
|
|
|
#define QUERY_DIALOG_VALUE2_MSG 321
|
|
|
|
#define QUERY_DIALOG_VALUE2_TEXT 322
|
|
|
|
#define QUERY_DIALOG_HINT_GROUP 323
|
|
|
|
#define QUERY_DIALOG_HINT_MSG 324
|
|
|
|
|
2004-02-08 06:53:48 -05:00
|
|
|
wxChar * const langNO = wxT("No");
|
|
|
|
wxChar * const langYES = wxT("Yes");
|
|
|
|
wxChar * const langDBINF_DB_NAME = wxT("Database Name = ");
|
|
|
|
wxChar * const langDBINF_DB_VER = wxT("Database Version = ");
|
|
|
|
wxChar * const langDBINF_DRIVER_NAME = wxT("Driver Name = ");
|
|
|
|
wxChar * const langDBINF_DRIVER_ODBC_VER = wxT("Driver ODBC Version = ");
|
|
|
|
wxChar * const langDBINF_DRIVER_MGR_ODBC_VER = wxT("Driver Manager ODBC Version = ");
|
|
|
|
wxChar * const langDBINF_DRIVER_VER = wxT("Driver Version = ");
|
|
|
|
wxChar * const langDBINF_SERVER_NAME = wxT("Server Name = ");
|
|
|
|
wxChar * const langDBINF_FILENAME = wxT("Filename = ");
|
|
|
|
wxChar * const langDBINF_OUTER_JOINS = wxT("Outer Joins = ");
|
|
|
|
wxChar * const langDBINF_STORED_PROC = wxT("Stored Procedures = ");
|
|
|
|
wxChar * const langDBINF_MAX_HDBC = wxT("Max # of Db connections = ");
|
|
|
|
wxChar * const langDBINF_MAX_HSTMT = wxT("Max # of cursors (per db connection) = ");
|
2004-10-06 16:54:57 -04:00
|
|
|
wxChar * const langDBINF_UNLIMITED = wxT("Unlimited or Unknown");
|
2004-02-08 06:53:48 -05:00
|
|
|
wxChar * const langDBINF_API_LVL = wxT("ODBC API conformance level = ");
|
|
|
|
wxChar * const langDBINF_CLI_LVL = wxT("Client (SAG) conformance level = ");
|
|
|
|
wxChar * const langDBINF_SQL_LVL = wxT("SQL conformance level = ");
|
|
|
|
wxChar * const langDBINF_COMMIT_BEHAVIOR = wxT("Commit Behavior = ");
|
|
|
|
wxChar * const langDBINF_ROLLBACK_BEHAVIOR = wxT("Rollback Behavior = ");
|
|
|
|
wxChar * const langDBINF_SUPP_NOT_NULL = wxT("Support NOT NULL clause = ");
|
|
|
|
wxChar * const langDBINF_SUPP_IEF = wxT("Support IEF = ");
|
|
|
|
wxChar * const langDBINF_TXN_ISOLATION = wxT("Transaction Isolation Level (default) = ");
|
|
|
|
wxChar * const langDBINF_TXN_ISOLATION_CURR = wxT("Transaction Isolation Level (current) = ");
|
|
|
|
wxChar * const langDBINF_TXN_ISOLATION_OPTS = wxT("Transaction Isolation Options Available = ");
|
|
|
|
wxChar * const langDBINF_FETCH_DIRS = wxT("Fetch Directions = ");
|
|
|
|
wxChar * const langDBINF_LOCK_TYPES = wxT("Lock Types (SQLSetPos) = ");
|
|
|
|
wxChar * const langDBINF_POS_OPERS = wxT("Position Operations (SQLSetPos) = ");
|
|
|
|
wxChar * const langDBINF_POS_STMTS = wxT("Position Statements = ");
|
|
|
|
wxChar * const langDBINF_SCROLL_CONCURR = wxT("Concurrency Options (scrollable cursors) = ");
|
|
|
|
wxChar * const langDBINF_SCROLL_OPTS = wxT("Scroll Options (scrollable cursors) = ");
|
|
|
|
wxChar * const langDBINF_STATIC_SENS = wxT("Static Sensitivity = ");
|
|
|
|
wxChar * const langDBINF_TXN_CAPABLE = wxT("Transaction Support = ");
|
|
|
|
wxChar * const langDBINF_LOGIN_TIMEOUT = wxT("Login Timeout = ");
|
|
|
|
wxChar * const langDBINF_NONE = wxT("None");
|
|
|
|
wxChar * const langDBINF_LEVEL1 = wxT("Level 1");
|
|
|
|
wxChar * const langDBINF_LEVEL2 = wxT("Level 2");
|
|
|
|
wxChar * const langDBINF_NOT_COMPLIANT = wxT("Not Compliant");
|
|
|
|
wxChar * const langDBINF_COMPLIANT = wxT("Compliant");
|
|
|
|
wxChar * const langDBINF_MIN_GRAMMAR = wxT("Minimum Grammer");
|
|
|
|
wxChar * const langDBINF_CORE_GRAMMAR = wxT("Core Grammer");
|
|
|
|
wxChar * const langDBINF_EXT_GRAMMAR = wxT("Extended Grammer");
|
|
|
|
wxChar * const langDBINF_DELETE_CURSORS = wxT("Delete cursors");
|
|
|
|
wxChar * const langDBINF_CLOSE_CURSORS = wxT("Close cursors");
|
|
|
|
wxChar * const langDBINF_PRESERVE_CURSORS = wxT("Preserve cursors");
|
|
|
|
wxChar * const langDBINF_READ_UNCOMMITTED = wxT("Read Uncommitted");
|
|
|
|
wxChar * const langDBINF_READ_COMMITTED = wxT("Read Committed");
|
|
|
|
wxChar * const langDBINF_REPEATABLE_READ = wxT("Repeatable Read");
|
|
|
|
wxChar * const langDBINF_SERIALIZABLE = wxT("Serializable");
|
|
|
|
wxChar * const langDBINF_VERSIONING = wxT("Versioning");
|
|
|
|
wxChar * const langDBINF_NEXT = wxT("Next");
|
|
|
|
wxChar * const langDBINF_PREV = wxT("Prev");
|
|
|
|
wxChar * const langDBINF_FIRST = wxT("First");
|
|
|
|
wxChar * const langDBINF_LAST = wxT("Last");
|
|
|
|
wxChar * const langDBINF_ABSOLUTE = wxT("Absolute");
|
|
|
|
wxChar * const langDBINF_RELATIVE = wxT("Relative");
|
|
|
|
wxChar * const langDBINF_RESUME = wxT("Resume");
|
|
|
|
wxChar * const langDBINF_BOOKMARK = wxT("Bookmark");
|
|
|
|
wxChar * const langDBINF_NO_CHANGE = wxT("No Change");
|
|
|
|
wxChar * const langDBINF_EXCLUSIVE = wxT("Exclusive");
|
|
|
|
wxChar * const langDBINF_UNLOCK = wxT("Unlock");
|
|
|
|
wxChar * const langDBINF_POSITION = wxT("Position");
|
|
|
|
wxChar * const langDBINF_REFRESH = wxT("Refresh");
|
|
|
|
wxChar * const langDBINF_UPD = wxT("Upd");
|
|
|
|
wxChar * const langDBINF_DEL = wxT("Del");
|
|
|
|
wxChar * const langDBINF_ADD = wxT("Add");
|
|
|
|
wxChar * const langDBINF_POS_DEL = wxT("Pos Delete");
|
|
|
|
wxChar * const langDBINF_POS_UPD = wxT("Pos Update");
|
|
|
|
wxChar * const langDBINF_SELECT_FOR_UPD = wxT("Select For Update");
|
|
|
|
wxChar * const langDBINF_READ_ONLY = wxT("Read Only");
|
|
|
|
wxChar * const langDBINF_LOCK = wxT("Lock");
|
|
|
|
wxChar * const langDBINF_OPT_ROWVER = wxT("Opt. Rowver");
|
|
|
|
wxChar * const langDBINF_OPT_VALUES = wxT("Opt. Values");
|
|
|
|
wxChar * const langDBINF_FWD_ONLY = wxT("Fwd Only");
|
|
|
|
wxChar * const langDBINF_STATIC = wxT("Static");
|
|
|
|
wxChar * const langDBINF_KEYSET_DRIVEN = wxT("Keyset Driven");
|
|
|
|
wxChar * const langDBINF_DYNAMIC = wxT("Dynamic");
|
|
|
|
wxChar * const langDBINF_MIXED = wxT("Mixed");
|
|
|
|
wxChar * const langDBINF_ADDITIONS = wxT("Additions");
|
|
|
|
wxChar * const langDBINF_DELETIONS = wxT("Deletions");
|
|
|
|
wxChar * const langDBINF_UPDATES = wxT("Updates");
|
|
|
|
wxChar * const langDBINF_DML_ONLY = wxT("DML Only");
|
|
|
|
wxChar * const langDBINF_DDL_COMMIT = wxT("DDL Commit");
|
|
|
|
wxChar * const langDBINF_DDL_IGNORE = wxT("DDL Ignore");
|
|
|
|
wxChar * const langDBINF_DDL_AND_DML = wxT("DDL and DML");
|
|
|
|
wxChar * const langDBINF_ORACLE_BANNER = wxT(">>> ORACLE STATISTICS AND TUNING INFORMATION <<<");
|
|
|
|
wxChar * const langDBINF_DB_BLOCK_GETS = wxT("DB block gets");
|
|
|
|
wxChar * const langDBINF_CONSISTENT_GETS = wxT("Consistent gets");
|
|
|
|
wxChar * const langDBINF_PHYSICAL_READS = wxT("Physical reads");
|
|
|
|
wxChar * const langDBINF_CACHE_HIT_RATIO = wxT("Cache hit ratio");
|
|
|
|
wxChar * const langDBINF_TABLESPACE_IO = wxT("TABLESPACE I/O LEVELS");
|
|
|
|
wxChar * const langDBINF_PHYSICAL_WRITES = wxT("Physical writes");
|