]>
Commit | Line | Data |
---|---|---|
1 | /////////////////////////////////////////////////////////////////////////////// | |
2 | // Name: dbtest.h | |
3 | // Purpose: wxWidgets database demo app | |
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 | ||
12 | #include "wx/string.h" | |
13 | #include "wx/dbtable.h" | |
14 | ||
15 | enum DialogModes {mView,mCreate,mEdit,mSearch}; | |
16 | ||
17 | // ID for the menu quit command | |
18 | #define FILE_CREATE_ID 100 | |
19 | #define FILE_RECREATE_TABLE 110 | |
20 | #define FILE_RECREATE_INDEXES 120 | |
21 | ||
22 | #if wxUSE_GRID | |
23 | #define FILE_DBGRID_TABLE 130 | |
24 | #endif | |
25 | #define FILE_EXIT wxID_EXIT | |
26 | #define EDIT_PARAMETERS 200 | |
27 | #define HELP_ABOUT wxID_ABOUT | |
28 | ||
29 | // this seems to be missing, Robert Roebling (?) | |
30 | #ifndef MAX_PATH | |
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 | |
36 | #endif | |
37 | ||
38 | // Name of the table to be created/opened | |
39 | const wxString CONTACT_TABLE_NAME = wxT("CONTACTS"); | |
40 | ||
41 | #define wxODBC_BLOB_SUPPORT | |
42 | ||
43 | ||
44 | // Number of columns in the CONTACT table | |
45 | #ifdef wxODBC_BLOB_SUPPORT | |
46 | const int CONTACT_NO_COLS = 14; // 0-13 | |
47 | const int MAX_PICTURE_SIZE = 128000; // in bytes | |
48 | #else | |
49 | const int CONTACT_NO_COLS = 12; // 0-11 | |
50 | #endif | |
51 | ||
52 | const wxString PARAM_FILENAME = wxT("dbtest.cfg"); | |
53 | ||
54 | enum Language {langENGLISH, langFRENCH, langGERMAN, langSPANISH, langOTHER}; | |
55 | ||
56 | // Forward class declarations | |
57 | class CeditorDlg; | |
58 | class CparameterDlg; | |
59 | ||
60 | ||
61 | // Used for displaying many of the database capabilites | |
62 | // and usage statistics on a database connection | |
63 | void DisplayDbDiagnostics(wxDb *pDb); | |
64 | ||
65 | ||
66 | // | |
67 | // This class contains the actual data members that are used for transferring | |
68 | // data back and forth from the database to the program. | |
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 | // | |
73 | class CstructContact : public wxObject | |
74 | { | |
75 | public: | |
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]; | |
83 | TIMESTAMP_STRUCT JoinDate; // Date on which this person joined the wxWidgets project | |
84 | Language NativeLanguage; // Enumerated type indicating person's native language | |
85 | ULONG BlobSize; | |
86 | wxChar Picture[MAX_PICTURE_SIZE]; | |
87 | bool IsDeveloper; // Is this person a developer for wxWidgets, or just a subscriber | |
88 | UCHAR Contributions; // Something to show off an integer field | |
89 | ULONG LinesOfCode; // Something to show off a 'long' field | |
90 | }; // CstructContact | |
91 | ||
92 | ||
93 | // | |
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. | |
98 | // | |
99 | class Ccontact : public wxDbTable, public CstructContact | |
100 | { | |
101 | private: | |
102 | // Used to keep track of whether this class had a wxDb instance | |
103 | // passed in to it or not. If an existing wxDb instance was not | |
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. | |
107 | bool freeDbConn; | |
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. | |
112 | void SetupColumns(); | |
113 | ||
114 | public: | |
115 | // Used in places where we need to construct a WHERE clause to | |
116 | // be passed to the SetWhereClause() function. From example, | |
117 | // where building the WHERE clause requires using ::Printf() | |
118 | // to build the string. | |
119 | wxString whereStr; | |
120 | ||
121 | // WHERE string returned from the query dialog | |
122 | wxString qryWhereStr; | |
123 | ||
124 | Ccontact(wxDb *pwxDb=NULL); | |
125 | ~Ccontact(); | |
126 | ||
127 | void Initialize(); | |
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. | |
131 | bool CreateIndexes(bool recreate); | |
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); | |
137 | ||
138 | }; // Ccontact class definition | |
139 | ||
140 | ||
141 | typedef struct Cparameters | |
142 | { | |
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]; | |
146 | wxChar DirPath[MAX_PATH+1]; | |
147 | } Cparameters; | |
148 | ||
149 | ||
150 | // Define a new frame type | |
151 | class DatabaseDemoFrame: public wxFrame | |
152 | { | |
153 | private: | |
154 | CeditorDlg *pEditorDlg; | |
155 | CparameterDlg *pParamDlg; | |
156 | ||
157 | public: | |
158 | DatabaseDemoFrame(wxFrame *frame, const wxString& title, const wxPoint& pos, const wxSize& sz); | |
159 | ~DatabaseDemoFrame(); | |
160 | ||
161 | void OnCloseWindow(wxCloseEvent& event); | |
162 | void OnCreate(wxCommandEvent& event); | |
163 | void OnRecreateTable(wxCommandEvent& event); | |
164 | void OnRecreateIndexes(wxCommandEvent& event); | |
165 | void OnExit(wxCommandEvent& event); | |
166 | void OnEditParameters(wxCommandEvent& event); | |
167 | void OnAbout(wxCommandEvent& event); | |
168 | #if wxUSE_GRID | |
169 | void OnDbGridTable( wxCommandEvent& ); | |
170 | #endif | |
171 | void CreateDataTable(bool recreate); | |
172 | void BuildEditorDialog(); | |
173 | void BuildParameterDialog(wxWindow *parent); | |
174 | ||
175 | DECLARE_EVENT_TABLE() | |
176 | }; // DatabaseDemoFrame | |
177 | ||
178 | ||
179 | #if wxUSE_GRID | |
180 | ||
181 | // *************************** DBGridFrame *************************** | |
182 | ||
183 | class DbGridFrame : public wxFrame | |
184 | { | |
185 | public: | |
186 | bool initialized; | |
187 | ||
188 | DbGridFrame(wxWindow *parent); | |
189 | ||
190 | void OnCloseWindow(wxCloseEvent& event); | |
191 | bool Initialize(); | |
192 | ||
193 | DECLARE_EVENT_TABLE() | |
194 | }; | |
195 | ||
196 | #endif | |
197 | ||
198 | // Define a new application type | |
199 | class 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. | |
213 | // | |
214 | // ---> IMPORTANT <--- | |
215 | // | |
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. | |
219 | // | |
220 | // To allow each table object (those derived from wxDbTable) to be | |
221 | // individually committed or rolled back, you MUST use a different | |
222 | // instance of wxDb in the constructor of the table. Doing so creates | |
223 | // more overhead, and will use more database connections (some DBs have | |
224 | // connection limits...), so use connections sparringly. | |
225 | // | |
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 | ||
232 | // Contains the ODBC connection information used by | |
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 ¶ms); | |
240 | bool WriteParamFile(Cparameters ¶ms); | |
241 | ||
242 | void CreateDataTable(bool recreate); | |
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 | ||
248 | }; // DatabaseDemoApp | |
249 | ||
250 | ||
251 | DECLARE_APP(DatabaseDemoApp) | |
252 | ||
253 | ||
254 | // *************************** CeditorDlg *************************** | |
255 | ||
256 | class CeditorDlg : public wxPanel | |
257 | { | |
258 | private: | |
259 | // Used to indicate whether all of the widget pointers (defined | |
260 | // below) have been initialized to point to the memory for | |
261 | // the named widget. Used as a safeguard from using the widget | |
262 | // before it has been initialized. | |
263 | bool widgetPtrsSet; | |
264 | ||
265 | // Used when the EDIT button has been pressed to maintain the | |
266 | // original name that was displayed in the editor before the | |
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. | |
270 | wxString saveName; | |
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; | |
276 | wxButton *pCatalogBtn, *pDataTypesBtn, *pDbDiagsBtn; | |
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; | |
284 | #ifdef wxODBC_BLOB_SUPPORT | |
285 | wxStaticText *pPictureMsg, *pPictSizeMsg; | |
286 | wxButton *pChooseImageBtn, *pShowImageBtn; | |
287 | wxTextCtrl *pPictSizeTxt; | |
288 | #endif | |
289 | ||
290 | public: | |
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. | |
294 | bool initialized; | |
295 | ||
296 | enum DialogModes mode; | |
297 | ||
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 | ||
305 | bool Initialize(); | |
306 | ||
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 | ||
314 | // Sets wxStaticText fields to be editable or not depending | |
315 | // on the current value of 'mode' | |
316 | void FieldsEditable(); | |
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. | |
321 | void SetMode(enum DialogModes m); | |
322 | ||
323 | // Update/Retrieve data from the widgets on the dialog | |
324 | bool PutData(); | |
325 | bool GetData(); | |
326 | ||
327 | // Inserts/updates the database with the current data | |
328 | // retrieved from the editor dialog | |
329 | bool Save(); | |
330 | ||
331 | // Database functions for changing the data that is to | |
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. | |
336 | bool GetNextRec(); | |
337 | bool GetPrevRec(); | |
338 | bool GetRec(const wxString &whereStr); | |
339 | ||
340 | DECLARE_EVENT_TABLE() | |
341 | }; // CeditorDlg | |
342 | ||
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 | |
384 | #define EDITOR_DIALOG_CATALOG 240 | |
385 | #define EDITOR_DIALOG_DATATYPES 250 | |
386 | #define EDITOR_DIALOG_DB_DIAGS 260 | |
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 | |
394 | ||
395 | // *************************** CparameterDlg *************************** | |
396 | ||
397 | class CparameterDlg : public wxDialog | |
398 | { | |
399 | private: | |
400 | // Used to indicate whether all of the widget pointers (defined | |
401 | // below) have been initialized to point to the memory for | |
402 | // the named widget. Used as a safeguard from using the widget | |
403 | // before it has been initialized. | |
404 | bool widgetPtrsSet; | |
405 | ||
406 | enum DialogModes mode; | |
407 | ||
408 | // Have the parameters been saved yet, or do they | |
409 | // need to be saved to update the params on disk | |
410 | bool saved; | |
411 | ||
412 | // Original params | |
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 | ||
430 | // Update/Retrieve data from the widgets on the dialog | |
431 | bool PutData(); | |
432 | bool GetData(); | |
433 | ||
434 | // Stores the defined parameter for connecting to the selected ODBC | |
435 | // data source to the config file name in "PARAM_FILENAME" | |
436 | bool Save(); | |
437 | ||
438 | // Populates the 'pParamODBCSourceList' listbox with the names of all | |
439 | // ODBC datasource defined for use at the current workstation | |
440 | void FillDataSourceList(); | |
441 | ||
442 | DECLARE_EVENT_TABLE() | |
443 | }; // CparameterDlg | |
444 | ||
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 | |
454 | #define PARAMETER_DIALOG_DIRPATH_MSG 407 | |
455 | #define PARAMETER_DIALOG_DIRPATH_TEXT 408 | |
456 | #define PARAMETER_DIALOG_SAVE 409 | |
457 | #define PARAMETER_DIALOG_CANCEL 410 | |
458 | ||
459 | // *************************** CqueryDlg *************************** | |
460 | ||
461 | ||
462 | // QUERY DIALOG | |
463 | enum qryOp | |
464 | { | |
465 | qryOpEQ, | |
466 | qryOpLT, | |
467 | qryOpGT, | |
468 | qryOpLE, | |
469 | qryOpGE, | |
470 | qryOpBEGINS, | |
471 | qryOpCONTAINS, | |
472 | qryOpLIKE, | |
473 | qryOpBETWEEN | |
474 | }; | |
475 | ||
476 | ||
477 | // Query strings | |
478 | wxString const & langQRY_EQ = wxT("column = column | value"); | |
479 | const wxString & langQRY_LT = wxT("column < column | value"); | |
480 | const wxString & langQRY_GT = wxT("column > column | value"); | |
481 | const wxString & langQRY_LE = wxT("column <= column | value"); | |
482 | const wxString & langQRY_GE = wxT("column >= column | value"); | |
483 | const wxString & langQRY_BEGINS = wxT("columns that BEGIN with the string entered"); | |
484 | const wxString & langQRY_CONTAINS = wxT("columns that CONTAIN the string entered"); | |
485 | const wxString & langQRY_LIKE = wxT("% matches 0 or more of any char; _ matches 1 char"); | |
486 | const wxString & langQRY_BETWEEN = wxT("column BETWEEN value AND value"); | |
487 | ||
488 | ||
489 | class CqueryDlg : public wxDialog | |
490 | { | |
491 | private: | |
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 | |
495 | wxString pWhere; // A pointer to the storage for the resulting where clause | |
496 | wxDb *pDB; | |
497 | ||
498 | public: | |
499 | // Used to indicate whether all of the widget pointers (defined | |
500 | // below) have been initialized to point to the memory for | |
501 | // the named widget. Used as a safeguard from using the widget | |
502 | // before it has been initialized. | |
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 | ||
532 | wxTextCtrl *pFocusTxt; | |
533 | ||
534 | CqueryDlg(wxWindow *parent, wxDb *pDb, wxChar *tblName[], const wxString &pWhereArg); | |
535 | ~CqueryDlg(); | |
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 | ||
542 | void AppendToWhere(wxChar *s); | |
543 | void ProcessAddBtn(); | |
544 | void ProcessCountBtn(); | |
545 | bool ValidateWhereClause(); | |
546 | ||
547 | DECLARE_EVENT_TABLE() | |
548 | }; // CqueryDlg | |
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 | ||
578 | #ifdef wxODBC_BLOB_SUPPORT | |
579 | ||
580 | class CimageDlg : public wxDialog | |
581 | { | |
582 | public: | |
583 | CimageDlg(wxWindow *parent, wxChar *pImageData, off_t iSize); | |
584 | ~CimageDlg(); | |
585 | ||
586 | void OnCloseWindow(wxCloseEvent &event); | |
587 | ||
588 | private: | |
589 | wxStaticBitmap *m_pDisplayBmp; | |
590 | wxBitmap *m_pBmp; | |
591 | wxImage *m_pImage; | |
592 | ||
593 | protected: | |
594 | ||
595 | ||
596 | DECLARE_EVENT_TABLE() | |
597 | }; // CimageDlg | |
598 | ||
599 | #define IMAGE_DIALOG 400 | |
600 | ||
601 | #define IMAGE_DIALOG_STATIC_BMP 401 | |
602 | ||
603 | #endif | |
604 | ||
605 | wxChar * const langNO = wxT("No"); | |
606 | wxChar * const langYES = wxT("Yes"); | |
607 | wxChar * const langDBINF_DB_NAME = wxT("Database Name = "); | |
608 | wxChar * const langDBINF_DB_VER = wxT("Database Version = "); | |
609 | wxChar * const langDBINF_DRIVER_NAME = wxT("Driver Name = "); | |
610 | wxChar * const langDBINF_DRIVER_ODBC_VER = wxT("Driver ODBC Version = "); | |
611 | wxChar * const langDBINF_DRIVER_MGR_ODBC_VER = wxT("Driver Manager ODBC Version = "); | |
612 | wxChar * const langDBINF_DRIVER_VER = wxT("Driver Version = "); | |
613 | wxChar * const langDBINF_SERVER_NAME = wxT("Server Name = "); | |
614 | wxChar * const langDBINF_FILENAME = wxT("Filename = "); | |
615 | wxChar * const langDBINF_OUTER_JOINS = wxT("Outer Joins = "); | |
616 | wxChar * const langDBINF_STORED_PROC = wxT("Stored Procedures = "); | |
617 | wxChar * const langDBINF_MAX_HDBC = wxT("Max # of Db connections = "); | |
618 | wxChar * const langDBINF_MAX_HSTMT = wxT("Max # of cursors (per db connection) = "); | |
619 | wxChar * const langDBINF_UNLIMITED = wxT("Unlimited or Unknown"); | |
620 | wxChar * const langDBINF_API_LVL = wxT("ODBC API conformance level = "); | |
621 | wxChar * const langDBINF_CLI_LVL = wxT("Client (SAG) conformance level = "); | |
622 | wxChar * const langDBINF_SQL_LVL = wxT("SQL conformance level = "); | |
623 | wxChar * const langDBINF_COMMIT_BEHAVIOR = wxT("Commit Behavior = "); | |
624 | wxChar * const langDBINF_ROLLBACK_BEHAVIOR = wxT("Rollback Behavior = "); | |
625 | wxChar * const langDBINF_SUPP_NOT_NULL = wxT("Support NOT NULL clause = "); | |
626 | wxChar * const langDBINF_SUPP_IEF = wxT("Support IEF = "); | |
627 | wxChar * const langDBINF_TXN_ISOLATION = wxT("Transaction Isolation Level (default) = "); | |
628 | wxChar * const langDBINF_TXN_ISOLATION_CURR = wxT("Transaction Isolation Level (current) = "); | |
629 | wxChar * const langDBINF_TXN_ISOLATION_OPTS = wxT("Transaction Isolation Options Available = "); | |
630 | wxChar * const langDBINF_FETCH_DIRS = wxT("Fetch Directions = "); | |
631 | wxChar * const langDBINF_LOCK_TYPES = wxT("Lock Types (SQLSetPos) = "); | |
632 | wxChar * const langDBINF_POS_OPERS = wxT("Position Operations (SQLSetPos) = "); | |
633 | wxChar * const langDBINF_POS_STMTS = wxT("Position Statements = "); | |
634 | wxChar * const langDBINF_SCROLL_CONCURR = wxT("Concurrency Options (scrollable cursors) = "); | |
635 | wxChar * const langDBINF_SCROLL_OPTS = wxT("Scroll Options (scrollable cursors) = "); | |
636 | wxChar * const langDBINF_STATIC_SENS = wxT("Static Sensitivity = "); | |
637 | wxChar * const langDBINF_TXN_CAPABLE = wxT("Transaction Support = "); | |
638 | wxChar * const langDBINF_LOGIN_TIMEOUT = wxT("Login Timeout = "); | |
639 | wxChar * const langDBINF_NONE = wxT("None"); | |
640 | wxChar * const langDBINF_LEVEL1 = wxT("Level 1"); | |
641 | wxChar * const langDBINF_LEVEL2 = wxT("Level 2"); | |
642 | wxChar * const langDBINF_NOT_COMPLIANT = wxT("Not Compliant"); | |
643 | wxChar * const langDBINF_COMPLIANT = wxT("Compliant"); | |
644 | wxChar * const langDBINF_MIN_GRAMMAR = wxT("Minimum Grammer"); | |
645 | wxChar * const langDBINF_CORE_GRAMMAR = wxT("Core Grammer"); | |
646 | wxChar * const langDBINF_EXT_GRAMMAR = wxT("Extended Grammer"); | |
647 | wxChar * const langDBINF_DELETE_CURSORS = wxT("Delete cursors"); | |
648 | wxChar * const langDBINF_CLOSE_CURSORS = wxT("Close cursors"); | |
649 | wxChar * const langDBINF_PRESERVE_CURSORS = wxT("Preserve cursors"); | |
650 | wxChar * const langDBINF_READ_UNCOMMITTED = wxT("Read Uncommitted"); | |
651 | wxChar * const langDBINF_READ_COMMITTED = wxT("Read Committed"); | |
652 | wxChar * const langDBINF_REPEATABLE_READ = wxT("Repeatable Read"); | |
653 | wxChar * const langDBINF_SERIALIZABLE = wxT("Serializable"); | |
654 | wxChar * const langDBINF_VERSIONING = wxT("Versioning"); | |
655 | wxChar * const langDBINF_NEXT = wxT("Next"); | |
656 | wxChar * const langDBINF_PREV = wxT("Prev"); | |
657 | wxChar * const langDBINF_FIRST = wxT("First"); | |
658 | wxChar * const langDBINF_LAST = wxT("Last"); | |
659 | wxChar * const langDBINF_ABSOLUTE = wxT("Absolute"); | |
660 | wxChar * const langDBINF_RELATIVE = wxT("Relative"); | |
661 | wxChar * const langDBINF_RESUME = wxT("Resume"); | |
662 | wxChar * const langDBINF_BOOKMARK = wxT("Bookmark"); | |
663 | wxChar * const langDBINF_NO_CHANGE = wxT("No Change"); | |
664 | wxChar * const langDBINF_EXCLUSIVE = wxT("Exclusive"); | |
665 | wxChar * const langDBINF_UNLOCK = wxT("Unlock"); | |
666 | wxChar * const langDBINF_POSITION = wxT("Position"); | |
667 | wxChar * const langDBINF_REFRESH = wxT("Refresh"); | |
668 | wxChar * const langDBINF_UPD = wxT("Upd"); | |
669 | wxChar * const langDBINF_DEL = wxT("Del"); | |
670 | wxChar * const langDBINF_ADD = wxT("Add"); | |
671 | wxChar * const langDBINF_POS_DEL = wxT("Pos Delete"); | |
672 | wxChar * const langDBINF_POS_UPD = wxT("Pos Update"); | |
673 | wxChar * const langDBINF_SELECT_FOR_UPD = wxT("Select For Update"); | |
674 | wxChar * const langDBINF_READ_ONLY = wxT("Read Only"); | |
675 | wxChar * const langDBINF_LOCK = wxT("Lock"); | |
676 | wxChar * const langDBINF_OPT_ROWVER = wxT("Opt. Rowver"); | |
677 | wxChar * const langDBINF_OPT_VALUES = wxT("Opt. Values"); | |
678 | wxChar * const langDBINF_FWD_ONLY = wxT("Fwd Only"); | |
679 | wxChar * const langDBINF_STATIC = wxT("Static"); | |
680 | wxChar * const langDBINF_KEYSET_DRIVEN = wxT("Keyset Driven"); | |
681 | wxChar * const langDBINF_DYNAMIC = wxT("Dynamic"); | |
682 | wxChar * const langDBINF_MIXED = wxT("Mixed"); | |
683 | wxChar * const langDBINF_ADDITIONS = wxT("Additions"); | |
684 | wxChar * const langDBINF_DELETIONS = wxT("Deletions"); | |
685 | wxChar * const langDBINF_UPDATES = wxT("Updates"); | |
686 | wxChar * const langDBINF_DML_ONLY = wxT("DML Only"); | |
687 | wxChar * const langDBINF_DDL_COMMIT = wxT("DDL Commit"); | |
688 | wxChar * const langDBINF_DDL_IGNORE = wxT("DDL Ignore"); | |
689 | wxChar * const langDBINF_DDL_AND_DML = wxT("DDL and DML"); | |
690 | wxChar * const langDBINF_ORACLE_BANNER = wxT(">>> ORACLE STATISTICS AND TUNING INFORMATION <<<"); | |
691 | wxChar * const langDBINF_DB_BLOCK_GETS = wxT("DB block gets"); | |
692 | wxChar * const langDBINF_CONSISTENT_GETS = wxT("Consistent gets"); | |
693 | wxChar * const langDBINF_PHYSICAL_READS = wxT("Physical reads"); | |
694 | wxChar * const langDBINF_CACHE_HIT_RATIO = wxT("Cache hit ratio"); | |
695 | wxChar * const langDBINF_TABLESPACE_IO = wxT("TABLESPACE I/O LEVELS"); | |
696 | wxChar * const langDBINF_PHYSICAL_WRITES = wxT("Physical writes"); |