From: George Tasker Date: Fri, 24 Nov 2000 16:47:45 +0000 (+0000) Subject: Added wxDbTable::SetOrderByColNums() function X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/38cfbffa153c8835025b4207faaf0a12b0b53e6f Added wxDbTable::SetOrderByColNums() function git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@8804 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/common/dbtable.cpp b/src/common/dbtable.cpp index e190a7b17a..de3b913141 100644 --- a/src/common/dbtable.cpp +++ b/src/common/dbtable.cpp @@ -1441,6 +1441,42 @@ bool wxDbTable::DropIndex(const char * idxName) } // wxDbTable::DropIndex() +/********** wxDbTable::SetOrderByColNums() **********/ +bool wxDbTable::SetOrderByColNums(int first, ... ) +{ + int colNo = first; + va_list argptr; + + bool abort = FALSE; + wxString tempStr; + + va_start(argptr, first); /* Initialize variable arguments. */ + while (!abort && (colNo != wxDB_NO_MORE_COLUMN_NUMBERS)) + { + // Make sure the passed in column number + // is within the valid range of columns + // + // Valid columns are 0 thru noCols-1 + if (colNo >= noCols || colNo < 0) + { + abort = TRUE; + continue; + } + + if (colNo != first) + tempStr += ","; + + tempStr += colDefs[colNo].ColName; + colNo = va_arg (argptr, int); + } + va_end (argptr); /* Reset variable arguments. */ + + SetOrderByClause(tempStr.c_str()); + + return (!abort); +} // wxDbTable::SetOrderByColNums() + + /********** wxDbTable::Insert() **********/ int wxDbTable::Insert(void) { @@ -1830,6 +1866,9 @@ bool wxDbTable::IsColNull(int colNo) /********** wxDbTable::CanSelectForUpdate() **********/ bool wxDbTable::CanSelectForUpdate(void) { + if (queryOnly) + return FALSE; + if (pDb->Dbms() == dbmsMY_SQL) return FALSE;