MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:pharvey Date:September 18 2006 6:18pm
Subject:Connector/ODBC 5 commit: r550 - trunk/SDK/MYSQLPlus/Library
View as plain text  
Modified:
   trunk/SDK/MYSQLPlus/Library/MResultRes.cpp
Log:
- changes/additions for block-cursor support


Modified: trunk/SDK/MYSQLPlus/Library/MResultRes.cpp
===================================================================
--- trunk/SDK/MYSQLPlus/Library/MResultRes.cpp	2006-09-18 08:22:31 UTC (rev 549)
+++ trunk/SDK/MYSQLPlus/Library/MResultRes.cpp	2006-09-18 18:18:46 UTC (rev 550)
@@ -421,19 +421,19 @@
             MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::DIA_HY106 ) );
 
         case BUFFERED_MYSQL_PLUS:
-            // have we buffered everything yet?
             if ( !isResultSetRowsKnown() )
             {
-                // do we need to load more data into our buffered ResultSet?
                 if ( getResultSetRows() < getRowSetSize() )
                     nReturn1 = getRowSetData();
             }
             break;
 
         case BUFFERED_MYSQL_CLIENT:
-            mysql_data_seek( pRes, 0 );
-            // load RowSet
-            nReturn1 = getRowSetData();
+            if ( getResultSetRows() )
+            {
+                mysql_data_seek( pRes, 0 );
+                nReturn1 = getRowSetData();
+            }
             break;
 
         default:
@@ -450,9 +450,6 @@
 {
     MYODBCDbgEnter();
 
-    if ( getState() < STATE_EXECUTED )
-        MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::DIA_HY010 ) );
-
     SQLRETURN nReturn1 = SQL_SUCCESS;
 
     switch ( getBuffered() )
@@ -486,21 +483,19 @@
         case BUFFERED_MYSQL_CLIENT:
             if ( nRow > 0 )
             {
-                if ( nRow >= getResultSetRows() )
-                    MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::DIA_01S06
) );
-
-                mysql_data_seek( pRes, nRow );
-                // load RowSet
-                nReturn1 = getRowSetData();
+                if ( nRow < getResultSetRows() )
+                {
+                    mysql_data_seek( pRes, nRow );
+                    nReturn1 = getRowSetData();
+                }
             }
             else if ( nRow < 0 )
             {
-                if ( getResultSetRows() + nRow < 1 )
-                    MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::DIA_01S06
) );
-
-                mysql_data_seek( pRes, getResultSetRows() + nRow );
-                // load RowSet
-                nReturn1 = getRowSetData();
+                if ( getResultSetRows() + nRow > 0 )
+                {
+                    mysql_data_seek( pRes, getResultSetRows() + nRow );
+                    nReturn1 = getRowSetData();
+                }
             }
             break;
 
@@ -518,9 +513,6 @@
 {
     MYODBCDbgEnter();
 
-    if ( getState() < STATE_EXECUTED )
-        MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::DIA_HY010 ) );
-
     SQLRETURN nReturn1 = SQL_SUCCESS;
 
     switch ( getBuffered() )
@@ -529,7 +521,6 @@
             MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::DIA_HY106 ) );
 
         case BUFFERED_MYSQL_PLUS:
-            // have we buffered everything?
             while ( !isResultSetRowsKnown() )
             {
                 nReturn1 = getRowSetData();
@@ -540,11 +531,18 @@
 
         case BUFFERED_MYSQL_CLIENT:
             if ( getRowSetSize() > getResultSetRows() )
-                MYODBCDbgReturn( doFirst_() );
-
-            mysql_data_seek( pRes, getResultSetRows() - getRowSetSize() );
-            // load RowSet
-            nReturn1 = getRowSetData();
+            {
+                if ( getResultSetRows() )
+                {
+                    mysql_data_seek( pRes, 0 );
+                    nReturn1 = getRowSetData();
+                }
+            }
+            else
+            {
+                mysql_data_seek( pRes, getResultSetRows() - getRowSetSize() );
+                nReturn1 = getRowSetData();
+            }
             break;
 
         default:
@@ -570,8 +568,7 @@
             break;
 
         case BUFFERED_MYSQL_PLUS:
-            // do we need to load more data into our buffered ResultSet?
-            while ( !isResultSetRowsKnown() && getResultSetRow() +
getRowSetSize() > getResultSetRows() )
+            while ( !isResultSetRowsKnown() && getResultSetRow() +
getRowSetSize() >= getResultSetRows() )
             {
                 nReturn1 = getRowSetData();
                 if ( !SQL_SUCCEEDED( nReturn1 ) )
@@ -580,9 +577,11 @@
             break;
 
         case BUFFERED_MYSQL_CLIENT:
-            mysql_data_seek( pRes, 0 );
-            // load RowSet
-            nReturn1 = getRowSetData();
+            if ( getResultSetRow() + getResultSetSize() < getResultSetRows() )
+            {
+                mysql_data_seek( pRes, getResultSetRow() + getResultSetSize() );
+                nReturn1 = getRowSetData();
+            }
             break;
 
         default:
@@ -610,13 +609,15 @@
             break;
 
         case BUFFERED_MYSQL_CLIENT:
-            if ( getResultSetRow() > getRowSetSize() )
-                mysql_data_seek( pRes, getResultSetRow() - getRowSetSize() );
-            else
-                mysql_data_seek( pRes, 0 );
+            if ( getResultSetRows() )
+            {
+                if ( getResultSetRow() > getRowSetSize() )
+                    mysql_data_seek( pRes, getResultSetRow() - getRowSetSize() );
+                else
+                    mysql_data_seek( pRes, 0 );
 
-            // load RowSet
-            nReturn1 = getRowSetData();
+                nReturn1 = getRowSetData();
+            }
             break;
 
         default:
@@ -633,21 +634,6 @@
 {
     MYODBCDbgEnter();
 
-    if ( getState() < STATE_EXECUTED )
-        MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::DIA_HY010 ) );
-
-    if ( nRows == 0 )
-        MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::DIA_01000, 0,
tr("doSkip 0 records is meaningless.") ) );
-
-    if ( nRows < 0 )
-    {
-        if ( getStatement()->getCursorType() == SQL_CURSOR_FORWARD_ONLY )
-            MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::DIA_HY000, 0,
tr("doSkip() not fully supported when SQL_CURSOR_FORWARD_ONLY") ) );
-
-        if ( !isBuffered() )
-            MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::DIA_HY000, 0,
tr("doSkip() not fully supported when unbuffered resultset") ) );
-    }
-
     SQLRETURN nReturn1 = SQL_SUCCESS;
 
     switch ( getBuffered() )
@@ -656,23 +642,23 @@
             MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::DIA_HY106 ) );
 
         case BUFFERED_MYSQL_PLUS:
-            // do we need to load more data into our buffered ResultSet?
-            while ( !isResultSetRowsKnown() && getResultSetRow() +
getRowSetSize() > getResultSetRows() )
+            if ( nRows > 0 )
             {
-                nReturn1 = getRowSetData();
-                if ( !SQL_SUCCEEDED( nReturn1 ) )
-                    break;
+                while ( !isResultSetRowsKnown() && getResultSetRow() +
getRowSetSize() > getResultSetRows() )
+                {
+                    nReturn1 = getRowSetData();
+                    if ( !SQL_SUCCEEDED( nReturn1 ) )
+                        break;
+                }
             }
             break;
 
         case BUFFERED_MYSQL_CLIENT:
-            if ( getResultSetRow() > getRowSetSize() )
-                mysql_data_seek( pRes, getResultSetRow() - getRowSetSize() );
-            else
-                mysql_data_seek( pRes, 0 );
-
-            // load RowSet
-            nReturn1 = getRowSetData();
+            if ( getResultSetRow() + nRows > 0 && getResultSetRow() + nRows
<= getResultSetRows() )
+            {
+                mysql_data_seek( pRes, getResultSetRow() + nRows );
+                nReturn1 = getRowSetData();
+            }
             break;
 
         default:
@@ -820,7 +806,7 @@
 
     \return SQLRETURN
 */
-SQLRETURN MResultSet::getRowSetData()
+SQLRETURN MResultRes::getRowSetData()
 {
     MYODBCDbgEnter();
 
@@ -905,7 +891,7 @@
     \retval     SQL_ROW_DELETED             The row has been deleted since it was last
fetched from this result set.
     \retval     SQL_ROW_NOROW               The rowset overlapped the end of the result
set and no row was returned that corresponded to this element of the row status array. 
 */
-SQLUSMALLINT MResultSet::getRowSetRowData( MYSQL_ROW pRow, qulonglong nRow /* 0-based */
)
+SQLUSMALLINT MResultRes::getRowSetRowData( MYSQL_ROW pRow, qulonglong nRow /* 0-based */
)
 {
     MYODBCDbgEnter();
 

Thread
Connector/ODBC 5 commit: r550 - trunk/SDK/MYSQLPlus/Librarypharvey18 Sep