]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/dbtable.cpp
test for timegm() added
[wxWidgets.git] / src / common / dbtable.cpp
index 1e603781ed48ca660a30dc371be2d4149be4d4cd..edf1a0ce1ca4f4d9075de72b05e942ddeb7b89b6 100644 (file)
@@ -461,31 +461,31 @@ bool wxTable::getRec(UWORD fetchType)
 {
        RETCODE retcode;
 
-#if !wxODBC_FWD_ONLY_CURSORS
-
-       // Fetch the NEXT, PREV, FIRST or LAST record, depending on fetchType
-       UDWORD  cRowsFetched;
-       UWORD   rowStatus;
-
-//     if ((retcode = SQLExtendedFetch(hstmt, fetchType, 0, &cRowsFetched, &rowStatus)) != SQL_SUCCESS)
-   retcode = SQLExtendedFetch(hstmt, fetchType, 0, &cRowsFetched, &rowStatus);
-   if (retcode  != SQL_SUCCESS && retcode != SQL_SUCCESS_WITH_INFO)
-               if (retcode == SQL_NO_DATA_FOUND)
-                       return(FALSE);
-               else
-                       return(pDb->DispAllErrors(henv, hdbc, hstmt));
-#else
+       if (!pDb->FwdOnlyCursors())
+       {
+               // Fetch the NEXT, PREV, FIRST or LAST record, depending on fetchType
+               UDWORD  cRowsFetched;
+               UWORD   rowStatus;
 
-       // Fetch the next record from the record set
-       retcode = SQLFetch(hstmt);
-       if (retcode != SQL_SUCCESS && retcode != SQL_SUCCESS_WITH_INFO)
+               retcode = SQLExtendedFetch(hstmt, fetchType, 0, &cRowsFetched, &rowStatus);
+               if (retcode  != SQL_SUCCESS && retcode != SQL_SUCCESS_WITH_INFO)
+                       if (retcode == SQL_NO_DATA_FOUND)
+                               return(FALSE);
+                       else
+                               return(pDb->DispAllErrors(henv, hdbc, hstmt));
+       }
+       else
        {
-               if (retcode == SQL_NO_DATA_FOUND)
-                       return(FALSE);
-               else
-                       return(pDb->DispAllErrors(henv, hdbc, hstmt));
+               // Fetch the next record from the record set
+               retcode = SQLFetch(hstmt);
+               if (retcode != SQL_SUCCESS && retcode != SQL_SUCCESS_WITH_INFO)
+               {
+                       if (retcode == SQL_NO_DATA_FOUND)
+                               return(FALSE);
+                       else
+                               return(pDb->DispAllErrors(henv, hdbc, hstmt));
+               }
        }
-#endif
 
        // Completed successfully
        return(TRUE);
@@ -660,6 +660,54 @@ bool wxTable::QueryOnKeyFields(bool forUpdate, bool distinct)
 
 }  // wxTable::QueryOnKeyFields()
 
+/********** wxTable::GetPrev() **********/
+bool wxTable::GetPrev(void)
+{
+       if (pDb->FwdOnlyCursors())
+       {
+               wxFAIL_MSG(wxT("GetPrev()::Backward scrolling cursors are not enabled for this instance of wxTable"));
+               return FALSE;
+       }
+       else
+               return(getRec(SQL_FETCH_PRIOR));
+}  // wxTable::GetPrev()
+
+/********** wxTable::operator-- **********/
+bool wxTable::operator--(int)
+{
+       if (pDb->FwdOnlyCursors())
+       {
+               wxFAIL_MSG(wxT("operator--:Backward scrolling cursors are not enabled for this instance of wxTable"));
+               return FALSE;
+       }
+       else
+               return(getRec(SQL_FETCH_PRIOR));
+}  // wxTable::operator--
+
+/********** wxTable::GetFirst() **********/
+bool wxTable::GetFirst(void)
+{
+       if (pDb->FwdOnlyCursors())
+       {
+               wxFAIL_MSG(wxT("GetFirst():Backward scrolling cursors are not enabled for this instance of wxTable"));
+               return FALSE;
+       }
+       else
+               return(getRec(SQL_FETCH_FIRST));
+}  // wxTable::GetFirst()
+
+/********** wxTable::GetLast() **********/
+bool wxTable::GetLast(void)
+{
+       if (pDb->FwdOnlyCursors())
+       {
+               wxFAIL_MSG(wxT("GetLast()::Backward scrolling cursors are not enabled for this instance of wxTable"));
+               return FALSE;
+       }
+       else 
+               return(getRec(SQL_FETCH_LAST));
+}  // wxTable::GetLast()
+
 /********** wxTable::GetSelectStmt() **********/
 void wxTable::GetSelectStmt(char *pSqlStmt, int typeOfSelect, bool distinct)
 {