Added:
trunk/Driver/Driver/Tests/TSTNumericStruct.c
Modified:
trunk/Driver/Driver/Tests/DriverTests.vpj
trunk/Driver/Driver/Tests/MYODBCDriverTest.c
trunk/Driver/Driver/Tests/MYODBCDriverTest.h
trunk/Driver/Driver/Tests/Tests.pro
trunk/SDK/C/Library/MYODBCC.cpp
trunk/SDK/C/include/MYODBCC.h
trunk/SDK/MYSQLPlus/Library/MDescriptorRecord.cpp
trunk/SDK/MYSQLPlus/Library/MResult.cpp
trunk/SDK/MYSQLPlus/Library/MStatement.cpp
Log:
ENH: integrated num_pack() into MResult (we now support SQL_NUMERIC_STRUCT)
ENH: Added test for SQL_NUMERIC_STRUCT
ENH: Minor internal doc improvement
Modified: trunk/Driver/Driver/Tests/DriverTests.vpj
===================================================================
--- trunk/Driver/Driver/Tests/DriverTests.vpj 2006-11-15 09:09:19 UTC (rev 676)
+++ trunk/Driver/Driver/Tests/DriverTests.vpj 2006-11-15 10:12:03 UTC (rev 677)
@@ -74,6 +74,7 @@
<F N="TSTGetTypeInfo.c"/>
<F N="TSTInitStm.c"/>
<F N="TSTInsert.c"/>
+ <F N="TSTNumericStruct.c"/>
<F N="TSTNumResultCols.c"/>
<F N="TSTPrepare.c"/>
<F N="TSTPrimaryKeys.c"/>
Modified: trunk/Driver/Driver/Tests/MYODBCDriverTest.c
===================================================================
--- trunk/Driver/Driver/Tests/MYODBCDriverTest.c 2006-11-15 09:09:19 UTC (rev 676)
+++ trunk/Driver/Driver/Tests/MYODBCDriverTest.c 2006-11-15 10:12:03 UTC (rev 677)
@@ -44,6 +44,7 @@
{"SQLSetEnvAttr", TSTSetEnvAttr},
{"SQLAllocHandle (dbc)", TSTAllocHandleDbc},
{"SQLDriverConnect", TSTDriverConnect},
+ {"SQL_NUMERIC_STRUCT", TSTNumericStruct},
{"SQLConnect", TSTConnect},
{"SQLAllocHandle (stm)", TSTAllocHandleStm},
{"SQLGetTypeInfo", TSTGetTypeInfo},
Modified: trunk/Driver/Driver/Tests/MYODBCDriverTest.h
===================================================================
--- trunk/Driver/Driver/Tests/MYODBCDriverTest.h 2006-11-15 09:09:19 UTC (rev 676)
+++ trunk/Driver/Driver/Tests/MYODBCDriverTest.h 2006-11-15 10:12:03 UTC (rev 677)
@@ -116,6 +116,7 @@
BOOL TSTGetTypeInfo();
BOOL TSTInitStm();
BOOL TSTInsert();
+BOOL TSTNumericStruct();
BOOL TSTNumResultCols();
BOOL TSTPrepare();
BOOL TSTPrimaryKeys();
Added: trunk/Driver/Driver/Tests/TSTNumericStruct.c
===================================================================
--- trunk/Driver/Driver/Tests/TSTNumericStruct.c 2006-11-15 09:09:19 UTC (rev 676)
+++ trunk/Driver/Driver/Tests/TSTNumericStruct.c 2006-11-15 10:12:03 UTC (rev 677)
@@ -0,0 +1,132 @@
+
+/*! \file TSTInsert.c
+ \author Peter Harvey <pharvey@stripped>
+ Copyright (C) MySQL AB 2004-2006, Released under GPL.
+ \version Connector/ODBC v5
+ \date 2005
+ \brief Code to support driver testing.
+
+ \license Copyright (C) 2000-2006 MySQL AB
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ There are special exceptions to the terms and conditions of the GPL as it
+ is applied to this software. View the full text of the exception in file
+ EXCEPTIONS in the directory of this software distribution.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+*/
+#include "MYODBCDriverTest.h"
+
+/* little endian to scaled int */
+long TSTNumericStruct_toScaled( SQLCHAR *pPackedNumeric )
+{
+ int nByteIndex = 1;
+ int nByteValue;
+ long nValue = 0;
+ int nLSD = 0; /* Least Significant Digit */
+ int nMSD = 0; /* Most Significant Digit */
+ int nLast = 1;
+
+ for ( nByteIndex = 0; nByteIndex <= 15; nByteIndex++ )
+ {
+ nByteValue = (int)pPackedNumeric[nByteIndex];
+ nLSD = nByteValue % 16;
+ nMSD = nByteValue / 16;
+
+ nValue += nLast * nLSD;
+ nLast = nLast * 16;
+ nValue += nLast * nMSD;
+ nLast = nLast * 16;
+ }
+
+ return nValue;
+}
+
+BOOL TSTNumericStruct()
+{
+ SQLRETURN nReturn;
+ SQLHENV hEnv;
+ SQLHDBC hDbc;
+ SQLHSTMT hStm;
+ SQLHDESC hDes;
+ SQLINTEGER nStrLenOrInd1;
+ SQLINTEGER nStrLenOrInd2;
+ SQL_NUMERIC_STRUCT structNumeric;
+ int i;
+ int nSign = 1;
+ long nScaled;
+ long nDivisor;
+ float nValue;
+
+ /* INIT 1 */
+ nReturn = MYODBCTstAllocHandle( SQL_HANDLE_ENV, NULL, &hEnv );
+ nReturn = MYODBCTstSetEnvAttr( hEnv, SQL_ATTR_ODBC_VERSION, (SQLPOINTER)SQL_OV_ODBC3,
0 );
+ nReturn = MYODBCTstAllocHandle( SQL_HANDLE_DBC, hEnv, &hDbc );
+ nReturn = MYODBCTstConnect( hDbc, MYODBC_DRV_TST_SERVERNAME, SQL_NTS,
MYODBC_DRV_TST_USERNAME, SQL_NTS, MYODBC_DRV_TST_AUTHENTICATION, SQL_NTS );
+ nReturn = MYODBCTstAllocHandle( SQL_HANDLE_STMT, hDbc, &hStm );
+
+ /* INIT 2 */
+ nReturn = MYODBCTstExecDirect( hStm, _T("DROP TABLE IF EXISTS TSTNumericStruct"),
SQL_NTS );
+ nReturn = MYODBCTstExecDirect( hStm, _T("CREATE TABLE TSTNumericStruct ( n
NUMERIC(5,3) )"), SQL_NTS );
+ nReturn = MYODBCTstExecDirect( hStm, _T("INSERT INTO TSTNumericStruct VALUES
(25.212)"), SQL_NTS );
+ nReturn = MYODBCTstExecDirect( hStm, _T("SELECT * FROM TSTNumericStruct"), SQL_NTS );
+
+ /* INIT 3 */
+ nReturn = SQLBindCol( hStm, 1, SQL_C_NUMERIC, &structNumeric, 19,
&nStrLenOrInd1 );
+ nReturn = SQLGetStmtAttr( hStm, SQL_ATTR_APP_ROW_DESC, &hDes, 0, NULL );
+ nReturn = SQLSetDescField( hDes, 1, SQL_DESC_TYPE, (VOID*)SQL_C_NUMERIC, 0 );
+ nReturn = SQLSetDescField( hDes, 1, SQL_DESC_PRECISION, (VOID*)5, 0 );
+ nReturn = SQLSetDescField( hDes, 1, SQL_DESC_SCALE, (VOID*)3, 0 );
+
+ memset( structNumeric.val, 0, 16 );
+
+ /* MAIN */
+ while ( ( nReturn = MYODBCTstFetch( hStm ) ) != SQL_NO_DATA )
+ {
+ nReturn = MYODBCTstGetData( hStm, 1, SQL_ARD_TYPE, &structNumeric, 19,
&nStrLenOrInd2 );
+ if ( SQL_NULL_DATA == nStrLenOrInd2 )
+ {
+ printf( "The final value: NULL\n" );
+ continue;
+ }
+
+ nScaled = TSTNumericStruct_toScaled( structNumeric.val );
+
+ nDivisor = 1;
+ if ( structNumeric.scale > 0 )
+ {
+ for ( i = 0; i < structNumeric.scale; i++ )
+ nDivisor = nDivisor * 10;
+ }
+ nValue = (float)nScaled / (float)nDivisor;
+
+ if ( !structNumeric.sign )
+ nSign = -1;
+ else
+ nSign = 1;
+
+ nValue *= nSign;
+ printf( "The final value: %f\n", nValue );
+ }
+
+ /* FINI 1 */
+ nReturn = MYODBCTstFreeHandle( SQL_HANDLE_STMT, hStm );
+ nReturn = MYODBCTstDisconnect( hDbc );
+ nReturn = MYODBCTstFreeHandle( SQL_HANDLE_DBC, hDbc );
+ nReturn = MYODBCTstFreeHandle( SQL_HANDLE_ENV, hEnv );
+
+ return TRUE;
+}
+
+
Modified: trunk/Driver/Driver/Tests/Tests.pro
===================================================================
--- trunk/Driver/Driver/Tests/Tests.pro 2006-11-15 09:09:19 UTC (rev 676)
+++ trunk/Driver/Driver/Tests/Tests.pro 2006-11-15 10:12:03 UTC (rev 677)
@@ -55,6 +55,7 @@
TSTGetTypeInfo.c \
TSTInitStm.c \
TSTInsert.c \
+ TSTNumericStruct.c \
TSTNumResultCols.c \
TSTPrepare.c \
TSTPrimaryKeys.c \
Modified: trunk/SDK/C/Library/MYODBCC.cpp
===================================================================
--- trunk/SDK/C/Library/MYODBCC.cpp 2006-11-15 09:09:19 UTC (rev 676)
+++ trunk/SDK/C/Library/MYODBCC.cpp 2006-11-15 10:12:03 UTC (rev 677)
@@ -397,6 +397,121 @@
return (pc - pszzKeywordValues);
}
+QString MYODBCC::getEscaped( QByteArray bytearrayBinary )
+{
+ QString stringEscaped;
+
+ for ( int nByte = 0; nByte < bytearrayBinary.size(); nByte++ )
+ {
+ switch ( bytearrayBinary[nByte] )
+ {
+ case 0: /* Must be escaped for 'mysql' */
+ stringEscaped += '\\';
+ stringEscaped += bytearrayBinary[nByte];
+ break;
+ case '\n': /* Must be escaped for logs */
+ stringEscaped += '\\';
+ stringEscaped += bytearrayBinary[nByte];
+ break;
+ case '\r':
+ stringEscaped += '\\';
+ stringEscaped += bytearrayBinary[nByte];
+ break;
+ case '\\':
+ stringEscaped += '\\';
+ stringEscaped += bytearrayBinary[nByte];
+ break;
+ case '\'':
+ stringEscaped += '\\';
+ stringEscaped += bytearrayBinary[nByte];
+ break;
+ case '"': /* Better safe than sorry */
+ stringEscaped += '\\';
+ stringEscaped += bytearrayBinary[nByte];
+ break;
+ case '\032': /* This gives problems on Win32 */
+ stringEscaped += '\\';
+ stringEscaped += 'Z';
+ break;
+ default:
+ stringEscaped += bytearrayBinary[nByte];
+ }
+ }
+/*
+ char * STDCALL
+ mysql_odbc_escape_string(MYSQL *mysql,
+ char *to, ulong to_length,
+ const char *from, ulong from_length,
+ void *param,
+ char * (*extend_buffer)
+ (void *, char *, ulong *))
+ {
+ char *to_end=to+to_length-5;
+ const char *end;
+ #ifdef USE_MB
+ my_bool use_mb_flag=use_mb(mysql->charset);
+ #endif
+
+ for (end=from+from_length; from != end ; from++)
+ {
+ if (to >= to_end)
+ {
+ to_length = (ulong) (end-from)+512;
+ if (!(to=(*extend_buffer)(param, to, &to_length)))
+ return to;
+ to_end=to+to_length-5;
+ }
+ #ifdef USE_MB
+ {
+ int l;
+ if (use_mb_flag && (l = my_ismbchar(mysql->charset, from, end)))
+ {
+ while (l--)
+ *to++ = *from++;
+ from--;
+ continue;
+ }
+ }
+ #endif
+ switch (*from) {
+ case 0:
+ *to++= '\\';
+ *to++= '0';
+ break;
+ case '\n':
+ *to++= '\\';
+ *to++= 'n';
+ break;
+ case '\r':
+ *to++= '\\';
+ *to++= 'r';
+ break;
+ case '\\':
+ *to++= '\\';
+ *to++= '\\';
+ break;
+ case '\'':
+ *to++= '\\';
+ *to++= '\'';
+ break;
+ case '"':
+ *to++= '\\';
+ *to++= '"';
+ break;
+ case '\032':
+ *to++= '\\';
+ *to++= 'Z';
+ break;
+ default:
+ *to++= *from;
+ }
+ }
+ return to;
+ }
+*/
+ return stringEscaped;
+}
+
QString MYODBCC::getConnectAttrString( SQLINTEGER nAttribute )
{
switch ( nAttribute )
@@ -2505,7 +2620,7 @@
return str;
}
-void MYODBCC::num_pack( char *str, int val )
+void MYODBCC::num_pack( SQLCHAR *str, int val )
{
int i;
unsigned char a,b;
Modified: trunk/SDK/C/include/MYODBCC.h
===================================================================
--- trunk/SDK/C/include/MYODBCC.h 2006-11-15 09:09:19 UTC (rev 676)
+++ trunk/SDK/C/include/MYODBCC.h 2006-11-15 10:12:03 UTC (rev 677)
@@ -510,6 +510,8 @@
*/
static int getKeywordValuesLength( LPCWSTR pszKeywordValues );
+ static QString getEscaped( QByteArray bytearrayBinary );
+
/*!
\name Get string version of a numeric "#define"
@@ -585,18 +587,23 @@
/*@}*/
/*!
- \name Handle the 'val' member of SQL_NUMERIC_STRUCT.
+ \brief Pack an 'int' into a char buffer.
- Call num_pack to pack the given integer into the byte array
- of a SQL_NUMERIC_STRUCT and num_unpack to parse the integer
- from the byte array.
+ To support SQL_NUMERIC_STRUCT.
- The string is always 16 bytes long.
+ \param str 16 byte buffer to place packed int.
+ \param val int to pack
*/
- /*@{*/
- static void num_pack( char *str, int val );
+ static void num_pack( SQLCHAR *str, int val );
+
+ /*!
+ \brief Unpack a int from a char buffer.
+
+ To support SQL_NUMERIC_STRUCT.
+
+ \param str 16 byte buffer holding packed int
+ */
static int num_unpack( const char *str );
- /*@}*/
/*!
\name Method argument/attribute value validators.
Modified: trunk/SDK/MYSQLPlus/Library/MDescriptorRecord.cpp
===================================================================
--- trunk/SDK/MYSQLPlus/Library/MDescriptorRecord.cpp 2006-11-15 09:09:19 UTC (rev 676)
+++ trunk/SDK/MYSQLPlus/Library/MDescriptorRecord.cpp 2006-11-15 10:12:03 UTC (rev 677)
@@ -344,6 +344,10 @@
{
MYODBCDbgEnter();
+#if MYODBC_DBG > 1
+ MYODBCDbgInfo( QString( "nOctetLength=%1" ).arg( nOctetLength ) );
+#endif
+
this->nOctetLength = nOctetLength;
MYODBCDbgReturn( SQL_SUCCESS );
@@ -353,6 +357,12 @@
{
MYODBCDbgEnter();
+#if MYODBC_DBG > 1
+ MYODBCDbgInfo( QString( "pnOctetLengthPtr=%1" ).arg( (qulonglong)pnOctetLengthPtr )
);
+ if ( pnOctetLengthPtr )
+ MYODBCDbgInfo( QString( "*pnOctetLengthPtr=%1" ).arg( *pnOctetLengthPtr ) );
+#endif
+
this->pnOctetLengthPtr = pnOctetLengthPtr;
MYODBCDbgReturn( SQL_SUCCESS );
Modified: trunk/SDK/MYSQLPlus/Library/MResult.cpp
===================================================================
--- trunk/SDK/MYSQLPlus/Library/MResult.cpp 2006-11-15 09:09:19 UTC (rev 676)
+++ trunk/SDK/MYSQLPlus/Library/MResult.cpp 2006-11-15 10:12:03 UTC (rev 677)
@@ -3480,15 +3480,6 @@
pResultGetData->nBytesTotal = sizeof(SQL_NUMERIC_STRUCT);
pResultGetData->nBytesRemaining = 0;
- /*!
- \internal
- \todo
-
- Complete - our goal at the moment is to catch up to v3 in features so defer this
until later.
- */
- MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_07006 ) );
-
-
/* our high precision stuff (DECIMAL) is stored as a string and all other numerics
can be turned into a string
so lets use a string as our starting point - in this way we hope to catch &
report any possible loss of
precision/scale :) */
@@ -3503,7 +3494,7 @@
if ( !pResultGetData->pTarget )
MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_01004 ) );
- QString stringData = vectorRows[pResultGetData->nRow][pResultGetData->nColumn -
1].toString().trimmed();
+ QString stringData = vectorRows[pResultGetData->nRow][pResultGetData->nColumn
- 1].toString().trimmed();
/*!
\internal ODBC RULE
@@ -3556,35 +3547,39 @@
}
/* get precision & scale strings */
- QString stringPrecision;
- QString stringScale;
+ int nWhole = 0;
+ int nDecimal = 0;
+
QStringList stringlistData = stringData.split( '.' );
if ( stringlistData.count() > 2 )
MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_07006, 0,
tr("Data was converted to string but then had too many decimal points.") ) );
if ( stringlistData.count() > 1 )
- stringScale = stringlistData[1];
+ nDecimal = stringlistData[1].length();
if ( stringlistData.count() > 0 )
- stringPrecision = stringlistData[0];
+ nWhole = stringlistData[0].length();
+ int nPrecision = nWhole + nDecimal;
+
+
/* check for truncation */
BOOL bFractionalTruncation = false;
- if ( stringPrecision.length() > pNumericTarget->precision )
+ if ( nPrecision > pNumericTarget->precision )
MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_22003 ) );
- if ( stringScale.length() > pNumericTarget->scale )
+ if ( nDecimal > pNumericTarget->scale )
{
if ( pNumericTarget->scale == 0 )
- stringScale = QString::null;
+ stringlistData[1] = QString::null;
else
- stringScale.truncate( pNumericTarget->scale );
+ stringlistData[1].truncate( pNumericTarget->scale );
bFractionalTruncation = true;
+ nDecimal = stringlistData[1].length();
}
- /* get int ver of each part */
- int nPrecision = stringPrecision.toInt();
- int nScale = stringScale.toInt();
+ QString stringValueToPack( stringlistData[0] + stringlistData[1] );
+ ulonglong nValueToPack = stringValueToPack.toULongLong();
/*!
\internal ODBC RULE
@@ -3596,9 +3591,15 @@
with the number of bytes defined by the SQL_MAX_NUMERIC_LEN #define.
*/
- memset( pNumericTarget->val, 0, SQL_MAX_NUMERIC_LEN );
+#if MYODBC_DBG > 1
+ MYODBCDbgInfo( QString( "stringlistData[0] =%1" ).arg( stringlistData[0] ) );
+ MYODBCDbgInfo( QString( "stringlistData[1] =%1" ).arg( stringlistData[1] ) );
+ MYODBCDbgInfo( QString( "stringValueToPack =%1" ).arg( stringValueToPack ) );
+ MYODBCDbgInfo( QString( "stringData =%1" ).arg( stringData ) );
+ MYODBCDbgInfo( QString( "nValueToPack =%1" ).arg( nValueToPack ) );
+#endif
- /*! \todo pack into 16 byte buffer */
+ MYODBCC::num_pack( pNumericTarget->val, (int)nValueToPack );
if ( bFractionalTruncation )
MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_01S07 ) );
@@ -3969,8 +3970,6 @@
{
MYODBCDbgEnter();
- pResultPutData->variantData.setValue( QByteArray(
(char*)pResultPutData->pDescriptorRecordAPD->getDataPtr(),
pResultPutData->pDescriptorRecordAPD->getOctetLength() ) );
-
switch ( pResultPutData->pDescriptorRecordIPD->getConciseType() )
{
case SQL_CHAR:
@@ -3979,6 +3978,7 @@
case SQL_WCHAR:
case SQL_WVARCHAR:
case SQL_WLONGVARCHAR:
+ pResultPutData->variantData.setValue( QByteArray(
(char*)pResultPutData->pDescriptorRecordAPD->getDataPtr(),
pResultPutData->pDescriptorRecordAPD->getOctetLength() ) );
if ( !pResultPutData->variantData.convert( QVariant::String ) )
break;
pResultPutData->variantData.setValue( "'" +
pResultPutData->variantData.toString() + "'" );
@@ -4000,6 +4000,7 @@
case SQL_FLOAT:
case SQL_DOUBLE:
case SQL_BIT:
+ pResultPutData->variantData.setValue( QByteArray(
(char*)pResultPutData->pDescriptorRecordAPD->getDataPtr(),
pResultPutData->pDescriptorRecordAPD->getOctetLength() ) );
if ( pResultPutData->variantData.convert( QVariant::LongLong ) )
MYODBCDbgReturn( SQL_SUCCESS );
break;
@@ -4015,6 +4016,7 @@
We assume that these are NOT stored in SQL_*_STRUCT format but are
instead
stored in string format.
*/
+ pResultPutData->variantData.setValue( QByteArray(
(char*)pResultPutData->pDescriptorRecordAPD->getDataPtr(),
pResultPutData->pDescriptorRecordAPD->getOctetLength() ) );
if ( !pResultPutData->variantData.convert( QVariant::String ) )
break;
pResultPutData->variantData.setValue( "'" +
pResultPutData->variantData.toString() + "'" );
@@ -4022,7 +4024,54 @@
case SQL_BINARY:
case SQL_VARBINARY:
case SQL_LONGVARBINARY:
- MYODBCDbgReturn( SQL_SUCCESS );
+ {
+ SQLINTEGER nBytes = 0;
+
+ if ( pResultPutData->pDescriptorRecordAPD->getOctetLengthPtr() )
+ {
+ nBytes =
*pResultPutData->pDescriptorRecordAPD->getOctetLengthPtr();
+ switch ( nBytes )
+ {
+ case SQL_NTS:
+ MYODBCDbgReturn( getDiagnostic()->doAppend(
MDiagnostic::STATE_07006, 0, tr("SQL_NTS not supported at this time") ) );
+ case SQL_NULL_DATA:
+ MYODBCDbgReturn( getDiagnostic()->doAppend(
MDiagnostic::STATE_07006, 0, tr("SQL_NULL_DATA not supported at this time") ) );
+ case SQL_DEFAULT_PARAM:
+ MYODBCDbgReturn( getDiagnostic()->doAppend(
MDiagnostic::STATE_07006, 0, tr("SQL_DEFAULT_PARAM not supported at this time") ) );
+ case SQL_DATA_AT_EXEC:
+ MYODBCDbgReturn( getDiagnostic()->doAppend(
MDiagnostic::STATE_07006 ) );
+ default:
+#if MYODBC_DBG > 1
+ MYODBCDbgInfo( QString( "nBytes=%1" ).arg( nBytes ) );
+#endif
+ /* SQL_LEN_DATA_AT_EXEC(length) macro? */
+ if ( nBytes < (-100) )
+ {
+ MYODBCDbgReturn( getDiagnostic()->doAppend(
MDiagnostic::STATE_07006, 0, tr("SQL_LEN_DATA_AT_EXEC not supported at this time") ) );
+ }
+ else if ( nBytes == (-100) )
+ {
+ MYODBCDbgReturn( getDiagnostic()->doAppend(
MDiagnostic::STATE_07006, 0, tr("0 length specified with SQL_LEN_DATA_AT_EXEC not
supported at this time") ) );
+ }
+ nBytes = abs( nBytes ) - 100;
+ }
+ }
+ else
+ {
+ MYODBCDbgReturn( getDiagnostic()->doAppend(
MDiagnostic::STATE_07006, 0, tr("APD::SQL_DESC_OCTET_LENGTH_PTR (StrlenInd) null") ) );
+ }
+#if MYODBC_DBG > 1
+ MYODBCDbgInfo( QString( "nBytes=%1" ).arg( nBytes ) );
+#endif
+
+// pResultPutData->variantData.setValue( QByteArray(
(char*)pResultPutData->pDescriptorRecordAPD->getDataPtr(),
pResultPutData->pDescriptorRecordAPD->getOctetLength() ) );
+ pResultPutData->variantData.setValue( QByteArray(
(char*)pResultPutData->pDescriptorRecordAPD->getDataPtr(), nBytes ) );
+ if ( !pResultPutData->variantData.canConvert( QVariant::ByteArray ) )
+ break;
+ pResultPutData->variantData.setValue( "'" + MYODBCC::getEscaped(
pResultPutData->variantData.toByteArray() ) + "'" );
+
+ MYODBCDbgReturn( SQL_SUCCESS );
+ }
}
/*!
Modified: trunk/SDK/MYSQLPlus/Library/MStatement.cpp
===================================================================
--- trunk/SDK/MYSQLPlus/Library/MStatement.cpp 2006-11-15 09:09:19 UTC (rev 676)
+++ trunk/SDK/MYSQLPlus/Library/MStatement.cpp 2006-11-15 10:12:03 UTC (rev 677)
@@ -1425,6 +1425,7 @@
MYODBCDbgInfo( QString( "nColumnSize =%1" ).arg( nColumnSize ) );
MYODBCDbgInfo( QString( "nDecimalDigits =%1" ).arg( nDecimalDigits ) );
MYODBCDbgInfo( QString( "pParameterValue =%1" ).arg( (unsigned
long)pParameterValue ) );
+ MYODBCDbgInfo( QString( "nBufferLength =%1" ).arg( nBufferLength ) );
MYODBCDbgInfo( QString( "pnStrLenOrInd =%1" ).arg( (unsigned long)pnStrLenOrInd
) );
#endif
| Thread |
|---|
| • Connector/ODBC 5 commit: r677 - in trunk: Driver/Driver/Tests SDK/C/Library SDK/C/include SDK/MYSQLPlus/Library | pharvey | 15 Nov |