Modified:
trunk/SDK/MYSQLPlus/Library/Library.pro
trunk/SDK/MYSQLPlus/Library/MResult.cpp
trunk/SDK/MYSQLPlus/Library/MResult.h
trunk/SDK/MYSQLPlus/Library/MStatement.cpp
Log:
changes/additions for block-cursor support
Modified: trunk/SDK/MYSQLPlus/Library/Library.pro
===================================================================
--- trunk/SDK/MYSQLPlus/Library/Library.pro 2006-09-10 21:43:22 UTC (rev 533)
+++ trunk/SDK/MYSQLPlus/Library/Library.pro 2006-09-11 01:53:42 UTC (rev 534)
@@ -7,7 +7,7 @@
include( ../../../common.pri )
include( ../../../config.pri )
include( ../../../defines.pri )
-CONFIG += staticlib ResultPlus
+CONFIG += staticlib
# CONFIG += staticlib ResultPlus ResultRes ResultStmt
INCLUDEPATH += ../../C/include
INCLUDEPATH += ../../Dbg/include
Modified: trunk/SDK/MYSQLPlus/Library/MResult.cpp
===================================================================
--- trunk/SDK/MYSQLPlus/Library/MResult.cpp 2006-09-10 21:43:22 UTC (rev 533)
+++ trunk/SDK/MYSQLPlus/Library/MResult.cpp 2006-09-11 01:53:42 UTC (rev 534)
@@ -19,6 +19,7 @@
*/
#include "MInternal.h"
+#include <stdlib.h>
MResultGetData::MResultGetData()
{
@@ -172,7 +173,7 @@
setKeySetSize()
setSimulateCursor()
*/
-SQLRETURN MResult::setConcurrency( CONCURENCY nConcurrency )
+SQLRETURN MResult::setConcurrency( CONCURRENCY nConcurrency )
{
MYODBCDbgEnter();
@@ -319,7 +320,7 @@
if ( getState() >= STATE_PREPARED )
MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::DIA_HY010 ) );
- this->nCursorType = nCursorType;
+ this->nKeySetSize = nKeySetSize;
MYODBCDbgReturn( SQL_SUCCESS );
}
@@ -450,10 +451,10 @@
MYODBCDbgReturn( SQL_SUCCESS );
}
-BUFFERED MResult::getBuffered()
+MResult::BUFFERED MResult::getBuffered()
{
MYODBCDbgEnter();
- MYODBCDbgReturn3( "%d", bBuffered );
+ MYODBCDbgReturn3( "%d", nBuffered );
}
/*!
@@ -470,7 +471,7 @@
MYODBCDbgReturn3( "%d", getImpRowDesc()->getCount() );
}
-MResult::CONCURENCY MResult::getConcurrency()
+MResult::CONCURRENCY MResult::getConcurrency()
{
MYODBCDbgEnter();
MYODBCDbgReturn3( "%d", nConcurrency );
@@ -1235,7 +1236,7 @@
| FetchOffset > RowsetSize[3] |
|
+---------------------------------------------------------------+-----------------------------------+
*/
- if ( nResultSetRow > 1 && nResultSetRow + nRows < 1 && abs(
nRows ) > nRowSetSize )
+ if ( nResultSetRow > 1 && nResultSetRow + nRows < 1 && abs(
(long double)nRows ) > nRowSetSize )
MYODBCDbgReturn( setBeforeStart() );
/*!
@@ -1248,7 +1249,7 @@
| FetchOffset <= RowsetSize[3] |
|
+---------------------------------------------------------------+-----------------------------------+
*/
- if ( nResultSetRow > 1 && nResultSetRow + nRows < 1 && abs(
nRows ) <= nRowSetSize )
+ if ( nResultSetRow > 1 && nResultSetRow + nRows < 1 && abs(
(long double)nRows ) <= nRowSetSize )
{
nResultSetRow = 1;
nRowSetRow = 1;
@@ -1346,7 +1347,7 @@
| FetchOffset <= LastResultRow |
|
+---------------------------------------------------------------+-----------------------------------+
*/
- if ( nRow < 0 && abs( nRow ) <= nResultSetRows )
+ if ( nRow < 0 && abs( (long double)nRow ) <= nResultSetRows )
{
nResultSetRow += nRow;
nRowSetRow = 1;
@@ -1365,7 +1366,7 @@
| FetchOffset > RowsetSize[2] |
|
+---------------------------------------------------------------+-----------------------------------+
*/
- if ( nRow < 0 && abs( nRow ) > nResultSetRows && abs( nRow )
> nRowSetSize )
+ if ( nRow < 0 && abs( (long double)nRow ) > nResultSetRows &&
abs( (long double)nRow ) > nRowSetSize )
MYODBCDbgReturn( setBeforeStart() );
/*!
@@ -1379,7 +1380,7 @@
| FetchOffset <= RowsetSize[2] |
|
+---------------------------------------------------------------+-----------------------------------+
*/
- if ( nRow < 0 && abs( nRow ) > nResultSetRows && abs( nRow )
<= nRowSetSize )
+ if ( nRow < 0 && abs( (long double)nRow ) > nResultSetRows &&
abs( (long double)nRow ) <= nRowSetSize )
{
nResultSetRow = 1;
nRowSetRow = 1;
@@ -1461,7 +1462,7 @@
MYODBCDbgReturn3( "%d", b );
}
-BOOLEAN MResult::isValidRowSetRow( SQLUSMALLINT nRowSetRow );
+BOOLEAN MResult::isValidRowSetRow()
{
MYODBCDbgEnter();
@@ -1490,7 +1491,7 @@
MYODBCDbgReturn( SQL_NO_DATA );
}
-void MResult::setAfterEnd()
+SQLRETURN MResult::setAfterEnd()
{
MYODBCDbgEnter();
@@ -1501,16 +1502,16 @@
MYODBCDbgReturn( SQL_NO_DATA );
}
-SQLRETURN MResult::setBuffered( BUFFERED bBuffered )
+SQLRETURN MResult::setBuffered( BUFFERED nBuffered )
{
MYODBCDbgEnter();
if ( getState() >= STATE_PREPARED )
MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::DIA_HY010 ) );
- this->bBuffered = bBuffered;
+ this->nBuffered = nBuffered;
- MYODBCDbgReturn( SQL_SUCCCESS );
+ MYODBCDbgReturn( SQL_SUCCESS );
}
/*!
Modified: trunk/SDK/MYSQLPlus/Library/MResult.h
===================================================================
--- trunk/SDK/MYSQLPlus/Library/MResult.h 2006-09-10 21:43:22 UTC (rev 533)
+++ trunk/SDK/MYSQLPlus/Library/MResult.h 2006-09-11 01:53:42 UTC (rev 534)
@@ -285,7 +285,7 @@
virtual ~MResult();
/* setters */
- virtual SQLRETURN setConcurrency( CONCURENCY nConcurrency = CONCURRENCY_READ_ONLY );
+ virtual SQLRETURN setConcurrency( CONCURRENCY nConcurrency = CONCURRENCY_READ_ONLY );
virtual SQLRETURN setCursorScrollable( CURSOR_SCROLLABLE nCursorScrollable =
CURSOR_SCROLLABLE_NONSCROLLABLE );
virtual SQLRETURN setCursorSensitivity( CURSOR_SENSITIVITY nCursorSensitivity =
CURSOR_SENSITIVITY_UNSPECIFIED );
virtual SQLRETURN setCursorType( CURSOR_TYPE nCursorType = CURSOR_TYPE_FORWARD_ONLY
);
@@ -300,7 +300,7 @@
/* getters */
virtual BUFFERED getBuffered();
virtual SQLUSMALLINT getColumns();
- virtual CONCURENCY getConcurrency();
+ virtual CONCURRENCY getConcurrency();
virtual CURSOR_SCROLLABLE getCursorScrollable();
virtual CURSOR_SENSITIVITY getCursorSensitivity();
virtual CURSOR_TYPE getCursorType();
@@ -349,7 +349,7 @@
qulonglong nResultSetRows; /*!< \todo Get rid of this limitation.
*/
qulonglong nRowsAffected; /*!< number of rows affected by a non-SELECT
statement (catalog and SHOW statements count as SELECT in this case) */
SQLUSMALLINT nRowSetRow; /*!< Current row in rowset.
*/
- SQLUSMALLINT nRowSetRows; /*!< Is RowSetSize but will be less when
RowSet goes beyond ResultSetRows. */
*/
+ SQLUSMALLINT nRowSetRows; /*!< Is RowSetSize but will be less when
RowSet goes beyond ResultSetRows. */
STATE nState; /*!< our state
*/
/*!
@@ -362,7 +362,7 @@
change in MStatement)
*/
/*@{*/
- CONCURENCY nConcurrency; /*!< SQL_ATTR_CONCURRENCY */
+ CONCURRENCY nConcurrency; /*!< SQL_ATTR_CONCURRENCY */
CURSOR_SCROLLABLE nCursorScrollable; /*!< SQL_ATTR_CURSOR_SCROLLABLE */
CURSOR_SENSITIVITY nCursorSensitivity; /*!< SQL_ATTR_CURSOR_SENSITIVITY */
CURSOR_TYPE nCursorType; /*!< SQL_ATTR_CURSOR_TYPE */
@@ -501,8 +501,7 @@
an overly complicated interface to them via derived classes. This is an
exception.
*/
- BUFFERE nBuffered; /*!< where is ResultSet buffered - if at all */
-
+ BUFFERED nBuffered; /*!< where is ResultSet buffered - if at all */
};
#endif
Modified: trunk/SDK/MYSQLPlus/Library/MStatement.cpp
===================================================================
--- trunk/SDK/MYSQLPlus/Library/MStatement.cpp 2006-09-10 21:43:22 UTC (rev 533)
+++ trunk/SDK/MYSQLPlus/Library/MStatement.cpp 2006-09-11 01:53:42 UTC (rev 534)
@@ -285,7 +285,7 @@
if ( !( nCursorAttributes1 & SQL_CA1_POS_POSITION ) )
MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::DIA_HYC00, 0,
tr("SQL_POSITION not supported for cursor type.") ) );
- MYODBCDbgReturn( getResult()->setPos( nRowNumber ) );
+ MYODBCDbgReturn( getResult()->setRowSetRow( nRowNumber ) );
case SQL_REFRESH:
{
@@ -293,7 +293,7 @@
if ( !( nCursorAttributes1 & SQL_CA1_POS_REFRESH ) )
MYODBCDbgReturn( getDiagnostic()->doAppend(
MDiagnostic::DIA_HYC00, 0, tr("SQL_REFRESH not supported for cursor type.") ) );
- SQLRETURN nReturn = getResult()->setPos( nRowNumber );
+ SQLRETURN nReturn = getResult()->setRowSetRow( nRowNumber );
if ( !SQL_SUCCEEDED( nReturn ) )
MYODBCDbgReturn( nReturn );
MYODBCDbgReturn( getResult()->doRefresh() );
@@ -738,7 +738,7 @@
set.
*/
MResult *pResult = getResult();
- if ( !pResult->isValidRow() )
+ if ( !pResult->isValidResultSetRow() )
MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::DIA_24000 ) );
/*!
@@ -4421,12 +4421,8 @@
MCommand *pCommand = pCommands->getCommand();
if ( pCommand->isResultSetPossible() )
{
- qulonglong n;
- if ( pResult->getRows( &n ) == SQL_SUCCESS )
- {
- *pnRowCount = (SQLINTEGER)n;
- MYODBCDbgReturn( SQL_SUCCESS );
- }
+ *pnRowCount = (SQLINTEGER)pResult->getResultSetRows();
+ MYODBCDbgReturn( SQL_SUCCESS );
}
else
{
@@ -4437,12 +4433,8 @@
else
{
/* catalog function */
- qulonglong n;
- if ( pResult->getRows( &n ) == SQL_SUCCESS )
- {
- *pnRowCount = (SQLINTEGER)n;
- MYODBCDbgReturn( SQL_SUCCESS );
- }
+ *pnRowCount = (SQLINTEGER)pResult->getResultSetRows();
+ MYODBCDbgReturn( SQL_SUCCESS );
}
/* we can not return row count in this state */
@@ -5630,7 +5622,7 @@
else
{
nCursorType = SQL_CURSOR_FORWARD_ONLY;
- getDiagnostic()->doAppend( MDiagnostic::DIA_01000, 0,
tr("SQL_CURSOR_STATIC not supported - using SQL_CURSOR_FORWARD_ONLY.") ) );
+ getDiagnostic()->doAppend( MDiagnostic::DIA_01000, 0,
tr("SQL_CURSOR_STATIC not supported - using SQL_CURSOR_FORWARD_ONLY.") );
}
break;
@@ -5649,7 +5641,7 @@
else
{
nConcurrency = SQL_CONCUR_READ_ONLY;
- getDiagnostic()->doAppend( MDiagnostic::DIA_01000, 0,
tr("SQL_CONCUR_VALUES not supported - using SQL_CONCUR_READ_ONLY.") ) );
+ getDiagnostic()->doAppend( MDiagnostic::DIA_01000, 0,
tr("SQL_CONCUR_VALUES not supported - using SQL_CONCUR_READ_ONLY.") );
}
}
break;
@@ -6091,6 +6083,7 @@
nCursorAttributes = getConnection()->getInfoDynamicCursorAttributes1();
break;
default:
+ getDiagnostic()->doAppend( MDiagnostic::DIA_01000, 0, QString( "Unknown
cursor type %1" ).arg( nCursorType ) );
}
MYODBCDbgReturn3( "%d", nCursorAttributes );
@@ -6333,7 +6326,8 @@
MYODBCDbgReturn3( "%d", 0 );
}
- pResult->getRow( &nRow );
+ if ( pResult->isValidResultSetRow() )
+ nRow = pResult->getResultSetRow();
MYODBCDbgReturn3( "%d", (SQLUINTEGER)nRow );
}
| Thread |
|---|
| • Connector/ODBC 5 commit: r534 - trunk/SDK/MYSQLPlus/Library | pharvey | 11 Sep |