]> git.saurik.com Git - wxWidgets.git/blob - demos/dbbrowse/browsedb.cpp
8b7f648df3906d5302387825f106fb43b5d2daf1
[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(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
229 if (OK)
230 {
231 //---------------------------
232 strcpy(ConnectInf.Dsn, ODBCSource); // ODBC data source name (created with ODBC Administrator under Win95/NT)
233 strcpy(ConnectInf.Uid, UserName); // database username - must already exist in the data source
234 strcpy(ConnectInf.AuthStr, Password); // password database username
235 db_BrowserDB = GetDbConnection(&ConnectInf);
236 // wxLogMessage(">>>%s<<<>>>%s<<<",UserName.c_str(),Password.c_str());
237 if (db_BrowserDB == NULL)
238 {
239 strcpy(ConnectInf.Dsn, "");
240 strcpy(ConnectInf.Uid, "");
241 strcpy(ConnectInf.AuthStr, "");
242 if (!Quite)
243 {
244 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)"));
245 wxLogMessage(_("-I-> BrowserDB::OnStartDB(%s) : End "),ODBCSource.c_str());
246 }
247 return FALSE;
248 }
249 //--------------------------------------------------------------------------
250 if (!Quite)
251 {
252 Temp1 = db_BrowserDB->GetDatabaseName();
253 Temp2 = db_BrowserDB->GetDataSource();
254 wxLogMessage(_("-I-> BrowserDB::OnGetDataSourceODBC() - DatabaseName(%s) ; DataSource(%s)"),Temp1.c_str(),Temp2.c_str());
255 wxLogMessage(_("-I-> BrowserDB::OnStartDB(%s) : End "),ODBCSource.c_str());
256 }
257 return TRUE;
258 } else return FALSE;
259 }
260 //--------------------------------------------------------------------------------------------
261 bool BrowserDB::OnCloseDB(int Quite)
262 {
263 if (!Quite)
264 wxLogMessage(_("-I-> BrowserDB::OnCloseDB() : Begin "));
265 if (db_BrowserDB)
266 {
267 db_BrowserDB->Close();
268 FreeDbConnection(db_BrowserDB);
269
270 // Free Environment Handle that ODBC uses
271 if (SQLFreeEnv(&ConnectInf.Henv) != SQL_SUCCESS)
272 {
273 // Error freeing environment handle
274 }
275 db_BrowserDB = NULL;
276 }
277 if (!Quite)
278 wxLogMessage(_("\n-I-> BrowserDB::OnCloseDB() : End "));
279 return TRUE;
280 }
281 //----------------------------------------------------------------------------------------
282 bool BrowserDB::OnGetNext(int Cols,int Quite)
283 {
284 SDWORD cb;
285 int i_dbDataType;
286 int i=0;
287 char s_temp[1024+1];
288 long l_temp;
289 double f_temp;
290 int AnzError=0;
291 TIMESTAMP_STRUCT t_temp;
292 wxString Temp0;
293 //-----------------------------
294 if (!db_BrowserDB->GetNext())
295 {
296 return FALSE;
297 Temp0.Printf(_("\n-E-> BrowserDB::OnGetNext - ODBC-Error with GetNext \n-E-> "));
298 Temp0 += GetExtendedDBErrorMsg(__FILE__,__LINE__);
299 wxLogMessage(Temp0);
300 wxMessageBox(Temp0);
301 }
302 else
303 {
304 for (i=0;i<Cols;i++)
305 {
306 strcpy((cl_BrowserDB+i)->tableName,"-E->");
307 i_dbDataType = (cl_BrowserDB->pColFor+i)->i_dbDataType;
308 if (i_dbDataType == 0) // Filter unsupported dbDataTypes
309 {
310 if (((cl_BrowserDB->pColFor+i)->i_sqlDataType == SQL_VARCHAR) || ((cl_BrowserDB->pColFor+i)->i_sqlDataType == SQL_LONGVARCHAR))
311 i_dbDataType = DB_DATA_TYPE_VARCHAR;
312 if ((cl_BrowserDB->pColFor+i)->i_sqlDataType == SQL_C_DATE)
313 i_dbDataType = DB_DATA_TYPE_DATE;
314 if ((cl_BrowserDB->pColFor+i)->i_sqlDataType == SQL_C_BIT)
315 i_dbDataType = DB_DATA_TYPE_INTEGER;
316 if ((cl_BrowserDB->pColFor+i)->i_sqlDataType == SQL_NUMERIC)
317 i_dbDataType = DB_DATA_TYPE_VARCHAR;
318 if ((cl_BrowserDB->pColFor+i)->i_sqlDataType == SQL_REAL)
319 i_dbDataType = DB_DATA_TYPE_FLOAT;
320 }
321 if ((i_dbDataType == DB_DATA_TYPE_INTEGER) && ((cl_BrowserDB->pColFor+i)->i_sqlDataType == SQL_C_DOUBLE))
322 { // DBASE Numeric
323 i_dbDataType = DB_DATA_TYPE_FLOAT;
324 }
325 switch(i_dbDataType)
326 {
327 case DB_DATA_TYPE_VARCHAR:
328 strcpy(s_temp,"");
329 if (!db_BrowserDB->GetData(i+1,(cl_BrowserDB->pColFor+i)->i_dbDataType,&s_temp,sizeof(s_temp), &cb))
330 {
331 Temp0.Printf(_("\n-E-> BrowserDB::OnGetNext - ODBC-Error with GetNext of >%s<.\n-E-> "),(cl_BrowserDB+i)->tableName);
332 Temp0 += GetExtendedDBErrorMsg(__FILE__,__LINE__);
333 wxLogMessage(Temp0);
334 }
335 Temp0.Printf((cl_BrowserDB->pColFor+i)->s_Field,s_temp);
336 strcpy((cl_BrowserDB+i)->tableName,Temp0.c_str());
337 break;
338 case DB_DATA_TYPE_INTEGER:
339 l_temp = 0;
340 if (!db_BrowserDB->GetData(i+1,(cl_BrowserDB->pColFor+i)->i_sqlDataType,&l_temp,sizeof(l_temp), &cb))
341 {
342 Temp0.Printf(_("\n-E-> BrowserDB::OnGetData - ODBC-Error with GetNext \n-E-> "));
343 Temp0 += GetExtendedDBErrorMsg(__FILE__,__LINE__);
344 }
345 else
346 {
347 Temp0.Printf((cl_BrowserDB->pColFor+i)->s_Field,l_temp);
348 strcpy((cl_BrowserDB+i)->tableName,Temp0.c_str());
349 }
350 break;
351 case DB_DATA_TYPE_FLOAT:
352 f_temp = 0;
353 if (!db_BrowserDB->GetData(i+1,(cl_BrowserDB->pColFor+i)->i_sqlDataType,&f_temp,sizeof(f_temp), &cb))
354 {
355 Temp0.Printf(_("\n-E-> BrowserDB::OnGetData - ODBC-Error with GetNext \n-E-> "));
356 Temp0 += GetExtendedDBErrorMsg(__FILE__,__LINE__);
357 wxMessageBox(Temp0);
358 }
359 else
360 {
361 Temp0.Printf((cl_BrowserDB->pColFor+i)->s_Field,f_temp);
362 strcpy((cl_BrowserDB+i)->tableName,Temp0.c_str());
363 }
364 break;
365 case DB_DATA_TYPE_DATE:
366 t_temp.day = t_temp.month = t_temp.year = t_temp.hour = t_temp.minute = t_temp.second = t_temp.fraction = 0;
367 if (!db_BrowserDB->GetData(i+1,(cl_BrowserDB->pColFor+i)->i_sqlDataType,&t_temp,sizeof(t_temp), &cb))
368 {
369 Temp0.Printf(_("\n-E-> BrowserDB::OnGetData - ODBC-Error with GetNext \n-E-> "));
370 Temp0 += GetExtendedDBErrorMsg(__FILE__,__LINE__);
371 }
372 else
373 {
374 // i_Nation = 0 = timestamp , 1=EU, 2=UK, 3=International, 4=US
375 if (((cl_BrowserDB->pColFor+i)->i_Nation == 0) || // TS YYYY-MM-DD
376 ((cl_BrowserDB->pColFor+i)->i_Nation == 3)) // IT YYYY-MM-DD
377 {
378 Temp0.Printf((cl_BrowserDB->pColFor+i)->s_Field,t_temp.year,t_temp.month,t_temp.day,
379 t_temp.hour, t_temp.minute, t_temp.second, t_temp.fraction);
380 strcpy((cl_BrowserDB+i)->tableName,Temp0.c_str());
381 }
382 if ( ((cl_BrowserDB->pColFor+i)->i_Nation == 1) || // EU DD.MM.YYYY
383 ((cl_BrowserDB->pColFor+i)->i_Nation == 2)) // UK DD/MM/YYYY
384 {
385 Temp0.Printf((cl_BrowserDB->pColFor+i)->s_Field,t_temp.day,t_temp.month,t_temp.year,
386 t_temp.hour, t_temp.minute, t_temp.second, t_temp.fraction);
387 strcpy((cl_BrowserDB+i)->tableName,Temp0.c_str());
388 }
389 if ((cl_BrowserDB->pColFor+i)->i_Nation == 3) // US MM/DD/YYYY
390 {
391 Temp0.Printf((cl_BrowserDB->pColFor+i)->s_Field,t_temp.month,t_temp.day,t_temp.year,
392 t_temp.hour, t_temp.minute, t_temp.second, t_temp.fraction);
393 strcpy((cl_BrowserDB+i)->tableName,Temp0.c_str());
394 }
395 }
396 break;
397 default:
398 AnzError++;
399 if (AnzError <= 100)
400 {
401 Temp0 = (cl_BrowserDB+i)->colName;
402 wxLogMessage(_("-E-> BrowserDB::OnGetNext - DB_DATA_TYPE_?? (%d) in Col(%s)"),(cl_BrowserDB->pColFor+i)->i_dbDataType,Temp0.c_str());
403 }
404 else
405 return TRUE;
406 Temp0.Printf(_("-E-> unknown Format(%d) - sql(%d)"),(cl_BrowserDB->pColFor+i)->i_dbDataType,(cl_BrowserDB->pColFor+i)->i_sqlDataType);
407 strcpy((cl_BrowserDB+i)->tableName,Temp0.c_str());
408 break;
409 };
410 }
411 }
412 // wxLogMessage("-E-> BrowserDB::OnGetNext - End");
413 return TRUE;
414 }
415 //----------------------------------------------------------------------------------------
416 bool BrowserDB::OnSelect(wxString tb_Name, int Quite)
417 {
418 wxString SQLStmt;
419 i_Records = 0;
420 //--------------------------------------------------------------------------
421 SQLStmt.sprintf("SELECT * FROM %s",tb_Name.c_str());
422 if (!db_BrowserDB->ExecSql((char *)(SQLStmt.GetData())))
423 {
424 Temp0.Printf(_("\n-E-> BrowserDB::OnSelect - ODBC-Error with ExecSql of >%s<.\n-E-> "),tb_Name.c_str());
425 Temp0 += GetExtendedDBErrorMsg(__FILE__,__LINE__);
426 wxLogMessage(Temp0);
427 wxMessageBox("-E-> BrowserDB::OnSelect - GetData()");
428 return FALSE;
429 }
430 //--------------------------------------------------------------------------
431 while (db_BrowserDB->GetNext())
432 {
433 i_Records++;
434 }
435 //--------------------------------------------------------------------------
436 if (!db_BrowserDB->ExecSql((char *)(SQLStmt.GetData())))
437 {
438 Temp0.Printf(_("\n-E-> BrowserDB::OnSelect - ODBC-Error with ExecSql of >%s<.\n-E-> "),tb_Name.c_str());
439 Temp0 += GetExtendedDBErrorMsg(__FILE__,__LINE__);
440 wxLogMessage(Temp0);
441 return FALSE;
442 }
443 //--------------------------------------------------------------------------
444 // SetColDefs ( 0,"NAME", DB_DATA_TYPE_VARCHAR, Name, SQL_C_CHAR, sizeof(Name), TRUE, TRUE); // Primary index
445 //--------------------------------------------------------------------------
446 if (!Quite)
447 {
448 wxLogMessage(_("\n-I-> BrowserDB::OnSelect(%s) Records(%d): End "),tb_Name.c_str(),i_Records);
449 }
450 return TRUE;
451 }
452 //----------------------------------------------------------------------------------------
453 bool BrowserDB::OnExecSql(wxString SQLStmt, int Quite)
454 {
455 //--------------------------------------------------------------------------
456 if (!db_BrowserDB->ExecSql((char *)(SQLStmt.GetData())))
457 {
458 Temp0.Printf(_("\n-E-> BrowserDB::OnExecSQL - ODBC-Error with ExecSql of >%s<.\n-E-> "),SQLStmt.c_str());
459 Temp0 += GetExtendedDBErrorMsg(__FILE__,__LINE__);
460 if (!Quite)
461 wxLogMessage(Temp0);
462 else
463 wxMessageBox("-E-> BrowserDB::OnExecSql - ExecSql()");
464 return FALSE;
465 }
466 if (!Quite)
467 {
468 // wxLogMessage(_("\n-I-> BrowserDB::OnExecSql(%s) - End "),SQLStmt.c_str());
469 }
470 return TRUE;
471 }
472 //----------------------------------------------------------------------------------------
473 wxDbInf* BrowserDB::OnGetCatalog(int Quite)
474 {
475 char UName[255];
476 strcpy(UName,UserName);
477 ct_BrowserDB = db_BrowserDB->GetCatalog(UName);
478 return ct_BrowserDB;
479 }
480 //----------------------------------------------------------------------------------------
481 wxColInf* BrowserDB::OnGetColumns(char *tableName, int numCols,int Quite)
482 {
483 char UName[255];
484 int i;
485 strcpy(UName,UserName);
486 cl_BrowserDB = db_BrowserDB->GetColumns(tableName,&numCols,UName);
487 cl_BrowserDB->pColFor = new wxColFor[numCols];
488 for (i=0;i<numCols;i++)
489 {
490 (cl_BrowserDB->pColFor+i)->Format(1,(cl_BrowserDB+i)->dbDataType,(cl_BrowserDB+i)->sqlDataType,
491 (cl_BrowserDB+i)->columnSize, (cl_BrowserDB+i)->decimalDigits);
492 }
493 return cl_BrowserDB;
494 }
495 //----------------------------------------------------------------------------------------
496 void BrowserDB::Zeiger_auf_NULL(int Art)
497 {
498 if (Art == 1) // Löschen
499 {
500 if (cl_BrowserDB != NULL)
501 { // Destroy the memory
502 delete [] cl_BrowserDB;
503 }
504 if (ct_BrowserDB != NULL)
505 { // Destroy the memory
506 delete [] ct_BrowserDB;
507 }
508 if (db_BrowserDB != NULL)
509 {
510 db_BrowserDB->CommitTrans();
511 db_BrowserDB->Close();
512 CloseDbConnections();
513 delete db_BrowserDB;
514 }
515 }
516 cl_BrowserDB = NULL;
517 ct_BrowserDB = NULL;
518 db_BrowserDB = NULL;
519 p_LogWindow = NULL;
520 }
521 //----------------------------------------------------------------------------------------
522 void BrowserDB::OnFillSqlTyp()
523 {
524 i_SqlTyp[1] = SQL_C_BINARY; s_SqlTyp[1] = "SQL_C_BINARY";
525 i_SqlTyp[2] = SQL_C_BIT; s_SqlTyp[2] = "SQL_C_BIT";
526 i_SqlTyp[3] = SQL_C_BOOKMARK; s_SqlTyp[3] = "SQL_C_BOOKMARK";
527 i_SqlTyp[4] = SQL_C_CHAR; s_SqlTyp[4] = "SQL_C_CHAR";
528 i_SqlTyp[5] = SQL_C_DATE; s_SqlTyp[5] = "SQL_C_DATE";
529 i_SqlTyp[6] = SQL_C_DEFAULT; s_SqlTyp[6] = "SQL_C_DEFAULT";
530 i_SqlTyp[7] = SQL_C_DOUBLE; s_SqlTyp[7] = "SQL_C_DOUBLE";
531 i_SqlTyp[8] = SQL_C_FLOAT; s_SqlTyp[8] = "SQL_C_FLOAT";
532 i_SqlTyp[9] = SQL_C_LONG; s_SqlTyp[9] = "SQL_C_LONG";
533 i_SqlTyp[10] = SQL_C_SHORT; s_SqlTyp[10] = "SQL_C_SHORT";
534 i_SqlTyp[11] = SQL_C_SLONG; s_SqlTyp[11] = "SQL_C_SLONG";
535 i_SqlTyp[12] = SQL_C_SSHORT; s_SqlTyp[12] = "SQL_C_SSHORT";
536 i_SqlTyp[13] = SQL_C_STINYINT; s_SqlTyp[13] = "SQL_C_STINYINT";
537 i_SqlTyp[14] = SQL_C_TIME; s_SqlTyp[14] = "SQL_C_TIME";
538 i_SqlTyp[15] = SQL_C_TIMESTAMP; s_SqlTyp[15] = "SQL_C_TIMESTAMP";
539 i_SqlTyp[16] = SQL_C_TINYINT; s_SqlTyp[16] = "SQL_C_TINYINT";
540 i_SqlTyp[17] = SQL_C_ULONG; s_SqlTyp[17] = "SQL_C_ULONG";
541 i_SqlTyp[18] = SQL_C_USHORT; s_SqlTyp[18] = "SQL_C_USHORT";
542 i_SqlTyp[19] = SQL_C_UTINYINT; s_SqlTyp[19] = "SQL_C_UTINYINT";
543 i_SqlTyp[20] = SQL_VARCHAR; s_SqlTyp[20] = "SQL_VARCHAR";
544 i_SqlTyp[21] = SQL_NUMERIC; s_SqlTyp[21] = "SQL_NUMERIC";
545 i_SqlTyp[22] = SQL_LONGVARCHAR; s_SqlTyp[22] = "SQL_LONGVARCHAR";
546 i_SqlTyp[23] = SQL_REAL; s_SqlTyp[23] = "SQL_REAL";
547 i_SqlTyp[0] = 23; s_SqlTyp[0] = "";
548 }
549 //----------------------------------------------------------------------------------------
550 void BrowserDB::OnFilldbTyp()
551 {
552 i_dbTyp[1] = DB_DATA_TYPE_VARCHAR; s_dbTyp[1] = "DB_DATA_TYPE_VARCHAR";
553 i_dbTyp[2] = DB_DATA_TYPE_INTEGER; s_dbTyp[2] = "DB_DATA_TYPE_INTEGER";
554 i_dbTyp[3] = DB_DATA_TYPE_FLOAT; s_dbTyp[3] = "DB_DATA_TYPE_FLOAT";
555 i_dbTyp[4] = DB_DATA_TYPE_DATE; s_dbTyp[4] = "DB_DATA_TYPE_DATE";
556 i_dbTyp[0] = 4; s_dbTyp[0] = "";
557 }
558 //----------------------------------------------------------------------------------------
559
560
561
562
563
564