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