]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/dbtable.cpp
Hopefully fixed library names generated by wx-config for OS/2's PM port.
[wxWidgets.git] / src / common / dbtable.cpp
index 65e863bcc031e4671ef3789f3bbc9f3fa9052f2f..d5f848518bd079e3ff3db7b34c3e59c8cd5cd1ae 100644 (file)
@@ -755,7 +755,6 @@ bool wxDbTable::Open(bool checkPrivileges, bool checkTableExists)
     int i;
     wxString sqlStmt;
     wxString s;
     int i;
     wxString sqlStmt;
     wxString s;
-//    int NumKeyCols=0;
 
     // Calculate the maximum size of the concatenated
     // keys for use with wxDbGrid
 
     // Calculate the maximum size of the concatenated
     // keys for use with wxDbGrid
@@ -764,7 +763,6 @@ bool wxDbTable::Open(bool checkPrivileges, bool checkTableExists)
     {
         if (colDefs[i].KeyField)
         {
     {
         if (colDefs[i].KeyField)
         {
-//            NumKeyCols++;
             m_keysize += colDefs[i].SzDataObj;
         }
     }
             m_keysize += colDefs[i].SzDataObj;
         }
     }
@@ -792,7 +790,8 @@ bool wxDbTable::Open(bool checkPrivileges, bool checkTableExists)
     else if (checkPrivileges)
     {
         // Verify the user has rights to access the table.
     else if (checkPrivileges)
     {
         // Verify the user has rights to access the table.
-        bool hasPrivs = true;
+        bool hasPrivs wxDUMMY_INITIALIZE(true);
+
         if (pDb->Dbms() == dbmsPOSTGRES)
             hasPrivs = pDb->TablePrivileges(tableName, wxT("SELECT"), pDb->GetUsername(), NULL, tablePath);
         else
         if (pDb->Dbms() == dbmsPOSTGRES)
             hasPrivs = pDb->TablePrivileges(tableName, wxT("SELECT"), pDb->GetUsername(), NULL, tablePath);
         else
@@ -802,11 +801,11 @@ bool wxDbTable::Open(bool checkPrivileges, bool checkTableExists)
             s = wxT("Connecting user does not have sufficient privileges to access this table.\n");
     }
 
             s = wxT("Connecting user does not have sufficient privileges to access this table.\n");
     }
 
-    if (!s.IsEmpty())
+    if (!s.empty())
     {
         wxString p;
 
     {
         wxString p;
 
-        if (!tablePath.IsEmpty())
+        if (!tablePath.empty())
             p.Printf(wxT("Error opening '%s/%s'.\n"),tablePath.c_str(),tableName.c_str());
         else
             p.Printf(wxT("Error opening '%s'.\n"), tableName.c_str());
             p.Printf(wxT("Error opening '%s/%s'.\n"),tablePath.c_str(),tableName.c_str());
         else
             p.Printf(wxT("Error opening '%s'.\n"), tableName.c_str());
@@ -851,7 +850,6 @@ bool wxDbTable::Open(bool checkPrivileges, bool checkTableExists)
             if (needComma)
                 sqlStmt += wxT(",");
             sqlStmt += pDb->SQLColumnName(colDefs[i].ColName);
             if (needComma)
                 sqlStmt += wxT(",");
             sqlStmt += pDb->SQLColumnName(colDefs[i].ColName);
-//            sqlStmt += colDefs[i].ColName;
             needComma = true;
         }
         needComma = false;
             needComma = true;
         }
         needComma = false;
@@ -1102,7 +1100,6 @@ void wxDbTable::BuildSelectStmt(wxString &pSqlStmt, int typeOfSelect, bool disti
         {
             pSqlStmt += wxT(",");
             pSqlStmt += pDb->SQLTableName(queryTableName);
         {
             pSqlStmt += wxT(",");
             pSqlStmt += pDb->SQLTableName(queryTableName);
-//            pSqlStmt += queryTableName;
             pSqlStmt += wxT(".ROWID");
         }
         else
             pSqlStmt += wxT(".ROWID");
         }
         else
@@ -1311,9 +1308,9 @@ void wxDbTable::BuildWhereClause(wxString &pWhereClause, int typeOfWhere,
             switch(colDefs[colNumber].SqlCtype)
             {
                 case SQL_C_CHAR:
             switch(colDefs[colNumber].SqlCtype)
             {
                 case SQL_C_CHAR:
-#ifndef __UNIX__
+#ifdef SQL_C_WCHAR
                 case SQL_C_WCHAR:
                 case SQL_C_WCHAR:
-#endif                 
+#endif
                 //case SQL_C_WXCHAR:  SQL_C_WXCHAR is covered by either SQL_C_CHAR or SQL_C_WCHAR
                     colValue.Printf(wxT("'%s'"), (UCHAR FAR *) colDefs[colNumber].PtrDataObj);
                     break;
                 //case SQL_C_WXCHAR:  SQL_C_WXCHAR is covered by either SQL_C_CHAR or SQL_C_WCHAR
                     colValue.Printf(wxT("'%s'"), (UCHAR FAR *) colDefs[colNumber].PtrDataObj);
                     break;
@@ -1856,6 +1853,7 @@ bool wxDbTable::DropIndex(const wxString &indexName)
                   (pDb->Dbms() == dbmsSYBASE_ASE    && !wxStrcmp(pDb->sqlState,wxT("37000"))) ||
                   (pDb->Dbms() == dbmsMS_SQL_SERVER && !wxStrcmp(pDb->sqlState,wxT("S1000"))) ||
                   (pDb->Dbms() == dbmsINTERBASE     && !wxStrcmp(pDb->sqlState,wxT("S1000"))) ||
                   (pDb->Dbms() == dbmsSYBASE_ASE    && !wxStrcmp(pDb->sqlState,wxT("37000"))) ||
                   (pDb->Dbms() == dbmsMS_SQL_SERVER && !wxStrcmp(pDb->sqlState,wxT("S1000"))) ||
                   (pDb->Dbms() == dbmsINTERBASE     && !wxStrcmp(pDb->sqlState,wxT("S1000"))) ||
+                  (pDb->Dbms() == dbmsMAXDB         && !wxStrcmp(pDb->sqlState,wxT("S1000"))) ||
                   (pDb->Dbms() == dbmsFIREBIRD      && !wxStrcmp(pDb->sqlState,wxT("HY000"))) ||
                   (pDb->Dbms() == dbmsSYBASE_ASE    && !wxStrcmp(pDb->sqlState,wxT("S0002"))) ||  // Base table not found
                   (pDb->Dbms() == dbmsMY_SQL        && !wxStrcmp(pDb->sqlState,wxT("42S12"))) ||  // tested by Christopher Ludwik Marino-Cebulski using v3.23.21beta
                   (pDb->Dbms() == dbmsFIREBIRD      && !wxStrcmp(pDb->sqlState,wxT("HY000"))) ||
                   (pDb->Dbms() == dbmsSYBASE_ASE    && !wxStrcmp(pDb->sqlState,wxT("S0002"))) ||  // Base table not found
                   (pDb->Dbms() == dbmsMY_SQL        && !wxStrcmp(pDb->sqlState,wxT("42S12"))) ||  // tested by Christopher Ludwik Marino-Cebulski using v3.23.21beta
@@ -2204,7 +2202,7 @@ void wxDbTable::ClearMemberVar(UWORD colNumber, bool setToNull)
     switch(colDefs[colNumber].SqlCtype)
     {
         case SQL_C_CHAR:
     switch(colDefs[colNumber].SqlCtype)
     {
         case SQL_C_CHAR:
-#ifndef __UNIX__
+#ifdef SQL_C_WCHAR
         case SQL_C_WCHAR:
 #endif
         //case SQL_C_WXCHAR:  SQL_C_WXCHAR is covered by either SQL_C_CHAR or SQL_C_WCHAR
         case SQL_C_WCHAR:
 #endif
         //case SQL_C_WXCHAR:  SQL_C_WXCHAR is covered by either SQL_C_CHAR or SQL_C_WCHAR
@@ -2713,8 +2711,14 @@ wxVariant wxDbTable::GetColumn(const int colNumber) const
     {
         switch (colDefs[colNumber].SqlCtype)
         {
     {
         switch (colDefs[colNumber].SqlCtype)
         {
+#if wxUSE_UNICODE
+    #if defined(SQL_WCHAR)
             case SQL_WCHAR:
             case SQL_WCHAR:
+    #endif
+    #if defined(SQL_WVARCHAR)
             case SQL_WVARCHAR:
             case SQL_WVARCHAR:
+    #endif
+#endif
             case SQL_CHAR:
             case SQL_VARCHAR:
                 val = (wxChar *)(colDefs[colNumber].PtrDataObj);
             case SQL_CHAR:
             case SQL_VARCHAR:
                 val = (wxChar *)(colDefs[colNumber].PtrDataObj);
@@ -2779,8 +2783,14 @@ void wxDbTable::SetColumn(const int colNumber, const wxVariant val)
 
         switch (colDefs[colNumber].SqlCtype)
         {
 
         switch (colDefs[colNumber].SqlCtype)
         {
+#if wxUSE_UNICODE
+    #if defined(SQL_WCHAR)
             case SQL_WCHAR:
             case SQL_WCHAR:
+    #endif
+    #if defined(SQL_WVARCHAR)
             case SQL_WVARCHAR:
             case SQL_WVARCHAR:
+    #endif
+#endif
             case SQL_CHAR:
             case SQL_VARCHAR:
                 csstrncpyt((wxChar *)(colDefs[colNumber].PtrDataObj),
             case SQL_CHAR:
             case SQL_VARCHAR:
                 csstrncpyt((wxChar *)(colDefs[colNumber].PtrDataObj),