List:Commits« Previous MessageNext Message »
From:ahristov Date:May 3 2007 2:53pm
Subject:Connector/ODBC 5 commit: r902 - trunk/SDK/MYSQLPlus/Library
View as plain text  
Modified:
   trunk/SDK/MYSQLPlus/Library/MResult.cpp
Log:
Simplify code.

Shorten some comments to fit on 1280x1024


Modified: trunk/SDK/MYSQLPlus/Library/MResult.cpp
===================================================================
--- trunk/SDK/MYSQLPlus/Library/MResult.cpp	2007-05-03 01:06:18 UTC (rev 901)
+++ trunk/SDK/MYSQLPlus/Library/MResult.cpp	2007-05-03 14:53:47 UTC (rev 902)
@@ -96,22 +96,23 @@
     DBUG_ENTER("MResult::MResult");
 
     bResultSetRowsKnown = false;
-    nBuffered           = BUFFERED_UNBUFFERED;              // no ResultSet buffering 
-    nConcurrency        = SQL_CONCUR_READ_ONLY;             // ReadOnly ResultSet
-    nCursorScrollable   = SQL_NONSCROLLABLE;                // doNext is only viable
cursor operation
-    nCursorSensitivity  = SQL_UNSPECIFIED;                  // we do not share changes to
ResultSet enthusiastically
-    nCursorType         = SQL_CURSOR_FORWARD_ONLY;          // Cursor can only scroll
forward
-    nKeySetSize         = 0;                                // cache keys for all rows
-    nMaxLength          = 0;                                // get all column data for
large data types
-    nMaxRows            = 0;                                // get all rows for resultset
-    nResultSetRow       = 0;                                // before 1st row 
-    nResultSetRows      = 0;                                // no rows in ResultSet
-    nRowsAffected       = 0;                                // no rows affected
-    nRowSetRow          = 1;                                // First row in RowSet (we
must always be 1 - RowSetSize and pref. 1 - RowSetRows).
-    nRowSetRows         = 0;                                // no valid rows
-    nRowSetSize         = 1;                                // single row cursor
-    nState              = STATE_UNINITIALIZED;              // our state
-    nSimulateCursor     = SQL_SC_TRY_UNIQUE;       // we try to ensure pos update/delete
affects 1 row but in case of no unique row id - we may affect more than 1 row 
+    nBuffered           = BUFFERED_UNBUFFERED;     // no ResultSet buffering 
+    nConcurrency        = SQL_CONCUR_READ_ONLY;    // ReadOnly ResultSet
+    nCursorScrollable   = SQL_NONSCROLLABLE;       // doNext is only viable cursor
operation
+    nCursorSensitivity  = SQL_UNSPECIFIED;         // we do not share changes to
ResultSet enthusiastically
+    nCursorType         = SQL_CURSOR_FORWARD_ONLY; // Cursor can only scroll forward
+    nKeySetSize         = 0;                       // cache keys for all rows
+    nMaxLength          = 0;                       // get all column data for large data
types
+    nMaxRows            = 0;                       // get all rows for resultset
+    nResultSetRow       = 0;                       // before 1st row 
+    nResultSetRows      = 0;                       // no rows in ResultSet
+    nRowsAffected       = 0;                       // no rows affected
+    nRowSetRow          = 1;                       // First row in RowSet (we must always
be 1 - RowSetSize and pref. 1 - RowSetRows).
+    nRowSetRows         = 0;                       // no valid rows
+    nRowSetSize         = 1;                       // single row cursor
+    nState              = STATE_UNINITIALIZED;     // our state
+    nSimulateCursor     = SQL_SC_TRY_UNIQUE;       // we try to ensure pos update/delete
affects 1 row but in case
+                                                   // of no unique row id - we may affect
more than 1 row 
     vectorStatus.resize(nRowSetSize);
 
     /*!
@@ -134,7 +135,8 @@
 SQLRETURN MResult::doPutData(SQLPOINTER, SQLINTEGER)
 {
     DBUG_ENTER("MResult::doPutData");
-    DBUG_RETURN(getDiagnostic()->doAppend(MDiagnostic::STATE_HY000, 0,
QObject::tr("Call unsupported for this result class.")));
+    DBUG_RETURN(getDiagnostic()->doAppend(MDiagnostic::STATE_HY000, 0,
+                                          QObject::tr("Call unsupported for this result
class.")));
 }
 
 /*!
@@ -181,8 +183,10 @@
     /*!
         \internal ODBC RULE
 
-        ...points to a buffer in which to return the number of rows fetched after a call
to SQLFetch or SQLFetchScroll; the number of rows affected 
-        by a bulk operation performed by a call to SQLSetPos with an Operation argument
of SQL_REFRESH; or the number of rows affected by a bulk 
+        ...points to a buffer in which to return the number of rows fetched
+        after a call to SQLFetch or SQLFetchScroll; the number of rows affected 
+        by a bulk operation performed by a call to SQLSetPos with an Operation
+        argument of SQL_REFRESH; or the number of rows affected by a bulk 
         operation performed by SQLBulkOperations. This number includes error rows.
     */
     if (pDescriptor->getRowsProcessedPtr())
@@ -244,7 +248,9 @@
 SQLRETURN MResult::doExecute()
 {
     DBUG_ENTER("MResult::doExecute");
-    DBUG_RETURN(getDiagnostic()->doAppend(MDiagnostic::STATE_HY000, 0,
QString(QObject::tr("Call is unsupported in this result class
(%1).")).arg(objectName())));
+    DBUG_RETURN(getDiagnostic()->doAppend(MDiagnostic::STATE_HY000, 0,
+                                          QString(QObject::tr("Call is unsupported in
this result class (%1).")).
+                                            arg(objectName())));
 }
 
 /*!
@@ -291,12 +297,12 @@
 
         No result rows then always return SQL_NO_DATA.
     */
-    if (!getResultSetRows())
+    if (!nResultSetRows)
         DBUG_RETURN(setBeforeStart());
 
     nResultSetRow = 1;
     nRowSetRow    = 1;
-    setRowSetRows(min((qulonglong)nRowSetSize, getResultSetRows()));
+    setRowSetRows(min((qulonglong)nRowSetSize, nResultSetRows));
 
     if (bRefresh)
         DBUG_RETURN(doRefresh());
@@ -349,43 +355,41 @@
 
         No result rows then always return SQL_NO_DATA.
     */
-    if (!getResultSetRows())
+    if (!nResultSetRows)
         DBUG_RETURN(setAfterEnd());
 
     /*!
         \internal ODBC RULE
 
-       
+---------------------------------------------------------------+-----------------------------------+
-        | Condition                                                     | First row of
new RowSet           |
-       
+---------------------------------------------------------------+-----------------------------------+
-        | RowsetSize [1] <= LastResultRow                               |
LastResultRow   RowsetSize + 1[1] |    
-       
+---------------------------------------------------------------+-----------------------------------+
+        +---------------------------------+-----------------------------------+
+        | Condition                       | First row of new RowSet           |
+        +---------------------------------+-----------------------------------+
+        | RowsetSize [1] <= LastResultRow | LastResultRow   RowsetSize + 1[1] |    
+        +---------------------------------+-----------------------------------+
     */
-    if (nRowSetSize <= getResultSetRows())
+    if (nRowSetSize <= nResultSetRows)
     {
-        nResultSetRow = getResultSetRows() - nRowSetSize + 1;
+        nResultSetRow = nResultSetRows - nRowSetSize + 1;
         nRowSetRow    = 1;
         setRowSetRows(nRowSetSize);
 
         if (bRefresh)
             DBUG_RETURN(doRefresh());
-
-        DBUG_RETURN(SQL_SUCCESS);
     }
-    else if (nRowSetSize > getResultSetRows())
+    else if (nRowSetSize > nResultSetRows)
     {
         /*!
             \internal ODBC RULE
 
-           
+---------------------------------------------------------------+-----------------------------------+
-            | Condition                                                     | First row
of new RowSet           |
-           
+---------------------------------------------------------------+-----------------------------------+
-            | RowsetSize [1] > LastResultRow                                | 1       
                         |
-           
+---------------------------------------------------------------+-----------------------------------+
+            +--------------------------------+--------------------------+
+            | Condition                      | First row of new RowSet  |
+            +--------------------------------+--------------------------+
+            | RowsetSize [1] > LastResultRow | 1                        |
+            +--------------------------------+--------------------------+
         */
         nResultSetRow = 1;
         nRowSetRow    = 1;
-        setRowSetRows(getResultSetRows());
+        setRowSetRows(nResultSetRows);
 
         if (bRefresh)
             DBUG_RETURN(doRefresh());
@@ -435,7 +439,7 @@
 
         No result rows then always return SQL_NO_DATA.
     */
-    if (!getResultSetRows())
+    if (!nResultSetRows)
         DBUG_RETURN(setBeforeStart());
 
     /*!
@@ -451,7 +455,7 @@
     {
         nResultSetRow = 1;
         nRowSetRow    = 1;
-        setRowSetRows(min((qulonglong) nRowSetSize, getResultSetRows()));
+        setRowSetRows(min((qulonglong) nRowSetSize, nResultSetRows));
 
         if (bRefresh)
             DBUG_RETURN(doRefresh());
@@ -480,11 +484,14 @@
         | CurrRowsetStart + RowsetSize[1] <= LastResultRow | CurrRowsetStart +
RowsetSize[1] |
        
+--------------------------------------------------+---------------------------------+
     */
-    if (nResultSetRow + nRowSetSize <= getResultSetRows())
+    if (nResultSetRow + nRowSetSize <= nResultSetRows)
     {
         nResultSetRow  += nRowSetSize;
         nRowSetRow      = 1;
-        setRowSetRows(((getResultSetRows() - nResultSetRow + 1) >= nRowSetSize ?
nRowSetSize : getResultSetRows() - nResultSetRow + 1));
+        if ((nResultSetRows - nResultSetRow + 1) >= nRowSetSize)
+            setRowSetRows(nRowSetSize);
+        else
+            setRowSetRows(nResultSetRows - nResultSetRow + 1);
 
         if (bRefresh)
             DBUG_RETURN(doRefresh());
@@ -501,7 +508,7 @@
         | CurrRowsetStart + RowsetSize[1]> LastResultRow   | After end                
      |
        
+--------------------------------------------------+---------------------------------+
     */
-    if (nResultSetRow + nRowSetSize > getResultSetRows())
+    if (nResultSetRow + nRowSetSize > nResultSetRows)
         DBUG_RETURN(setAfterEnd());
 
     DBUG_RETURN(getDiagnostic()->doAppend(MDiagnostic::STATE_HY000, 0,
@@ -555,11 +562,11 @@
     /*!
         \internal ODBC RULE
 
-       
+--------------------------------------------------+---------------------------------+
-        | Condition                                        | First row of new RowSet     
   |
-       
+--------------------------------------------------+---------------------------------+
-        | Before start                                     | Before start                
   |
-       
+--------------------------------------------------+---------------------------------+
+        +-----------------------+-------------------------+
+        | Condition             | First row of new RowSet |
+        +-----------------------+-------------------------+
+        | Before start          | Before start            |
+        +-----------------------+-------------------------+
     */
     if (isBeforeStart())
         DBUG_RETURN(setBeforeStart()); // just to be sure all vars set
@@ -567,11 +574,11 @@
     /*!
         \internal ODBC RULE
 
-       
+--------------------------------------------------+---------------------------------+
-        | Condition                                        | First row of new RowSet     
   |
-       
+--------------------------------------------------+---------------------------------+
-        | CurrRowsetStart = 1                              | Before start                
   |
-       
+--------------------------------------------------+---------------------------------+
+        +---------------------------+-------------------------+
+        | Condition                 | First row of new RowSet |
+        +---------------------------+-------------------------+
+        | CurrRowsetStart = 1       | Before start            |
+        +---------------------------+-------------------------+
     */
     if (nResultSetRow == 1)
         DBUG_RETURN(setBeforeStart());
@@ -579,17 +586,20 @@
     /*!
         \internal ODBC RULE
 
-       
+--------------------------------------------------+---------------------------------+
-        | Condition                                        | First row of new RowSet     
   |
-       
+--------------------------------------------------+---------------------------------+
-        | 1 < CurrRowsetStart <= RowsetSize[2]             | 1[1]                  
         |
-       
+--------------------------------------------------+---------------------------------+
+        +---------------------------------------+-------------------------+
+        | Condition                             | First row of new RowSet |
+        +---------------------------------------+-------------------------+
+        | 1 < CurrRowsetStart <= RowsetSize[2]  | 1[1]                    |
+        +---------------------------------------+-------------------------+
     */
     if (1 < nResultSetRow && nResultSetRow <= nRowSetSize)
     {
-        nResultSetRow   = 1;
-        nRowSetRow      = 1;
-        setRowSetRows(((getResultSetRows() - nResultSetRow + 1) >= nRowSetSize ?
nRowSetSize : getResultSetRows() - nResultSetRow + 1));
+        nResultSetRow = 1;
+        nRowSetRow    = 1;
+        if ((nResultSetRows - nResultSetRow + 1) >= nRowSetSize)
+            setRowSetRows(nRowSetSize);
+        else
+            setRowSetRows(nResultSetRows - nResultSetRow + 1);
 
         if (bRefresh)
         {
@@ -604,11 +614,11 @@
     /*!
         \internal ODBC RULE
 
-       
+--------------------------------------------------+---------------------------------+
-        | Condition                                        | First row of new RowSet     
   |
-       
+--------------------------------------------------+---------------------------------+
-        | CurrRowsetStart > RowsetSize[2]                  | CurrRowsetStart  
RowsetSize[2] |
-       
+--------------------------------------------------+---------------------------------+
+        +----------------------------------+---------------------------------+
+        | Condition                        | First row of new RowSet         |
+        +----------------------------------+---------------------------------+
+        | CurrRowsetStart > RowsetSize[2]  | CurrRowsetStart   RowsetSize[2] |
+        +----------------------------------+---------------------------------+
     */
     if (nResultSetRow > nRowSetSize)
     {
@@ -625,17 +635,17 @@
     /*!
         \internal ODBC RULE
 
-       
+--------------------------------------------------+---------------------------------+
-        | Condition                                        | First row of new RowSet     
   |
-       
+--------------------------------------------------+---------------------------------+
-        | After end AND LastResultRow < RowsetSize[2]      | 1[1]                     
      |
-       
+--------------------------------------------------+---------------------------------+
+       
+-----------------------------------------------+---------------------------------+
+        | Condition                                     | First row of new RowSet        
|
+       
+-----------------------------------------------+---------------------------------+
+        | After end AND LastResultRow < RowsetSize[2]   | 1[1]                        
   |
+       
+-----------------------------------------------+---------------------------------+
     */
-    if (isAfterEnd() && getResultSetRows() < nRowSetSize)
+    if (isAfterEnd() && nResultSetRows < nRowSetSize)
     {
         nResultSetRow   = 1;
         nRowSetRow      = 1;
-        setRowSetRows(getResultSetRows() - nRowSetSize + 1);
+        setRowSetRows(nResultSetRows - nRowSetSize + 1);
 
         if (bRefresh)
         {
@@ -650,15 +660,15 @@
     /*!
         \internal ODBC RULE
 
-       
+--------------------------------------------------+-----------------------------------+
-        | Condition                                        | First row of new RowSet     
     |
-       
+--------------------------------------------------+-----------------------------------+
-        | After end AND LastResultRow >= RowsetSize[2]     | LastResultRow  
RowsetSize + 1[2] |
-       
+--------------------------------------------------+-----------------------------------+
+       
+-----------------------------------------------+-----------------------------------+
+        | Condition                                     | First row of new RowSet        
  |
+       
+-----------------------------------------------+-----------------------------------+
+        | After end AND LastResultRow >= RowsetSize[2]  | LastResultRow   RowsetSize +
1[2] |
+       
+-----------------------------------------------+-----------------------------------+
     */
-    if (isAfterEnd() && getResultSetRows() >= nRowSetSize)
+    if (isAfterEnd() && nResultSetRows >= nRowSetSize)
     {
-        nResultSetRow   = getResultSetRows() - nRowSetSize;
+        nResultSetRow   = nResultSetRows - nRowSetSize;
         nRowSetRow      = 1;
         setRowSetRows(nRowSetSize);
 
@@ -714,12 +724,12 @@
     /*!
         \internal ODBC RULE
 
-       
+--------------------------------------------------+-----------------------------------+
-        | Condition                                        | First row of new RowSet     
     |
-       
+--------------------------------------------------+-----------------------------------+
-        | (Before start AND FetchOffset > 0) OR            | as per SQL_FETCH_ABSOLUTE
        |
-        | (After end AND FetchOffset < 0)                  |                          
        |     
-       
+--------------------------------------------------+-----------------------------------+
+        +-----------------------------------------+---------------------------+
+        | Condition                               | First row of new RowSet   |
+        +-----------------------------------------+---------------------------+
+        | (Before start AND FetchOffset > 0) OR   | as per SQL_FETCH_ABSOLUTE |
+        | (After end AND FetchOffset < 0)         |                           |     
+        +-----------------------------------------+---------------------------+
     */
     if ((isBeforeStart() && nRows > 0) || (isAfterEnd() && nRows <
0))
         DBUG_RETURN(doGoto(nRows, bRefresh));
@@ -727,11 +737,11 @@
     /*!
         \internal ODBC RULE
 
-       
+--------------------------------------------------+-----------------------------------+
-        | Condition                                        | First row of new RowSet     
     |
-       
+--------------------------------------------------+-----------------------------------+
-        | BeforeStart AND FetchOffset <= 0                 | Before start             
        |
-       
+--------------------------------------------------+-----------------------------------+
+        +-----------------------------------------+-------------------------+
+        | Condition                               | First row of new RowSet |
+        +-----------------------------------------+-------------------------+
+        | BeforeStart AND FetchOffset <= 0        | Before start            |
+        +-----------------------------------------+-------------------------+
     */
     if (isBeforeStart() && nRows <= 0)
         DBUG_RETURN(setBeforeStart());
@@ -739,11 +749,11 @@
     /*!
         \internal ODBC RULE
 
-       
+--------------------------------------------------+-----------------------------------+
-        | Condition                                        | First row of new RowSet     
     |
-       
+--------------------------------------------------+-----------------------------------+
-        | CurrRowsetStart = 1 AND FetchOffset < 0          | Before start             
        |
-       
+--------------------------------------------------+-----------------------------------+
+        +-----------------------------------------+-------------------------+
+        | Condition                               | First row of new RowSet |
+        +-----------------------------------------+-------------------------+
+        | CurrRowsetStart = 1 AND FetchOffset < 0 | Before start            |
+        +-----------------------------------------+-------------------------+
     */
     if (nResultSetRow == 1 && nRows < 0)
         DBUG_RETURN(setBeforeStart());
@@ -751,12 +761,13 @@
     /*!
         \internal ODBC RULE
 
-       
+---------------------------------------------------------------+-----------------------------------+
-        | Condition                                                     | First row of
new RowSet           |
-       
+---------------------------------------------------------------+-----------------------------------+
-        | CurrRowsetStart > 1 AND CurrRowsetStart + FetchOffset < 1 AND | Before
start                      |
-        | FetchOffset > RowsetSize[3]                                   |             
                     |
-       
+---------------------------------------------------------------+-----------------------------------+
+        +-----------------------------------------+-------------------------+
+        | Condition                               | First row of new RowSet |
+        +-----------------------------------------+-------------------------+
+        | CurrRowsetStart > 1 AND                 | Before start            |
+        | CurrRowsetStart + FetchOffset < 1 AND   |                         |
+        | FetchOffset > RowsetSize[3]             |                         |
+        +-----------------------------------------+-------------------------+
     */
     if (nResultSetRow > 1 && nResultSetRow + nRows < 1 && abs((long
double)nRows) > nRowSetSize)
         DBUG_RETURN(setBeforeStart());
@@ -764,18 +775,22 @@
     /*!
         \internal ODBC RULE
 
-       
+---------------------------------------------------------------+-----------------------------------+
-        | Condition                                                     | First row of
new RowSet           |
-       
+---------------------------------------------------------------+-----------------------------------+
-        | CurrRowsetStart > 1 AND CurrRowsetStart + FetchOffset < 1 AND | 1[2]     
                        |
-        | FetchOffset <= RowsetSize[3]                                  |             
                     |
-       
+---------------------------------------------------------------+-----------------------------------+
+        +-----------------------------------------+-------------------------+
+        | Condition                               | First row of new RowSet |
+        +-----------------------------------------+-------------------------+
+        | CurrRowsetStart > 1 AND                 | 1[2]                    |
+        | CurrRowsetStart + FetchOffset < 1 AND   |                         |
+        | FetchOffset <= RowsetSize[3]            |                         |
+        +-----------------------------------------+-------------------------+
     */
     if (nResultSetRow > 1 && nResultSetRow + nRows < 1 && abs((long
double)nRows) <= nRowSetSize)
     {
         nResultSetRow   = 1;
         nRowSetRow      = 1;
-        setRowSetRows(((getResultSetRows() - nResultSetRow + 1) >= nRowSetSize ?
nRowSetSize : getResultSetRows() - nResultSetRow + 1));
+        if ((nResultSetRows - nResultSetRow + 1) >= nRowSetSize)
+            setRowSetRows(nRowSetSize);
+        else
+            setRowSetRows(nResultSetRows - nResultSetRow + 1);
 
         if (bRefresh)
         {
@@ -790,17 +805,20 @@
     /*!
         \internal ODBC RULE
 
-       
+---------------------------------------------------------------+-----------------------------------+
-        | Condition                                                     | First row of
new RowSet           |
-       
+---------------------------------------------------------------+-----------------------------------+
-        | 1 <= CurrRowsetStart + FetchOffset <= LastResultRow           |
CurrRowsetStart + FetchOffset     |
-       
+---------------------------------------------------------------+-----------------------------------+
+       
+------------------------------------------------------+-------------------------------+
+        | Condition                                            | First row of new RowSet 
     |
+       
+------------------------------------------------------+-------------------------------+
+        | 1 <= CurrRowsetStart + FetchOffset <= LastResultRow  | CurrRowsetStart +
FetchOffset |
+       
+------------------------------------------------------+-------------------------------+
     */
-    if (1 <= nResultSetRow + nRows && nResultSetRow + nRows <=
getResultSetRows())
+    if (1 <= nResultSetRow + nRows && nResultSetRow + nRows <=
nResultSetRows)
     {
         nResultSetRow  += nRows;
         nRowSetRow      = 1;
-        setRowSetRows(((getResultSetRows() - nResultSetRow + 1) >= nRowSetSize ?
nRowSetSize : getResultSetRows() - nResultSetRow + 1));
+        if ((nResultSetRows - nResultSetRow + 1) >= nRowSetSize)
+            setRowSetRows(nRowSetSize);
+        else
+            setRowSetRows(nResultSetRows - nResultSetRow + 1);
 
         if (bRefresh)
             DBUG_RETURN(doRefresh());
@@ -811,23 +829,23 @@
     /*!
         \internal ODBC RULE
 
-       
+---------------------------------------------------------------+-----------------------------------+
-        | Condition                                                     | First row of
new RowSet           |
-       
+---------------------------------------------------------------+-----------------------------------+
-        | CurrRowsetStart + FetchOffset > LastResultRow                 | After end   
                     |
-       
+---------------------------------------------------------------+-----------------------------------+
+        +------------------------------------------------+--------------------------+
+        | Condition                                      | First row of new RowSet  |
+        +------------------------------------------------+--------------------------+
+        | CurrRowsetStart + FetchOffset > LastResultRow  | After end                |
+        +------------------------------------------------+--------------------------+
     */
-    if (nResultSetRow + nRows > getResultSetRows())
+    if (nResultSetRow + nRows > nResultSetRows)
         DBUG_RETURN(setAfterEnd());
 
     /*!
         \internal ODBC RULE
 
-       
+---------------------------------------------------------------+-----------------------------------+
-        | Condition                                                     | First row of
new RowSet           |
-       
+---------------------------------------------------------------+-----------------------------------+
-        | After end AND FetchOffset >= 0                                | After end   
                     |
-       
+---------------------------------------------------------------+-----------------------------------+
+        +---------------------------------+-------------------------+
+        | Condition                       | First row of new RowSet |
+        +---------------------------------+-------------------------+
+        | After end AND FetchOffset >= 0  | After end               |
+        +---------------------------------+-------------------------+
     */
     if (isAfterEnd() && nRows >= 0)
         DBUG_RETURN(setAfterEnd());
@@ -882,18 +900,21 @@
     /*!
         \internal ODBC RULE
 
-       
+---------------------------------------------------------------+-----------------------------------+
-        | Condition                                                     | First row of
new RowSet           |
-       
+---------------------------------------------------------------+-----------------------------------+
-        | FetchOffset < 0 AND                                           |
LastResultRow + FetchOffset + 1   |
-        | FetchOffset <= LastResultRow                                  |             
                     |
-       
+---------------------------------------------------------------+-----------------------------------+
+        +-------------------------------------+---------------------------------+
+        | Condition                           | First row of new RowSet         |
+        +-------------------------------------+---------------------------------+
+        | FetchOffset < 0 AND                 | LastResultRow + FetchOffset + 1 |
+        | FetchOffset <= LastResultRow        |                                 |
+        +-------------------------------------+---------------------------------+
     */
-    if (nRow < 0 && abs((long double)nRow) <= getResultSetRows() )
+    if (nRow < 0 && abs((long double)nRow) <= nResultSetRows)
     {
         nResultSetRow  += nRow;
         nRowSetRow      = 1;
-        setRowSetRows(((getResultSetRows() - nResultSetRow + 1) >= nRowSetSize ?
nRowSetSize : getResultSetRows() - nResultSetRow + 1));
+        if ((nResultSetRows - nResultSetRow + 1) >= nRowSetSize)
+            setRowSetRows(nRowSetSize);
+        else
+            setRowSetRows(nResultSetRows - nResultSetRow + 1);
 
         if (bRefresh)
             DBUG_RETURN(doRefresh());
@@ -904,33 +925,36 @@
     /*!
         \internal ODBC RULE
 
-       
+---------------------------------------------------------------+-----------------------------------+
-        | Condition                                                     | First row of
new RowSet           |
-       
+---------------------------------------------------------------+-----------------------------------+
-        | FetchOffset < 0 AND                                           | Before start
                     |
-        | FetchOffset > LastResultRow AND                               |             
                     |
-        | FetchOffset > RowsetSize[2]                                   |             
                     |
-       
+---------------------------------------------------------------+-----------------------------------+
+        +-------------------------------------+--------------------------+
+        | Condition                           | First row of new RowSet  |
+        +-------------------------------------+--------------------------+
+        | FetchOffset < 0 AND                 | Before start             |
+        | FetchOffset > LastResultRow AND     |                          |
+        | FetchOffset > RowsetSize[2]         |                          |
+        +-------------------------------------+--------------------------+
     */
-    if (nRow < 0 && abs((long double)nRow) > getResultSetRows() &&
abs((long double)nRow) > nRowSetSize)
+    if (nRow < 0 && abs((long double)nRow) > nResultSetRows &&
abs((long double)nRow) > nRowSetSize)
         DBUG_RETURN(setBeforeStart());
 
     /*!
         \internal ODBC RULE
 
-       
+---------------------------------------------------------------+-----------------------------------+
-        | Condition                                                     | First row of
new RowSet           |
-       
+---------------------------------------------------------------+-----------------------------------+
-        | FetchOffset < 0 AND                                           | 1[1]        
                     |
-        | FetchOffset > LastResultRow AND                               |             
                     |
-        | FetchOffset <= RowsetSize[2]                                  |             
                     |
-       
+---------------------------------------------------------------+-----------------------------------+
+        +-------------------------------------+--------------------------+
+        | Condition                           | First row of new RowSet  |
+        +-------------------------------------+--------------------------+
+        | FetchOffset < 0 AND                 | 1[1]                     |
+        | FetchOffset > LastResultRow AND     |                          |
+        | FetchOffset <= RowsetSize[2]        |                          |
+        +-------------------------------------+--------------------------+
     */
-    if (nRow < 0 && abs((long double)nRow) > getResultSetRows() &&
abs((long double)nRow) <= nRowSetSize)
+    if (nRow < 0 && abs((long double)nRow) > nResultSetRows &&
abs((long double)nRow) <= nRowSetSize)
     {
         nResultSetRow   = 1;
         nRowSetRow      = 1;
-        setRowSetRows(((getResultSetRows() - nResultSetRow + 1) >= nRowSetSize ?
nRowSetSize : getResultSetRows() - nResultSetRow + 1));
+        if ((nResultSetRows - nResultSetRow + 1) >= nRowSetSize)
+            setRowSetRows(nRowSetSize);
+        else
+            setRowSetRows(nResultSetRows - nResultSetRow + 1);
 
         if (bRefresh)
         {
@@ -945,11 +969,11 @@
     /*!
         \internal ODBC RULE
 
-       
+---------------------------------------------------------------+-----------------------------------+
-        | Condition                                                     | First row of
new RowSet           |
-       
+---------------------------------------------------------------+-----------------------------------+
-        | FetchOffset = 0                                               | Before start   
                  |
-       
+---------------------------------------------------------------+-----------------------------------+
+        +-------------------+-------------------------+
+        | Condition         | First row of new RowSet |
+        +-------------------+-------------------------+
+        | FetchOffset = 0   | Before start            |
+        +-------------------+-------------------------+
     */
     if (nRow == 0)
         DBUG_RETURN(setBeforeStart());
@@ -957,17 +981,20 @@
     /*!
         \internal ODBC RULE
 
-       
+---------------------------------------------------------------+-----------------------------------+
-        | Condition                                                     | First row of
new RowSet           |
-       
+---------------------------------------------------------------+-----------------------------------+
-        | 1 <= FetchOffset <= LastResultRow                             |
FetchOffset                       |
-       
+---------------------------------------------------------------+-----------------------------------+
+        +------------------------------------+-------------------------+
+        | Condition                          | First row of new RowSet |
+        +------------------------------------+-------------------------+
+        | 1 <= FetchOffset <= LastResultRow  | FetchOffset             |
+        +------------------------------------+-------------------------+
     */
-    if (1 <= nRow && nRow <= getResultSetRows())
+    if (1 <= nRow && nRow <= nResultSetRows)
     {
         nResultSetRow   = nRow;
         nRowSetRow      = 1;
-        setRowSetRows(((getResultSetRows() - nResultSetRow + 1) >= nRowSetSize ?
nRowSetSize : getResultSetRows() - nResultSetRow + 1));        
+        if ((nResultSetRows - nResultSetRow + 1) >= nRowSetSize)
+            setRowSetRows(nRowSetSize);
+        else
+            setRowSetRows(nResultSetRows - nResultSetRow + 1);
 
         if (bRefresh)
             DBUG_RETURN(doRefresh());
@@ -978,11 +1005,11 @@
     /*!
         \internal ODBC RULE
 
-       
+---------------------------------------------------------------+-----------------------------------+
-        | Condition                                                     | First row of
new RowSet           |
-       
+---------------------------------------------------------------+-----------------------------------+
-        | FetchOffset > LastResultRow                                   | After end   
                     |
-       
+---------------------------------------------------------------+-----------------------------------+
+        +-------------------------------+--------------------------+
+        | Condition                     | First row of new RowSet  |
+        +-------------------------------+--------------------------+
+        | FetchOffset > LastResultRow   | After end                |
+        +-------------------------------+--------------------------+
     */
     if (nRow > nResultSetRow)
         DBUG_RETURN(setAfterEnd());
@@ -1162,7 +1189,7 @@
 /*  pDescriptorRecord->setconcise_type;                 - type specific     */
 /*  pDescriptorRecord->setdata_ptr;                     - N/A               */
 /*  pDescriptorRecord->setdatetime_interval_code;       - type specific     */
-    pDescriptorRecord->setDatetimeIntervalPrecision(10);       /* this is a
conservative guess - not sure what precision we get when we diff 2 times */
+    pDescriptorRecord->setDatetimeIntervalPrecision(10); /* this is a conservative
guess - not sure what precision we get when we diff 2 times */
     pDescriptorRecord->setDisplaySize(max_length);   /* - also type specific   */
     pDescriptorRecord->setFixedPrecScale(SQL_FALSE);            /* - also type
specific   */
 /*  pDescriptorRecord->setindicator_ptr;                - N/A               */
@@ -1604,12 +1631,12 @@
                 !(pnOctetLengthPtr || pnIndicatorPtr))
             {
                 SQLRETURN nReturn = MResult::getData(nRowsIndex,
-                                                      nColumn, 
-                                                     
pAppRowDescRec->getConciseType(), 
-                                                      pAppRowDescRec->getDataPtr(), 
-                                                      pAppRowDescRec->getLength(), 
-                                                      pnOctetLengthPtr, 
-                                                      pnIndicatorPtr);
+                                                     nColumn, 
+                                                     pAppRowDescRec->getConciseType(),

+                                                     pAppRowDescRec->getDataPtr(), 
+                                                     pAppRowDescRec->getLength(), 
+                                                     pnOctetLengthPtr, 
+                                                     pnIndicatorPtr);
                 if (nReturn != SQL_SUCCESS)
                     DBUG_RETURN(nReturn);
             }
@@ -1679,12 +1706,12 @@
                  (pnIndicatorPtr && *pnIndicatorPtr != SQL_COLUMN_IGNORE))
             {
                 SQLRETURN nReturn = MResult::getData(nRowsIndex,
-                                                      nColumn, 
-                                                     
pAppRowDescRec->getConciseType(), 
-                                                      pDataPtr, 
-                                                      pAppRowDescRec->getLength(), 
-                                                      pnOctetLengthPtr, 
-                                                      pnIndicatorPtr);
+                                                     nColumn, 
+                                                     pAppRowDescRec->getConciseType(),

+                                                     pDataPtr, 
+                                                     pAppRowDescRec->getLength(), 
+                                                     pnOctetLengthPtr, 
+                                                     pnIndicatorPtr);
                 switch (nReturn)
                 {
                     case SQL_SUCCESS_WITH_INFO:

Thread
Connector/ODBC 5 commit: r902 - trunk/SDK/MYSQLPlus/Libraryahristov3 May