]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/db.cpp
added new project file having the new files
[wxWidgets.git] / src / common / db.cpp
index 4912134e0bc5beb4f3e667d229efc0107d0b7b0d..0b06c0497e13a11aecaa5225ce82247a1152403b 100644 (file)
@@ -53,7 +53,9 @@
     #include "wx/object.h"
     #include "wx/list.h"
     #include "wx/utils.h"
-    #include "wx/msgdlg.h"
+    #if wxUSE_GUI
+        #include "wx/msgdlg.h"
+    #endif
     #include "wx/log.h"
 #endif
 #include "wx/filefn.h"
@@ -2978,7 +2980,7 @@ bool wxDb::Catalog(const wxChar *userID, const wxString &fileName)
     wxChar    colName[DB_MAX_COLUMN_NAME_LEN+1];
     SWORD     sqlDataType;
     wxChar    typeName[30+1];
-    SWORD     precision, length;
+    SDWORD    precision, length;
 
     FILE *fp = fopen(fileName.c_str(),wxT("wt"));
     if (fp == NULL)
@@ -3020,8 +3022,12 @@ bool wxDb::Catalog(const wxChar *userID, const wxString &fileName)
     tblNameSave.Empty();
     int cnt = 0;
 
-    while ((retcode = SQLFetch(hstmt)) == SQL_SUCCESS)
+    while (TRUE)
     {
+        retcode = SQLFetch(hstmt);
+        if (retcode != SQL_SUCCESS && retcode != SQL_SUCCESS_WITH_INFO)
+            break;
+
         if (wxStrcmp(tblName, tblNameSave.c_str()))
         {
             if (cnt)
@@ -3042,12 +3048,12 @@ bool wxDb::Catalog(const wxChar *userID, const wxString &fileName)
             tblNameSave = tblName;
         }
 
-      GetData(3,SQL_C_CHAR,  (UCHAR *)tblName,     DB_MAX_TABLE_NAME_LEN+1, &cb);
-      GetData(4,SQL_C_CHAR,  (UCHAR *)colName,     DB_MAX_COLUMN_NAME_LEN+1,&cb);
-      GetData(5,SQL_C_SSHORT,(UCHAR *)&sqlDataType,0,                       &cb);
-      GetData(6,SQL_C_CHAR,  (UCHAR *)typeName,    sizeof(typeName),        &cb);
-      GetData(7,SQL_C_SSHORT,(UCHAR *)&precision,  0,                       &cb);
-      GetData(8,SQL_C_SSHORT,(UCHAR *)&length,     0,                       &cb);
+      GetData(3,SQL_C_CHAR,  (UCHAR *) tblName,     DB_MAX_TABLE_NAME_LEN+1, &cb);
+      GetData(4,SQL_C_CHAR,  (UCHAR *) colName,     DB_MAX_COLUMN_NAME_LEN+1,&cb);
+      GetData(5,SQL_C_SSHORT,(UCHAR *)&sqlDataType, 0,                       &cb);
+      GetData(6,SQL_C_CHAR,  (UCHAR *) typeName,    sizeof(typeName),        &cb);
+      GetData(7,SQL_C_SLONG, (UCHAR *)&precision,   0,                       &cb);
+      GetData(8,SQL_C_SLONG, (UCHAR *)&length,      0,                       &cb);
 
         outStr.Printf(wxT("%-32s %-32s (%04d)%-15s %9d %9d\n"),
             tblName, colName, sqlDataType, typeName, precision, length);
@@ -3716,7 +3722,7 @@ const wxChar WXDLLEXPORT *wxDbLogExtendedErrorMsg(const wxChar *userText, wxDb *
 
     msg.Append (wxT("\nODBC errors:\n"));
     msg += wxT("\n");
-    
+
     // Display errors for this connection
     int i;
     for (i = 0; i < DB_MAX_ERROR_HISTORY; i++)