]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/db.cpp
more fixes to dllexport/import stuff for operator<<()s (still bug 1104372)
[wxWidgets.git] / src / common / db.cpp
index 18184c49b850238b0fa07a68d86f1f7103d78a71..f01b98dd990f87276d2a871a98579c8f104af84e 100644 (file)
@@ -287,14 +287,15 @@ int wxDbColFor::Format(int Nation, int dbDataType, SWORD sqlDataType,
 
     if (i_dbDataType == 0)                                        // Filter unsupported dbDataTypes
     {
-        if ((i_sqlDataType == SQL_VARCHAR) || (i_sqlDataType == SQL_LONGVARCHAR))
+        if ((i_sqlDataType == SQL_VARCHAR) || (i_sqlDataType == SQL_LONGVARCHAR) ||
+            (i_sqlDataType == SQL_WCHAR) || (i_sqlDataType == SQL_WVARCHAR))
             i_dbDataType = DB_DATA_TYPE_VARCHAR;
         if ((i_sqlDataType == SQL_C_DATE) || (i_sqlDataType == SQL_C_TIMESTAMP))
             i_dbDataType = DB_DATA_TYPE_DATE;
         if (i_sqlDataType == SQL_C_BIT)
             i_dbDataType = DB_DATA_TYPE_INTEGER;
         if (i_sqlDataType == SQL_NUMERIC)
-            i_dbDataType = DB_DATA_TYPE_VARCHAR;
+            i_dbDataType = DB_DATA_TYPE_VARCHAR;   // glt - ??? is this right?
         if (i_sqlDataType == SQL_REAL)
             i_dbDataType = DB_DATA_TYPE_FLOAT;
         if (i_sqlDataType == SQL_C_BINARY)
@@ -578,13 +579,13 @@ const wxChar *wxDb::convertUserID(const wxChar *userID, wxString &UserID)
 
 bool wxDb::determineDataTypes(bool failOnDataTypeUnsupported)
 {
-    int iIndex;
+    size_t iIndex;
 
     // These are the possible SQL types we check for use against the datasource we are connected
     // to for the purpose of determining which data type to use for the basic character strings
     // column types
     //
-    // NOTE: The first type in this enumeration that is determined to be supported by the 
+    // NOTE: The first type in this enumeration that is determined to be supported by the
     //       datasource/driver is the one that will be used.
     SWORD PossibleSqlCharTypes[] = {
 #if wxUSE_UNICODE && defined(SQL_WVARCHAR)
@@ -601,7 +602,7 @@ bool wxDb::determineDataTypes(bool failOnDataTypeUnsupported)
     // to for the purpose of determining which data type to use for the basic non-floating point
     // column types
     //
-    // NOTE: The first type in this enumeration that is determined to be supported by the 
+    // NOTE: The first type in this enumeration that is determined to be supported by the
     //       datasource/driver is the one that will be used.
     SWORD PossibleSqlIntegerTypes[] = {
         SQL_INTEGER
@@ -611,7 +612,7 @@ bool wxDb::determineDataTypes(bool failOnDataTypeUnsupported)
     // to for the purpose of determining which data type to use for the basic floating point number
     // column types
     //
-    // NOTE: The first type in this enumeration that is determined to be supported by the 
+    // NOTE: The first type in this enumeration that is determined to be supported by the
     //       datasource/driver is the one that will be used.
     SWORD PossibleSqlFloatTypes[] = {
         SQL_DOUBLE,
@@ -624,7 +625,7 @@ bool wxDb::determineDataTypes(bool failOnDataTypeUnsupported)
     // These are the possible SQL types we check for use agains the datasource we are connected
     // to for the purpose of determining which data type to use for the date/time column types
     //
-    // NOTE: The first type in this enumeration that is determined to be supported by the 
+    // NOTE: The first type in this enumeration that is determined to be supported by the
     //       datasource/driver is the one that will be used.
     SWORD PossibleSqlDateTypes[] = {
         SQL_TIMESTAMP,
@@ -637,7 +638,7 @@ bool wxDb::determineDataTypes(bool failOnDataTypeUnsupported)
     // These are the possible SQL types we check for use agains the datasource we are connected
     // to for the purpose of determining which data type to use for the BLOB column types.
     //
-    // NOTE: The first type in this enumeration that is determined to be supported by the 
+    // NOTE: The first type in this enumeration that is determined to be supported by the
     //       datasource/driver is the one that will be used.
     SWORD PossibleSqlBlobTypes[] = {
         SQL_LONGVARBINARY,
@@ -690,8 +691,8 @@ bool wxDb::determineDataTypes(bool failOnDataTypeUnsupported)
     if (!getDbInfo(failOnDataTypeUnsupported))
         return false;
 
-    // --------------- Varchar - (Variable length character string) --------------- 
-    for (iIndex = 0; iIndex < WXSIZEOF(PossibleSqlCharTypes) && 
+    // --------------- Varchar - (Variable length character string) ---------------
+    for (iIndex = 0; iIndex < WXSIZEOF(PossibleSqlCharTypes) &&
                      !getDataTypeInfo(PossibleSqlCharTypes[iIndex], typeInfVarchar); ++iIndex)
     {}
 
@@ -700,8 +701,8 @@ bool wxDb::determineDataTypes(bool failOnDataTypeUnsupported)
     else if (failOnDataTypeUnsupported)
         return false;
 
-    // --------------- Float --------------- 
-    for (iIndex = 0; iIndex < WXSIZEOF(PossibleSqlFloatTypes) && 
+    // --------------- Float ---------------
+    for (iIndex = 0; iIndex < WXSIZEOF(PossibleSqlFloatTypes) &&
                      !getDataTypeInfo(PossibleSqlFloatTypes[iIndex], typeInfFloat); ++iIndex)
     {}
 
@@ -711,7 +712,7 @@ bool wxDb::determineDataTypes(bool failOnDataTypeUnsupported)
         return false;
 
     // --------------- Integer -------------
-    for (iIndex = 0; iIndex < WXSIZEOF(PossibleSqlIntegerTypes) && 
+    for (iIndex = 0; iIndex < WXSIZEOF(PossibleSqlIntegerTypes) &&
                      !getDataTypeInfo(PossibleSqlIntegerTypes[iIndex], typeInfInteger); ++iIndex)
     {}
 
@@ -730,8 +731,8 @@ bool wxDb::determineDataTypes(bool failOnDataTypeUnsupported)
             typeInfInteger.FsqlType = typeInfFloat.FsqlType;
     }
 
-    // --------------- Date/Time --------------- 
-    for (iIndex = 0; iIndex < WXSIZEOF(PossibleSqlDateTypes) && 
+    // --------------- Date/Time ---------------
+    for (iIndex = 0; iIndex < WXSIZEOF(PossibleSqlDateTypes) &&
                      !getDataTypeInfo(PossibleSqlDateTypes[iIndex], typeInfDate); ++iIndex)
     {}
 
@@ -740,8 +741,8 @@ bool wxDb::determineDataTypes(bool failOnDataTypeUnsupported)
     else if (failOnDataTypeUnsupported)
         return false;
 
-    // --------------- BLOB --------------- 
-    for (iIndex = 0; iIndex < WXSIZEOF(PossibleSqlBlobTypes) && 
+    // --------------- BLOB ---------------
+    for (iIndex = 0; iIndex < WXSIZEOF(PossibleSqlBlobTypes) &&
                      !getDataTypeInfo(PossibleSqlBlobTypes[iIndex], typeInfBlob); ++iIndex)
     {}
 
@@ -2271,6 +2272,8 @@ bool wxDb::ExecSql(const wxString &pSqlStmt, wxDbColInf** columns, short& numcol
 
         switch (Sdword)
         {
+            case SQL_WCHAR:
+            case SQL_WVARCHAR:
             case SQL_VARCHAR:
             case SQL_CHAR:
                 pColInf[colNum].dbDataType = DB_DATA_TYPE_VARCHAR;
@@ -3046,6 +3049,8 @@ wxDbColInf *wxDb::GetColumns(const wxString &tableName, int *numCols, const wxCh
                     // Get the intern datatype
                     switch (colInf[colNo].sqlDataType)
                     {
+                        case SQL_WCHAR:
+                        case SQL_WVARCHAR:
                         case SQL_VARCHAR:
                         case SQL_CHAR:
                             colInf[colNo].dbDataType = DB_DATA_TYPE_VARCHAR;