Modified:
trunk/SDK/MYSQLPlus/Library/MResult.cpp
trunk/SDK/MYSQLPlus/Library/MResult.h
trunk/SDK/MYSQLPlus/Library/MStatement.cpp
Log:
FIX: A partial fix for SQLGetData for issue uncovered during testing with MS Access.
Moving work over to WIN64 to include WIN64 port in scope of work (and be on a faster
machine).
Modified: trunk/SDK/MYSQLPlus/Library/MResult.cpp
===================================================================
--- trunk/SDK/MYSQLPlus/Library/MResult.cpp 2006-10-03 14:57:20 UTC (rev 569)
+++ trunk/SDK/MYSQLPlus/Library/MResult.cpp 2006-10-04 03:09:09 UTC (rev 570)
@@ -39,14 +39,15 @@
nTargetType = SQL_C_DEFAULT;
pTarget = NULL;
nBytesMax = 0;
- pnBytesRemaining = NULL;
+ pnLength = NULL;
pnIndicator = NULL;
nTargetTypeAdjusted = SQL_C_CHAR;
- nIndicator = 0; /* hopefully unused and invalid - we do not want to use
a valid value here - messed up merge of ind and len */
+ nLength = 0;
+ nIndicator = 0; /* init to, hopefully, unused and invalid value - we do
not want to use a valid value here - will mess up merge of ind and len */
nRow = 0;
- pDescriptorRecordIRD = NULL;
- pDescriptorRecordARD = NULL;
+ pImpRowDescRec = NULL;
+ pAppRowDescRec = NULL;
nBytesRemaining = 0;
stringData.clear();
@@ -1610,7 +1611,7 @@
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/odbc/htm/odbcconverting_data_from_sql_to_c_data_types.asp
*/
- switch ( resultGetData.pDescriptorRecordIRD->getConciseType() )
+ switch ( resultGetData.pImpRowDescRec->getConciseType() )
{
case SQL_CHAR:
case SQL_VARCHAR:
@@ -1639,28 +1640,28 @@
break;
case SQL_TINYINT:
- if ( resultGetData.pDescriptorRecordIRD->getUnsigned() == SQL_TRUE )
+ if ( resultGetData.pImpRowDescRec->getUnsigned() == SQL_TRUE )
resultGetData.nTargetTypeAdjusted = SQL_C_STINYINT;
else
resultGetData.nTargetTypeAdjusted = SQL_C_UTINYINT;
break;
case SQL_SMALLINT:
- if ( resultGetData.pDescriptorRecordIRD->getUnsigned() == SQL_TRUE )
+ if ( resultGetData.pImpRowDescRec->getUnsigned() == SQL_TRUE )
resultGetData.nTargetTypeAdjusted = SQL_C_SSHORT;
else
resultGetData.nTargetTypeAdjusted = SQL_C_USHORT;
break;
case SQL_INTEGER:
- if ( resultGetData.pDescriptorRecordIRD->getUnsigned() == SQL_TRUE )
+ if ( resultGetData.pImpRowDescRec->getUnsigned() == SQL_TRUE )
resultGetData.nTargetTypeAdjusted = SQL_C_SLONG;
else
resultGetData.nTargetTypeAdjusted = SQL_C_ULONG;
break;
case SQL_BIGINT:
- if ( resultGetData.pDescriptorRecordIRD->getUnsigned() == SQL_TRUE )
+ if ( resultGetData.pImpRowDescRec->getUnsigned() == SQL_TRUE )
resultGetData.nTargetTypeAdjusted = SQL_C_SBIGINT;
else
resultGetData.nTargetTypeAdjusted = SQL_C_UBIGINT;
@@ -1883,9 +1884,19 @@
This supports the getData() which operates on RowSetRow AND doRefresh()
(bound array or single row).
- \param nRowsIndex Index into vectorRows. 0-based.
- \param nColumn Index into vectorRows[nRow]. 1-based.
+ \param nRowsIndex Index into vectorRows. 0-based.
+ \param nColumn Index into vectorRows[nRow]. 1-based.
+ \param nTargetType
+ \param pTarget
+ \param nBufferLength
+ \param pnLength ODBC RULE: "For data being retrieved from the data source,
this is the byte length of the data
+ after conversion to the data buffer's type and before any
truncation is done."
+ ODBC RULE: "If the byte length of the data is greater than
the byte length of the buffer, the driver truncates
+ fetched data to the byte length of the buffer and returns
SQL_SUCCESS_WITH_INFO with SQLSTATE 01004
+ (Data truncated). However, the returned byte length is the
length of the untruncated data."
+ \param pnIndicator
+
*/
SQLRETURN MResult::getData( SQLUINTEGER nRowsIndex, SQLUSMALLINT nColumn, SQLSMALLINT
nTargetType, SQLPOINTER pTarget, SQLINTEGER nBufferLength, SQLINTEGER *pnLength,
SQLINTEGER *pnIndicator )
{
@@ -1899,23 +1910,22 @@
*/
if ( resultGetData.isChunkingRequest( nRowsIndex, nColumn ) )
{
- if ( MDescriptorRecordIRD::isVariableLength(
resultGetData.pDescriptorRecordIRD->getConciseType() ) )
+ if ( MDescriptorRecordIRD::isVariableLength(
resultGetData.pImpRowDescRec->getConciseType() ) )
{
- if ( *(resultGetData.pnBytesRemaining) == 0 ||
vectorRows[resultGetData.nRow][resultGetData.nColumn - 1].isNull() )
+ if ( resultGetData.nBytesRemaining == 0 ||
vectorRows[resultGetData.nRow][resultGetData.nColumn - 1].isNull() )
MYODBCDbgReturn( SQL_NO_DATA );
/*!
\internal
\note
- We assume that nTargetType (and some others) have not changed!!!
+ We assume that nTargetType has not changed!!! In this way we *avoid*
having to convert
+ data & recalc length after the first call.
*/
- resultGetData.nBytesMax = nBufferLength;
- resultGetData.pnBytesRemaining = pnLength;
- resultGetData.pnIndicator = pnIndicator;
- resultGetData.pTarget = pTarget;
- if ( !resultGetData.pnBytesRemaining )
- resultGetData.pnBytesRemaining = &resultGetData.nBytesRemaining;
+ resultGetData.pTarget = pTarget;
+ resultGetData.nBytesMax = nBufferLength;
+ resultGetData.pnLength = pnLength;
+ resultGetData.pnIndicator = pnIndicator;
}
else
{
@@ -1930,26 +1940,27 @@
}
else
{
- /* init our get data state */
+ /* init our get data state (beyond doClear()) */
resultGetData.doClear();
resultGetData.bInUse = true;
resultGetData.nBytesMax = nBufferLength;
resultGetData.nColumn = nColumn;
resultGetData.nTargetType = nTargetType;
resultGetData.nTargetTypeAdjusted = nTargetType;
- resultGetData.pDescriptorRecordIRD =
(MDescriptorRecordIRD*)getImpRowDesc()->getRecord( nColumn );
- resultGetData.pnBytesRemaining = pnLength;
+ resultGetData.pImpRowDescRec =
(MDescriptorRecordIRD*)getImpRowDesc()->getRecord( nColumn );
+ resultGetData.pnLength = pnLength;
resultGetData.pnIndicator = pnIndicator;
resultGetData.pTarget = pTarget;
resultGetData.nRow = nRowsIndex;
- if ( !resultGetData.pnBytesRemaining )
- resultGetData.pnBytesRemaining = &resultGetData.nBytesRemaining;
/* get indicator value; no need to process further if we are null */
if ( vectorRows[resultGetData.nRow][resultGetData.nColumn - 1].isNull() )
{
- resultGetData.nIndicator = SQL_NULL_DATA;
- *resultGetData.pnBytesRemaining = 0;
+ resultGetData.nIndicator = SQL_NULL_DATA;
+
+ if ( resultGetData.pnLength )
+ *resultGetData.pnLength = 0;
+
if ( resultGetData.pnIndicator )
{
*resultGetData.pnIndicator = resultGetData.nIndicator;
@@ -1999,8 +2010,8 @@
TargetType argument of SQL_ARD_TYPE, which will cause the precision and
scale values in
the descriptor fields to be used.
*/
- resultGetData.pDescriptorRecordARD =
(MDescriptorRecordARD*)getAppRowDesc()->getRecord( nColumn );
- resultGetData.nTargetTypeAdjusted =
resultGetData.pDescriptorRecordARD->getConciseType();
+ resultGetData.pAppRowDescRec =
(MDescriptorRecordARD*)getAppRowDesc()->getRecord( nColumn );
+ resultGetData.nTargetTypeAdjusted =
resultGetData.pAppRowDescRec->getConciseType();
/* sanity check to prevent 'looping' */
if ( resultGetData.nTargetTypeAdjusted == SQL_ARD_TYPE )
@@ -2041,7 +2052,7 @@
get data state in resultGetData - including cell data in our variant (data
conversion 'hub').
Now lets convert the data (select a 'spoke to head out on').
*/
- switch ( resultGetData.pDescriptorRecordIRD->getConciseType() )
+ switch ( resultGetData.pImpRowDescRec->getConciseType() )
{
case SQL_CHAR:
case SQL_VARCHAR:
@@ -2828,19 +2839,19 @@
{
if ( MYODBCC::doStringCopyOut( (SQLCHAR*)pResultGetData->pTarget,
pResultGetData->nBytesMax, (SQLCHAR*)pResultGetData->stringData.toAscii().data() )
)
{
- *pResultGetData->pnBytesRemaining = 0;
+ pResultGetData->nBytesRemaining = 0;
}
else
{
/* remove chars returned thus far from our working copy */
- *pResultGetData->pnBytesRemaining = pResultGetData->stringData.length()
- pResultGetData->nBytesMax;
+ pResultGetData->nBytesRemaining = pResultGetData->stringData.length() -
pResultGetData->nBytesMax;
pResultGetData->stringData.remove( 0, pResultGetData->nBytesMax );
MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::DIA_01004 ) );
}
}
else
{
- *pResultGetData->pnBytesRemaining = pResultGetData->stringData.length();
+ pResultGetData->nBytesRemaining = pResultGetData->stringData.length();
MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::DIA_01004 ) );
}
@@ -2896,19 +2907,19 @@
{
if ( MYODBCC::doStringCopyOut( (SQLWCHAR*)pResultGetData->pTarget,
pResultGetData->nBytesMax / sizeof(SQLWCHAR),
(SQLWCHAR*)pResultGetData->stringData.utf16() ) )
{
- *pResultGetData->pnBytesRemaining = 0;
+ pResultGetData->nBytesRemaining = 0;
}
else
{
/* remove chars returned thus far from our working copy */
- *pResultGetData->pnBytesRemaining = pResultGetData->stringData.length()
- pResultGetData->nBytesMax;
+ pResultGetData->nBytesRemaining = pResultGetData->stringData.length() -
pResultGetData->nBytesMax;
pResultGetData->stringData.remove( 0, pResultGetData->nBytesMax /
sizeof(SQLWCHAR) );
MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::DIA_01004 ) );
}
}
else
{
- *pResultGetData->pnBytesRemaining = pResultGetData->stringData.length() *
sizeof(SQLWCHAR);
+ pResultGetData->nBytesRemaining = pResultGetData->stringData.length() *
sizeof(SQLWCHAR);
MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::DIA_01004 ) );
}
@@ -2948,7 +2959,7 @@
*/
if ( !pResultGetData->pTarget )
{
- *pResultGetData->pnBytesRemaining = sizeof(short int);
+ pResultGetData->nBytesRemaining = sizeof(short int);
MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::DIA_01004 ) );
}
@@ -2957,7 +2968,7 @@
*((short int *)(pResultGetData->pTarget)) = (short
int)vectorRows[pResultGetData->nRow][pResultGetData->nColumn - 1].toInt();
- *pResultGetData->pnBytesRemaining = 0;
+ pResultGetData->nBytesRemaining = 0;
MYODBCDbgReturn( SQL_SUCCESS );
}
@@ -2985,7 +2996,7 @@
*/
if ( !pResultGetData->pTarget )
{
- *pResultGetData->pnBytesRemaining = sizeof(unsigned short int);
+ pResultGetData->nBytesRemaining = sizeof(unsigned short int);
MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::DIA_01004 ) );
}
@@ -2994,7 +3005,7 @@
*((unsigned short int *)pResultGetData->pTarget) = (unsigned short
int)vectorRows[pResultGetData->nRow][pResultGetData->nColumn - 1].toUInt();
- *pResultGetData->pnBytesRemaining = 0;
+ pResultGetData->nBytesRemaining = 0;
MYODBCDbgReturn( SQL_SUCCESS );
}
@@ -3022,7 +3033,7 @@
*/
if ( !pResultGetData->pTarget )
{
- *pResultGetData->pnBytesRemaining = sizeof(long int);
+ pResultGetData->nBytesRemaining = sizeof(long int);
MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::DIA_01004 ) );
}
@@ -3032,10 +3043,10 @@
Try to be smart about dates and times. We probably could do this for all numeric
types but
for now do it here so we are compat. with v3.
*/
- if ( pResultGetData->pDescriptorRecordIRD->getConciseType() ==
SQL_TYPE_TIMESTAMP ||
- pResultGetData->pDescriptorRecordIRD->getConciseType() == SQL_TYPE_TIME
||
- pResultGetData->pDescriptorRecordIRD->getConciseType() == SQL_TYPE_DATE
||
- pResultGetData->pDescriptorRecordIRD->getConciseType() ==
SQL_TYPE_TIMESTAMP )
+ if ( pResultGetData->pImpRowDescRec->getConciseType() == SQL_TYPE_TIMESTAMP
||
+ pResultGetData->pImpRowDescRec->getConciseType() == SQL_TYPE_TIME
||
+ pResultGetData->pImpRowDescRec->getConciseType() == SQL_TYPE_DATE
||
+ pResultGetData->pImpRowDescRec->getConciseType() == SQL_TYPE_TIMESTAMP )
{
if ( !vectorRows[pResultGetData->nRow][pResultGetData->nColumn -
1].canConvert<QDateTime>() )
MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::DIA_07006 ) );
@@ -3050,7 +3061,7 @@
*((long int *)pResultGetData->pTarget) = (long
int)vectorRows[pResultGetData->nRow][pResultGetData->nColumn - 1].toLongLong();
}
- *pResultGetData->pnBytesRemaining = 0;
+ pResultGetData->nBytesRemaining = 0;
MYODBCDbgReturn( SQL_SUCCESS );
}
@@ -3078,7 +3089,7 @@
*/
if ( !pResultGetData->pTarget )
{
- *pResultGetData->pnBytesRemaining = sizeof(unsigned long int);
+ pResultGetData->nBytesRemaining = sizeof(unsigned long int);
MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::DIA_01004 ) );
}
@@ -3087,7 +3098,7 @@
*((unsigned long int *)pResultGetData->pTarget) = (unsigned long
int)vectorRows[pResultGetData->nRow][pResultGetData->nColumn - 1].toULongLong();
- *pResultGetData->pnBytesRemaining = 0;
+ pResultGetData->nBytesRemaining = 0;
MYODBCDbgReturn( SQL_SUCCESS );
}
@@ -3115,7 +3126,7 @@
*/
if ( !pResultGetData->pTarget )
{
- *pResultGetData->pnBytesRemaining = sizeof(float);
+ pResultGetData->nBytesRemaining = sizeof(float);
MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::DIA_01004 ) );
}
@@ -3124,7 +3135,7 @@
*((float *)pResultGetData->pTarget) =
(float)vectorRows[pResultGetData->nRow][pResultGetData->nColumn - 1].toDouble();
- *pResultGetData->pnBytesRemaining = 0;
+ pResultGetData->nBytesRemaining = 0;
MYODBCDbgReturn( SQL_SUCCESS );
}
@@ -3152,7 +3163,7 @@
*/
if ( !pResultGetData->pTarget )
{
- *pResultGetData->pnBytesRemaining = sizeof(double);
+ pResultGetData->nBytesRemaining = sizeof(double);
MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::DIA_01004 ) );
}
@@ -3161,7 +3172,7 @@
*((double *)pResultGetData->pTarget) =
(double)vectorRows[pResultGetData->nRow][pResultGetData->nColumn - 1].toDouble();
- *pResultGetData->pnBytesRemaining = 0;
+ pResultGetData->nBytesRemaining = 0;
MYODBCDbgReturn( SQL_SUCCESS );
}
@@ -3189,7 +3200,7 @@
*/
if ( !pResultGetData->pTarget )
{
- *pResultGetData->pnBytesRemaining = sizeof(unsigned char);
+ pResultGetData->nBytesRemaining = sizeof(unsigned char);
MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::DIA_01004 ) );
}
@@ -3213,7 +3224,7 @@
getDiagnostic()->doAppend( MDiagnostic::DIA_01000, 0, tr("value out of range
for a bit - has been forced to 1") );
}
- *pResultGetData->pnBytesRemaining = 0;
+ pResultGetData->nBytesRemaining = 0;
MYODBCDbgReturn( SQL_SUCCESS );
}
@@ -3241,7 +3252,7 @@
*/
if ( !pResultGetData->pTarget )
{
- *pResultGetData->pnBytesRemaining = sizeof(char);
+ pResultGetData->nBytesRemaining = sizeof(char);
MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::DIA_01004 ) );
}
@@ -3250,7 +3261,7 @@
*((char *)pResultGetData->pTarget) =
vectorRows[pResultGetData->nRow][pResultGetData->nColumn - 1].toInt();
- *pResultGetData->pnBytesRemaining = 0;
+ pResultGetData->nBytesRemaining = 0;
MYODBCDbgReturn( SQL_SUCCESS );
}
@@ -3278,7 +3289,7 @@
*/
if ( !pResultGetData->pTarget )
{
- *pResultGetData->pnBytesRemaining = sizeof(unsigned char);
+ pResultGetData->nBytesRemaining = sizeof(unsigned char);
MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::DIA_01004 ) );
}
@@ -3287,7 +3298,7 @@
*((unsigned char *)pResultGetData->pTarget) =
vectorRows[pResultGetData->nRow][pResultGetData->nColumn - 1].toInt();
- *pResultGetData->pnBytesRemaining = 0;
+ pResultGetData->nBytesRemaining = 0;
MYODBCDbgReturn( SQL_SUCCESS );
}
@@ -3315,7 +3326,7 @@
*/
if ( !pResultGetData->pTarget )
{
- *pResultGetData->pnBytesRemaining = sizeof(qint64);
+ pResultGetData->nBytesRemaining = sizeof(qint64);
MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::DIA_01004 ) );
}
@@ -3324,7 +3335,7 @@
*((qint64 *)pResultGetData->pTarget) =
(qint64)vectorRows[pResultGetData->nRow][pResultGetData->nColumn - 1].toLongLong();
- *pResultGetData->pnBytesRemaining = 0;
+ pResultGetData->nBytesRemaining = 0;
MYODBCDbgReturn( SQL_SUCCESS );
}
@@ -3352,7 +3363,7 @@
*/
if ( !pResultGetData->pTarget )
{
- *pResultGetData->pnBytesRemaining = sizeof(quint64);
+ pResultGetData->nBytesRemaining = sizeof(quint64);
MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::DIA_01004 ) );
}
@@ -3361,7 +3372,7 @@
*((quint64 *)pResultGetData->pTarget) =
(quint64)vectorRows[pResultGetData->nRow][pResultGetData->nColumn -
1].toLongLong();
- *pResultGetData->pnBytesRemaining = 0;
+ pResultGetData->nBytesRemaining = 0;
MYODBCDbgReturn( SQL_SUCCESS );
}
@@ -3397,19 +3408,19 @@
MYODBCC::doMemCpy( pResultGetData->pTarget,
pResultGetData->bytearrayData.constData(), min( pResultGetData->nBytesMax,
pResultGetData->bytearrayData.size() ) );
if ( pResultGetData->bytearrayData.size() < pResultGetData->nBytesMax )
{
- *pResultGetData->pnBytesRemaining = 0;
+ pResultGetData->nBytesRemaining = 0;
}
else
{
/* remove chars returned thus far from our working copy */
- *pResultGetData->pnBytesRemaining =
pResultGetData->bytearrayData.size() - pResultGetData->nBytesMax;
+ pResultGetData->nBytesRemaining = pResultGetData->bytearrayData.size()
- pResultGetData->nBytesMax;
pResultGetData->bytearrayData.remove( 0, pResultGetData->nBytesMax );
MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::DIA_01004 ) );
}
}
else
{
- *pResultGetData->pnBytesRemaining = pResultGetData->bytearrayData.size();
+ pResultGetData->nBytesRemaining = pResultGetData->bytearrayData.size();
MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::DIA_01004 ) );
}
@@ -3461,7 +3472,7 @@
*/
if ( !pResultGetData->pTarget )
{
- *pResultGetData->pnBytesRemaining = sizeof(SQL_DATE_STRUCT);
+ pResultGetData->nBytesRemaining = sizeof(SQL_DATE_STRUCT);
MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::DIA_01004 ) );
}
@@ -3475,7 +3486,7 @@
pDateTarget->month = d.month();
pDateTarget->year = d.year();
- *pResultGetData->pnBytesRemaining = 0;
+ pResultGetData->nBytesRemaining = 0;
MYODBCDbgReturn( SQL_SUCCESS );
}
@@ -3503,7 +3514,7 @@
*/
if ( !pResultGetData->pTarget )
{
- *pResultGetData->pnBytesRemaining = sizeof(SQL_TIME_STRUCT);
+ pResultGetData->nBytesRemaining = sizeof(SQL_TIME_STRUCT);
MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::DIA_01004 ) );
}
@@ -3517,7 +3528,7 @@
pTimeTarget->minute = t.minute();
pTimeTarget->second = t.second();
- *pResultGetData->pnBytesRemaining = 0;
+ pResultGetData->nBytesRemaining = 0;
MYODBCDbgReturn( SQL_SUCCESS );
}
@@ -3545,7 +3556,7 @@
*/
if ( !pResultGetData->pTarget )
{
- *pResultGetData->pnBytesRemaining = sizeof(SQL_TIMESTAMP_STRUCT);
+ pResultGetData->nBytesRemaining = sizeof(SQL_TIMESTAMP_STRUCT);
MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::DIA_01004 ) );
}
@@ -3563,7 +3574,7 @@
pTimeStampTarget->second = t.time().second();
pTimeStampTarget->year = t.date().year();
- *pResultGetData->pnBytesRemaining = 0;
+ pResultGetData->nBytesRemaining = 0;
MYODBCDbgReturn( SQL_SUCCESS );
}
@@ -3612,7 +3623,7 @@
*/
if ( !pResultGetData->pTarget )
{
- *pResultGetData->pnBytesRemaining = sizeof(SQL_NUMERIC_STRUCT);
+ pResultGetData->nBytesRemaining = sizeof(SQL_NUMERIC_STRUCT);
MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::DIA_01004 ) );
}
@@ -3636,10 +3647,10 @@
pNumericTarget->sign = 1;
/* is default being overidden with ARD? */
- if ( pResultGetData->pDescriptorRecordARD )
+ if ( pResultGetData->pAppRowDescRec )
{
- pNumericTarget->precision =
pResultGetData->pDescriptorRecordARD->getPrecision();
- pNumericTarget->scale =
pResultGetData->pDescriptorRecordARD->getScale();
+ pNumericTarget->precision =
pResultGetData->pAppRowDescRec->getPrecision();
+ pNumericTarget->scale = pResultGetData->pAppRowDescRec->getScale();
}
else
{
@@ -3714,7 +3725,7 @@
/*! \todo pack into 16 byte buffer */
/* set length */
- *pResultGetData->pnBytesRemaining = 0;
+ pResultGetData->nBytesRemaining = 0;
if ( bFractionalTruncation )
MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::DIA_01S07 ) );
Modified: trunk/SDK/MYSQLPlus/Library/MResult.h
===================================================================
--- trunk/SDK/MYSQLPlus/Library/MResult.h 2006-10-03 14:57:20 UTC (rev 569)
+++ trunk/SDK/MYSQLPlus/Library/MResult.h 2006-10-04 03:09:09 UTC (rev 570)
@@ -36,17 +36,18 @@
SQLSMALLINT nTargetType; /*!< C data type desired for value
in pTarget */
SQLPOINTER pTarget; /*!< buffer to return cell data
*/
SQLINTEGER nBytesMax; /*!< size of pTarget buffer as per
SQLGetData */
- SQLINTEGER * pnBytesRemaining; /*!< bytes or chars remaining in
cell (possibly at end of last getData) */
- SQLINTEGER * pnIndicator; /*!< value indicates whether or
not the cell is NULL as per SQLGetData */
+ SQLINTEGER * pnLength; /*!< place to return nLength to
caller (optional) */
+ SQLINTEGER * pnIndicator; /*!< place to return nIndicator to
caller (mostly optional) */
/* these are additional fields which assist in maintaining our getData state */
BOOLEAN bInUse; /*!< true if we hold a valid get
data state (false if just cleared) */
SQLSMALLINT nTargetTypeAdjusted; /*!< is nTargetType, SQL_C_DEFAULT
derived, or ARD derived */
- SQLINTEGER nIndicator; /*!< cached ver of value at
pnIndicator */
+ SQLINTEGER nLength; /*!< bytes of data available
(after conversion - before any truncation) */
+ SQLINTEGER nIndicator; /*!< value indicates whether or
not the cell is NULL as per SQLGetData */
SQLUINTEGER nRow; /*!< index into vectorRows
(0-based) */
MDescriptorRecordIRD * pDescriptorRecordIRD; /*!< descriptor describing the
resultset column */
MDescriptorRecordARD * pDescriptorRecordARD; /*!< set if nTargetType ==
SQL_ARD_TYPE - otherwise this is null */
- SQLINTEGER nBytesRemaining; /*!< only used indirectly via
pnBytesRemaining when pnBytesRemaining==NULL - do not use otherwise! */
+ SQLINTEGER nBytesRemaining; /*!< bytes or chars remaining in
cell (possibly at end of last getData) */
/* we use these to avoid repeatedly converting data during chunking (optimize this -
particularly when we are chunking over the wire) */
QString stringData;
Modified: trunk/SDK/MYSQLPlus/Library/MStatement.cpp
===================================================================
--- trunk/SDK/MYSQLPlus/Library/MStatement.cpp 2006-10-03 14:57:20 UTC (rev 569)
+++ trunk/SDK/MYSQLPlus/Library/MStatement.cpp 2006-10-04 03:09:09 UTC (rev 570)
@@ -586,6 +586,11 @@
{
MYODBCDbgEnter();
+#if MYODBC_DBG > 1
+ MYODBCDbgInfo( QString( "nColumnNumber=%1" ).arg( nColumnNumber ) );
+ MYODBCDbgInfo( QString( "nTargetType=%1=%2" ).arg( nTargetType ).arg(
MYODBCC::getConciseTypeStringC( nTargetType ) ) );
+#endif
+
/*!
\internal ODBC RULE
@@ -768,12 +773,9 @@
// if ( nColumnNumber == 0 && nBufferLength < 4 && ODBCVER <
0x0300 && ODBCVER >= 0x0200 )
// MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::DIA_HY090 ) );
-MYODBCDbgInfo( QString( "PAH" ) );
-
SQLINTEGER nLength;
SQLINTEGER nIndicator;
SQLRETURN nReturn = pResult->getData( nColumnNumber, nTargetType, pTargetValue,
nBufferLength, &nLength, &nIndicator );
-MYODBCDbgInfo( QString( "PAH" ) );
if ( !SQL_SUCCEEDED(nReturn) )
MYODBCDbgReturn( nReturn );
@@ -781,6 +783,8 @@
/* merge nLength and nIndicator */
if ( pnStrLenOrInd )
{
+MYODBCDbgInfo( QString( "[PAH] nIndicator=%1" ).arg( nIndicator ) );
+MYODBCDbgInfo( QString( "[PAH] nLength=%1" ).arg( nLength ) );
if ( nIndicator == SQL_NULL_DATA || nIndicator == SQL_NO_TOTAL )
*pnStrLenOrInd = nIndicator;
else
| Thread |
|---|
| • Connector/ODBC 5 commit: r570 - trunk/SDK/MYSQLPlus/Library | pharvey | 4 Oct |