]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/dbtable.cpp
reverted Julian's unintentional breakage of wxChoice
[wxWidgets.git] / src / common / dbtable.cpp
index 8a67be23116a9bf1caca1df699a8da631085cd5c..cf3860dfcfb1fcf1cbea72be97ecb60f5b7c2244 100644 (file)
 #endif
 
 #ifdef DBDEBUG_CONSOLE
 #endif
 
 #ifdef DBDEBUG_CONSOLE
-    #include "iostream.h"
+#if wxUSE_IOSTREAMH
+    #include <iostream.h>
+#else
+    #include <iostream>
+#endif
     #include "wx/ioswrap.h"
 #endif
 
     #include "wx/ioswrap.h"
 #endif
 
@@ -1121,7 +1125,7 @@ void wxDbTable::BuildUpdateStmt(wxString &pSqlStmt, int typeOfUpd, const wxStrin
     bool firstColumn = TRUE;
 
     pSqlStmt.Printf(wxT("UPDATE %s SET "),
     bool firstColumn = TRUE;
 
     pSqlStmt.Printf(wxT("UPDATE %s SET "),
-                    pDb->SQLTableName(tableName.Upper().c_str()).c_str());
+                    pDb->SQLTableName(tableName.c_str()).c_str());
 
     // Append a list of columns to be updated
     int i;
 
     // Append a list of columns to be updated
     int i;
@@ -1380,7 +1384,8 @@ bool wxDbTable::CreateTable(bool attemptDrop)
                 break;
         }
         // For varchars, append the size of the string
                 break;
         }
         // For varchars, append the size of the string
-        if (colDefs[i].DbDataType == DB_DATA_TYPE_VARCHAR)// ||
+        if (colDefs[i].DbDataType == DB_DATA_TYPE_VARCHAR &&
+            (pDb->Dbms() != dbmsMY_SQL || pDb->GetTypeInfVarchar().TypeName != "text"))// ||
 //            colDefs[i].DbDataType == DB_DATA_TYPE_BLOB)
         {
             wxString s;
 //            colDefs[i].DbDataType == DB_DATA_TYPE_BLOB)
         {
             wxString s;
@@ -1452,7 +1457,14 @@ bool wxDbTable::CreateTable(bool attemptDrop)
                 if (j++) // Multi part key, comma separate names
                     sqlStmt += wxT(",");
                 sqlStmt += pDb->SQLColumnName(colDefs[i].ColName);
                 if (j++) // Multi part key, comma separate names
                     sqlStmt += wxT(",");
                 sqlStmt += pDb->SQLColumnName(colDefs[i].ColName);
-//                sqlStmt += colDefs[i].ColName;
+
+                if (pDb->Dbms() == dbmsMY_SQL &&
+                    colDefs[i].DbDataType ==  DB_DATA_TYPE_VARCHAR)
+                {
+                    wxString s;
+                    s.Printf(wxT("(%d)"), colDefs[i].SzDataObj);
+                    sqlStmt += s;
+                }
             }
         }
         sqlStmt += wxT(")");
             }
         }
         sqlStmt += wxT(")");
@@ -1696,7 +1708,7 @@ bool wxDbTable::DropIndex(const wxString &idxName)
         pDb->Dbms() == dbmsDBASE /*|| Paradox needs this syntax too when we add support*/)
         sqlStmt.Printf(wxT("DROP INDEX %s ON %s"),
                        pDb->SQLTableName(idxName.c_str()).c_str(),
         pDb->Dbms() == dbmsDBASE /*|| Paradox needs this syntax too when we add support*/)
         sqlStmt.Printf(wxT("DROP INDEX %s ON %s"),
                        pDb->SQLTableName(idxName.c_str()).c_str(),
-                       pDb->SQLTableName(tableName.c_str().c_str()));
+                       pDb->SQLTableName(tableName.c_str()).c_str());
     else if ((pDb->Dbms() == dbmsMS_SQL_SERVER) ||
              (pDb->Dbms() == dbmsSYBASE_ASE))
         sqlStmt.Printf(wxT("DROP INDEX %s.%s"),
     else if ((pDb->Dbms() == dbmsMS_SQL_SERVER) ||
              (pDb->Dbms() == dbmsSYBASE_ASE))
         sqlStmt.Printf(wxT("DROP INDEX %s.%s"),