home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / wxos2233.zip / wxOS2-2_3_3.zip / wxWindows-2.3.3 / demos / dbbrowse / browsedb.cpp next >
C/C++ Source or Header  |  2001-10-04  |  22KB  |  498 lines

  1. //----------------------------------------------------------------------------------------
  2. // Name:        BrowserDB.h,cpp
  3. // Purpose:     a wxDB class
  4. // Author:        Mark Johnson
  5. // Modified by:
  6. // Created:     19991127.mj10777
  7. // Copyright:    (c) Mark Johnson
  8. // Licence:     wxWindows license
  9. // RCS-ID:        $Id: browsedb.cpp,v 1.23 2001/10/04 16:44:08 GT Exp $
  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 "std.h"
  32. //----------------------------------------------------------------------------------------
  33. // Global structure for holding ODBC connection information
  34. // - darf nur einmal im Projekte definiert werden ?? Extra Databasse Klasse ?
  35. wxDbConnectInf DbConnectInf;        // Fⁿr DBase
  36.  
  37. #if !wxUSE_ODBC
  38.   #error Demo cannot be compiled unless setup.h has wxUSE_ODBC set to 1
  39. #endif
  40.  
  41. //----------------------------------------------------------------------------------------
  42. extern WXDLLEXPORT_DATA(wxDbList*) PtrBegDbList;    /* from db.cpp, used in getting back error results from db connections */
  43.  
  44. //----------------------------------------------------------------------------------------
  45. char *GetExtendedDBErrorMsg(char *ErrFile, int ErrLine)
  46. {
  47.     static wxString msg;
  48.     wxString tStr;
  49.     if (ErrFile || ErrLine)
  50.     {
  51.         msg += "File: ";
  52.         msg += ErrFile;
  53.         msg += "   Line: ";
  54.         tStr.Printf("%d",ErrLine);
  55.         msg += tStr.GetData();
  56.         // msg += "\n";
  57.     }
  58.     msg.Append ("\nODBC errors:\n");
  59.     // msg += "\n";
  60.     /* Scan through each database connection displaying
  61.     * any ODBC errors that have occured. */
  62.     wxDbList *pDbList;
  63.     for (pDbList = PtrBegDbList; pDbList; pDbList = pDbList->PtrNext)
  64.     {
  65.         // Skip over any free connections
  66.         if (pDbList->Free)
  67.             continue;
  68.         // Display errors for this connection
  69.         for (int i = 0; i < DB_MAX_ERROR_HISTORY; i++)
  70.         {
  71.             if (pDbList->PtrDb->errorList[i])
  72.             {
  73.                 msg.Append(pDbList->PtrDb->errorList[i]);
  74.                 if (strcmp(pDbList->PtrDb->errorList[i],"") != 0)
  75.                     msg.Append("\n");
  76.             }
  77.         }
  78.     }
  79.     msg += "\n";
  80.     return (char*) (const char*) msg;
  81. }  // GetExtendedDBErrorMsg
  82.  
  83. //----------------------------------------------------------------------------------------
  84. BrowserDB::BrowserDB()
  85. {
  86.     PointerToNULL(0);
  87.     ODBCSource = "";             // ODBC data source name (created with ODBC Administrator under Win95/NT)
  88.     UserName   = "";             // database username - must already exist in the data source
  89.     Password   = "";             // password database username
  90.     OnFillSqlTyp();
  91.     OnFilldbTyp();
  92. }  // BrowserDB Constructor
  93.  
  94. //----------------------------------------------------------------------------------------
  95. BrowserDB::~BrowserDB()
  96. {
  97.     PointerToNULL(1);  // Clean up Tables and Databases (Commit, Close and delete)
  98. }  // BrowserDB destructor
  99.  
  100. //----------------------------------------------------------------------------------------
  101. bool BrowserDB::Initialize(int Quiet)
  102. {
  103.     if (!OnStartDB(Quiet))
  104.     {
  105.         wxLogMessage(_("\n\n-E-> BrowserDB::OnStartDB(%s) : Failed ! "),ODBCSource.c_str());
  106.         return FALSE;
  107.     }
  108.     return TRUE;
  109. }  // BrowserDB:Initialize
  110.  
  111. //----------------------------------------------------------------------------------------
  112. bool BrowserDB::OnStartDB(int Quiet)
  113. {
  114.     wxStopWatch sw;
  115.     if (!Quiet)
  116.         wxLogMessage(_("\n-I-> BrowserDB::OnStartDB(%s) : Begin "),ODBCSource.c_str());
  117.     if (db_BrowserDB != NULL)
  118.     {
  119.         if (!Quiet)
  120.             wxLogMessage(_("\n-I-> BrowserDB::OnStartDB() : DB is already open."));
  121.         return TRUE;
  122.     }
  123.  
  124.     DbConnectInf.AllocHenv();
  125.  
  126.     //---------------------------------------------------------------------------------------
  127.     // Connect to datasource
  128.     //---------------------------------------------------------------------------------------
  129.     DlgUser *p_Dlg;
  130.     p_Dlg = new DlgUser(pDoc->p_MainFrame,pDoc,"");
  131.     p_Dlg->s_DSN      = ODBCSource;
  132.     p_Dlg->s_User      = UserName;
  133.     p_Dlg->s_Password = Password;
  134.     p_Dlg->OnInit();
  135.     p_Dlg->Fit();
  136.     
  137.     bool OK = FALSE;
  138.     if (p_Dlg->ShowModal() == wxID_OK)
  139.     {
  140.         (pDoc->p_DSN+i_Which)->Usr = p_Dlg->s_User;
  141.         (pDoc->p_DSN+i_Which)->Pas = p_Dlg->s_Password;
  142.         UserName  = p_Dlg->s_User;
  143.         Password  = p_Dlg->s_Password;
  144.         OK = TRUE;
  145.     }
  146.     delete p_Dlg;
  147.     if (OK)
  148.     {
  149.         //--------------------------------------------------------------------------------------
  150.         DbConnectInf.SetDsn(ODBCSource);           // ODBC data source name (created with ODBC Administrator under Win95/NT)
  151.         DbConnectInf.SetUserID(UserName);          // database username - must already exist in the data source
  152.         DbConnectInf.SetPassword(Password);      // password database username
  153.         db_BrowserDB = wxDbGetConnection(&DbConnectInf);
  154.         // wxLogMessage(">>>%s<<<>>>%s<<<",UserName.c_str(),Password.c_str());
  155.         if (db_BrowserDB == NULL)
  156.         {
  157.             DbConnectInf.SetDsn(wxT(""));
  158.             DbConnectInf.SetUserID(wxT(""));
  159.             DbConnectInf.SetPassword(wxT(""));
  160.             if (!Quiet)
  161.             {
  162.                 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)"));
  163.                 wxLogMessage(_("-I-> BrowserDB::OnStartDB(%s) : End - Time needed : %ld ms"),ODBCSource.c_str(),sw.Time());
  164.             }
  165.             DbConnectInf.FreeHenv();
  166.             return FALSE;
  167.         }
  168.         //--------------------------------------------------------------------------------------
  169.         if (!Quiet)
  170.         {
  171.             Temp1 = db_BrowserDB->GetDatabaseName();
  172.             Temp2 = db_BrowserDB->GetDataSource();
  173.             wxLogMessage(_("-I-> BrowserDB::OnGetDataSourceODBC() - DatabaseName(%s) ; DataSource(%s)"),Temp1.c_str(),Temp2.c_str());
  174.             wxLogMessage(_("-I-> BrowserDB::OnStartDB(%s) : End - Time needed : %ld ms"),ODBCSource.c_str(),sw.Time());
  175.         }
  176.         return TRUE;
  177.     }
  178.     else
  179.     {
  180.         DbConnectInf.FreeHenv();
  181.         return FALSE;
  182.     }
  183. }
  184.  
  185. //----------------------------------------------------------------------------------------
  186. bool BrowserDB::OnCloseDB(int Quiet)
  187. {
  188.     if (!Quiet)
  189.         wxLogMessage(_("-I-> BrowserDB::OnCloseDB() : Begin "));
  190.     if (db_BrowserDB)
  191.     {
  192. //        db_BrowserDB->Close();
  193.         wxDbFreeConnection(db_BrowserDB);
  194.  
  195.         DbConnectInf.FreeHenv();
  196.  
  197.         db_BrowserDB = NULL;
  198.     }
  199.     if (!Quiet)
  200.         wxLogMessage(_("\n-I-> BrowserDB::OnCloseDB() : End "));
  201.     return TRUE;
  202. }
  203.  
  204. //----------------------------------------------------------------------------------------
  205. bool BrowserDB::OnGetNext(int Cols,int Quiet)
  206. {
  207.     SDWORD cb;
  208.     int      i_dbDataType;
  209.     int   i=0;
  210.     char             s_temp[1024+1];
  211.     long             l_temp;
  212.     double             f_temp;
  213.     int              AnzError=0;
  214.     TIMESTAMP_STRUCT t_temp;
  215.     wxString Temp0;
  216.     //-----------------------------
  217.     if (!db_BrowserDB->GetNext())
  218.     {
  219.         return FALSE;
  220.         Temp0.Printf(_("\n-E-> BrowserDB::OnGetNext - ODBC-Error with GetNext \n-E-> "));
  221.         Temp0 += GetExtendedDBErrorMsg(__FILE__,__LINE__);
  222.         wxLogMessage(Temp0);
  223.         wxMessageBox(Temp0);
  224.     }
  225.     else
  226.     {
  227.         for (i=0;i<Cols;i++)
  228.         {
  229.             strcpy((cl_BrowserDB+i)->tableName,"-E->");
  230.             i_dbDataType = (cl_BrowserDB+i)->pColFor->i_dbDataType;
  231.             if (i_dbDataType == 0)                          // Filter unsupported dbDataTypes
  232.             {
  233.                 if (((cl_BrowserDB+i)->pColFor->i_sqlDataType == SQL_VARCHAR) ||
  234.                           ((cl_BrowserDB+i)->pColFor->i_sqlDataType == SQL_LONGVARCHAR))
  235.                     i_dbDataType = DB_DATA_TYPE_VARCHAR;
  236.                 if ((cl_BrowserDB+i)->pColFor->i_sqlDataType == SQL_C_DATE)
  237.                     i_dbDataType = DB_DATA_TYPE_DATE;
  238.                 if ((cl_BrowserDB+i)->pColFor->i_sqlDataType == SQL_C_BIT)
  239.                     i_dbDataType = DB_DATA_TYPE_INTEGER;
  240.                 if ((cl_BrowserDB+i)->pColFor->i_sqlDataType == SQL_NUMERIC)
  241.                     i_dbDataType = DB_DATA_TYPE_VARCHAR;
  242.                 if ((cl_BrowserDB+i)->pColFor->i_sqlDataType == SQL_REAL)
  243.                     i_dbDataType = DB_DATA_TYPE_FLOAT;
  244.             }
  245.             if ((i_dbDataType == DB_DATA_TYPE_INTEGER) &&
  246.                      ((cl_BrowserDB+i)->pColFor->i_sqlDataType == SQL_C_DOUBLE))
  247.             {    // DBASE Numeric
  248.                 i_dbDataType = DB_DATA_TYPE_FLOAT;
  249.             }
  250.             switch(i_dbDataType)
  251.             {
  252.             case DB_DATA_TYPE_VARCHAR:
  253.                 strcpy(s_temp,"");
  254.                 if (!db_BrowserDB->GetData(i+1,(cl_BrowserDB+i)->pColFor->i_dbDataType,&s_temp,sizeof(s_temp), &cb))
  255.                 {
  256.                     Temp0.Printf(_("\n-E-> BrowserDB::OnGetNext - ODBC-Error with GetNext of >%s<.\n-E-> "),(cl_BrowserDB+i)->tableName);
  257.                     Temp0 += GetExtendedDBErrorMsg(__FILE__,__LINE__);
  258.                     wxLogMessage(Temp0);
  259.                 }
  260.                 Temp0.Printf((cl_BrowserDB+i)->pColFor->s_Field,s_temp);
  261.                 strcpy((cl_BrowserDB+i)->tableName,Temp0.c_str());
  262.                 break;
  263.             case DB_DATA_TYPE_INTEGER:
  264.                 l_temp = 0;
  265.                 if (!db_BrowserDB->GetData(i+1,(cl_BrowserDB+i)->pColFor->i_sqlDataType,&l_temp,sizeof(l_temp), &cb))
  266.                 {
  267.                     Temp0.Printf(_("\n-E-> BrowserDB::OnGetData - ODBC-Error with GetNext \n-E-> "));
  268.                     Temp0 += GetExtendedDBErrorMsg(__FILE__,__LINE__);
  269.                 }
  270.                 else
  271.                 {
  272.                     Temp0.Printf((cl_BrowserDB+i)->pColFor->s_Field,l_temp);
  273.                     strcpy((cl_BrowserDB+i)->tableName,Temp0.c_str());
  274.                 }
  275.                 break;
  276.             case DB_DATA_TYPE_FLOAT:
  277.                 f_temp = 0;
  278.                 if (!db_BrowserDB->GetData(i+1,(cl_BrowserDB+i)->pColFor->i_sqlDataType,&f_temp,sizeof(f_temp), &cb))
  279.                 {
  280.                     Temp0.Printf(_("\n-E-> BrowserDB::OnGetData - ODBC-Error with GetNext \n-E-> "));
  281.                     Temp0 += GetExtendedDBErrorMsg(__FILE__,__LINE__);
  282.                     wxMessageBox(Temp0);
  283.                 }
  284.                 else
  285.                 {
  286.                     Temp0.Printf((cl_BrowserDB+i)->pColFor->s_Field,f_temp);
  287.                     strcpy((cl_BrowserDB+i)->tableName,Temp0.c_str());
  288.                 }
  289.                 break;
  290.             case DB_DATA_TYPE_DATE:
  291.                 t_temp.day = t_temp.month = t_temp.year = t_temp.hour = t_temp.minute = t_temp.second = t_temp.fraction = 0;
  292.                 if (!db_BrowserDB->GetData(i+1,(cl_BrowserDB+i)->pColFor->i_sqlDataType,&t_temp,sizeof(t_temp), &cb))
  293.                 {
  294.                     Temp0.Printf(_("\n-E-> BrowserDB::OnGetData - ODBC-Error with GetNext \n-E-> "));
  295.                     Temp0 += GetExtendedDBErrorMsg(__FILE__,__LINE__);
  296.                 }
  297.                 else
  298.                 {
  299.                     // i_Nation =  0 = timestamp , 1=EU, 2=UK, 3=International, 4=US
  300.                     if (((cl_BrowserDB+i)->pColFor->i_Nation == 0)    ||    // TS  YYYY-MM-DD
  301.                         ((cl_BrowserDB+i)->pColFor->i_Nation == 3))     // IT  YYYY-MM-DD
  302.                     {
  303.                         Temp0.Printf((cl_BrowserDB+i)->pColFor->s_Field,t_temp.year,t_temp.month,t_temp.day,
  304.                             t_temp.hour, t_temp.minute, t_temp.second, t_temp.fraction);
  305.                         strcpy((cl_BrowserDB+i)->tableName,Temp0.c_str());
  306.                     }
  307.                     if (((cl_BrowserDB+i)->pColFor->i_Nation == 1) ||  // EU  DD.MM.YYYY
  308.                         ((cl_BrowserDB+i)->pColFor->i_Nation == 2))   // UK  DD/MM/YYYY
  309.                     {
  310.                         Temp0.Printf((cl_BrowserDB+i)->pColFor->s_Field,t_temp.day,t_temp.month,t_temp.year,
  311.                             t_temp.hour, t_temp.minute, t_temp.second, t_temp.fraction);
  312.                         strcpy((cl_BrowserDB+i)->tableName,Temp0.c_str());
  313.                     }
  314.                     if ((cl_BrowserDB+i)->pColFor->i_Nation == 3)       // US  MM/DD/YYYY
  315.                     {
  316.                         Temp0.Printf((cl_BrowserDB+i)->pColFor->s_Field,t_temp.month,t_temp.day,t_temp.year,
  317.                             t_temp.hour, t_temp.minute, t_temp.second, t_temp.fraction);
  318.                         strcpy((cl_BrowserDB+i)->tableName,Temp0.c_str());
  319.                     }
  320.                 }
  321.                 break;
  322.             default:
  323.                 AnzError++;
  324.                 if (AnzError <= 100)
  325.                 {
  326.                     Temp0 = (cl_BrowserDB+i)->colName;
  327.                     wxLogMessage(_("-E-> BrowserDB::OnGetNext - DB_DATA_TYPE_?? (%d) in Col(%s)"),(cl_BrowserDB+i)->pColFor->i_dbDataType,Temp0.c_str());
  328.                 }
  329.                 else
  330.                     return TRUE;
  331.                 Temp0.Printf(_("-E-> unknown Format(%d) - sql(%d)"),(cl_BrowserDB+i)->pColFor->i_dbDataType,(cl_BrowserDB+i)->pColFor->i_sqlDataType);
  332.                 strcpy((cl_BrowserDB+i)->tableName,Temp0.c_str());
  333.                 break;
  334.             };  // switch
  335.         }  // for
  336.     }  // else
  337.  
  338.     return TRUE;
  339. }
  340.  
  341. //----------------------------------------------------------------------------------------
  342. bool BrowserDB::OnSelect(wxString tb_Name, int Quiet)
  343. {
  344.     wxStopWatch sw;
  345.     wxString SQLStmt;
  346.     i_Records = 0;
  347.     //---------------------------------------------------------------------------------------
  348.     SQLStmt.sprintf("SELECT * FROM %s",db_BrowserDB->SQLTableName(tb_Name.c_str()));
  349.     if (!db_BrowserDB->ExecSql((char *)(SQLStmt.GetData())))
  350.     {
  351.         Temp0.Printf(_("\n-E-> BrowserDB::OnSelect - ODBC-Error with ExecSql of >%s<.\n-E-> "),tb_Name.c_str());
  352.         Temp0 += GetExtendedDBErrorMsg(__FILE__,__LINE__);
  353.         wxLogMessage(Temp0);
  354.         wxMessageBox("-E-> BrowserDB::OnSelect - GetData()");
  355.         return FALSE;
  356.     }
  357.     //---------------------------------------------------------------------------------------
  358.     while (db_BrowserDB->GetNext())
  359.     {
  360.         i_Records++;
  361.     }
  362.     //---------------------------------------------------------------------------------------
  363.     if (!db_BrowserDB->ExecSql((char *)(SQLStmt.GetData())))
  364.     {
  365.         Temp0.Printf(_("\n-E-> BrowserDB::OnSelect - ODBC-Error with ExecSql of >%s<.\n-E-> "),tb_Name.c_str());
  366.         Temp0 += GetExtendedDBErrorMsg(__FILE__,__LINE__);
  367.         wxLogMessage(Temp0);
  368.         return FALSE;
  369.     }
  370.     //---------------------------------------------------------------------------------------
  371.     // SetColDefs ( 0,"NAME",      DB_DATA_TYPE_VARCHAR,  Name,       SQL_C_CHAR,        sizeof(Name),     TRUE, TRUE);  // Primary index
  372.     //---------------------------------------------------------------------------------------
  373.     if (!Quiet)
  374.     {
  375.         wxLogMessage(_("\n-I-> BrowserDB::OnSelect(%s) Records(%d): End - Time needed : %ld ms"),tb_Name.c_str(),i_Records,sw.Time());
  376.     }
  377.     return TRUE;
  378. }
  379.  
  380. //----------------------------------------------------------------------------------------
  381. bool BrowserDB::OnExecSql(wxString SQLStmt, int Quiet)
  382. {
  383.     //---------------------------------------------------------------------------------------
  384.     if (!db_BrowserDB->ExecSql((char *)(SQLStmt.GetData())))
  385.     {
  386.         Temp0.Printf(_("\n-E-> BrowserDB::OnExecSQL - ODBC-Error with ExecSql of >%s<.\n-E-> "),SQLStmt.c_str());
  387.         Temp0 += GetExtendedDBErrorMsg(__FILE__,__LINE__);
  388.         if (!Quiet)
  389.             wxLogMessage(Temp0);
  390.         else
  391.             wxMessageBox("-E-> BrowserDB::OnExecSql - ExecSql()");
  392.         return FALSE;
  393.     }
  394.     if (!Quiet)
  395.     {
  396.         // wxLogMessage(_("\n-I-> BrowserDB::OnExecSql(%s) - End - Time needed : %ld ms"),SQLStmt.c_str(),sw.Time());
  397.     }
  398.     return TRUE;
  399. }
  400.  
  401. //----------------------------------------------------------------------------------------
  402. wxDbInf* BrowserDB::OnGetCatalog(int Quiet)
  403. {
  404.     char UName[255];
  405.     strcpy(UName,UserName);
  406.     ct_BrowserDB = db_BrowserDB->GetCatalog(UName);
  407.     return ct_BrowserDB;
  408. }
  409.  
  410. //----------------------------------------------------------------------------------------
  411. wxDbColInf* BrowserDB::OnGetColumns(char *tableName, UWORD numCols, int Quiet)
  412. {
  413.     char UName[255];
  414.     int i;
  415.     strcpy(UName,UserName);
  416.     cl_BrowserDB = db_BrowserDB->GetColumns(tableName,&numCols,UName);
  417. //    cl_BrowserDB->pColFor = new wxDbColFor[numCols];
  418.     for (i=0;i<numCols;i++)
  419.     {
  420. //        (cl_BrowserDB->pColFor+i)->Format(1,(cl_BrowserDB+i)->dbDataType,(cl_BrowserDB+i)->sqlDataType,
  421. //            (cl_BrowserDB+i)->columnSize, (cl_BrowserDB+i)->decimalDigits);
  422.         (cl_BrowserDB+i)->pColFor = new wxDbColFor;
  423.         (cl_BrowserDB+i)->pColFor->Format(1,
  424.                                         (cl_BrowserDB+i)->dbDataType,
  425.                                         (cl_BrowserDB+i)->sqlDataType,
  426.                                         (cl_BrowserDB+i)->columnSize, 
  427.                                         (cl_BrowserDB+i)->decimalDigits);
  428.     }
  429.     return cl_BrowserDB;
  430. }
  431.  
  432. //----------------------------------------------------------------------------------------
  433. void BrowserDB::PointerToNULL(int Art)
  434. {
  435.     if (Art == 1) // L÷schen
  436.     {
  437.         if (cl_BrowserDB != NULL)
  438.         { // Destroy the memory
  439.             delete [] cl_BrowserDB;
  440.         }
  441.         if (ct_BrowserDB != NULL)
  442.         { // Destroy the memory
  443.             delete [] ct_BrowserDB;
  444.         }
  445.         if (db_BrowserDB != NULL)
  446.         {
  447.             db_BrowserDB->CommitTrans();
  448.             db_BrowserDB->Close();
  449.             wxDbCloseConnections();
  450.             delete db_BrowserDB;
  451.         }
  452.     }
  453.     cl_BrowserDB       = NULL;
  454.     ct_BrowserDB       = NULL;
  455.     db_BrowserDB       = NULL;
  456.     p_LogWindow        = NULL;
  457. }
  458.  
  459. //----------------------------------------------------------------------------------------
  460. void BrowserDB::OnFillSqlTyp()
  461. {
  462.     i_SqlTyp[1]  = SQL_C_BINARY;     s_SqlTyp[1]  = "SQL_C_BINARY";
  463.     i_SqlTyp[2]  = SQL_C_BIT;         s_SqlTyp[2]  = "SQL_C_BIT";
  464.     i_SqlTyp[3]  = SQL_C_BOOKMARK;     s_SqlTyp[3]  = "SQL_C_BOOKMARK";
  465.     i_SqlTyp[4]  = SQL_C_CHAR;         s_SqlTyp[4]  = "SQL_C_CHAR";
  466.     i_SqlTyp[5]  = SQL_C_DATE;         s_SqlTyp[5]  = "SQL_C_DATE";
  467.     i_SqlTyp[6]  = SQL_C_DEFAULT;     s_SqlTyp[6]  = "SQL_C_DEFAULT";
  468.     i_SqlTyp[7]  = SQL_C_DOUBLE;     s_SqlTyp[7]  = "SQL_C_DOUBLE";
  469.     i_SqlTyp[8]  = SQL_C_FLOAT;      s_SqlTyp[8]  = "SQL_C_FLOAT";
  470.     i_SqlTyp[9]  = SQL_C_LONG;         s_SqlTyp[9]  = "SQL_C_LONG";
  471.     i_SqlTyp[10] = SQL_C_SHORT;      s_SqlTyp[10] = "SQL_C_SHORT";
  472.     i_SqlTyp[11] = SQL_C_SLONG;      s_SqlTyp[11] = "SQL_C_SLONG";
  473.     i_SqlTyp[12] = SQL_C_SSHORT;     s_SqlTyp[12] = "SQL_C_SSHORT";
  474.     i_SqlTyp[13] = SQL_C_STINYINT;     s_SqlTyp[13] = "SQL_C_STINYINT";
  475.     i_SqlTyp[14] = SQL_C_TIME;         s_SqlTyp[14] = "SQL_C_TIME";
  476.     i_SqlTyp[15] = SQL_C_TIMESTAMP;  s_SqlTyp[15] = "SQL_C_TIMESTAMP";
  477.     i_SqlTyp[16] = SQL_C_TINYINT;     s_SqlTyp[16] = "SQL_C_TINYINT";
  478.     i_SqlTyp[17] = SQL_C_ULONG;      s_SqlTyp[17] = "SQL_C_ULONG";
  479.     i_SqlTyp[18] = SQL_C_USHORT;     s_SqlTyp[18] = "SQL_C_USHORT";
  480.     i_SqlTyp[19] = SQL_C_UTINYINT;     s_SqlTyp[19] = "SQL_C_UTINYINT";
  481.     i_SqlTyp[20] = SQL_VARCHAR;      s_SqlTyp[20] = "SQL_VARCHAR";
  482.     i_SqlTyp[21] = SQL_NUMERIC;      s_SqlTyp[21] = "SQL_NUMERIC";
  483.     i_SqlTyp[22] = SQL_LONGVARCHAR;  s_SqlTyp[22] = "SQL_LONGVARCHAR";
  484.     i_SqlTyp[23] = SQL_REAL;         s_SqlTyp[23] = "SQL_REAL";
  485.     i_SqlTyp[0]  = 23;                 s_SqlTyp[0]  = "";
  486. }
  487.  
  488. //----------------------------------------------------------------------------------------
  489. void BrowserDB::OnFilldbTyp()
  490. {
  491.     i_dbTyp[1]     = DB_DATA_TYPE_VARCHAR;     s_dbTyp[1]  = "DB_DATA_TYPE_VARCHAR";
  492.     i_dbTyp[2]     = DB_DATA_TYPE_INTEGER;     s_dbTyp[2]  = "DB_DATA_TYPE_INTEGER";
  493.     i_dbTyp[3]     = DB_DATA_TYPE_FLOAT;         s_dbTyp[3]  = "DB_DATA_TYPE_FLOAT";
  494.     i_dbTyp[4]     = DB_DATA_TYPE_DATE;         s_dbTyp[4]  = "DB_DATA_TYPE_DATE";
  495.     i_dbTyp[0]     = 4;                         s_dbTyp[0]   = "";
  496. }
  497. //----------------------------------------------------------------------------------------
  498.