]>
Commit | Line | Data |
---|---|---|
108106cf JS |
1 | /////////////////////////////////////////////////////////////////////////////// |
2 | // Name: dbtest.h | |
3 | // Purpose: wxWindows 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 | ||
1fc5dd6f | 12 | #ifdef __GNUG__ |
108106cf | 13 | #pragma interface "dbtest.h" |
1fc5dd6f | 14 | #endif |
108106cf JS |
15 | |
16 | #include <wx/string.h> | |
e70e8f4c | 17 | #include <wx/db.h> |
108106cf JS |
18 | #include <wx/dbtable.h> |
19 | ||
e70e8f4c | 20 | enum DialogModes {mView,mCreate,mEdit,mSearch}; |
108106cf JS |
21 | |
22 | // ID for the menu quit command | |
3ca6a5f0 BP |
23 | #define FILE_CREATE 100 |
24 | #define FILE_RECREATE_TABLE 110 | |
25 | #define FILE_RECREATE_INDEXES 120 | |
26 | #define FILE_EXIT 199 | |
27 | #define EDIT_PARAMETERS 200 | |
e70e8f4c | 28 | #define ABOUT_DEMO 300 |
108106cf | 29 | |
e115e771 | 30 | // this seems to be missing, Robert Roebling (?) |
d433a26f | 31 | #ifndef MAX_PATH |
049977d0 GT |
32 | #if defined(__WXMAC__) |
33 | #define MAX_PATH 260 /* max. length of full pathname */ | |
34 | #else /* _MAC */ | |
35 | #define MAX_PATH 256 /* max. length of full pathname */ | |
36 | #endif | |
d433a26f | 37 | #endif |
108106cf JS |
38 | |
39 | // Name of the table to be created/opened | |
049977d0 | 40 | const wxChar CONTACT_TABLE_NAME[] = "contacts"; |
108106cf | 41 | |
049977d0 GT |
42 | // Number of columns in the CONTACT table |
43 | const int CONTACT_NO_COLS = 12; // 0-11 | |
44 | ||
45 | const wxChar PARAM_FILENAME[] = "dbtest.cfg"; | |
108106cf | 46 | |
108106cf JS |
47 | |
48 | enum Language {langENGLISH, langFRENCH, langGERMAN, langSPANISH, langOTHER}; | |
49 | ||
50 | // Forward class declarations | |
51 | class CeditorDlg; | |
52 | class CparameterDlg; | |
53 | ||
049977d0 GT |
54 | // |
55 | // This class contains the actual data members that are used for transferring | |
56 | // data back and forth from the database to the program. | |
57 | // | |
58 | // NOTE: The object described in this class is just for example purposes, and has no | |
59 | // real meaning other than to show each type of field being used by the database | |
60 | // | |
108106cf JS |
61 | class CstructContact : public wxObject |
62 | { | |
e70e8f4c | 63 | public: |
049977d0 GT |
64 | wxChar Name[50+1]; // Contact's name |
65 | wxChar Addr1[50+1]; | |
66 | wxChar Addr2[50+1]; | |
67 | wxChar City[25+1]; | |
68 | wxChar State[25+1]; | |
69 | wxChar PostalCode[15+1]; | |
70 | wxChar Country[20+1]; | |
e70e8f4c GT |
71 | TIMESTAMP_STRUCT JoinDate; // Date on which this person joined the wxWindows project |
72 | Language NativeLanguage; // Enumerated type indicating person's native language | |
73 | bool IsDeveloper; // Is this person a developer for wxWindows, or just a subscriber | |
74 | UCHAR Contributions; // Something to show off an integer field | |
75 | ULONG LinesOfCode; // Something to show off a 'long' field | |
108106cf JS |
76 | }; // CstructContact |
77 | ||
78 | ||
79 | // | |
049977d0 GT |
80 | // The Ccontact class derives from wxDbTable, so we have access to all |
81 | // of the database table functions and the local memory variables that | |
82 | // the database classes will store the data into (and read the data from) | |
83 | // all combined in this one class. | |
108106cf | 84 | // |
f6bcfd97 | 85 | class Ccontact : public wxDbTable, public CstructContact |
108106cf | 86 | { |
e70e8f4c | 87 | private: |
049977d0 GT |
88 | // Used to keep track of whether this class had a wxDb instance |
89 | // passed in to it or not. If an existing wxDb instance was not | |
90 | // passed in at Ccontact creation time, then when the Ccontact | |
91 | // instance is deleted, the connection will be freed as Ccontact | |
92 | // created its own connection when it was created. | |
e70e8f4c | 93 | bool freeDbConn; |
049977d0 GT |
94 | |
95 | // Calls wxDbTable::SetColDefs() once for each column that is | |
96 | // to be associated with some member variable for use with | |
97 | // this database object. | |
e70e8f4c | 98 | void SetupColumns(); |
108106cf | 99 | |
e70e8f4c | 100 | public: |
049977d0 GT |
101 | // Used in places where we need to construct a WHERE clause to |
102 | // be passed to the SetWhereClause() function. From example, | |
103 | // where building the WHERE clause requires using ::Printf() | |
104 | // to build the string. | |
e70e8f4c | 105 | wxString whereStr; |
049977d0 GT |
106 | |
107 | // WHERE string returned from the query dialog | |
108 | wxString qryWhereStr; | |
108106cf | 109 | |
f6bcfd97 | 110 | Ccontact(wxDb *pwxDb=NULL); |
e70e8f4c | 111 | ~Ccontact(); |
108106cf | 112 | |
e70e8f4c | 113 | void Initialize(); |
049977d0 GT |
114 | |
115 | // Contains all the index definitions and calls to wxDbTable::CreateIndex() | |
116 | // required to create all the indexes we wish to define for this table. | |
e70e8f4c | 117 | bool CreateIndexes(void); |
049977d0 GT |
118 | |
119 | // Since we do not wish to have duplicate code blocks all over our program | |
120 | // for a common query/fetch that we will need to do in many places, we | |
121 | // include this member function that does it all for us in one place. | |
122 | bool FetchByName(const wxString &name); | |
108106cf JS |
123 | |
124 | }; // Ccontact class definition | |
125 | ||
126 | ||
127 | typedef struct Cparameters | |
128 | { | |
049977d0 GT |
129 | wxChar ODBCSource[SQL_MAX_DSN_LENGTH+1]; |
130 | wxChar UserName[SQL_MAX_USER_NAME_LEN+1]; | |
131 | wxChar Password[SQL_MAX_AUTHSTR_LEN+1]; | |
94613352 | 132 | wxChar DirPath[MAX_PATH+1]; |
108106cf JS |
133 | } Cparameters; |
134 | ||
135 | ||
108106cf JS |
136 | // Define a new frame type |
137 | class DatabaseDemoFrame: public wxFrame | |
138 | { | |
e70e8f4c GT |
139 | private: |
140 | CeditorDlg *pEditorDlg; | |
141 | CparameterDlg *pParamDlg; | |
108106cf | 142 | |
e70e8f4c GT |
143 | public: |
144 | DatabaseDemoFrame(wxFrame *frame, const wxString& title, const wxPoint& pos, const wxSize& sz); | |
108106cf | 145 | |
e70e8f4c | 146 | void OnCloseWindow(wxCloseEvent& event); |
1fc5dd6f | 147 | void OnCreate(wxCommandEvent& event); |
3ca6a5f0 BP |
148 | void OnRecreateTable(wxCommandEvent& event); |
149 | void OnRecreateIndexes(wxCommandEvent& event); | |
1fc5dd6f JS |
150 | void OnExit(wxCommandEvent& event); |
151 | void OnEditParameters(wxCommandEvent& event); | |
152 | void OnAbout(wxCommandEvent& event); | |
108106cf | 153 | |
e70e8f4c GT |
154 | void BuildEditorDialog(); |
155 | void BuildParameterDialog(wxWindow *parent); | |
1fc5dd6f JS |
156 | |
157 | DECLARE_EVENT_TABLE() | |
108106cf JS |
158 | }; // DatabaseDemoFrame |
159 | ||
160 | ||
049977d0 GT |
161 | // Define a new application type |
162 | class DatabaseDemoApp: public wxApp | |
163 | { | |
164 | public: | |
165 | // These are the parameters that are stored in the "PARAM_FILENAME" file | |
166 | // that are read in at startup of the program that indicate the connection | |
167 | // parameters to be used for connecting to the ODBC data source. | |
168 | Cparameters params; | |
169 | ||
170 | // Pointer to the main frame used by the App | |
171 | DatabaseDemoFrame *DemoFrame; | |
172 | ||
173 | // Pointer to the main database connection used in the program. This | |
174 | // pointer would normally be used for doing things as database lookups | |
175 | // for user login names and passwords, getting workstation settings, etc. | |
176 | // | |
177 | // ---> IMPORTANT <--- | |
178 | // | |
179 | // For each database object created which uses this wxDb pointer | |
180 | // connection to the database, when a CommitTrans() or RollBackTrans() | |
181 | // will commit or rollback EVERY object which uses this wxDb pointer. | |
182 | // | |
183 | // To allow each table object (those derived from wxDbTable) to be | |
184 | // individually committed or rolled back, you MUST use a different | |
185 | // instance of wxDb in the constructor of the table. Doing so creates | |
186 | // more overhead, and will use more database connections (some DBs have | |
187 | // connection limits...), so use connections sparringly. | |
188 | // | |
189 | // It is recommended that one "main" database connection be created for | |
190 | // the entire program to use for READ-ONLY database accesses, but for each | |
191 | // table object which will do a CommitTrans() or RollbackTrans() that a | |
192 | // new wxDb object be created and used for it. | |
193 | wxDb *READONLY_DB; | |
194 | ||
195 | // Contains the ODBC connection information used by | |
196 | // all database connections | |
197 | wxDbConnectInf *DbConnectInf; | |
198 | ||
199 | bool OnInit(); | |
200 | ||
201 | // Read/Write ODBC connection parameters to the "PARAM_FILENAME" file | |
202 | bool ReadParamFile(Cparameters ¶ms); | |
203 | bool WriteParamFile(Cparameters ¶ms); | |
204 | ||
205 | void CreateDataTable(bool recreate); | |
206 | }; // DatabaseDemoApp | |
207 | ||
208 | ||
209 | DECLARE_APP(DatabaseDemoApp) | |
210 | ||
108106cf JS |
211 | |
212 | // *************************** CeditorDlg *************************** | |
213 | ||
214 | class CeditorDlg : public wxPanel | |
215 | { | |
e70e8f4c | 216 | private: |
049977d0 GT |
217 | // Used to indicate whether all of the widget pointers (defined |
218 | // below) have been initialized to point to the memory for | |
219 | // the named widget. Used as a safeguard from using the widget | |
220 | // before it has been initialized. | |
3ca6a5f0 | 221 | bool widgetPtrsSet; |
049977d0 GT |
222 | |
223 | // Used when the EDIT button has been pressed to maintain the | |
224 | // original name that was displayed in the editor before the | |
225 | // EDIT button was pressed, so that if CANCEL is pressed, a | |
226 | // FetchByName() can be done to retrieve the original data | |
227 | // to repopulate the dialog. | |
3ca6a5f0 | 228 | wxString saveName; |
e70e8f4c GT |
229 | |
230 | // Pointers to all widgets on the dialog | |
231 | wxButton *pCreateBtn, *pEditBtn, *pDeleteBtn, *pCopyBtn, *pSaveBtn, *pCancelBtn; | |
232 | wxButton *pPrevBtn, *pNextBtn, *pQueryBtn, *pResetBtn, *pDoneBtn, *pHelpBtn; | |
233 | wxButton *pNameListBtn; | |
234 | wxTextCtrl *pNameTxt, *pAddress1Txt, *pAddress2Txt,*pCityTxt, *pStateTxt, *pCountryTxt,*pPostalCodeTxt; | |
235 | wxStaticText *pNameMsg, *pAddress1Msg, *pAddress2Msg,*pCityMsg, *pStateMsg, *pCountryMsg,*pPostalCodeMsg; | |
236 | wxTextCtrl *pJoinDateTxt,*pContribTxt, *pLinesTxt; | |
237 | wxStaticText *pJoinDateMsg,*pContribMsg, *pLinesMsg; | |
238 | wxRadioBox *pDeveloperRadio; | |
239 | wxChoice *pNativeLangChoice; | |
240 | wxStaticText *pNativeLangMsg; | |
241 | ||
242 | public: | |
049977d0 GT |
243 | // Indicates if the editor dialog has been initialized yet (used to |
244 | // help trap if the Initialize() function failed to load all required | |
245 | // resources or not. | |
3ca6a5f0 | 246 | bool initialized; |
049977d0 | 247 | |
3ca6a5f0 | 248 | enum DialogModes mode; |
049977d0 GT |
249 | |
250 | // Pointer to the wxDbTable instance that is used to manipulate | |
251 | // the data in memory and in the database | |
252 | Ccontact *Contact; | |
e70e8f4c GT |
253 | |
254 | CeditorDlg(wxWindow *parent); | |
255 | ||
256 | void OnCloseWindow(wxCloseEvent& event); | |
257 | void OnButton( wxCommandEvent &event ); | |
258 | void OnCommand(wxWindow& win, wxCommandEvent& event); | |
259 | void OnActivate(bool) {}; // necessary for hot keys | |
260 | ||
3ca6a5f0 | 261 | bool Initialize(); |
049977d0 GT |
262 | |
263 | // Sets wxStaticText fields to be editable or not depending | |
264 | // on the current value of 'mode' | |
e70e8f4c | 265 | void FieldsEditable(); |
049977d0 GT |
266 | |
267 | // Sets the editor mode, determining what state widgets | |
268 | // on the dialog are to be in based on the operation | |
269 | // being performed. | |
e70e8f4c | 270 | void SetMode(enum DialogModes m); |
049977d0 GT |
271 | |
272 | // Update/Retrieve data from the widgets on the dialog | |
e70e8f4c GT |
273 | bool PutData(); |
274 | bool GetData(); | |
049977d0 GT |
275 | |
276 | // Inserts/updates the database with the current data | |
277 | // retrieved from the editor dialog | |
e70e8f4c | 278 | bool Save(); |
049977d0 GT |
279 | |
280 | // Database functions for changing the data that is to | |
281 | // be displayed on the dialog. GetNextRec()/GetPrevRec() | |
282 | // provide database independent methods that do not require | |
283 | // backward scrolling cursors to obtain the record that | |
284 | // is prior to the current record in the search sequence. | |
e70e8f4c GT |
285 | bool GetNextRec(); |
286 | bool GetPrevRec(); | |
049977d0 | 287 | bool GetRec(const wxString &whereStr); |
e70e8f4c | 288 | |
f6fcbb63 | 289 | DECLARE_EVENT_TABLE() |
108106cf JS |
290 | }; // CeditorDlg |
291 | ||
1fc5dd6f JS |
292 | #define EDITOR_DIALOG 199 |
293 | ||
294 | // Editor dialog control ids | |
295 | #define EDITOR_DIALOG_FN_GROUP 200 | |
296 | #define EDITOR_DIALOG_SEARCH_GROUP 201 | |
297 | #define EDITOR_DIALOG_CREATE 202 | |
298 | #define EDITOR_DIALOG_EDIT 203 | |
299 | #define EDITOR_DIALOG_DELETE 204 | |
300 | #define EDITOR_DIALOG_COPY 205 | |
301 | #define EDITOR_DIALOG_SAVE 206 | |
302 | #define EDITOR_DIALOG_CANCEL 207 | |
303 | #define EDITOR_DIALOG_PREV 208 | |
304 | #define EDITOR_DIALOG_NEXT 209 | |
305 | #define EDITOR_DIALOG_QUERY 211 | |
306 | #define EDITOR_DIALOG_RESET 212 | |
307 | #define EDITOR_DIALOG_NAME_MSG 213 | |
308 | #define EDITOR_DIALOG_NAME_TEXT 214 | |
309 | #define EDITOR_DIALOG_LOOKUP 215 | |
310 | #define EDITOR_DIALOG_ADDRESS1_MSG 216 | |
311 | #define EDITOR_DIALOG_ADDRESS1_TEXT 217 | |
312 | #define EDITOR_DIALOG_ADDRESS2_MSG 218 | |
313 | #define EDITOR_DIALOG_ADDRESS2_TEXT 219 | |
314 | #define EDITOR_DIALOG_CITY_MSG 220 | |
315 | #define EDITOR_DIALOG_CITY_TEXT 221 | |
316 | #define EDITOR_DIALOG_COUNTRY_MSG 222 | |
317 | #define EDITOR_DIALOG_COUNTRY_TEXT 223 | |
318 | #define EDITOR_DIALOG_POSTAL_MSG 224 | |
319 | #define EDITOR_DIALOG_POSTAL_TEXT 225 | |
320 | #define EDITOR_DIALOG_LANG_MSG 226 | |
321 | #define EDITOR_DIALOG_LANG_CHOICE 227 | |
322 | #define EDITOR_DIALOG_DATE_MSG 228 | |
323 | #define EDITOR_DIALOG_DATE_TEXT 229 | |
324 | #define EDITOR_DIALOG_CONTRIB_MSG 230 | |
325 | #define EDITOR_DIALOG_CONTRIB_TEXT 231 | |
326 | #define EDITOR_DIALOG_LINES_MSG 232 | |
327 | #define EDITOR_DIALOG_LINES_TEXT 233 | |
328 | #define EDITOR_DIALOG_STATE_MSG 234 | |
329 | #define EDITOR_DIALOG_STATE_TEXT 235 | |
330 | #define EDITOR_DIALOG_DEVELOPER 236 | |
331 | #define EDITOR_DIALOG_JOIN_MSG 237 | |
332 | #define EDITOR_DIALOG_JOIN_TEXT 238 | |
108106cf JS |
333 | |
334 | // *************************** CparameterDlg *************************** | |
335 | ||
1fc5dd6f | 336 | class CparameterDlg : public wxDialog |
108106cf | 337 | { |
e70e8f4c | 338 | private: |
049977d0 GT |
339 | // Used to indicate whether all of the widget pointers (defined |
340 | // below) have been initialized to point to the memory for | |
341 | // the named widget. Used as a safeguard from using the widget | |
342 | // before it has been initialized. | |
e70e8f4c | 343 | bool widgetPtrsSet; |
049977d0 | 344 | |
e70e8f4c | 345 | enum DialogModes mode; |
049977d0 GT |
346 | |
347 | // Have the parameters been saved yet, or do they | |
348 | // need to be saved to update the params on disk | |
e70e8f4c | 349 | bool saved; |
049977d0 GT |
350 | |
351 | // Original params | |
e70e8f4c GT |
352 | Cparameters savedParamSettings; |
353 | ||
354 | // Pointers to all widgets on the dialog | |
355 | wxStaticText *pParamODBCSourceMsg; | |
356 | wxListBox *pParamODBCSourceList; | |
357 | wxStaticText *pParamUserNameMsg, *pParamPasswordMsg, *pParamDirPathMsg; | |
358 | wxTextCtrl *pParamUserNameTxt, *pParamPasswordTxt, *pParamDirPathTxt; | |
359 | wxButton *pParamSaveBtn, *pParamCancelBtn; | |
360 | ||
361 | public: | |
362 | CparameterDlg(wxWindow *parent); | |
363 | ||
364 | void OnCloseWindow(wxCloseEvent& event); | |
365 | void OnButton( wxCommandEvent &event ); | |
366 | void OnCommand(wxWindow& win, wxCommandEvent& event); | |
367 | void OnActivate(bool) {}; // necessary for hot keys | |
368 | ||
049977d0 | 369 | // Update/Retrieve data from the widgets on the dialog |
e70e8f4c GT |
370 | bool PutData(); |
371 | bool GetData(); | |
049977d0 GT |
372 | |
373 | // Stores the defined parameter for connecting to the selected ODBC | |
374 | // data source to the config file name in "PARAM_FILENAME" | |
e70e8f4c | 375 | bool Save(); |
049977d0 GT |
376 | |
377 | // Populates the 'pParamODBCSourceList' listbox with the names of all | |
378 | // ODBC datasource defined for use at the current workstation | |
e70e8f4c | 379 | void FillDataSourceList(); |
108106cf | 380 | |
e3065973 | 381 | DECLARE_EVENT_TABLE() |
108106cf JS |
382 | }; // CparameterDlg |
383 | ||
1fc5dd6f JS |
384 | #define PARAMETER_DIALOG 400 |
385 | ||
386 | // Parameter dialog control ids | |
387 | #define PARAMETER_DIALOG_SOURCE_MSG 401 | |
388 | #define PARAMETER_DIALOG_SOURCE_LISTBOX 402 | |
389 | #define PARAMETER_DIALOG_NAME_MSG 403 | |
390 | #define PARAMETER_DIALOG_NAME_TEXT 404 | |
391 | #define PARAMETER_DIALOG_PASSWORD_MSG 405 | |
392 | #define PARAMETER_DIALOG_PASSWORD_TEXT 406 | |
e70e8f4c GT |
393 | #define PARAMETER_DIALOG_DIRPATH_MSG 407 |
394 | #define PARAMETER_DIALOG_DIRPATH_TEXT 408 | |
65d7ddc4 GT |
395 | #define PARAMETER_DIALOG_SAVE 409 |
396 | #define PARAMETER_DIALOG_CANCEL 410 | |
108106cf JS |
397 | |
398 | // *************************** CqueryDlg *************************** | |
399 | ||
400 | ||
401 | // QUERY DIALOG | |
402 | enum qryOp | |
403 | { | |
e70e8f4c GT |
404 | qryOpEQ, |
405 | qryOpLT, | |
406 | qryOpGT, | |
407 | qryOpLE, | |
408 | qryOpGE, | |
409 | qryOpBEGINS, | |
410 | qryOpCONTAINS, | |
411 | qryOpLIKE, | |
412 | qryOpBETWEEN | |
108106cf JS |
413 | }; |
414 | ||
415 | ||
416 | // Query strings | |
94613352 GT |
417 | wxChar * const langQRY_EQ = "column = column | value"; |
418 | wxChar * const langQRY_LT = "column < column | value"; | |
419 | wxChar * const langQRY_GT = "column > column | value"; | |
420 | wxChar * const langQRY_LE = "column <= column | value"; | |
421 | wxChar * const langQRY_GE = "column >= column | value"; | |
422 | wxChar * const langQRY_BEGINS = "columns that BEGIN with the string entered"; | |
423 | wxChar * const langQRY_CONTAINS = "columns that CONTAIN the string entered"; | |
424 | wxChar * const langQRY_LIKE = "% matches 0 or more of any char; _ matches 1 char"; | |
425 | wxChar * const langQRY_BETWEEN = "column BETWEEN value AND value"; | |
108106cf JS |
426 | |
427 | ||
1fc5dd6f | 428 | class CqueryDlg : public wxDialog |
108106cf | 429 | { |
e70e8f4c | 430 | private: |
049977d0 GT |
431 | wxDbColInf *colInf; // Column inf. returned by db->GetColumns() |
432 | wxDbTable *dbTable; // generic wxDbTable object for attaching to the table to query | |
433 | wxChar *masterTableName; // Name of the table that 'dbTable' will be associated with | |
d3358961 | 434 | wxString pWhere; // A pointer to the storage for the resulting where clause |
f6bcfd97 | 435 | wxDb *pDB; |
e70e8f4c GT |
436 | |
437 | public: | |
049977d0 GT |
438 | // Used to indicate whether all of the widget pointers (defined |
439 | // below) have been initialized to point to the memory for | |
440 | // the named widget. Used as a safeguard from using the widget | |
441 | // before it has been initialized. | |
e70e8f4c GT |
442 | bool widgetPtrsSet; |
443 | ||
444 | // Widget pointers | |
445 | wxStaticText *pQueryCol1Msg; | |
446 | wxChoice *pQueryCol1Choice; | |
447 | wxStaticText *pQueryNotMsg; | |
448 | wxCheckBox *pQueryNotCheck; | |
449 | wxStaticText *pQueryOperatorMsg; | |
450 | wxChoice *pQueryOperatorChoice; | |
451 | wxStaticText *pQueryCol2Msg; | |
452 | wxChoice *pQueryCol2Choice; | |
453 | wxStaticText *pQueryValue1Msg; | |
454 | wxTextCtrl *pQueryValue1Txt; | |
455 | wxStaticText *pQueryValue2Msg; | |
456 | wxTextCtrl *pQueryValue2Txt; | |
457 | wxStaticText *pQuerySqlWhereMsg; | |
458 | wxTextCtrl *pQuerySqlWhereMtxt; | |
459 | wxButton *pQueryAddBtn; | |
460 | wxButton *pQueryAndBtn; | |
461 | wxButton *pQueryOrBtn; | |
462 | wxButton *pQueryLParenBtn; | |
463 | wxButton *pQueryRParenBtn; | |
464 | wxButton *pQueryDoneBtn; | |
465 | wxButton *pQueryClearBtn; | |
466 | wxButton *pQueryCountBtn; | |
467 | wxButton *pQueryHelpBtn; | |
468 | wxStaticBox *pQueryHintGrp; | |
469 | wxStaticText *pQueryHintMsg; | |
470 | ||
3ca6a5f0 | 471 | wxTextCtrl *pFocusTxt; |
e70e8f4c | 472 | |
d3358961 | 473 | CqueryDlg(wxWindow *parent, wxDb *pDb, wxChar *tblName[], const wxString &pWhereArg); |
4c4a393f | 474 | ~CqueryDlg(); |
e70e8f4c GT |
475 | |
476 | void OnButton( wxCommandEvent &event ); | |
477 | void OnCommand(wxWindow& win, wxCommandEvent& event); | |
478 | void OnCloseWindow(wxCloseEvent& event); | |
479 | void OnActivate(bool) {}; // necessary for hot keys | |
480 | ||
94613352 | 481 | void AppendToWhere(wxChar *s); |
e70e8f4c GT |
482 | void ProcessAddBtn(); |
483 | void ProcessCountBtn(); | |
484 | bool ValidateWhereClause(); | |
108106cf | 485 | |
f6fcbb63 | 486 | DECLARE_EVENT_TABLE() |
108106cf | 487 | }; // CqueryDlg |
1fc5dd6f JS |
488 | |
489 | #define QUERY_DIALOG 300 | |
490 | ||
491 | // Parameter dialog control ids | |
492 | #define QUERY_DIALOG_COL_MSG 301 | |
493 | #define QUERY_DIALOG_COL_CHOICE 302 | |
494 | #define QUERY_DIALOG_NOT_MSG 303 | |
495 | #define QUERY_DIALOG_NOT_CHECKBOX 304 | |
496 | #define QUERY_DIALOG_OP_MSG 305 | |
497 | #define QUERY_DIALOG_OP_CHOICE 306 | |
498 | #define QUERY_DIALOG_COL2_MSG 307 | |
499 | #define QUERY_DIALOG_COL2_CHOICE 308 | |
500 | #define QUERY_DIALOG_WHERE_MSG 309 | |
501 | #define QUERY_DIALOG_WHERE_TEXT 310 | |
502 | #define QUERY_DIALOG_ADD 311 | |
503 | #define QUERY_DIALOG_AND 312 | |
504 | #define QUERY_DIALOG_OR 313 | |
505 | #define QUERY_DIALOG_LPAREN 314 | |
506 | #define QUERY_DIALOG_RPAREN 315 | |
507 | #define QUERY_DIALOG_DONE 316 | |
508 | #define QUERY_DIALOG_CLEAR 317 | |
509 | #define QUERY_DIALOG_COUNT 318 | |
510 | #define QUERY_DIALOG_VALUE1_MSG 319 | |
511 | #define QUERY_DIALOG_VALUE1_TEXT 320 | |
512 | #define QUERY_DIALOG_VALUE2_MSG 321 | |
513 | #define QUERY_DIALOG_VALUE2_TEXT 322 | |
514 | #define QUERY_DIALOG_HINT_GROUP 323 | |
515 | #define QUERY_DIALOG_HINT_MSG 324 | |
516 |