]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/dbtable.cpp
fixed typo
[wxWidgets.git] / src / common / dbtable.cpp
index 03cedf85f3200501661b5c330f1b01206af6e9e8..ce60d096dcc3dddef1c69486ac7770c4741c8fd7 100644 (file)
@@ -8,16 +8,7 @@
 // Created:     9.96
 // RCS-ID:      $Id$
 // Copyright:   (c) 1996 Remstar International, Inc.
-// Licence:     wxWindows licence, plus:
-// Notice:      This class library and its intellectual design are free of charge for use,
-//              modification, enhancement, debugging under the following conditions:
-//              1) These classes may only be used as part of the implementation of a
-//                 wxWindows-based application
-//              2) All enhancements and bug fixes are to be submitted back to the wxWindows
-//                 user groups free of all charges for use with the wxWindows library.
-//              3) These classes may not be distributed as part of any other class library,
-//                 DLL, text (written or electronic), other than a complete distribution of
-//                 the wxWindows GUI development toolkit.
+// Licence:     wxWindows licence
 ///////////////////////////////////////////////////////////////////////////////
 
 /*
@@ -321,18 +312,17 @@ void wxDbTable::cleanup()
 #ifdef __WXDEBUG__
     if (tableID)
     {
-        TablesInUse.DeleteContents(TRUE);
         bool found = FALSE;
 
-        wxNode *pNode;
+        wxList::compatibility_iterator pNode;
         pNode = TablesInUse.GetFirst();
         while (pNode && !found)
         {
             if (((wxTablesInUse *)pNode->GetData())->tableID == tableID)
             {
                 found = TRUE;
-                if (!TablesInUse.DeleteNode(pNode))
-                    wxLogDebug (s,wxT("Unable to delete node!"));
+                delete (wxTablesInUse *)pNode->GetData();
+                TablesInUse.Erase(pNode);
             }
             else
                 pNode = pNode->GetNext();
@@ -443,7 +433,7 @@ void wxDbTable::setCbValueForColumn(int columnIndex)
                 colDefs[columnIndex].CbValue = SQL_NULL_DATA;
             else
                 if (colDefs[columnIndex].SqlCtype == SQL_C_CHAR)
-                    colDefs[columnIndex].CbValue = SQL_LEN_DATA_AT_EXEC(0);
+                    colDefs[columnIndex].CbValue = SQL_NTS;
                 else
                     colDefs[columnIndex].CbValue = SQL_LEN_DATA_AT_EXEC(colDefs[columnIndex].SzDataObj);
             break;
@@ -1071,7 +1061,7 @@ void wxDbTable::BuildSelectStmt(wxString &pSqlStmt, int typeOfSelect, bool disti
     {
         tStr = colDefs[i].ColName;
         // If joining tables, the base table column names must be qualified to avoid ambiguity
-        if ((appendFromClause || pDb->Dbms() == dbmsACCESS) && !tStr.Find(wxT('.')))
+        if ((appendFromClause || pDb->Dbms() == dbmsACCESS) && tStr.Find(wxT('.')) == wxNOT_FOUND)
         {
             pSqlStmt += pDb->SQLTableName(queryTableName.c_str());
             pSqlStmt += wxT(".");
@@ -1284,7 +1274,7 @@ void wxDbTable::BuildWhereClause(wxString &pWhereClause, int typeOfWhere,
             // Concatenate where phrase for the column
             wxString tStr = colDefs[colNo].ColName;
 
-            if (qualTableName.Length() && !tStr.Find(wxT('.')))
+            if (qualTableName.Length() && tStr.Find(wxT('.')) == wxNOT_FOUND)
             {
                 pWhereClause += pDb->SQLTableName(qualTableName);
                 pWhereClause += wxT(".");
@@ -1326,7 +1316,7 @@ void wxDbTable::BuildWhereClause(wxString &pWhereClause, int typeOfWhere,
                         wxString strMsg;
                         strMsg.Printf(wxT("wxDbTable::bindParams(): Unknown column type for colDefs %d colName %s"),
                                     colNo,colDefs[colNo].ColName);
-                        wxFAIL_MSG(wxT(strMsg));
+                        wxFAIL_MSG(strMsg.c_str());
                     }
                     break;
             }
@@ -1946,6 +1936,14 @@ int wxDbTable::Insert(void)
                 }
             }
             retcode = SQLParamData(hstmtInsert, &pParmID);
+            if (retcode != SQL_SUCCESS &&
+                retcode != SQL_SUCCESS_WITH_INFO)
+            {
+                // record was not inserted
+                pDb->DispNextError();
+                pDb->DispAllErrors(henv, hdbc, hstmtInsert);
+                return(DB_FAILURE);
+            }
         }
     }