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