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