]> git.saurik.com Git - wxWidgets.git/blame - samples/db/dbtest.h
renamed AddSubPage() with pos parameter to InsertSubPage()
[wxWidgets.git] / samples / db / dbtest.h
CommitLineData
108106cf
JS
1///////////////////////////////////////////////////////////////////////////////
2// Name: dbtest.h
be5a51fb 3// Purpose: wxWidgets database demo app
108106cf
JS
4// Author: George Tasker
5// Modified by:
6// Created: 1998
7// RCS-ID: $Id$
8// Copyright: (c) 1998 Remstar International, Inc.
9// Licence: wxWindows licence
10///////////////////////////////////////////////////////////////////////////////
11
fb86524f
GD
12#include "wx/string.h"
13#include "wx/dbtable.h"
108106cf 14
e70e8f4c 15enum DialogModes {mView,mCreate,mEdit,mSearch};
108106cf
JS
16
17// ID for the menu quit command
74de91cc 18#define FILE_CREATE_ID 100
3ca6a5f0
BP
19#define FILE_RECREATE_TABLE 110
20#define FILE_RECREATE_INDEXES 120
9b12bd99
GT
21
22#if wxUSE_GRID
f21b2fd8
GT
23#define FILE_DBGRID_TABLE 130
24#endif
91b07357 25#define FILE_EXIT wxID_EXIT
3ca6a5f0 26#define EDIT_PARAMETERS 200
91b07357 27#define HELP_ABOUT wxID_ABOUT
108106cf 28
e115e771 29// this seems to be missing, Robert Roebling (?)
d433a26f 30#ifndef MAX_PATH
049977d0
GT
31 #if defined(__WXMAC__)
32 #define MAX_PATH 260 /* max. length of full pathname */
33 #else /* _MAC */
34 #define MAX_PATH 256 /* max. length of full pathname */
35 #endif
d433a26f 36#endif
108106cf
JS
37
38// Name of the table to be created/opened
aa324ea9 39const wxString CONTACT_TABLE_NAME = wxT("CONTACTS");
108106cf 40
dd5b579c 41#define wxODBC_BLOB_SUPPORT
3fe813a9 42
da1e87c4 43
049977d0 44// Number of columns in the CONTACT table
dd5b579c 45#ifdef wxODBC_BLOB_SUPPORT
da1e87c4
GT
46 const int CONTACT_NO_COLS = 14; // 0-13
47 const int MAX_PICTURE_SIZE = 128000; // in bytes
3fe813a9 48#else
da1e87c4 49 const int CONTACT_NO_COLS = 12; // 0-11
3fe813a9 50#endif
049977d0 51
c3677ad3 52const wxString PARAM_FILENAME = wxT("dbtest.cfg");
108106cf 53
108106cf
JS
54enum Language {langENGLISH, langFRENCH, langGERMAN, langSPANISH, langOTHER};
55
56// Forward class declarations
57class CeditorDlg;
58class CparameterDlg;
59
3f030b48
GT
60
61// Used for displaying many of the database capabilites
62// and usage statistics on a database connection
63void DisplayDbDiagnostics(wxDb *pDb);
64
65
049977d0
GT
66//
67// This class contains the actual data members that are used for transferring
925e9792 68// data back and forth from the database to the program.
049977d0
GT
69//
70// NOTE: The object described in this class is just for example purposes, and has no
71// real meaning other than to show each type of field being used by the database
72//
108106cf
JS
73class CstructContact : public wxObject
74{
e70e8f4c 75 public:
049977d0
GT
76 wxChar Name[50+1]; // Contact's name
77 wxChar Addr1[50+1];
78 wxChar Addr2[50+1];
79 wxChar City[25+1];
80 wxChar State[25+1];
81 wxChar PostalCode[15+1];
82 wxChar Country[20+1];
be5a51fb 83 TIMESTAMP_STRUCT JoinDate; // Date on which this person joined the wxWidgets project
e70e8f4c 84 Language NativeLanguage; // Enumerated type indicating person's native language
da1e87c4
GT
85 ULONG BlobSize;
86 wxChar Picture[MAX_PICTURE_SIZE];
be5a51fb 87 bool IsDeveloper; // Is this person a developer for wxWidgets, or just a subscriber
e70e8f4c
GT
88 UCHAR Contributions; // Something to show off an integer field
89 ULONG LinesOfCode; // Something to show off a 'long' field
108106cf
JS
90}; // CstructContact
91
92
93//
049977d0
GT
94// The Ccontact class derives from wxDbTable, so we have access to all
95// of the database table functions and the local memory variables that
96// the database classes will store the data into (and read the data from)
97// all combined in this one class.
108106cf 98//
f6bcfd97 99class Ccontact : public wxDbTable, public CstructContact
925e9792 100{
e70e8f4c 101 private:
049977d0 102 // Used to keep track of whether this class had a wxDb instance
925e9792 103 // passed in to it or not. If an existing wxDb instance was not
049977d0
GT
104 // passed in at Ccontact creation time, then when the Ccontact
105 // instance is deleted, the connection will be freed as Ccontact
106 // created its own connection when it was created.
e70e8f4c 107 bool freeDbConn;
049977d0
GT
108
109 // Calls wxDbTable::SetColDefs() once for each column that is
110 // to be associated with some member variable for use with
111 // this database object.
e70e8f4c 112 void SetupColumns();
108106cf 113
e70e8f4c 114 public:
925e9792 115 // Used in places where we need to construct a WHERE clause to
049977d0
GT
116 // be passed to the SetWhereClause() function. From example,
117 // where building the WHERE clause requires using ::Printf()
118 // to build the string.
e70e8f4c 119 wxString whereStr;
049977d0
GT
120
121 // WHERE string returned from the query dialog
122 wxString qryWhereStr;
108106cf 123
f6bcfd97 124 Ccontact(wxDb *pwxDb=NULL);
e70e8f4c 125 ~Ccontact();
108106cf 126
e70e8f4c 127 void Initialize();
049977d0
GT
128
129 // Contains all the index definitions and calls to wxDbTable::CreateIndex()
130 // required to create all the indexes we wish to define for this table.
69a2b59d 131 bool CreateIndexes(bool recreate);
049977d0
GT
132
133 // Since we do not wish to have duplicate code blocks all over our program
134 // for a common query/fetch that we will need to do in many places, we
135 // include this member function that does it all for us in one place.
136 bool FetchByName(const wxString &name);
108106cf
JS
137
138}; // Ccontact class definition
139
140
141typedef struct Cparameters
142{
049977d0
GT
143 wxChar ODBCSource[SQL_MAX_DSN_LENGTH+1];
144 wxChar UserName[SQL_MAX_USER_NAME_LEN+1];
145 wxChar Password[SQL_MAX_AUTHSTR_LEN+1];
94613352 146 wxChar DirPath[MAX_PATH+1];
108106cf
JS
147} Cparameters;
148
149
108106cf
JS
150// Define a new frame type
151class DatabaseDemoFrame: public wxFrame
925e9792 152{
e70e8f4c
GT
153 private:
154 CeditorDlg *pEditorDlg;
155 CparameterDlg *pParamDlg;
108106cf 156
e70e8f4c
GT
157 public:
158 DatabaseDemoFrame(wxFrame *frame, const wxString& title, const wxPoint& pos, const wxSize& sz);
3f030b48 159 ~DatabaseDemoFrame();
108106cf 160
e70e8f4c 161 void OnCloseWindow(wxCloseEvent& event);
1fc5dd6f 162 void OnCreate(wxCommandEvent& event);
3ca6a5f0
BP
163 void OnRecreateTable(wxCommandEvent& event);
164 void OnRecreateIndexes(wxCommandEvent& event);
1fc5dd6f
JS
165 void OnExit(wxCommandEvent& event);
166 void OnEditParameters(wxCommandEvent& event);
167 void OnAbout(wxCommandEvent& event);
9b12bd99 168#if wxUSE_GRID
f21b2fd8 169 void OnDbGridTable( wxCommandEvent& );
925e9792 170#endif
f21b2fd8 171 void CreateDataTable(bool recreate);
e70e8f4c
GT
172 void BuildEditorDialog();
173 void BuildParameterDialog(wxWindow *parent);
1fc5dd6f
JS
174
175DECLARE_EVENT_TABLE()
108106cf
JS
176}; // DatabaseDemoFrame
177
178
9b12bd99 179#if wxUSE_GRID
f21b2fd8
GT
180
181// *************************** DBGridFrame ***************************
182
183class DbGridFrame : public wxFrame
184{
185public:
2f6c54eb 186 bool initialized;
f21b2fd8 187
2f6c54eb 188 DbGridFrame(wxWindow *parent);
f21b2fd8 189
2f6c54eb
VZ
190 void OnCloseWindow(wxCloseEvent& event);
191 bool Initialize();
f21b2fd8 192
2f6c54eb 193 DECLARE_EVENT_TABLE()
f21b2fd8
GT
194};
195
196#endif
197
049977d0
GT
198// Define a new application type
199class DatabaseDemoApp: public wxApp
200{
201 public:
202 // These are the parameters that are stored in the "PARAM_FILENAME" file
203 // that are read in at startup of the program that indicate the connection
204 // parameters to be used for connecting to the ODBC data source.
205 Cparameters params;
206
207 // Pointer to the main frame used by the App
208 DatabaseDemoFrame *DemoFrame;
209
210 // Pointer to the main database connection used in the program. This
211 // pointer would normally be used for doing things as database lookups
212 // for user login names and passwords, getting workstation settings, etc.
925e9792 213 //
049977d0 214 // ---> IMPORTANT <---
925e9792 215 //
049977d0
GT
216 // For each database object created which uses this wxDb pointer
217 // connection to the database, when a CommitTrans() or RollBackTrans()
218 // will commit or rollback EVERY object which uses this wxDb pointer.
925e9792
WS
219 //
220 // To allow each table object (those derived from wxDbTable) to be
049977d0 221 // individually committed or rolled back, you MUST use a different
925e9792 222 // instance of wxDb in the constructor of the table. Doing so creates
049977d0
GT
223 // more overhead, and will use more database connections (some DBs have
224 // connection limits...), so use connections sparringly.
925e9792 225 //
049977d0
GT
226 // It is recommended that one "main" database connection be created for
227 // the entire program to use for READ-ONLY database accesses, but for each
228 // table object which will do a CommitTrans() or RollbackTrans() that a
229 // new wxDb object be created and used for it.
230 wxDb *READONLY_DB;
231
925e9792 232 // Contains the ODBC connection information used by
049977d0
GT
233 // all database connections
234 wxDbConnectInf *DbConnectInf;
235
236 bool OnInit();
237
238 // Read/Write ODBC connection parameters to the "PARAM_FILENAME" file
239 bool ReadParamFile(Cparameters &params);
240 bool WriteParamFile(Cparameters &params);
241
242 void CreateDataTable(bool recreate);
ea24eeb2
GT
243
244 // Pointer to the wxDbTable instance that is used to manipulate
245 // the data in memory and in the database
246 Ccontact *Contact;
247
049977d0
GT
248}; // DatabaseDemoApp
249
250
251DECLARE_APP(DatabaseDemoApp)
252
108106cf
JS
253
254// *************************** CeditorDlg ***************************
255
256class CeditorDlg : public wxPanel
257{
e70e8f4c 258 private:
049977d0 259 // Used to indicate whether all of the widget pointers (defined
925e9792 260 // below) have been initialized to point to the memory for
049977d0
GT
261 // the named widget. Used as a safeguard from using the widget
262 // before it has been initialized.
3ca6a5f0 263 bool widgetPtrsSet;
049977d0 264
925e9792
WS
265 // Used when the EDIT button has been pressed to maintain the
266 // original name that was displayed in the editor before the
049977d0
GT
267 // EDIT button was pressed, so that if CANCEL is pressed, a
268 // FetchByName() can be done to retrieve the original data
269 // to repopulate the dialog.
3ca6a5f0 270 wxString saveName;
e70e8f4c
GT
271
272 // Pointers to all widgets on the dialog
273 wxButton *pCreateBtn, *pEditBtn, *pDeleteBtn, *pCopyBtn, *pSaveBtn, *pCancelBtn;
274 wxButton *pPrevBtn, *pNextBtn, *pQueryBtn, *pResetBtn, *pDoneBtn, *pHelpBtn;
275 wxButton *pNameListBtn;
69a2b59d 276 wxButton *pCatalogBtn, *pDataTypesBtn, *pDbDiagsBtn;
e70e8f4c
GT
277 wxTextCtrl *pNameTxt, *pAddress1Txt, *pAddress2Txt,*pCityTxt, *pStateTxt, *pCountryTxt,*pPostalCodeTxt;
278 wxStaticText *pNameMsg, *pAddress1Msg, *pAddress2Msg,*pCityMsg, *pStateMsg, *pCountryMsg,*pPostalCodeMsg;
279 wxTextCtrl *pJoinDateTxt,*pContribTxt, *pLinesTxt;
280 wxStaticText *pJoinDateMsg,*pContribMsg, *pLinesMsg;
281 wxRadioBox *pDeveloperRadio;
282 wxChoice *pNativeLangChoice;
283 wxStaticText *pNativeLangMsg;
da1e87c4
GT
284#ifdef wxODBC_BLOB_SUPPORT
285 wxStaticText *pPictureMsg, *pPictSizeMsg;
286 wxButton *pChooseImageBtn, *pShowImageBtn;
287 wxTextCtrl *pPictSizeTxt;
288#endif
e70e8f4c
GT
289
290 public:
049977d0
GT
291 // Indicates if the editor dialog has been initialized yet (used to
292 // help trap if the Initialize() function failed to load all required
293 // resources or not.
3ca6a5f0 294 bool initialized;
049977d0 295
3ca6a5f0 296 enum DialogModes mode;
049977d0 297
e70e8f4c
GT
298 CeditorDlg(wxWindow *parent);
299
300 void OnCloseWindow(wxCloseEvent& event);
301 void OnButton( wxCommandEvent &event );
302 void OnCommand(wxWindow& win, wxCommandEvent& event);
303 void OnActivate(bool) {}; // necessary for hot keys
304
3ca6a5f0 305 bool Initialize();
049977d0 306
da1e87c4
GT
307#ifdef wxODBC_BLOB_SUPPORT
308 // Methods for reading image file into current table, and
309 // also displaying the image.
310 void OnSelectPict();
311 void OnShowImage();
312#endif
313
049977d0
GT
314 // Sets wxStaticText fields to be editable or not depending
315 // on the current value of 'mode'
e70e8f4c 316 void FieldsEditable();
049977d0
GT
317
318 // Sets the editor mode, determining what state widgets
319 // on the dialog are to be in based on the operation
320 // being performed.
e70e8f4c 321 void SetMode(enum DialogModes m);
049977d0
GT
322
323 // Update/Retrieve data from the widgets on the dialog
e70e8f4c
GT
324 bool PutData();
325 bool GetData();
049977d0
GT
326
327 // Inserts/updates the database with the current data
328 // retrieved from the editor dialog
e70e8f4c 329 bool Save();
049977d0 330
925e9792 331 // Database functions for changing the data that is to
049977d0
GT
332 // be displayed on the dialog. GetNextRec()/GetPrevRec()
333 // provide database independent methods that do not require
334 // backward scrolling cursors to obtain the record that
335 // is prior to the current record in the search sequence.
e70e8f4c
GT
336 bool GetNextRec();
337 bool GetPrevRec();
049977d0 338 bool GetRec(const wxString &whereStr);
925e9792 339
f6fcbb63 340DECLARE_EVENT_TABLE()
108106cf
JS
341}; // CeditorDlg
342
1fc5dd6f
JS
343#define EDITOR_DIALOG 199
344
345// Editor dialog control ids
346#define EDITOR_DIALOG_FN_GROUP 200
347#define EDITOR_DIALOG_SEARCH_GROUP 201
348#define EDITOR_DIALOG_CREATE 202
349#define EDITOR_DIALOG_EDIT 203
350#define EDITOR_DIALOG_DELETE 204
351#define EDITOR_DIALOG_COPY 205
352#define EDITOR_DIALOG_SAVE 206
353#define EDITOR_DIALOG_CANCEL 207
354#define EDITOR_DIALOG_PREV 208
355#define EDITOR_DIALOG_NEXT 209
356#define EDITOR_DIALOG_QUERY 211
357#define EDITOR_DIALOG_RESET 212
358#define EDITOR_DIALOG_NAME_MSG 213
359#define EDITOR_DIALOG_NAME_TEXT 214
360#define EDITOR_DIALOG_LOOKUP 215
361#define EDITOR_DIALOG_ADDRESS1_MSG 216
362#define EDITOR_DIALOG_ADDRESS1_TEXT 217
363#define EDITOR_DIALOG_ADDRESS2_MSG 218
364#define EDITOR_DIALOG_ADDRESS2_TEXT 219
365#define EDITOR_DIALOG_CITY_MSG 220
366#define EDITOR_DIALOG_CITY_TEXT 221
367#define EDITOR_DIALOG_COUNTRY_MSG 222
368#define EDITOR_DIALOG_COUNTRY_TEXT 223
369#define EDITOR_DIALOG_POSTAL_MSG 224
370#define EDITOR_DIALOG_POSTAL_TEXT 225
371#define EDITOR_DIALOG_LANG_MSG 226
372#define EDITOR_DIALOG_LANG_CHOICE 227
373#define EDITOR_DIALOG_DATE_MSG 228
374#define EDITOR_DIALOG_DATE_TEXT 229
375#define EDITOR_DIALOG_CONTRIB_MSG 230
376#define EDITOR_DIALOG_CONTRIB_TEXT 231
377#define EDITOR_DIALOG_LINES_MSG 232
378#define EDITOR_DIALOG_LINES_TEXT 233
379#define EDITOR_DIALOG_STATE_MSG 234
380#define EDITOR_DIALOG_STATE_TEXT 235
381#define EDITOR_DIALOG_DEVELOPER 236
382#define EDITOR_DIALOG_JOIN_MSG 237
383#define EDITOR_DIALOG_JOIN_TEXT 238
69a2b59d 384#define EDITOR_DIALOG_CATALOG 240
3f030b48
GT
385#define EDITOR_DIALOG_DATATYPES 250
386#define EDITOR_DIALOG_DB_DIAGS 260
da1e87c4
GT
387#ifdef wxODBC_BLOB_SUPPORT
388 #define EDITOR_DIALOG_PIC_MSG 270
389 #define EDITOR_DIALOG_PICSIZE_MSG 271
390 #define EDITOR_DIALOG_PIC_BROWSE 272
391 #define EDITOR_DIALOG_PIC_SHOW 273
392 #define EDITOR_DIALOG_PIC_SIZE_TEXT 274
393#endif
108106cf
JS
394
395// *************************** CparameterDlg ***************************
396
1fc5dd6f 397class CparameterDlg : public wxDialog
108106cf 398{
e70e8f4c 399 private:
049977d0 400 // Used to indicate whether all of the widget pointers (defined
925e9792 401 // below) have been initialized to point to the memory for
049977d0
GT
402 // the named widget. Used as a safeguard from using the widget
403 // before it has been initialized.
e70e8f4c 404 bool widgetPtrsSet;
049977d0 405
e70e8f4c 406 enum DialogModes mode;
049977d0 407
925e9792 408 // Have the parameters been saved yet, or do they
049977d0 409 // need to be saved to update the params on disk
e70e8f4c 410 bool saved;
049977d0
GT
411
412 // Original params
e70e8f4c
GT
413 Cparameters savedParamSettings;
414
415 // Pointers to all widgets on the dialog
416 wxStaticText *pParamODBCSourceMsg;
417 wxListBox *pParamODBCSourceList;
418 wxStaticText *pParamUserNameMsg, *pParamPasswordMsg, *pParamDirPathMsg;
419 wxTextCtrl *pParamUserNameTxt, *pParamPasswordTxt, *pParamDirPathTxt;
420 wxButton *pParamSaveBtn, *pParamCancelBtn;
421
422 public:
423 CparameterDlg(wxWindow *parent);
424
425 void OnCloseWindow(wxCloseEvent& event);
426 void OnButton( wxCommandEvent &event );
427 void OnCommand(wxWindow& win, wxCommandEvent& event);
428 void OnActivate(bool) {}; // necessary for hot keys
429
049977d0 430 // Update/Retrieve data from the widgets on the dialog
e70e8f4c
GT
431 bool PutData();
432 bool GetData();
049977d0
GT
433
434 // Stores the defined parameter for connecting to the selected ODBC
435 // data source to the config file name in "PARAM_FILENAME"
e70e8f4c 436 bool Save();
049977d0
GT
437
438 // Populates the 'pParamODBCSourceList' listbox with the names of all
439 // ODBC datasource defined for use at the current workstation
e70e8f4c 440 void FillDataSourceList();
108106cf 441
e3065973 442DECLARE_EVENT_TABLE()
108106cf
JS
443}; // CparameterDlg
444
1fc5dd6f
JS
445#define PARAMETER_DIALOG 400
446
447// Parameter dialog control ids
448#define PARAMETER_DIALOG_SOURCE_MSG 401
449#define PARAMETER_DIALOG_SOURCE_LISTBOX 402
450#define PARAMETER_DIALOG_NAME_MSG 403
451#define PARAMETER_DIALOG_NAME_TEXT 404
452#define PARAMETER_DIALOG_PASSWORD_MSG 405
453#define PARAMETER_DIALOG_PASSWORD_TEXT 406
e70e8f4c
GT
454#define PARAMETER_DIALOG_DIRPATH_MSG 407
455#define PARAMETER_DIALOG_DIRPATH_TEXT 408
65d7ddc4
GT
456#define PARAMETER_DIALOG_SAVE 409
457#define PARAMETER_DIALOG_CANCEL 410
108106cf
JS
458
459// *************************** CqueryDlg ***************************
460
461
462// QUERY DIALOG
463enum qryOp
464{
e70e8f4c
GT
465 qryOpEQ,
466 qryOpLT,
467 qryOpGT,
468 qryOpLE,
469 qryOpGE,
470 qryOpBEGINS,
471 qryOpCONTAINS,
472 qryOpLIKE,
473 qryOpBETWEEN
108106cf
JS
474};
475
476
477// Query strings
c3677ad3
GT
478wxString const & langQRY_EQ = wxT("column = column | value");
479const wxString & langQRY_LT = wxT("column < column | value");
480const wxString & langQRY_GT = wxT("column > column | value");
481const wxString & langQRY_LE = wxT("column <= column | value");
482const wxString & langQRY_GE = wxT("column >= column | value");
483const wxString & langQRY_BEGINS = wxT("columns that BEGIN with the string entered");
484const wxString & langQRY_CONTAINS = wxT("columns that CONTAIN the string entered");
485const wxString & langQRY_LIKE = wxT("% matches 0 or more of any char; _ matches 1 char");
486const wxString & langQRY_BETWEEN = wxT("column BETWEEN value AND value");
108106cf
JS
487
488
1fc5dd6f 489class CqueryDlg : public wxDialog
108106cf 490{
e70e8f4c 491 private:
049977d0
GT
492 wxDbColInf *colInf; // Column inf. returned by db->GetColumns()
493 wxDbTable *dbTable; // generic wxDbTable object for attaching to the table to query
494 wxChar *masterTableName; // Name of the table that 'dbTable' will be associated with
d3358961 495 wxString pWhere; // A pointer to the storage for the resulting where clause
f6bcfd97 496 wxDb *pDB;
e70e8f4c
GT
497
498 public:
049977d0 499 // Used to indicate whether all of the widget pointers (defined
925e9792 500 // below) have been initialized to point to the memory for
049977d0
GT
501 // the named widget. Used as a safeguard from using the widget
502 // before it has been initialized.
e70e8f4c
GT
503 bool widgetPtrsSet;
504
505 // Widget pointers
506 wxStaticText *pQueryCol1Msg;
507 wxChoice *pQueryCol1Choice;
508 wxStaticText *pQueryNotMsg;
509 wxCheckBox *pQueryNotCheck;
510 wxStaticText *pQueryOperatorMsg;
511 wxChoice *pQueryOperatorChoice;
512 wxStaticText *pQueryCol2Msg;
513 wxChoice *pQueryCol2Choice;
514 wxStaticText *pQueryValue1Msg;
515 wxTextCtrl *pQueryValue1Txt;
516 wxStaticText *pQueryValue2Msg;
517 wxTextCtrl *pQueryValue2Txt;
518 wxStaticText *pQuerySqlWhereMsg;
519 wxTextCtrl *pQuerySqlWhereMtxt;
520 wxButton *pQueryAddBtn;
521 wxButton *pQueryAndBtn;
522 wxButton *pQueryOrBtn;
523 wxButton *pQueryLParenBtn;
524 wxButton *pQueryRParenBtn;
525 wxButton *pQueryDoneBtn;
526 wxButton *pQueryClearBtn;
527 wxButton *pQueryCountBtn;
528 wxButton *pQueryHelpBtn;
529 wxStaticBox *pQueryHintGrp;
530 wxStaticText *pQueryHintMsg;
531
3ca6a5f0 532 wxTextCtrl *pFocusTxt;
e70e8f4c 533
d3358961 534 CqueryDlg(wxWindow *parent, wxDb *pDb, wxChar *tblName[], const wxString &pWhereArg);
da1e87c4 535 ~CqueryDlg();
e70e8f4c
GT
536
537 void OnButton( wxCommandEvent &event );
538 void OnCommand(wxWindow& win, wxCommandEvent& event);
539 void OnCloseWindow(wxCloseEvent& event);
540 void OnActivate(bool) {}; // necessary for hot keys
541
94613352 542 void AppendToWhere(wxChar *s);
e70e8f4c
GT
543 void ProcessAddBtn();
544 void ProcessCountBtn();
545 bool ValidateWhereClause();
108106cf 546
f6fcbb63 547DECLARE_EVENT_TABLE()
108106cf 548}; // CqueryDlg
1fc5dd6f
JS
549
550#define QUERY_DIALOG 300
551
552// Parameter dialog control ids
553#define QUERY_DIALOG_COL_MSG 301
554#define QUERY_DIALOG_COL_CHOICE 302
555#define QUERY_DIALOG_NOT_MSG 303
556#define QUERY_DIALOG_NOT_CHECKBOX 304
557#define QUERY_DIALOG_OP_MSG 305
558#define QUERY_DIALOG_OP_CHOICE 306
559#define QUERY_DIALOG_COL2_MSG 307
560#define QUERY_DIALOG_COL2_CHOICE 308
561#define QUERY_DIALOG_WHERE_MSG 309
562#define QUERY_DIALOG_WHERE_TEXT 310
563#define QUERY_DIALOG_ADD 311
564#define QUERY_DIALOG_AND 312
565#define QUERY_DIALOG_OR 313
566#define QUERY_DIALOG_LPAREN 314
567#define QUERY_DIALOG_RPAREN 315
568#define QUERY_DIALOG_DONE 316
569#define QUERY_DIALOG_CLEAR 317
570#define QUERY_DIALOG_COUNT 318
571#define QUERY_DIALOG_VALUE1_MSG 319
572#define QUERY_DIALOG_VALUE1_TEXT 320
573#define QUERY_DIALOG_VALUE2_MSG 321
574#define QUERY_DIALOG_VALUE2_TEXT 322
575#define QUERY_DIALOG_HINT_GROUP 323
576#define QUERY_DIALOG_HINT_MSG 324
577
da1e87c4
GT
578#ifdef wxODBC_BLOB_SUPPORT
579
580class CimageDlg : public wxDialog
581{
582public:
583 CimageDlg(wxWindow *parent, wxChar *pImageData, off_t iSize);
584 ~CimageDlg();
585
586 void OnCloseWindow(wxCloseEvent &event);
587
588private:
589 wxStaticBitmap *m_pDisplayBmp;
590 wxBitmap *m_pBmp;
591 wxImage *m_pImage;
592
593protected:
594
595
596DECLARE_EVENT_TABLE()
597}; // CimageDlg
598
599#define IMAGE_DIALOG 400
600
601#define IMAGE_DIALOG_STATIC_BMP 401
602
603#endif
604
74de91cc
JS
605wxChar * const langNO = wxT("No");
606wxChar * const langYES = wxT("Yes");
607wxChar * const langDBINF_DB_NAME = wxT("Database Name = ");
608wxChar * const langDBINF_DB_VER = wxT("Database Version = ");
609wxChar * const langDBINF_DRIVER_NAME = wxT("Driver Name = ");
610wxChar * const langDBINF_DRIVER_ODBC_VER = wxT("Driver ODBC Version = ");
611wxChar * const langDBINF_DRIVER_MGR_ODBC_VER = wxT("Driver Manager ODBC Version = ");
612wxChar * const langDBINF_DRIVER_VER = wxT("Driver Version = ");
613wxChar * const langDBINF_SERVER_NAME = wxT("Server Name = ");
614wxChar * const langDBINF_FILENAME = wxT("Filename = ");
615wxChar * const langDBINF_OUTER_JOINS = wxT("Outer Joins = ");
616wxChar * const langDBINF_STORED_PROC = wxT("Stored Procedures = ");
617wxChar * const langDBINF_MAX_HDBC = wxT("Max # of Db connections = ");
618wxChar * const langDBINF_MAX_HSTMT = wxT("Max # of cursors (per db connection) = ");
925e9792 619wxChar * const langDBINF_UNLIMITED = wxT("Unlimited or Unknown");
74de91cc
JS
620wxChar * const langDBINF_API_LVL = wxT("ODBC API conformance level = ");
621wxChar * const langDBINF_CLI_LVL = wxT("Client (SAG) conformance level = ");
622wxChar * const langDBINF_SQL_LVL = wxT("SQL conformance level = ");
623wxChar * const langDBINF_COMMIT_BEHAVIOR = wxT("Commit Behavior = ");
624wxChar * const langDBINF_ROLLBACK_BEHAVIOR = wxT("Rollback Behavior = ");
625wxChar * const langDBINF_SUPP_NOT_NULL = wxT("Support NOT NULL clause = ");
626wxChar * const langDBINF_SUPP_IEF = wxT("Support IEF = ");
627wxChar * const langDBINF_TXN_ISOLATION = wxT("Transaction Isolation Level (default) = ");
628wxChar * const langDBINF_TXN_ISOLATION_CURR = wxT("Transaction Isolation Level (current) = ");
629wxChar * const langDBINF_TXN_ISOLATION_OPTS = wxT("Transaction Isolation Options Available = ");
630wxChar * const langDBINF_FETCH_DIRS = wxT("Fetch Directions = ");
631wxChar * const langDBINF_LOCK_TYPES = wxT("Lock Types (SQLSetPos) = ");
632wxChar * const langDBINF_POS_OPERS = wxT("Position Operations (SQLSetPos) = ");
633wxChar * const langDBINF_POS_STMTS = wxT("Position Statements = ");
634wxChar * const langDBINF_SCROLL_CONCURR = wxT("Concurrency Options (scrollable cursors) = ");
635wxChar * const langDBINF_SCROLL_OPTS = wxT("Scroll Options (scrollable cursors) = ");
636wxChar * const langDBINF_STATIC_SENS = wxT("Static Sensitivity = ");
637wxChar * const langDBINF_TXN_CAPABLE = wxT("Transaction Support = ");
638wxChar * const langDBINF_LOGIN_TIMEOUT = wxT("Login Timeout = ");
639wxChar * const langDBINF_NONE = wxT("None");
640wxChar * const langDBINF_LEVEL1 = wxT("Level 1");
641wxChar * const langDBINF_LEVEL2 = wxT("Level 2");
642wxChar * const langDBINF_NOT_COMPLIANT = wxT("Not Compliant");
643wxChar * const langDBINF_COMPLIANT = wxT("Compliant");
644wxChar * const langDBINF_MIN_GRAMMAR = wxT("Minimum Grammer");
645wxChar * const langDBINF_CORE_GRAMMAR = wxT("Core Grammer");
646wxChar * const langDBINF_EXT_GRAMMAR = wxT("Extended Grammer");
647wxChar * const langDBINF_DELETE_CURSORS = wxT("Delete cursors");
648wxChar * const langDBINF_CLOSE_CURSORS = wxT("Close cursors");
649wxChar * const langDBINF_PRESERVE_CURSORS = wxT("Preserve cursors");
650wxChar * const langDBINF_READ_UNCOMMITTED = wxT("Read Uncommitted");
651wxChar * const langDBINF_READ_COMMITTED = wxT("Read Committed");
652wxChar * const langDBINF_REPEATABLE_READ = wxT("Repeatable Read");
653wxChar * const langDBINF_SERIALIZABLE = wxT("Serializable");
654wxChar * const langDBINF_VERSIONING = wxT("Versioning");
655wxChar * const langDBINF_NEXT = wxT("Next");
656wxChar * const langDBINF_PREV = wxT("Prev");
657wxChar * const langDBINF_FIRST = wxT("First");
658wxChar * const langDBINF_LAST = wxT("Last");
659wxChar * const langDBINF_ABSOLUTE = wxT("Absolute");
660wxChar * const langDBINF_RELATIVE = wxT("Relative");
661wxChar * const langDBINF_RESUME = wxT("Resume");
662wxChar * const langDBINF_BOOKMARK = wxT("Bookmark");
663wxChar * const langDBINF_NO_CHANGE = wxT("No Change");
664wxChar * const langDBINF_EXCLUSIVE = wxT("Exclusive");
665wxChar * const langDBINF_UNLOCK = wxT("Unlock");
666wxChar * const langDBINF_POSITION = wxT("Position");
667wxChar * const langDBINF_REFRESH = wxT("Refresh");
668wxChar * const langDBINF_UPD = wxT("Upd");
669wxChar * const langDBINF_DEL = wxT("Del");
670wxChar * const langDBINF_ADD = wxT("Add");
671wxChar * const langDBINF_POS_DEL = wxT("Pos Delete");
672wxChar * const langDBINF_POS_UPD = wxT("Pos Update");
673wxChar * const langDBINF_SELECT_FOR_UPD = wxT("Select For Update");
674wxChar * const langDBINF_READ_ONLY = wxT("Read Only");
675wxChar * const langDBINF_LOCK = wxT("Lock");
676wxChar * const langDBINF_OPT_ROWVER = wxT("Opt. Rowver");
677wxChar * const langDBINF_OPT_VALUES = wxT("Opt. Values");
678wxChar * const langDBINF_FWD_ONLY = wxT("Fwd Only");
679wxChar * const langDBINF_STATIC = wxT("Static");
680wxChar * const langDBINF_KEYSET_DRIVEN = wxT("Keyset Driven");
681wxChar * const langDBINF_DYNAMIC = wxT("Dynamic");
682wxChar * const langDBINF_MIXED = wxT("Mixed");
683wxChar * const langDBINF_ADDITIONS = wxT("Additions");
684wxChar * const langDBINF_DELETIONS = wxT("Deletions");
685wxChar * const langDBINF_UPDATES = wxT("Updates");
686wxChar * const langDBINF_DML_ONLY = wxT("DML Only");
687wxChar * const langDBINF_DDL_COMMIT = wxT("DDL Commit");
688wxChar * const langDBINF_DDL_IGNORE = wxT("DDL Ignore");
689wxChar * const langDBINF_DDL_AND_DML = wxT("DDL and DML");
690wxChar * const langDBINF_ORACLE_BANNER = wxT(">>> ORACLE STATISTICS AND TUNING INFORMATION <<<");
691wxChar * const langDBINF_DB_BLOCK_GETS = wxT("DB block gets");
692wxChar * const langDBINF_CONSISTENT_GETS = wxT("Consistent gets");
693wxChar * const langDBINF_PHYSICAL_READS = wxT("Physical reads");
694wxChar * const langDBINF_CACHE_HIT_RATIO = wxT("Cache hit ratio");
695wxChar * const langDBINF_TABLESPACE_IO = wxT("TABLESPACE I/O LEVELS");
696wxChar * const langDBINF_PHYSICAL_WRITES = wxT("Physical writes");