Modified:
MYSQLPlus/MYSQLPlusLib/MDescriptorRecordIRD.cpp
MYSQLPlus/MYSQLPlusLib/MDescriptorRecordIRD.h
MYSQLPlus/MYSQLPlusLib/MResult.cpp
MYSQLPlus/MYSQLPlusLib/MResult.h
MYSQLPlus/MYSQLPlusLib/MResultPlus.cpp
MYSQLPlus/MYSQLPlusLib/MResultStmt.cpp
Log:
Modified: MYSQLPlus/MYSQLPlusLib/MDescriptorRecordIRD.cpp
===================================================================
--- MYSQLPlus/MYSQLPlusLib/MDescriptorRecordIRD.cpp 2006-05-17 06:55:08 UTC (rev 250)
+++ MYSQLPlus/MYSQLPlusLib/MDescriptorRecordIRD.cpp 2006-05-17 20:20:50 UTC (rev 251)
@@ -34,6 +34,36 @@
MYODBCDbgReturn( getDescriptor()->getDiagnostic()->doAppend(
MDiagnostic::DIA_HY016 ) );
}
+BOOLEAN MDescriptorRecordIRD::isVariableLength( SQLSMALLINT nConciseType )
+{
+ MYODBCDbgEnter();
+
+ /*!
+ \internal ODBC RULE
+
+ SQLGetData can be used to retrieve data from a column that contains
variable-length data
+ in parts + SQL_VARCHAR, SQL_LONGVARCHAR, SQL_WCHAR, SQL_WVARCHAR, SQL_WLONGVARCHAR,
SQL_BINARY,
+ SQL_VARBINARY, SQL_LONGVARBINARY, or a driver-specific identifier for a
variable-length
+ type.
+ */
+ switch ( nConciseType )
+ {
+ case SQL_CHAR:
+ case SQL_VARCHAR:
+ case SQL_LONGVARCHAR:
+ case SQL_WCHAR:
+ case SQL_WVARCHAR:
+ case SQL_WLONGVARCHAR:
+ case SQL_BINARY:
+ case SQL_VARBINARY:
+ case SQL_LONGVARBINARY:
+ MYODBCDbgReturn3( "%d", true );
+ }
+
+ MYODBCDbgReturn3( "%d", false );
+}
+
SQLRETURN MDescriptorRecordIRD::setConciseType( SQLSMALLINT nConciseType )
{
MYODBCDbgEnter();
Modified: MYSQLPlus/MYSQLPlusLib/MDescriptorRecordIRD.h
===================================================================
--- MYSQLPlus/MYSQLPlusLib/MDescriptorRecordIRD.h 2006-05-17 06:55:08 UTC (rev 250)
+++ MYSQLPlus/MYSQLPlusLib/MDescriptorRecordIRD.h 2006-05-17 20:20:50 UTC (rev 251)
@@ -12,6 +12,9 @@
/* setters */
SQLRETURN setDescField( SQLSMALLINT nFieldIdentifier, SQLPOINTER pValuePtr,
SQLINTEGER nBufferLength );
+ /* isers */
+ static BOOLEAN isVariableLength( SQLSMALLINT nConciseType );
+
protected:
/* setters */
SQLRETURN setConciseType( SQLSMALLINT nConciseType );
Modified: MYSQLPlus/MYSQLPlusLib/MResult.cpp
===================================================================
--- MYSQLPlus/MYSQLPlusLib/MResult.cpp 2006-05-17 06:55:08 UTC (rev 250)
+++ MYSQLPlus/MYSQLPlusLib/MResult.cpp 2006-05-17 20:20:50 UTC (rev 251)
@@ -20,6 +20,47 @@
#include "MInternal.h"
+MResultGetData::MResultGetData()
+{
+ MYODBCDbgEnter();
+
+ doClear();
+
+ MYODBCDbgReturn2();
+}
+
+void MResultGetData::doClear()
+{
+ MYODBCDbgEnter();
+
+ nColumn = 0;
+ nTargetType = SQL_C_DEFAULT;
+ pTarget = NULL;
+ nBytesOrCharsMax = 0;
+ nBytesOrCharsRemaining = 0;
+ nIndicator = SQL_NO_TOTAL;
+ variantData.clear();
+ pDescriptorRecordIRD = NULL;
+ pDescriptorRecordARD = NULL;
+
+ MYODBCDbgReturn2();
+}
+
+BOOLEAN MResultGetData::isChunkingRequest( SQLUSMALLINT nColumn, SQLSMALLINT nTargetType,
SQLSMALLINT nType )
+{
+ MYODBCDbgEnter();
+
+ if ( resultGetData.nColumn == nColumnNumber &&
+ resultGetData.nBytesOrCharsRemaining > 0 &&
+ resultGetData.nTargetType == nTargetType &&
+ MDescriptorRecordIRD::isVariableLength( nType ) )
+ {
+ MYODBCDbgReturn3( "%d", true );
+ }
+
+ MYODBCDbgReturn3( "%d", false );
+}
+
/*!
\internal
\brief Allocates, initializes and returns a new MYODBC_RES_HANDLE.
@@ -84,6 +125,8 @@
This means that we are getting data defined by SQL type to a C buffer
defined by C type. Data conversion
will take place as needed and in accordance with the ODBC
specification.
+ \note MySQL does nto support all SQL types but this method does ;)
+
\param nColumnNumber The desired column number as per SQLGetData().
\param nTargetType The desired C data type for pTargetValue as per SQLGetData().
\param pTargetValue A viable buffer where we can put the column value as per
SQLGetData().
@@ -106,6 +149,19 @@
if ( nColumnNumber > getImpRowDesc()->getCount() )
MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::DIA_07009 ) );
+
+ /* are we being called a second (or more) time on same column to get large data? */
+ if ( resultGetData.isChunkingRequest( nColumnNumber, nTargetType,
resultGetData.pDescriptorRecordIRD->getConciseType() ) )
+ {
+ }
+
+ if ( nTargetType == SQL_ARD_TYPE )
+ {
+ }
+ else
+ {
+ }
+
MResultDataTarget dataTarget;
dataTarget.nBytesOrCharsMax = nBufferLength;
dataTarget.nColumn = nColumnNumber;
@@ -154,9 +210,9 @@
MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::DIA_07009
) );
/*!
- \internal ODBC RULE (I think)
+ \internal ODBC RULE
- Examples in the spec. (not the spec. itself) shows SQL_ARD_TYPE being
used during
+ Examples in the spec. shows SQL_ARD_TYPE being used during
a SQLGetData() to tell the driver to use not just the concise type
but also the
precision and scale. Specifying the precision and scale in this way
adjusts the
behaviour of SQLGetData when SQL_C_NUMERIC (SQL_NUMERIC_STRUCT) is
the target type
@@ -194,7 +250,7 @@
}
/* try again - call ourself with the type */
- MYODBCDbgReturn( getData( nColumnNumber,
pDescriptorRecordARD->getConciseType(), pTargetValue, nBufferLength, pnLength,
pnIndicator ) );
+ MYODBCDbgReturn( getDataARDType( nColumnNumber,
pDescriptorRecordARD->getConciseType(), pTargetValue, nBufferLength, pnLength,
pnIndicator ) );
}
break;
@@ -209,7 +265,7 @@
The logic for selecting the C data type is spelled out in the ODBC
specification.
*/
case SQL_C_DEFAULT:
- MYODBCDbgReturn( getData( nColumnNumber,
(MDescriptorRecordIRD*)getImpRowDesc()->getRecord( nColumnNumber ), pTargetValue,
nBufferLength, pnLength, pnIndicator ) );
+ MYODBCDbgReturn( getDataDefault( nColumnNumber,
(MDescriptorRecordIRD*)getImpRowDesc()->getRecord( nColumnNumber ), pTargetValue,
nBufferLength, pnLength, pnIndicator ) );
case SQL_CHAR:
case SQL_VARCHAR:
@@ -405,7 +461,7 @@
\sa getData
*/
-SQLRETURN MResult::getData( SQLUSMALLINT nColumn, MDescriptorRecordARD *pDescriptorRecord
)
+SQLRETURN MResult::getDataARDType( SQLUSMALLINT nColumn, MDescriptorRecordARD
*pDescriptorRecord )
{
MYODBCDbgEnter();
@@ -450,7 +506,7 @@
"Converting Data from SQL to C Data Types"
"http://msdn.microsoft.com/library/default.asp?url=/library/en-us/odbc/htm/odbcconverting_data_from_sql_to_c_data_types.asp"
*/
-SQLRETURN MResult::getData( SQLUSMALLINT nColumn, MDescriptorRecordIRD
*pDescriptorRecord, SQLPOINTER pTargetValue, SQLINTEGER nBufferLength, SQLINTEGER
*pnLength, SQLINTEGER *pnIndicator )
+SQLRETURN MResult::getDataDefault( SQLUSMALLINT nColumn, MDescriptorRecordIRD
*pDescriptorRecordIRD, SQLPOINTER pTargetValue, SQLINTEGER nBufferLength, SQLINTEGER
*pnLength, SQLINTEGER *pnIndicator )
{
MYODBCDbgEnter();
@@ -601,7 +657,7 @@
\sa "SQL to C: Character"
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/odbc/htm/odbcconverting_data_from_sql_to_c_data_types.asp
*/
-SQLRETURN MResult::fromCharacterSQL( MDescriptorRecordIRD *pDescriptorRecordIRD,
MResultDataTarget *pResultDataTarget )
+SQLRETURN MResult::fromCharacterSQL()
{
MYODBCDbgEnter();
@@ -654,7 +710,7 @@
MYODBCDbgReturn( SQL_SUCCESS );
}
-SQLRETURN fromNumericSQL( MDescriptorRecordIRD *pDescriptorRecordIRD, MResultDataTarget
*pResultDataTarget )
+SQLRETURN fromNumericSQL()
{
MYODBCDbgEnter();
@@ -703,7 +759,7 @@
MYODBCDbgReturn( SQL_SUCCESS );
}
-SQLRETURN fromBitSQL( MDescriptorRecordIRD *pDescriptorRecordIRD, MResultDataTarget
*pResultDataTarget )
+SQLRETURN fromBitSQL()
{
MYODBCDbgEnter();
@@ -740,7 +796,7 @@
MYODBCDbgReturn( SQL_SUCCESS );
}
-SQLRETURN fromBinarySQL( MDescriptorRecordIRD *pDescriptorRecordIRD, MResultDataTarget
*pResultDataTarget )
+SQLRETURN fromBinarySQL()
{
MYODBCDbgEnter();
@@ -762,7 +818,7 @@
MYODBCDbgReturn( SQL_SUCCESS );
}
-SQLRETURN fromDateSQL( MDescriptorRecordIRD *pDescriptorRecordIRD, MResultDataTarget
*pResultDataTarget )
+SQLRETURN fromDateSQL()
{
MYODBCDbgEnter();
@@ -786,7 +842,7 @@
MYODBCDbgReturn( SQL_SUCCESS );
}
-SQLRETURN fromGuidSQL( MDescriptorRecordIRD *pDescriptorRecordIRD, MResultDataTarget
*pResultDataTarget )
+SQLRETURN fromGuidSQL()
{
MYODBCDbgEnter();
@@ -809,7 +865,7 @@
MYODBCDbgReturn( SQL_SUCCESS );
}
-SQLRETURN fromTimeSQL( MDescriptorRecordIRD *pDescriptorRecordIRD, MResultDataTarget
*pResultDataTarget )
+SQLRETURN fromTimeSQL()
{
MYODBCDbgEnter();
@@ -833,7 +889,7 @@
MYODBCDbgReturn( SQL_SUCCESS );
}
-SQLRETURN fromTimeStampSQL( MDescriptorRecordIRD *pDescriptorRecordIRD, MResultDataTarget
*pResultDataTarget )
+SQLRETURN fromTimeStampSQL()
{
MYODBCDbgEnter();
@@ -858,7 +914,7 @@
MYODBCDbgReturn( SQL_SUCCESS );
}
-SQLRETURN fromIntervalYearMonthSQL( MDescriptorRecordIRD *pDescriptorRecordIRD,
MResultDataTarget *pResultDataTarget )
+SQLRETURN fromIntervalYearMonthSQL()
{
MYODBCDbgEnter();
@@ -891,7 +947,7 @@
MYODBCDbgReturn( SQL_SUCCESS );
}
-SQLRETURN fromIntervalDayTimeSQL( MDescriptorRecordIRD *pDescriptorRecordIRD,
MResultDataTarget *pResultDataTarget )
+SQLRETURN fromIntervalDayTimeSQL()
{
MYODBCDbgEnter();
@@ -934,7 +990,7 @@
MYODBCDbgReturn( SQL_SUCCESS );
}
-SQLRETURN MResult::toCharStringC( MDescriptorRecordIRD *pDescriptorRecordIRD,
MResultDataTarget *pResultDataTarget )
+SQLRETURN MResult::toCharStringC()
{
MYODBCDbgEnter();
@@ -967,7 +1023,7 @@
MYODBCDbgReturn( SQL_SUCCESS );
}
-SQLRETURN MResult::toWideCharStringC( MDescriptorRecordIRD *pDescriptorRecordIRD,
MResultDataTarget *pResultDataTarget )
+SQLRETURN MResult::toWideCharStringC()
{
MYODBCDbgEnter();
@@ -1000,7 +1056,7 @@
MYODBCDbgReturn( SQL_SUCCESS );
}
-SQLRETURN MResult::toShortIntC( MDescriptorRecordIRD *pDescriptorRecordIRD,
MResultDataTarget *pResultDataTarget )
+SQLRETURN MResult::toShortIntC()
{
MYODBCDbgEnter();
@@ -1025,7 +1081,7 @@
MYODBCDbgReturn( SQL_SUCCESS );
}
-SQLRETURN MResult::toUnsignedShortIntC( MDescriptorRecordIRD *pDescriptorRecordIRD,
MResultDataTarget *pResultDataTarget )
+SQLRETURN MResult::toUnsignedShortIntC()
{
MYODBCDbgEnter();
@@ -1039,7 +1095,7 @@
MYODBCDbgReturn( SQL_SUCCESS );
}
-SQLRETURN MResult::toLongIntC( MDescriptorRecordIRD *pDescriptorRecordIRD,
MResultDataTarget *pResultDataTarget )
+SQLRETURN MResult::toLongIntC()
{
MYODBCDbgEnter();
@@ -1053,7 +1109,7 @@
MYODBCDbgReturn( SQL_SUCCESS );
}
-SQLRETURN MResult::toUnsignedLongIntC( MDescriptorRecordIRD *pDescriptorRecordIRD,
MResultDataTarget *pResultDataTarget )
+SQLRETURN MResult::toUnsignedLongIntC()
{
MYODBCDbgEnter();
@@ -1067,7 +1123,7 @@
MYODBCDbgReturn( SQL_SUCCESS );
}
-SQLRETURN MResult::toFloatC( MDescriptorRecordIRD *pDescriptorRecordIRD,
MResultDataTarget *pResultDataTarget )
+SQLRETURN MResult::toFloatC()
{
MYODBCDbgEnter();
@@ -1081,7 +1137,7 @@
MYODBCDbgReturn( SQL_SUCCESS );
}
-SQLRETURN MResult::toDoubleC( MDescriptorRecordIRD *pDescriptorRecordIRD,
MResultDataTarget *pResultDataTarget )
+SQLRETURN MResult::toDoubleC()
{
MYODBCDbgEnter();
@@ -1095,7 +1151,7 @@
MYODBCDbgReturn( SQL_SUCCESS );
}
-SQLRETURN MResult::toCharC( MDescriptorRecordIRD *pDescriptorRecordIRD, MResultDataTarget
*pResultDataTarget )
+SQLRETURN MResult::toCharC()
{
MYODBCDbgEnter();
@@ -1109,7 +1165,7 @@
MYODBCDbgReturn( SQL_SUCCESS );
}
-SQLRETURN MResult::toUnsignedCharC( MDescriptorRecordIRD *pDescriptorRecordIRD,
MResultDataTarget *pResultDataTarget )
+SQLRETURN MResult::toUnsignedCharC()
{
MYODBCDbgEnter();
@@ -1123,7 +1179,7 @@
MYODBCDbgReturn( SQL_SUCCESS );
}
-SQLRETURN MResult::toInt64C( MDescriptorRecordIRD *pDescriptorRecordIRD,
MResultDataTarget *pResultDataTarget )
+SQLRETURN MResult::toInt64C()
{
MYODBCDbgEnter();
@@ -1137,7 +1193,7 @@
MYODBCDbgReturn( SQL_SUCCESS );
}
-SQLRETURN MResult::toUnsignedInt64C( MDescriptorRecordIRD *pDescriptorRecordIRD,
MResultDataTarget *pResultDataTarget )
+SQLRETURN MResult::toUnsignedInt64C()
{
MYODBCDbgEnter();
@@ -1151,7 +1207,7 @@
MYODBCDbgReturn( SQL_SUCCESS );
}
-SQLRETURN MResult::toBinaryC( MDescriptorRecordIRD *pDescriptorRecordIRD,
MResultDataTarget *pResultDataTarget )
+SQLRETURN MResult::toBinaryC()
{
MYODBCDbgEnter();
@@ -1164,7 +1220,7 @@
MYODBCDbgReturn( SQL_SUCCESS );
}
-SQLRETURN MResult::toDateC( MDescriptorRecordIRD *pDescriptorRecordIRD, MResultDataTarget
*pResultDataTarget )
+SQLRETURN MResult::toDateC()
{
MYODBCDbgEnter();
@@ -1179,7 +1235,7 @@
MYODBCDbgReturn( SQL_SUCCESS );
}
-SQLRETURN MResult::toTimeC( MDescriptorRecordIRD *pDescriptorRecordIRD, MResultDataTarget
*pResultDataTarget )
+SQLRETURN MResult::toTimeC()
{
MYODBCDbgEnter();
@@ -1194,7 +1250,7 @@
MYODBCDbgReturn( SQL_SUCCESS );
}
-SQLRETURN MResult::toTimeStampC( MDescriptorRecordIRD *pDescriptorRecordIRD,
MResultDataTarget *pResultDataTarget )
+SQLRETURN MResult::toTimeStampC()
{
MYODBCDbgEnter();
@@ -1233,7 +1289,7 @@
\sa getData()
*/
-SQLRETURN MResult::toNumericC( MDescriptorRecordIRD *pDescriptorRecordIRD,
MResultDataTarget *pResultDataTarget )
+SQLRETURN MResult::toNumericC()
{
MYODBCDbgEnter();
Modified: MYSQLPlus/MYSQLPlusLib/MResult.h
===================================================================
--- MYSQLPlus/MYSQLPlusLib/MResult.h 2006-05-17 06:55:08 UTC (rev 250)
+++ MYSQLPlus/MYSQLPlusLib/MResult.h 2006-05-17 20:20:50 UTC (rev 251)
@@ -12,18 +12,38 @@
#include "MInternal.h"
-typedef struct tMResultDataTarget
+/*!
+ \brief Data to support getData.
+
+ getData (SQLGetData) requires that a state be maintained between calls
+ because getData can be called multiple times on the same column to
+ get the cell data in chunks. This is only the case for variable-length
+ types - basically all character and binary types.
+
+ We package the entire getData call in here and then some.
+*/
+class MResultGetData
{
- SQLUSMALLINT nColumn;
- SQLSMALLINT nTargetType;
- SQLPOINTER pTarget;
- SQLINTEGER nBytesOrCharsMax;
- SQLINTEGER * pnBytesOrCharsRemaining;
- SQLINTEGER * pnIndicator;
- QVariant variantData;
+public:
+ MResultGetData();
-} MResultDataTarget;
+ void doClear();
+
+ BOOLEAN isChunkingRequest( SQLUSMALLINT nColumnNumber, SQLSMALLINT nTargetType,
SQLSMALLINT nType );
+ SQLUSMALLINT nColumn; /*!< column number as per
SQLGetData */
+ SQLSMALLINT nTargetType; /*!< C data type desired for
value in pTarget */
+ SQLPOINTER pTarget; /*!< buffer to return cell
data */
+ SQLINTEGER nBytesOrCharsMax; /*!< size of pTarget buffer as
per SQLGetData */
+ SQLINTEGER nBytesOrCharsRemaining; /*!< bytes or chars remaining
in cell at end of last getData - we get
+ more IF nColumn is requested
again AND nBytesOrCharsRemaining > 0
+ AND nBytesOrCharsRemaining
< data length */
+ SQLINTEGER nIndicator; /*!< value indicates whether
or not the cell is NULL as per SQLGetData */
+ QVariant variantData; /*!< resultset cell data
*/
+ MDescriptorRecordIRD * pDescriptorRecordIRD; /*!< descriptor describing the
resultset column */
+ MDescriptorRecordARD * pDescriptorRecordARD; /*!< this is set if
SQL_ARD_TYPE was used - otherwise this is null */
+};
+
/*!
\brief Result-set.
@@ -85,7 +105,9 @@
virtual BOOLEAN isDirty() = 0;
protected:
+ MResultGetData resultGetData;
+
/* setters */
BOOLEAN setState( STATE nState );
virtual BOOLEAN setBuffered( BOOLEAN bBuffered );
@@ -99,41 +121,41 @@
MDescriptor * getImpRowDesc();
/* support for getData: this is called when target C type is SQL_ARD_TYPE (derive
type from ARD) */
- SQLRETURN getData( SQLUSMALLINT nColumn, MDescriptorRecordARD
*pDescriptorRecord );
+ SQLRETURN getDataARDType( SQLUSMALLINT nColumn, MDescriptorRecordARD
*pDescriptorRecord );
/* support for getData: this is called when target C type is SQL_C_DEFAULT (derive
type from IRD) */
- SQLRETURN getData( SQLUSMALLINT nColumn, MDescriptorRecordIRD
*pDescriptorRecord, SQLPOINTER pTargetValue, SQLINTEGER nBufferLength, SQLINTEGER
*pnLength, SQLINTEGER *pnIndicator );
+ SQLRETURN getDataDefault( SQLUSMALLINT nColumn, MDescriptorRecordIRD
*pDescriptorRecordIRD, SQLPOINTER pTargetValue, SQLINTEGER nBufferLength, SQLINTEGER
*pnLength, SQLINTEGER *pnIndicator );
/* support for getData: these enforce ODBC rules generalized based upon SQL type (ie
see "SQL to C: Character" in odbc spec) */
- SQLRETURN fromCharacterSQL( MDescriptorRecordIRD *pDescriptorRecordIRD,
MResultDataTarget *pResultDataTarget );
- SQLRETURN fromNumericSQL( MDescriptorRecordIRD *pDescriptorRecordIRD,
MResultDataTarget *pResultDataTarget );
- SQLRETURN fromBitSQL( MDescriptorRecordIRD *pDescriptorRecordIRD,
MResultDataTarget *pResultDataTarget );
- SQLRETURN fromBinarySQL( MDescriptorRecordIRD *pDescriptorRecordIRD,
MResultDataTarget *pResultDataTarget );
- SQLRETURN fromDateSQL( MDescriptorRecordIRD *pDescriptorRecordIRD,
MResultDataTarget *pResultDataTarget );
- SQLRETURN fromGuidSQL( MDescriptorRecordIRD *pDescriptorRecordIRD,
MResultDataTarget *pResultDataTarget );
- SQLRETURN fromTimeSQL( MDescriptorRecordIRD *pDescriptorRecordIRD,
MResultDataTarget *pResultDataTarget );
- SQLRETURN fromTimeStampSQL( MDescriptorRecordIRD *pDescriptorRecordIRD,
MResultDataTarget *pResultDataTarget );
- SQLRETURN fromIntervalYearMonthSQL( MDescriptorRecordIRD *pDescriptorRecordIRD,
MResultDataTarget *pResultDataTarget );
- SQLRETURN fromIntervalDayTimeSQL( MDescriptorRecordIRD *pDescriptorRecordIRD,
MResultDataTarget *pResultDataTarget );
+ SQLRETURN fromCharacterSQL();
+ SQLRETURN fromNumericSQL();
+ SQLRETURN fromBitSQL();
+ SQLRETURN fromBinarySQL();
+ SQLRETURN fromDateSQL();
+ SQLRETURN fromGuidSQL();
+ SQLRETURN fromTimeSQL();
+ SQLRETURN fromTimeStampSQL();
+ SQLRETURN fromIntervalYearMonthSQL();
+ SQLRETURN fromIntervalDayTimeSQL();
/* support for getData: these do the conversion */
- SQLRETURN toCharStringC( MDescriptorRecordIRD *pDescriptorRecordIRD,
MResultDataTarget *pResultDataTarget );
- SQLRETURN toWideCharStringC( MDescriptorRecordIRD *pDescriptorRecordIRD,
MResultDataTarget *pResultDataTarget );
- SQLRETURN toShortIntC( MDescriptorRecordIRD *pDescriptorRecordIRD,
MResultDataTarget *pResultDataTarget );
- SQLRETURN toUnsignedShortIntC( MDescriptorRecordIRD *pDescriptorRecordIRD,
MResultDataTarget *pResultDataTarget );
- SQLRETURN toLongIntC( MDescriptorRecordIRD *pDescriptorRecordIRD,
MResultDataTarget *pResultDataTarget );
- SQLRETURN toUnsignedLongIntC( MDescriptorRecordIRD *pDescriptorRecordIRD,
MResultDataTarget *pResultDataTarget );
- SQLRETURN toFloatC( MDescriptorRecordIRD *pDescriptorRecordIRD,
MResultDataTarget *pResultDataTarget );
- SQLRETURN toDoubleC( MDescriptorRecordIRD *pDescriptorRecordIRD,
MResultDataTarget *pResultDataTarget );
- SQLRETURN toCharC( MDescriptorRecordIRD *pDescriptorRecordIRD,
MResultDataTarget *pResultDataTarget );
- SQLRETURN toUnsignedCharC( MDescriptorRecordIRD *pDescriptorRecordIRD,
MResultDataTarget *pResultDataTarget );
- SQLRETURN toInt64C( MDescriptorRecordIRD *pDescriptorRecordIRD,
MResultDataTarget *pResultDataTarget );
- SQLRETURN toUnsignedInt64C( MDescriptorRecordIRD *pDescriptorRecordIRD,
MResultDataTarget *pResultDataTarget );
- SQLRETURN toBinaryC( MDescriptorRecordIRD *pDescriptorRecordIRD,
MResultDataTarget *pResultDataTarget );
- SQLRETURN toDateC( MDescriptorRecordIRD *pDescriptorRecordIRD,
MResultDataTarget *pResultDataTarget );
- SQLRETURN toTimeC( MDescriptorRecordIRD *pDescriptorRecordIRD,
MResultDataTarget *pResultDataTarget );
- SQLRETURN toTimeStampC( MDescriptorRecordIRD *pDescriptorRecordIRD,
MResultDataTarget *pResultDataTarget );
- SQLRETURN toNumericC( MDescriptorRecordIRD *pDescriptorRecordIRD,
MResultDataTarget *pResultDataTarget );
+ SQLRETURN toCharStringC();
+ SQLRETURN toWideCharStringC();
+ SQLRETURN toShortIntC();
+ SQLRETURN toUnsignedShortIntC();
+ SQLRETURN toLongIntC();
+ SQLRETURN toUnsignedLongIntC();
+ SQLRETURN toFloatC();
+ SQLRETURN toDoubleC();
+ SQLRETURN toCharC();
+ SQLRETURN toUnsignedCharC();
+ SQLRETURN toInt64C();
+ SQLRETURN toUnsignedInt64C();
+ SQLRETURN toBinaryC();
+ SQLRETURN toDateC();
+ SQLRETURN toTimeC();
+ SQLRETURN toTimeStampC();
+ SQLRETURN toNumericC();
/* doers */
virtual SQLRETURN doStateRollBack( STATE nState ) = 0;
Modified: MYSQLPlus/MYSQLPlusLib/MResultPlus.cpp
===================================================================
--- MYSQLPlus/MYSQLPlusLib/MResultPlus.cpp 2006-05-17 06:55:08 UTC (rev 250)
+++ MYSQLPlus/MYSQLPlusLib/MResultPlus.cpp 2006-05-17 20:20:50 UTC (rev 251)
@@ -48,6 +48,8 @@
if ( nColumn == 0 )
MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::DIA_HY000, 0,
"Invalid column. Bookmark column is read-only." ) );
+ resultGetData.doClear();
+
listResults[ nRow - 1 ].replace( nColumn - 1, variantData );
MYODBCDbgReturn( SQL_SUCCESS );
@@ -63,6 +65,8 @@
if ( getStatement()->getCursorType() == SQL_CURSOR_FORWARD_ONLY )
MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::DIA_HY000, 0,
tr("setRow() not supported when SQL_CURSOR_FORWARD_ONLY") ) );
+ resultGetData.doClear();
+
if ( !isValidRow( nRow ) )
{
nRow = 0;
@@ -101,6 +105,8 @@
if ( !isValidColumn( nColumn ) )
MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::DIA_HY000, 0,
"Invalid column." ) );
+ resultGetData.doClear();
+
if ( nColumn == 0 )
variantData = nRow; // bookmark is row num - obvious limitations apply
else
@@ -155,6 +161,8 @@
MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::DIA_HY010, 0,
tr("Resultset is read-only.") ) );
}
+ resultGetData.doClear();
+
SQLSMALLINT nColumns = getImpRowDesc()->getCount() - 1;
listResults.append( QVector<QVariant>( nColumns ) );
nRow = listResults.count();
@@ -179,6 +187,8 @@
if ( getState() < STATE_EXECUTED )
MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::DIA_HY010 ) );
+ resultGetData.doClear();
+
MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::DIA_HY000, 0,
tr("Resultset is read-only.") ) );
/*
Q_ASSERT( !isValidRow() );
@@ -203,6 +213,8 @@
if ( getState() < STATE_EXECUTED )
MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::DIA_HY010 ) );
+ resultGetData.doClear();
+
if ( !listResults.count() )
{
nRow = 0;
@@ -221,6 +233,8 @@
if ( getState() < STATE_EXECUTED )
MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::DIA_HY010 ) );
+ resultGetData.doClear();
+
MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::DIA_HY000, 0,
tr("Resultset is read-only.") ) );
/*
if ( nRow == 0 )
@@ -241,6 +255,8 @@
if ( getState() < STATE_EXECUTED )
MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::DIA_HY010 ) );
+ resultGetData.doClear();
+
nRow = listResults.count();
if ( !isValidRow() )
MYODBCDbgReturn( SQL_NO_DATA );
@@ -258,6 +274,8 @@
if ( !isValidRow() )
MYODBCDbgReturn( doFirst() );
+ resultGetData.doClear();
+
nRow++;
if ( !isValidRow() )
MYODBCDbgReturn( SQL_NO_DATA );
@@ -281,6 +299,8 @@
if ( !isValidRow() )
MYODBCDbgReturn( doLast() );
+ resultGetData.doClear();
+
nRow--;
if ( !isValidRow() )
MYODBCDbgReturn( SQL_NO_DATA );
@@ -297,6 +317,8 @@
Q_ASSERT( nRows == 0 );
+ resultGetData.doClear();
+
if ( !isValidRow( nRow + nRows ) )
{
nRow = 0;
@@ -518,6 +540,7 @@
nRow = 0;
getImpParamDesc()->doClear();
getImpRowDesc()->doClear();
+ resultGetData.doClear();
setState( STATE_INITIALIZED ); /* we do not use a 'prepared' state */
break;
Modified: MYSQLPlus/MYSQLPlusLib/MResultStmt.cpp
===================================================================
--- MYSQLPlus/MYSQLPlusLib/MResultStmt.cpp 2006-05-17 06:55:08 UTC (rev 250)
+++ MYSQLPlus/MYSQLPlusLib/MResultStmt.cpp 2006-05-17 20:20:50 UTC (rev 251)
@@ -86,6 +86,8 @@
if ( nColumn == 0 )
MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::DIA_HY000, 0,
tr("Invalid column. Bookmark column is read-only.") ) );
+ resultGetData.doClear();
+
/*! \internal
\todo
@@ -128,6 +130,8 @@
if ( nRow == this->nRow )
MYODBCDbgReturn( SQL_SUCCESS );
+ resultGetData.doClear();
+
if ( !isBuffered() )
{
if ( nRow < this->nRow )
@@ -216,6 +220,8 @@
if ( !isValidColumn( nColumn ) )
MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::DIA_HY000, 0,
tr("Invalid column.") ) );
+ resultGetData.doClear();
+
if ( nColumn == 0 )
{
/*!
@@ -236,7 +242,7 @@
MYSQL_BIND *pbind = &(pbindColumns[nColumn - 1]);
if ( pbindColumns->is_null )
- variantData = QVariant();
+ variantData.clear();
else
{
switch ( pbind->buffer_type )
@@ -263,7 +269,7 @@
variantData.setValue( *((double*)pbind->buffer) );
break;
case MYSQL_TYPE_NULL:
- variantData = QVariant();
+ variantData.clear();
break;
case MYSQL_TYPE_TIME:
case MYSQL_TYPE_DATE:
@@ -387,6 +393,8 @@
if ( getStatement()->getConcurrency() == SQL_CONCUR_READ_ONLY )
MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::DIA_HY000, 0,
tr("Resultset is read-only.") ) );
+ resultGetData.doClear();
+
/*!
\internal
\todo
@@ -443,6 +451,8 @@
if ( getStatement()->getConcurrency() == SQL_CONCUR_READ_ONLY )
MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::DIA_HY000, 0,
tr("Resultset is read-only.") ) );
+ resultGetData.doClear();
+
/*!
\internal
\todo
@@ -533,6 +543,8 @@
if ( !isBuffered() )
MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::DIA_HY000, 0,
tr("doFirst() not supported for unbuffered resultset") ) );
+ resultGetData.doClear();
+
if ( !isValidRow( 1 ) )
{
nRow = 0;
@@ -565,6 +577,8 @@
if ( getStatement()->getConcurrency() == SQL_CONCUR_READ_ONLY )
MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::DIA_HY000, 0,
tr("Resultset is read-only.") ) );
+ resultGetData.doClear();
+
/*!
\internal
\todo
@@ -604,6 +618,8 @@
if ( !isBuffered() )
MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::DIA_HY000, 0,
tr("doLast() not supported for unbuffered resultset") ) );
+ resultGetData.doClear();
+
qulonglong nRows = 0;
getRows( &nRows );
if ( nRows == 0 )
@@ -645,6 +661,8 @@
if ( getState() < STATE_EXECUTED )
MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::DIA_HY010 ) );
+ resultGetData.doClear();
+
if ( isBuffered() )
{
if ( !isValidRow( nRow + 1 ) )
@@ -760,6 +778,8 @@
if ( !isValidRow() )
MYODBCDbgReturn( doLast() );
+ resultGetData.doClear();
+
if ( !isValidRow( nRow - 1 ) )
{
nRow = 0;
@@ -810,6 +830,8 @@
MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::DIA_HY000, 0,
tr("doSkip() not fully supported when unbuffered resultset") ) );
}
+ resultGetData.doClear();
+
if ( isBuffered() )
{
if ( (nRow + nRows) <= 0 || !isValidRow( nRow + nRows ) )
@@ -990,6 +1012,7 @@
if ( !mysql_stmt_reset( pstm ) )
MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::DIA_HY000,
mysql_stmt_errno( pstm ), mysql_stmt_error( pstm ) ) );
nRow = 0;
+ resultGetData.doClear();
setState( STATE_PREPARED );
break;
@@ -1008,6 +1031,8 @@
{
MYODBCDbgEnter();
+ resultGetData.doClear();
+
/* state etc validation done by caller */
/* this must only be called when isBuffered() but we leave that up to the caller */
| Thread |
|---|
| • Connector/ODBC 5 commit: r251 - MYSQLPlus/MYSQLPlusLib | pharvey | 17 May |