]> git.saurik.com Git - wxWidgets.git/blob - demos/dbbrowse/browsedb.cpp
Handle Cancel button in userdlg
[wxWidgets.git] / demos / dbbrowse / browsedb.cpp
1 //---------------------------------------------------------------------------
2 // Name: BrowserDB.h,cpp
3 // Purpose: a wxDB;
4 // Author: Mark Johnson, mj10777@gmx.net
5 // Modified by:
6 // Created: 19991127.mj10777
7 // Copyright: (c) Mark Johnson
8 // Licence: wxWindows license
9 // RCS-ID: $Id$
10 //---------------------------------------------------------------------------
11 //-- 1)
12 //---------------------------------------------------------------------------
13 //-- all #ifdefs that the whole Project needs. ------------------------------
14 //---------------------------------------------------------------------------
15 #ifdef __GNUG__
16 #pragma implementation
17 #pragma interface
18 #endif
19 //---------------------------------------------------------------------------
20 // For compilers that support precompilation, includes "wx/wx.h".
21 #include "wx/wxprec.h"
22 //---------------------------------------------------------------------------
23 #ifdef __BORLANDC__
24 #pragma hdrstop
25 #endif
26 //---------------------------------------------------------------------------
27 #ifndef WX_PRECOMP
28 #include "wx/wx.h"
29 #endif
30 //---------------------------------------------------------------------------
31 #include <wx/dbtable.h>
32 #include "std.h"
33 //---------------------------------------------------------------------------
34 // Global structure for holding ODBC connection information
35 // - darf nur einmal im Projekte definiert werden ?? Extra Databasse Klasse ?
36 struct DbStuff ConnectInf; // Für DBase
37 //---------------------------------------------------------------------------
38 extern DbList* WXDLLEXPORT PtrBegDbList; /* from db.cpp, used in getting back error results from db connections */
39 //---------------------------------------------------------------------------
40 char *GetExtendedDBErrorMsg(char *ErrFile, int ErrLine)
41 {
42 static wxString msg;
43 wxString tStr;
44 if (ErrFile || ErrLine)
45 {
46 msg += "File: ";
47 msg += ErrFile;
48 msg += " Line: ";
49 tStr.Printf("%d",ErrLine);
50 msg += tStr.GetData();
51 // msg += "\n";
52 }
53 msg.Append ("\nODBC errors:\n");
54 // msg += "\n";
55 /* Scan through each database connection displaying
56 * any ODBC errors that have occured. */
57 for (DbList *pDbList = PtrBegDbList; pDbList; pDbList = pDbList->PtrNext)
58 {
59 // Skip over any free connections
60 if (pDbList->Free)
61 continue;
62 // Display errors for this connection
63 for (int i = 0; i < DB_MAX_ERROR_HISTORY; i++)
64 {
65 if (pDbList->PtrDb->errorList[i])
66 {
67 msg.Append(pDbList->PtrDb->errorList[i]);
68 if (strcmp(pDbList->PtrDb->errorList[i],"") != 0)
69 msg.Append("\n");
70 }
71 }
72 }
73 msg += "\n";
74 return (char*) (const char*) msg;
75 } // GetExtendedDBErrorMsg
76 //////////////////////////////////////////////////////////////////////////////////
77 // BJO 20000115 : New stuff : dialog to ask for username and password
78 //////////////////////////////////////////////////////////////////////////////////
79 class UserDialog : public wxDialog
80 {
81 public:
82 UserDialog(wxWindow* parent);
83 virtual ~UserDialog();
84 void OnOK(wxCommandEvent& event);
85 wxString s_UserName, s_Password;
86
87 private:
88 wxButton *m_OK;
89 wxStaticText *m_Label1, *m_Label2;
90 wxTextCtrl *m_UserName, *m_Password;
91
92
93 DECLARE_EVENT_TABLE()
94 };
95 //---------------------------------------------------------------------------
96 BEGIN_EVENT_TABLE(UserDialog, wxDialog)
97 EVT_BUTTON(wxID_OK, UserDialog::OnOK)
98 END_EVENT_TABLE()
99 //---------------------------------------------------------------------------
100 UserDialog::UserDialog(wxWindow *parent):
101 wxDialog(parent, -1, _("ODBC user"),wxDefaultPosition, wxSize(310, 300),wxDIALOG_MODAL | wxDEFAULT_DIALOG_STYLE)
102 {
103 wxLayoutConstraints* layout;
104 SetAutoLayout(TRUE);
105 //-----------------------------------------------
106 m_OK = new wxButton(this, wxID_OK, _("Ok"));
107 layout = new wxLayoutConstraints;
108 layout->left.SameAs(this, wxLeft, 10);
109 layout->top.SameAs(this, wxTop,10);
110 layout->height.AsIs();
111 layout->width.Absolute(75);
112 m_OK->SetConstraints(layout);
113
114 m_Label1 = new wxStaticText(this, -1, _("User ID:"));
115 layout = new wxLayoutConstraints;
116 layout->left.SameAs(m_OK, wxLeft);
117 layout->top.SameAs(m_OK, wxBottom, 10);
118 layout->height.AsIs();
119 layout->width.AsIs();
120 m_Label1->SetConstraints(layout);
121
122 m_UserName = new wxTextCtrl(this, -1, "");
123 layout = new wxLayoutConstraints;
124 layout->left.SameAs(m_OK, wxLeft);
125 layout->top.SameAs(m_Label1, wxBottom, 3);
126 layout->width.AsIs();
127 layout->height.AsIs();
128 m_UserName->SetConstraints(layout);
129
130 m_Label2 = new wxStaticText(this, -1, _("Password:"));
131 layout = new wxLayoutConstraints;
132 layout->left.SameAs(m_OK, wxLeft);
133 layout->top.SameAs(m_UserName, wxBottom, 10);
134 layout->height.AsIs();
135 layout->width.AsIs();
136 m_Label2->SetConstraints(layout);
137
138 m_Password = new wxTextCtrl(this, -1, "", wxDefaultPosition, wxDefaultSize, wxTE_PASSWORD);
139 layout = new wxLayoutConstraints;
140 layout->left.SameAs(m_OK, wxLeft);
141 layout->width.AsIs();
142 layout->top.SameAs(m_Label2, wxBottom, 3);
143 layout->height.AsIs();
144 m_Password->SetConstraints(layout);
145
146 s_UserName = "";
147 s_Password = "";
148
149 Layout();
150 }
151 //---------------------------------------------------------------------------
152 UserDialog::~UserDialog()
153 {
154 }
155 //---------------------------------------------------------------------------
156 void UserDialog::OnOK(wxCommandEvent& WXUNUSED(event))
157 {
158 strcpy(ConnectInf.Uid, m_UserName->GetValue());
159 strcpy(ConnectInf.AuthStr, m_Password->GetValue());
160 EndModal(1);
161 }
162 //////////////////////////////////////////////////////////////////////////////////
163 // BJO 20000115 : end of new stuff
164 //////////////////////////////////////////////////////////////////////////////////
165 //---------------------------------------------------------------------------
166 BrowserDB::BrowserDB()
167 {
168 Zeiger_auf_NULL(0);
169 ODBCSource = ""; // ODBC data source name (created with ODBC Administrator under Win95/NT)
170 UserName = ""; // database username - must already exist in the data source
171 Password = ""; // password database username
172 OnFillSqlTyp();
173 OnFilldbTyp();
174 } // BrowserDB Constructor
175 //---------------------------------------------------------------------------
176 BrowserDB::~BrowserDB()
177 {
178 Zeiger_auf_NULL(1); // Clean up Tables and Databases (Commit, Close und delete)
179 } // BrowserDB destructor
180 //--------------------------------------------------------------------------------------------
181 bool BrowserDB::Initialize(int Quite)
182 {
183 if (!OnStartDB(Quite))
184 {
185 wxLogMessage(_("\n\n-E-> BrowserDB::OnStartDB(%s) : Failed ! "),ODBCSource.c_str());
186 return FALSE;
187 }
188 return TRUE;
189 } // BrowserDB:Initialize
190 //--------------------------------------------------------------------------------------------
191 bool BrowserDB::OnStartDB(int Quite)
192 {
193 if (!Quite)
194 wxLogMessage(_("\n-I-> BrowserDB::OnStartDB(%s) : Begin "),ODBCSource.c_str());
195 if (db_BrowserDB != NULL)
196 {
197 if (!Quite)
198 wxLogMessage(_("\n-I-> BrowserDB::OnStartDB() : DB is allready open."));
199 return TRUE;
200 }
201 // Initialize the ODBC Environment for Database Operations
202 if (SQLAllocEnv(&ConnectInf.Henv) != SQL_SUCCESS)
203 {
204 if (!Quite)
205 wxLogMessage(_("\n-E-> BrowserDB::OnStartDB() : DB CONNECTION ERROR : A problem occured while trying to get a connection to the data source"));
206 return FALSE;
207 }
208 //---------------------------------------------------------------------------
209 // Connect to datasource
210 //---------------------------
211 DlgUser *p_Dlg = new DlgUser(pDoc->p_MainFrame, "Username and Password");
212 p_Dlg->s_DSN = ODBCSource;
213 p_Dlg->s_User = UserName;
214 p_Dlg->s_Password = Password;
215 p_Dlg->OnInit();
216 p_Dlg->Fit();
217
218 bool OK = FALSE;
219 if (p_Dlg->ShowModal() == wxID_OK)
220 {
221 (pDoc->p_DSN+i_Which)->Usr = p_Dlg->s_User;
222 (pDoc->p_DSN+i_Which)->Pas = p_Dlg->s_Password;
223 UserName = p_Dlg->s_User;
224 Password = p_Dlg->s_Password;
225 OK = TRUE;
226 }
227 //p_Dlg.Destroy();
228 delete p_Dlg;
229
230 if (OK)
231 {
232 //---------------------------
233 strcpy(ConnectInf.Dsn, ODBCSource); // ODBC data source name (created with ODBC Administrator under Win95/NT)
234 strcpy(ConnectInf.Uid, UserName); // database username - must already exist in the data source
235 strcpy(ConnectInf.AuthStr, Password); // password database username
236 db_BrowserDB = GetDbConnection(&ConnectInf);
237 // wxLogMessage(">>>%s<<<>>>%s<<<",UserName.c_str(),Password.c_str());
238 if (db_BrowserDB == NULL)
239 {
240 strcpy(ConnectInf.Dsn, "");
241 strcpy(ConnectInf.Uid, "");
242 strcpy(ConnectInf.AuthStr, "");
243 if (!Quite)
244 {
245 wxLogMessage(_("\n-E-> BrowserDB::OnConnectDataSource() DB CONNECTION ERROR : Unable to connect to the data source.\n\nCheck the name of your data source to verify it has been correctly entered/spelled.\n\nWith some databases, the user name and password must\nbe created with full rights to the table prior to making a connection\n(using tools provided by the database manufacturer)"));
246 wxLogMessage(_("-I-> BrowserDB::OnStartDB(%s) : End "),ODBCSource.c_str());
247 }
248 return FALSE;
249 }
250 //--------------------------------------------------------------------------
251 if (!Quite)
252 {
253 Temp1 = db_BrowserDB->GetDatabaseName();
254 Temp2 = db_BrowserDB->GetDataSource();
255 wxLogMessage(_("-I-> BrowserDB::OnGetDataSourceODBC() - DatabaseName(%s) ; DataSource(%s)"),Temp1.c_str(),Temp2.c_str());
256 wxLogMessage(_("-I-> BrowserDB::OnStartDB(%s) : End "),ODBCSource.c_str());
257 }
258 return TRUE;
259 } else return FALSE;
260 }
261 //--------------------------------------------------------------------------------------------
262 bool BrowserDB::OnCloseDB(int Quite)
263 {
264 if (!Quite)
265 wxLogMessage(_("-I-> BrowserDB::OnCloseDB() : Begin "));
266 if (db_BrowserDB)
267 {
268 db_BrowserDB->Close();
269 FreeDbConnection(db_BrowserDB);
270
271 // Free Environment Handle that ODBC uses
272 if (SQLFreeEnv(&ConnectInf.Henv) != SQL_SUCCESS)
273 {
274 // Error freeing environment handle
275 }
276 db_BrowserDB = NULL;
277 }
278 if (!Quite)
279 wxLogMessage(_("\n-I-> BrowserDB::OnCloseDB() : End "));
280 return TRUE;
281 }
282 //----------------------------------------------------------------------------------------
283 bool BrowserDB::OnGetNext(int Cols,int Quite)
284 {
285 SDWORD cb;
286 int i_dbDataType;
287 int i=0;
288 char s_temp[1024+1];
289 long l_temp;
290 double f_temp;
291 int AnzError=0;
292 TIMESTAMP_STRUCT t_temp;
293 wxString Temp0;
294 //-----------------------------
295 if (!db_BrowserDB->GetNext())
296 {
297 return FALSE;
298 Temp0.Printf(_("\n-E-> BrowserDB::OnGetNext - ODBC-Error with GetNext \n-E-> "));
299 Temp0 += GetExtendedDBErrorMsg(__FILE__,__LINE__);
300 wxLogMessage(Temp0);
301 wxMessageBox(Temp0);
302 }
303 else
304 {
305 for (i=0;i<Cols;i++)
306 {
307 strcpy((cl_BrowserDB+i)->tableName,"-E->");
308 i_dbDataType = (cl_BrowserDB->pColFor+i)->i_dbDataType;
309 if (i_dbDataType == 0) // Filter unsupported dbDataTypes
310 {
311 if (((cl_BrowserDB->pColFor+i)->i_sqlDataType == SQL_VARCHAR) || ((cl_BrowserDB->pColFor+i)->i_sqlDataType == SQL_LONGVARCHAR))
312 i_dbDataType = DB_DATA_TYPE_VARCHAR;
313 if ((cl_BrowserDB->pColFor+i)->i_sqlDataType == SQL_C_DATE)
314 i_dbDataType = DB_DATA_TYPE_DATE;
315 if ((cl_BrowserDB->pColFor+i)->i_sqlDataType == SQL_C_BIT)
316 i_dbDataType = DB_DATA_TYPE_INTEGER;
317 if ((cl_BrowserDB->pColFor+i)->i_sqlDataType == SQL_NUMERIC)
318 i_dbDataType = DB_DATA_TYPE_VARCHAR;
319 if ((cl_BrowserDB->pColFor+i)->i_sqlDataType == SQL_REAL)
320 i_dbDataType = DB_DATA_TYPE_FLOAT;
321 }
322 if ((i_dbDataType == DB_DATA_TYPE_INTEGER) && ((cl_BrowserDB->pColFor+i)->i_sqlDataType == SQL_C_DOUBLE))
323 { // DBASE Numeric
324 i_dbDataType = DB_DATA_TYPE_FLOAT;
325 }
326 switch(i_dbDataType)
327 {
328 case DB_DATA_TYPE_VARCHAR:
329 strcpy(s_temp,"");
330 if (!db_BrowserDB->GetData(i+1,(cl_BrowserDB->pColFor+i)->i_dbDataType,&s_temp,sizeof(s_temp), &cb))
331 {
332 Temp0.Printf(_("\n-E-> BrowserDB::OnGetNext - ODBC-Error with GetNext of >%s<.\n-E-> "),(cl_BrowserDB+i)->tableName);
333 Temp0 += GetExtendedDBErrorMsg(__FILE__,__LINE__);
334 wxLogMessage(Temp0);
335 }
336 Temp0.Printf((cl_BrowserDB->pColFor+i)->s_Field,s_temp);
337 strcpy((cl_BrowserDB+i)->tableName,Temp0.c_str());
338 break;
339 case DB_DATA_TYPE_INTEGER:
340 l_temp = 0;
341 if (!db_BrowserDB->GetData(i+1,(cl_BrowserDB->pColFor+i)->i_sqlDataType,&l_temp,sizeof(l_temp), &cb))
342 {
343 Temp0.Printf(_("\n-E-> BrowserDB::OnGetData - ODBC-Error with GetNext \n-E-> "));
344 Temp0 += GetExtendedDBErrorMsg(__FILE__,__LINE__);
345 }
346 else
347 {
348 Temp0.Printf((cl_BrowserDB->pColFor+i)->s_Field,l_temp);
349 strcpy((cl_BrowserDB+i)->tableName,Temp0.c_str());
350 }
351 break;
352 case DB_DATA_TYPE_FLOAT:
353 f_temp = 0;
354 if (!db_BrowserDB->GetData(i+1,(cl_BrowserDB->pColFor+i)->i_sqlDataType,&f_temp,sizeof(f_temp), &cb))
355 {
356 Temp0.Printf(_("\n-E-> BrowserDB::OnGetData - ODBC-Error with GetNext \n-E-> "));
357 Temp0 += GetExtendedDBErrorMsg(__FILE__,__LINE__);
358 wxMessageBox(Temp0);
359 }
360 else
361 {
362 Temp0.Printf((cl_BrowserDB->pColFor+i)->s_Field,f_temp);
363 strcpy((cl_BrowserDB+i)->tableName,Temp0.c_str());
364 }
365 break;
366 case DB_DATA_TYPE_DATE:
367 t_temp.day = t_temp.month = t_temp.year = t_temp.hour = t_temp.minute = t_temp.second = t_temp.fraction = 0;
368 if (!db_BrowserDB->GetData(i+1,(cl_BrowserDB->pColFor+i)->i_sqlDataType,&t_temp,sizeof(t_temp), &cb))
369 {
370 Temp0.Printf(_("\n-E-> BrowserDB::OnGetData - ODBC-Error with GetNext \n-E-> "));
371 Temp0 += GetExtendedDBErrorMsg(__FILE__,__LINE__);
372 }
373 else
374 {
375 // i_Nation = 0 = timestamp , 1=EU, 2=UK, 3=International, 4=US
376 if (((cl_BrowserDB->pColFor+i)->i_Nation == 0) || // TS YYYY-MM-DD
377 ((cl_BrowserDB->pColFor+i)->i_Nation == 3)) // IT YYYY-MM-DD
378 {
379 Temp0.Printf((cl_BrowserDB->pColFor+i)->s_Field,t_temp.year,t_temp.month,t_temp.day,
380 t_temp.hour, t_temp.minute, t_temp.second, t_temp.fraction);
381 strcpy((cl_BrowserDB+i)->tableName,Temp0.c_str());
382 }
383 if ( ((cl_BrowserDB->pColFor+i)->i_Nation == 1) || // EU DD.MM.YYYY
384 ((cl_BrowserDB->pColFor+i)->i_Nation == 2)) // UK DD/MM/YYYY
385 {
386 Temp0.Printf((cl_BrowserDB->pColFor+i)->s_Field,t_temp.day,t_temp.month,t_temp.year,
387 t_temp.hour, t_temp.minute, t_temp.second, t_temp.fraction);
388 strcpy((cl_BrowserDB+i)->tableName,Temp0.c_str());
389 }
390 if ((cl_BrowserDB->pColFor+i)->i_Nation == 3) // US MM/DD/YYYY
391 {
392 Temp0.Printf((cl_BrowserDB->pColFor+i)->s_Field,t_temp.month,t_temp.day,t_temp.year,
393 t_temp.hour, t_temp.minute, t_temp.second, t_temp.fraction);
394 strcpy((cl_BrowserDB+i)->tableName,Temp0.c_str());
395 }
396 }
397 break;
398 default:
399 AnzError++;
400 if (AnzError <= 100)
401 {
402 Temp0 = (cl_BrowserDB+i)->colName;
403 wxLogMessage(_("-E-> BrowserDB::OnGetNext - DB_DATA_TYPE_?? (%d) in Col(%s)"),(cl_BrowserDB->pColFor+i)->i_dbDataType,Temp0.c_str());
404 }
405 else
406 return TRUE;
407 Temp0.Printf(_("-E-> unknown Format(%d) - sql(%d)"),(cl_BrowserDB->pColFor+i)->i_dbDataType,(cl_BrowserDB->pColFor+i)->i_sqlDataType);
408 strcpy((cl_BrowserDB+i)->tableName,Temp0.c_str());
409 break;
410 };
411 }
412 }
413 // wxLogMessage("-E-> BrowserDB::OnGetNext - End");
414 return TRUE;
415 }
416 //----------------------------------------------------------------------------------------
417 bool BrowserDB::OnSelect(wxString tb_Name, int Quite)
418 {
419 wxString SQLStmt;
420 i_Records = 0;
421 //--------------------------------------------------------------------------
422 SQLStmt.sprintf("SELECT * FROM %s",tb_Name.c_str());
423 if (!db_BrowserDB->ExecSql((char *)(SQLStmt.GetData())))
424 {
425 Temp0.Printf(_("\n-E-> BrowserDB::OnSelect - ODBC-Error with ExecSql of >%s<.\n-E-> "),tb_Name.c_str());
426 Temp0 += GetExtendedDBErrorMsg(__FILE__,__LINE__);
427 wxLogMessage(Temp0);
428 wxMessageBox("-E-> BrowserDB::OnSelect - GetData()");
429 return FALSE;
430 }
431 //--------------------------------------------------------------------------
432 while (db_BrowserDB->GetNext())
433 {
434 i_Records++;
435 }
436 //--------------------------------------------------------------------------
437 if (!db_BrowserDB->ExecSql((char *)(SQLStmt.GetData())))
438 {
439 Temp0.Printf(_("\n-E-> BrowserDB::OnSelect - ODBC-Error with ExecSql of >%s<.\n-E-> "),tb_Name.c_str());
440 Temp0 += GetExtendedDBErrorMsg(__FILE__,__LINE__);
441 wxLogMessage(Temp0);
442 return FALSE;
443 }
444 //--------------------------------------------------------------------------
445 // SetColDefs ( 0,"NAME", DB_DATA_TYPE_VARCHAR, Name, SQL_C_CHAR, sizeof(Name), TRUE, TRUE); // Primary index
446 //--------------------------------------------------------------------------
447 if (!Quite)
448 {
449 wxLogMessage(_("\n-I-> BrowserDB::OnSelect(%s) Records(%d): End "),tb_Name.c_str(),i_Records);
450 }
451 return TRUE;
452 }
453 //----------------------------------------------------------------------------------------
454 bool BrowserDB::OnExecSql(wxString SQLStmt, int Quite)
455 {
456 //--------------------------------------------------------------------------
457 if (!db_BrowserDB->ExecSql((char *)(SQLStmt.GetData())))
458 {
459 Temp0.Printf(_("\n-E-> BrowserDB::OnExecSQL - ODBC-Error with ExecSql of >%s<.\n-E-> "),SQLStmt.c_str());
460 Temp0 += GetExtendedDBErrorMsg(__FILE__,__LINE__);
461 if (!Quite)
462 wxLogMessage(Temp0);
463 else
464 wxMessageBox("-E-> BrowserDB::OnExecSql - ExecSql()");
465 return FALSE;
466 }
467 if (!Quite)
468 {
469 // wxLogMessage(_("\n-I-> BrowserDB::OnExecSql(%s) - End "),SQLStmt.c_str());
470 }
471 return TRUE;
472 }
473 //----------------------------------------------------------------------------------------
474 wxDbInf* BrowserDB::OnGetCatalog(int Quite)
475 {
476 char UName[255];
477 strcpy(UName,UserName);
478 ct_BrowserDB = db_BrowserDB->GetCatalog(UName);
479 return ct_BrowserDB;
480 }
481 //----------------------------------------------------------------------------------------
482 wxColInf* BrowserDB::OnGetColumns(char *tableName, int numCols,int Quite)
483 {
484 char UName[255];
485 int i;
486 strcpy(UName,UserName);
487 cl_BrowserDB = db_BrowserDB->GetColumns(tableName,&numCols,UName);
488 cl_BrowserDB->pColFor = new wxColFor[numCols];
489 for (i=0;i<numCols;i++)
490 {
491 (cl_BrowserDB->pColFor+i)->Format(1,(cl_BrowserDB+i)->dbDataType,(cl_BrowserDB+i)->sqlDataType,
492 (cl_BrowserDB+i)->columnSize, (cl_BrowserDB+i)->decimalDigits);
493 }
494 return cl_BrowserDB;
495 }
496 //----------------------------------------------------------------------------------------
497 void BrowserDB::Zeiger_auf_NULL(int Art)
498 {
499 if (Art == 1) // Löschen
500 {
501 if (cl_BrowserDB != NULL)
502 { // Destroy the memory
503 delete [] cl_BrowserDB;
504 }
505 if (ct_BrowserDB != NULL)
506 { // Destroy the memory
507 delete [] ct_BrowserDB;
508 }
509 if (db_BrowserDB != NULL)
510 {
511 db_BrowserDB->CommitTrans();
512 db_BrowserDB->Close();
513 CloseDbConnections();
514 delete db_BrowserDB;
515 }
516 }
517 cl_BrowserDB = NULL;
518 ct_BrowserDB = NULL;
519 db_BrowserDB = NULL;
520 p_LogWindow = NULL;
521 }
522 //----------------------------------------------------------------------------------------
523 void BrowserDB::OnFillSqlTyp()
524 {
525 i_SqlTyp[1] = SQL_C_BINARY; s_SqlTyp[1] = "SQL_C_BINARY";
526 i_SqlTyp[2] = SQL_C_BIT; s_SqlTyp[2] = "SQL_C_BIT";
527 i_SqlTyp[3] = SQL_C_BOOKMARK; s_SqlTyp[3] = "SQL_C_BOOKMARK";
528 i_SqlTyp[4] = SQL_C_CHAR; s_SqlTyp[4] = "SQL_C_CHAR";
529 i_SqlTyp[5] = SQL_C_DATE; s_SqlTyp[5] = "SQL_C_DATE";
530 i_SqlTyp[6] = SQL_C_DEFAULT; s_SqlTyp[6] = "SQL_C_DEFAULT";
531 i_SqlTyp[7] = SQL_C_DOUBLE; s_SqlTyp[7] = "SQL_C_DOUBLE";
532 i_SqlTyp[8] = SQL_C_FLOAT; s_SqlTyp[8] = "SQL_C_FLOAT";
533 i_SqlTyp[9] = SQL_C_LONG; s_SqlTyp[9] = "SQL_C_LONG";
534 i_SqlTyp[10] = SQL_C_SHORT; s_SqlTyp[10] = "SQL_C_SHORT";
535 i_SqlTyp[11] = SQL_C_SLONG; s_SqlTyp[11] = "SQL_C_SLONG";
536 i_SqlTyp[12] = SQL_C_SSHORT; s_SqlTyp[12] = "SQL_C_SSHORT";
537 i_SqlTyp[13] = SQL_C_STINYINT; s_SqlTyp[13] = "SQL_C_STINYINT";
538 i_SqlTyp[14] = SQL_C_TIME; s_SqlTyp[14] = "SQL_C_TIME";
539 i_SqlTyp[15] = SQL_C_TIMESTAMP; s_SqlTyp[15] = "SQL_C_TIMESTAMP";
540 i_SqlTyp[16] = SQL_C_TINYINT; s_SqlTyp[16] = "SQL_C_TINYINT";
541 i_SqlTyp[17] = SQL_C_ULONG; s_SqlTyp[17] = "SQL_C_ULONG";
542 i_SqlTyp[18] = SQL_C_USHORT; s_SqlTyp[18] = "SQL_C_USHORT";
543 i_SqlTyp[19] = SQL_C_UTINYINT; s_SqlTyp[19] = "SQL_C_UTINYINT";
544 i_SqlTyp[20] = SQL_VARCHAR; s_SqlTyp[20] = "SQL_VARCHAR";
545 i_SqlTyp[21] = SQL_NUMERIC; s_SqlTyp[21] = "SQL_NUMERIC";
546 i_SqlTyp[22] = SQL_LONGVARCHAR; s_SqlTyp[22] = "SQL_LONGVARCHAR";
547 i_SqlTyp[23] = SQL_REAL; s_SqlTyp[23] = "SQL_REAL";
548 i_SqlTyp[0] = 23; s_SqlTyp[0] = "";
549 }
550 //----------------------------------------------------------------------------------------
551 void BrowserDB::OnFilldbTyp()
552 {
553 i_dbTyp[1] = DB_DATA_TYPE_VARCHAR; s_dbTyp[1] = "DB_DATA_TYPE_VARCHAR";
554 i_dbTyp[2] = DB_DATA_TYPE_INTEGER; s_dbTyp[2] = "DB_DATA_TYPE_INTEGER";
555 i_dbTyp[3] = DB_DATA_TYPE_FLOAT; s_dbTyp[3] = "DB_DATA_TYPE_FLOAT";
556 i_dbTyp[4] = DB_DATA_TYPE_DATE; s_dbTyp[4] = "DB_DATA_TYPE_DATE";
557 i_dbTyp[0] = 4; s_dbTyp[0] = "";
558 }
559 //----------------------------------------------------------------------------------------
560
561
562
563
564
565