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