Modified:
MYODBCDes/MYODBCDes.vpj
MYODBCDes/MYODBCDesLib/MYODBCDes.cpp
MYODBCDes/MYODBCDesLib/MYODBCDesAPD.cpp
MYODBCDes/MYODBCDesLib/MYODBCDesARD.cpp
MYODBCDes/MYODBCDesLib/MYODBCDesIPD.cpp
MYODBCDes/MYODBCDesLib/MYODBCDesIRD.cpp
MYODBCDes/include/MYODBCDes.h
MYODBCDes/include/MYODBCDesAPD.h
MYODBCDes/include/MYODBCDesARD.h
MYODBCDes/include/MYODBCDesIPD.h
MYODBCDes/include/MYODBCDesIRD.h
MYODBCDes/include/MYODBCDesRec.h
Log:
UNICODE:
- simplifying descriptors
Modified: MYODBCDes/MYODBCDes.vpj
===================================================================
--- MYODBCDes/MYODBCDes.vpj 2006-01-31 08:51:33 UTC (rev 51)
+++ MYODBCDes/MYODBCDes.vpj 2006-01-31 09:47:34 UTC (rev 52)
@@ -193,6 +193,11 @@
<F N="include/MYODBCDesARD.h"/>
<F N="include/MYODBCDesIPD.h"/>
<F N="include/MYODBCDesIRD.h"/>
+ <F N="include/MYODBCDesRec.h"/>
+ <F N="include/MYODBCDesRecAPD.h"/>
+ <F N="include/MYODBCDesRecARD.h"/>
+ <F N="include/MYODBCDesRecIPD.h"/>
+ <F N="include/MYODBCDesRecIRD.h"/>
</Folder>
<Folder
Name="Resource Files"
Modified: MYODBCDes/MYODBCDesLib/MYODBCDes.cpp
===================================================================
--- MYODBCDes/MYODBCDesLib/MYODBCDes.cpp 2006-01-31 08:51:33 UTC (rev 51)
+++ MYODBCDes/MYODBCDesLib/MYODBCDes.cpp 2006-01-31 09:47:34 UTC (rev 52)
@@ -161,6 +161,63 @@
MYODBCDbgReturn( SQL_SUCCESS );
}
+/*!
+ \brief Expands or shrinks list of records.
+
+ Expands or shrinks list of records while trying to account for some
+ rules stated in the ODBC spec in regard to maintaining the records list.
+
+ \param pDes any type of descriptor
+ \param nCount the desired value for SQL_DESC_COUNT (0-n), records appended
+ or truncated as needed
+ \param bUnbind - True - is ok to truncate records which are bound
+ - False - never truncate a bound record (in this case num-recs
+ could be > count)
+ \return MYODBC_C_BOOL
+
+ \retval MYODBC_C_TRUE success (its possible to have success but count <
+ SQL_DESC_COUNT)
+ \retval MYODBC_C_FALSE failed
+*/
+SQLRETURN MYODBCDes::setCount( SQLSMALLINT nCount, bool bUnbind )
+{
+ MYODBCDbgEnter();
+
+ /*!
+ \internal ODBC Rule
+
+ The FieldIdentifier argument was SQL_DESC_COUNT, and *ValuePtr argument was
+ less than 0.
+ */
+ if ( nCount < 0 )
+ MYODBCDbgReturn( getDia()->doAppend( MYODBC_DIA_07009, 0, NULL ) );
+
+ /* append */
+ while ( nCount > getCount() )
+ {
+ doAppend();
+ }
+
+ /* truncate */
+ {
+ QMutableVectorIterator<MYODBCDesRec*> i( vectorRecords );
+ i.toBack();
+ while ( getCount() > nCount && i.findPrevious() )
+ {
+ MYODBCDesRec *pdesrec = i.previous();
+
+ /* do not delete bound records */
+ if ( pdesrec->getDataPtr() && !bUnbind )
+ break;
+
+ i.remove();
+ delete pdesrec;
+ }
+ }
+
+ MYODBCDbgReturn( SQL_SUCCESS );
+}
+
SQLRETURN MYODBCDes::setRowsProcessedPtr( SQLUINTEGER *pnRowsProcessedPtr )
{
MYODBCDbgEnter();
@@ -380,9 +437,21 @@
nBindType = SQL_BIND_BY_COLUMN;
pnRowsProcessedPtr = NULL;
- /* we always have a viable index 0 - used, in some cases, as a bookmark */
- doAppend();
+ /*
+ \internal ODBC Rule
+ When ColumnNumber is equal to 0 (for a bookmark column),
+ SQL_BINARY is returned in *DataTypePtr for variable-length
+ bookmarks. (SQL_INTEGER is returned if bookmarks are used
+ by an ODBC 3.x application working with an ODBC 2.x driver
+ or by an ODBC 2.x application working with an ODBC 3.x
+ driver.)
+ */
+ MYODBCDesRec *pdesrec = doAppend();
+ pdesrec->setConciseType( SQL_BINARY );
+ pdesrec->setType( SQL_BINARY );
+ pdesrec->setDatetimeIntervalCode( 0 );
+
MYODBCDbgReturn2();
}
Modified: MYODBCDes/MYODBCDesLib/MYODBCDesAPD.cpp
===================================================================
--- MYODBCDes/MYODBCDesLib/MYODBCDesAPD.cpp 2006-01-31 08:51:33 UTC (rev 51)
+++ MYODBCDes/MYODBCDesLib/MYODBCDesAPD.cpp 2006-01-31 09:47:34 UTC (rev 52)
@@ -1,15 +1,16 @@
#include "MYODBCDesInternal.h"
-MYODBCDesAPD::MYODBCDesAPD( SQLHANDLE hOwner )
- : MYODBCDes( hOwner )
+MYODBCDesAPD::MYODBCDesAPD( SQLHANDLE hOwner, SQLSMALLINT nAllocType )
+ : MYODBCDes( hOwner, nAllocType )
{
- doInit();
}
SQLRETURN MYODBCDesAPD::setDescField( SQLSMALLINT nRecNumber, SQLSMALLINT
nFieldIdentifier, SQLPOINTER pValuePtr, SQLINTEGER nBufferLength )
{
MYODBCDbgEnter();
+ SQLRETURN nReturn;
+
/* header field? */
switch ( nFieldIdentifier )
{
@@ -19,7 +20,8 @@
APD: R
*/
- MYODBCDbgReturn( getDia()->doAppend( MYODBC_DIA_HY091, 0, NULL ) );
+ nReturn = getDia()->doAppend( MYODBC_DIA_HY091, 0, NULL );
+ MYODBCDbgReturn( nReturn );
case SQL_DESC_ARRAY_SIZE:
/*!
@@ -27,7 +29,8 @@
APD: R/W
*/
- MYODBCDbgReturn( setArraySize( (SQLUINTEGER)pValuePtr ) );
+ nReturn = setArraySize( (SQLUINTEGER)pValuePtr );
+ MYODBCDbgReturn( nReturn );
case SQL_DESC_ARRAY_STATUS_PTR:
/*!
@@ -35,7 +38,8 @@
APD: R/W
*/
- MYODBCDbgReturn( setArrayStatusPtr( (SQLUSMALLINT*)pValuePtr ) );
+ nReturn = setArrayStatusPtr( (SQLUSMALLINT*)pValuePtr );
+ MYODBCDbgReturn( nReturn );
case SQL_DESC_BIND_OFFSET_PTR:
/*!
@@ -43,7 +47,8 @@
APD: R/W
*/
- MYODBCDbgReturn( setBindOffsetPtr( (SQLINTEGER*)pValuePtr ) );
+ nReturn = setBindOffsetPtr( (SQLINTEGER*)pValuePtr );
+ MYODBCDbgReturn( nReturn );
case SQL_DESC_BIND_TYPE:
/*!
@@ -60,7 +65,8 @@
value to the length of a structure or an instance of a buffer into
which result columns will be bound.
*/
- MYODBCDbgReturn( setBindType( (SQLINTEGER)pValuePtr) );
+ nReturn = setBindType( (SQLINTEGER)pValuePtr );
+ MYODBCDbgReturn( nReturn );
case SQL_DESC_COUNT:
/*!
@@ -74,9 +80,13 @@
argument was less than 0.
*/
if ( (SQLSMALLINT)pValuePtr < 0 )
- MYODBCDbgReturn( getDia()->doAppend( MYODBC_DIA_07009, 0, NULL ) );
+ {
+ nReturn = getDia()->doAppend( MYODBC_DIA_07009, 0, NULL );
+ MYODBCDbgReturn( nReturn );
+ }
- MYODBCDbgReturn( setCount( (SQLSMALLINT)pValuePtr, true ) );
+ nReturn = setCount( (SQLSMALLINT)pValuePtr, true );
+ MYODBCDbgReturn( nReturn );
case SQL_DESC_ROWS_PROCESSED_PTR:
/*!
@@ -84,7 +94,8 @@
APD: Unused
*/
- MYODBCDbgReturn( getDia()->doAppend( MYODBC_DIA_HY091, 0, NULL ) );
+ nReturn = getDia()->doAppend( MYODBC_DIA_HY091, 0, NULL );
+ MYODBCDbgReturn( nReturn );
} /* switch (for header fields) */
@@ -94,85 +105,27 @@
referred to an ARD or an APD.
*/
if ( nRecNumber < 0 )
- MYODBCDbgReturn( getDia()->doAppend( MYODBC_DIA_07009, 0, NULL ) );
+ {
+ nReturn = getDia()->doAppend( MYODBC_DIA_07009, 0, NULL );
+ MYODBCDbgReturn( nReturn );
+ }
/* auto expand record list... */
if ( nRecNumber >= getCount() )
setCount( nRecNumber );
/* handle as record field */
- MYODBCDbgReturn( listRecords[nRecNumber]->setDescField( nFieldIdentifier,
pValuePtr, nBufferLength ) );
+ nReturn = vectorRecords[nRecNumber]->setDescField( nFieldIdentifier, pValuePtr,
nBufferLength );
+ MYODBCDbgReturn( nReturn );
}
-/*!
- \brief Expands or shrinks list of records.
-
- Expands or shrinks list of records while trying to account for some
- rules stated in the ODBC spec in regard to maintaining the records list.
-
- \param pDes any type of descriptor
- \param nCount the desired value for SQL_DESC_COUNT (0-n), records appended
- or truncated as needed
- \param bUnbind - True - is ok to truncate records which are bound
- - False - never truncate a bound record (in this case num-recs
- could be > count)
- \return MYODBC_C_BOOL
-
- \retval MYODBC_C_TRUE success (its possible to have success but count <
- SQL_DESC_COUNT)
- \retval MYODBC_C_FALSE failed
-*/
-SQLRETURN MYODBCDesAPD::setCount( SQLSMALLINT nCount, bool bUnbind )
+MYODBCDesRec *MYODBCDesAPD::doAppend()
{
MYODBCDbgEnter();
- /*!
- \internal ODBC Rule
+ MYODBCDesRecAPD *p = new MYODBCDesRecAPD( this );
+ vectorRecords.append( p );
- The FieldIdentifier argument was SQL_DESC_COUNT, and *ValuePtr argument was
- less than 0.
- */
- if ( nCount < 0 )
- MYODBCDbgReturn( getDia()->doAppend( MYODBC_DIA_07009, 0, NULL ) );
-
- /* append */
- while ( nCount > getCount() )
- {
- MYODBCDesRecAPD *pdesrec = new MYODBCDesRecAPD( this );
- listRecords.append( pdesrec );
- }
-
- /* truncate */
- while ( getCount() > nCount )
- {
- /* do not delete bound records */
- if ( listRecords.last()->getDataPtr() && !bUnbind )
- break;
-
- delete listRecords.takeLast();
- }
-
- MYODBCDbgReturn( SQL_SUCCESS );
+ MYODBCDbgReturn3( "%p", p );
}
-void MYODBCDesAPD::doInit()
-{
- MYODBCDes::doInit();
-
- /* add bookmark record at index 0 */
- /*
- \internal ODBC Rule
-
- When ColumnNumber is equal to 0 (for a bookmark column),
- SQL_BINARY is returned in *DataTypePtr for variable-length
- bookmarks. (SQL_INTEGER is returned if bookmarks are used
- by an ODBC 3.x application working with an ODBC 2.x driver
- or by an ODBC 2.x application working with an ODBC 3.x
- driver.)
- */
- MYODBCDesRecAPD *precord = new MYODBCDesRecAPD( this );
- precord->setConciseType( SQL_BINARY );
- precord->setType( SQL_BINARY );
- precord->setDatetimeIntervalCode( 0 );
- listRecords.prepend( precord );
-}
Modified: MYODBCDes/MYODBCDesLib/MYODBCDesARD.cpp
===================================================================
--- MYODBCDes/MYODBCDesLib/MYODBCDesARD.cpp 2006-01-31 08:51:33 UTC (rev 51)
+++ MYODBCDes/MYODBCDesLib/MYODBCDesARD.cpp 2006-01-31 09:47:34 UTC (rev 52)
@@ -1,15 +1,16 @@
#include "MYODBCDesInternal.h"
-MYODBCDesARD::MYODBCDesARD( SQLHANDLE hOwner )
- : MYODBCDes( hOwner )
+MYODBCDesARD::MYODBCDesARD( SQLHANDLE hOwner, SQLSMALLINT nAllocType )
+ : MYODBCDes( hOwner, nAllocType )
{
- doInit();
}
SQLRETURN MYODBCDesARD::setDescField( SQLSMALLINT nRecNumber, SQLSMALLINT
nFieldIdentifier, SQLPOINTER pValuePtr, SQLINTEGER nBufferLength )
{
MYODBCDbgEnter();
+ SQLRETURN nReturn;
+
/*!
\internal ODBC Rule
@@ -30,7 +31,8 @@
ARD: R
*/
- MYODBCDbgReturn( getDia()->doAppend( MYODBC_DIA_HY091, 0, NULL ) );
+ nReturn = getDia()->doAppend( MYODBC_DIA_HY091, 0, NULL );
+ MYODBCDbgReturn( nReturn );
case SQL_DESC_ARRAY_SIZE:
/*!
@@ -38,7 +40,8 @@
ARD: R/W
*/
- MYODBCDbgReturn( setArraySize( (SQLUINTEGER)pValuePtr ) );
+ nReturn = setArraySize( (SQLUINTEGER)pValuePtr );
+ MYODBCDbgReturn( nReturn );
case SQL_DESC_ARRAY_STATUS_PTR:
/*!
@@ -46,7 +49,8 @@
ARD: R/W
*/
- MYODBCDbgReturn( setArrayStatusPtr( (SQLUSMALLINT*)pValuePtr ) );
+ nReturn = setArrayStatusPtr( (SQLUSMALLINT*)pValuePtr );
+ MYODBCDbgReturn( nReturn );
case SQL_DESC_BIND_OFFSET_PTR:
/*!
@@ -54,7 +58,8 @@
ARD: R/W
*/
- MYODBCDbgReturn( setBindOffsetPtr( (SQLINTEGER*)pValuePtr ) );
+ nReturn = setBindOffsetPtr( (SQLINTEGER*)pValuePtr );
+ MYODBCDbgReturn( nReturn );
case SQL_DESC_BIND_TYPE:
/*!
@@ -78,9 +83,13 @@
Sanity check. Value must >=0
*/
if ( (SQLINTEGER)pValuePtr < 0 )
- MYODBCDbgReturn( getDia()->doAppend( MYODBC_DIA_HY000, 0, "Value must
be >= 0." ) );
+ {
+ nReturn = getDia()->doAppend( MYODBC_DIA_HY000, 0, "Value must be
>= 0." );
+ MYODBCDbgReturn( nReturn );
+ }
- MYODBCDbgReturn( setBindType( (SQLINTEGER)pValuePtr) );
+ nReturn = setBindType( (SQLINTEGER)pValuePtr);
+ MYODBCDbgReturn( nReturn );
case SQL_DESC_COUNT:
/*!
@@ -94,9 +103,13 @@
argument was less than 0.
*/
if ( (SQLSMALLINT)pValuePtr < 0 )
- MYODBCDbgReturn( getDia()->doAppend( MYODBC_DIA_07009, 0, NULL ) );
+ {
+ nReturn = getDia()->doAppend( MYODBC_DIA_07009, 0, NULL );
+ MYODBCDbgReturn( nReturn );
+ }
- MYODBCDbgReturn( setCount( (SQLSMALLINT)pValuePtr, true ) );
+ nReturn = setCount( (SQLSMALLINT)pValuePtr, true );
+ MYODBCDbgReturn( nReturn );
case SQL_DESC_ROWS_PROCESSED_PTR:
/*!
@@ -104,7 +117,8 @@
ARD: Unused
*/
- MYODBCDbgReturn( getDia()->doAppend( MYODBC_DIA_HY091, 0, NULL ) );
+ nReturn = getDia()->doAppend( MYODBC_DIA_HY091, 0, NULL );
+ MYODBCDbgReturn( nReturn );
} /* switch (for header fields) */
@@ -114,81 +128,27 @@
referred to an ARD or an APD.
*/
if ( nRecNumber < 0 )
- MYODBCDbgReturn( getDia()->doAppend( MYODBC_DIA_07009, 0, NULL ) );
+ {
+ nReturn = getDia()->doAppend( MYODBC_DIA_07009, 0, NULL );
+ MYODBCDbgReturn( nReturn );
+ }
/* auto expand record list... */
if ( nRecNumber >= getCount() )
setCount( nRecNumber );
/* handle as record field */
- MYODBCDbgReturn( listRecords[nRecNumber]->setDescField( nFieldIdentifier,
pValuePtr, nBufferLength ) );
+ nReturn = vectorRecords[nRecNumber]->setDescField( nFieldIdentifier, pValuePtr,
nBufferLength );
+ MYODBCDbgReturn( nReturn );
}
-/*!
- \brief Expands or shrinks list of records.
-
- Expands or shrinks list of records while trying to account for some
- rules stated in the ODBC spec in regard to maintaining the records list.
-
- \param pDes any type of descriptor
- \param nCount the desired value for SQL_DESC_COUNT (0-n), records appended
- or truncated as needed
- \param bUnbind - True - is ok to truncate records which are bound
- - False - never truncate a bound record (in this case num-recs
- could be > count)
- \return MYODBC_C_BOOL
-
- \retval MYODBC_C_TRUE success (its possible to have success but count <
- SQL_DESC_COUNT)
- \retval MYODBC_C_FALSE failed
-*/
-SQLRETURN MYODBCDesARD::setCount( SQLSMALLINT nCount, bool bUnbind )
+MYODBCDesRec *MYODBCDesARD::doAppend()
{
MYODBCDbgEnter();
- /* We should always have a bookmark record at index 0. */
- if ( nCount < 0 )
- MYODBCDbgReturn( getDia()->doAppend( MYODBC_DIA_07009, 0, NULL ) );
+ MYODBCDesRecARD *p = new MYODBCDesRecARD( this );
+ vectorRecords.append( p );
- /* append */
- while ( nCount > getCount() )
- {
- MYODBCDesRecARD *pdesrec = new MYODBCDesRecARD( this );
- listRecords.append( pdesrec );
- }
-
- /* truncate */
- while ( getCount() > nCount )
- {
- /* do not delete bound records */
- if ( listRecords.last()->getDataPtr() && !bUnbind )
- break;
-
- delete listRecords.takeLast();
- }
-
- MYODBCDbgReturn( SQL_SUCCESS );
+ MYODBCDbgReturn3( "%p", p );
}
-void MYODBCDesARD::doInit()
-{
- MYODBCDes::doInit();
-
- /* add bookmark record at index 0 */
- /*
- \internal ODBC Rule
-
- When ColumnNumber is equal to 0 (for a bookmark column),
- SQL_BINARY is returned in *DataTypePtr for variable-length
- bookmarks. (SQL_INTEGER is returned if bookmarks are used
- by an ODBC 3.x application working with an ODBC 2.x driver
- or by an ODBC 2.x application working with an ODBC 3.x
- driver.)
- */
- MYODBCDesRecARD *precord = new MYODBCDesRecARD( this );
- precord->setConciseType( SQL_BINARY );
- precord->setType( SQL_BINARY );
- precord->setDatetimeIntervalCode( 0 );
- listRecords.prepend( precord );
-}
-
Modified: MYODBCDes/MYODBCDesLib/MYODBCDesIPD.cpp
===================================================================
--- MYODBCDes/MYODBCDesLib/MYODBCDesIPD.cpp 2006-01-31 08:51:33 UTC (rev 51)
+++ MYODBCDes/MYODBCDesLib/MYODBCDesIPD.cpp 2006-01-31 09:47:34 UTC (rev 52)
@@ -1,9 +1,8 @@
#include "MYODBCDesInternal.h"
MYODBCDesIPD::MYODBCDesIPD( SQLHANDLE hOwner )
- : MYODBCDes( hOwner )
+ : MYODBCDes( hOwner, SQL_DESC_ALLOC_AUTO )
{
- doInit();
}
SQLRETURN MYODBCDesIPD::setDescField( SQLSMALLINT nRecNumber, SQLSMALLINT
nFieldIdentifier, SQLPOINTER pValuePtr, SQLINTEGER nBufferLength )
@@ -33,7 +32,8 @@
IRD: R
IPD: R
*/
- MYODBCDbgReturn( getDia()->doAppend( MYODBC_DIA_HY091, 0, NULL ) );
+ nReturn = getDia()->doAppend( MYODBC_DIA_HY091, 0, NULL );
+ MYODBCDbgReturn( nReturn );
case SQL_DESC_ARRAY_SIZE:
/*!
@@ -44,7 +44,8 @@
IRD: Unused
IPD: Unused
*/
- MYODBCDbgReturn( getDia()->doAppend( MYODBC_DIA_HY091, 0, NULL ) );
+ nReturn = getDia()->doAppend( MYODBC_DIA_HY091, 0, NULL );
+ MYODBCDbgReturn( nReturn );
case SQL_DESC_ARRAY_STATUS_PTR:
/*!
@@ -55,7 +56,8 @@
IRD: R/W
IPD: R/W
*/
- MYODBCDbgReturn( setArrayStatusPtr( (SQLUSMALLINT*)pValuePtr ) );
+ nReturn = setArrayStatusPtr( (SQLUSMALLINT*)pValuePtr );
+ MYODBCDbgReturn( nReturn );
case SQL_DESC_BIND_OFFSET_PTR:
/*!
@@ -66,7 +68,8 @@
IRD: Unused
IPD: Unused
*/
- MYODBCDbgReturn( getDia()->doAppend( MYODBC_DIA_HY091, 0, NULL ) );
+ nReturn = getDia()->doAppend( MYODBC_DIA_HY091, 0, NULL );
+ MYODBCDbgReturn( nReturn );
case SQL_DESC_BIND_TYPE:
/*!
@@ -77,7 +80,8 @@
IRD: Unused
IPD: Unused
*/
- MYODBCDbgReturn( getDia()->doAppend( MYODBC_DIA_HY091, 0, NULL ) );
+ nReturn = getDia()->doAppend( MYODBC_DIA_HY091, 0, NULL );
+ MYODBCDbgReturn( nReturn );
case SQL_DESC_COUNT:
/*!
@@ -89,7 +93,8 @@
IPD: R/W
*/
/* expand/shrink record list; free, even, bound records as needed */
- MYODBCDbgReturn( setCount( (SQLSMALLINT)pValuePtr, true ) );
+ nReturn = setCount( (SQLSMALLINT)pValuePtr, true );
+ MYODBCDbgReturn( nReturn );
case SQL_DESC_ROWS_PROCESSED_PTR:
/*!
@@ -100,7 +105,8 @@
IRD: R/W
IPD: R/W
*/
- MYODBCDbgReturn( setRowsProcessedPtr( (SQLUINTEGER*)pValuePtr ) );
+ nReturn = setRowsProcessedPtr( (SQLUINTEGER*)pValuePtr );
+ MYODBCDbgReturn( nReturn );
} /* switch (for header fields) */
@@ -110,80 +116,30 @@
was 0, and the DescriptorHandle argument referred to an IPD handle.
*/
if ( nRecNumber == 0 )
- MYODBCDbgReturn( getDia()->doAppend( MYODBC_DIA_07009, 0, NULL ) );
+ {
+ nReturn = getDia()->doAppend( MYODBC_DIA_07009, 0, NULL );
+ MYODBCDbgReturn( nReturn );
+ }
/* record field needs a valid record */
if ( nRecNumber < 0 || nRecNumber >= getCount() )
- MYODBCDbgReturn( getDia()->doAppend( MYODBC_DIA_07009, 0, NULL ) );
+ {
+ nReturn = getDia()->doAppend( MYODBC_DIA_07009, 0, NULL );
+ MYODBCDbgReturn( nReturn );
+ }
/* handle as record field */
- MYODBCDbgReturn( listRecords[nRecNumber]->setDescField( nFieldIdentifier,
pValuePtr, nBufferLength ) );
+ nReturn = vectorRecords[nRecNumber]->setDescField( nFieldIdentifier, pValuePtr,
nBufferLength );
+ MYODBCDbgReturn( nReturn );
}
-/*!
- \brief Expands or shrinks list of records.
-
- Expands or shrinks list of records while trying to account for some
- rules stated in the ODBC spec in regard to maintaining the records list.
-
- \param pDes any type of descriptor
- \param nCount the desired value for SQL_DESC_COUNT (0-n), records appended
- or truncated as needed
- \param bUnbind - True - is ok to truncate records which are bound
- - False - never truncate a bound record (in this case num-recs
- could be > count)
- \return MYODBC_C_BOOL
-
- \retval MYODBC_C_TRUE success (its possible to have success but count <
- SQL_DESC_COUNT)
- \retval MYODBC_C_FALSE failed
-*/
-SQLRETURN MYODBCDesIPD::setCount( SQLSMALLINT nCount, bool bUnbind )
+MYODBCDesRec *MYODBCDesIPD::doAppend()
{
MYODBCDbgEnter();
- /* We should always have a bookmark record at index 0. */
- if ( nCount < 0 )
- MYODBCDbgReturn( getDia()->doAppend( MYODBC_DIA_07009, 0, NULL ) );
+ MYODBCDesRecIPD *p = new MYODBCDesRecIPD( this );
+ vectorRecords.append( p );
- /* append */
- while ( nCount > getCount() )
- {
- MYODBCDesRecIPD *pdesrec = new MYODBCDesRecIPD( this );
- listRecords.append( pdesrec );
- }
-
- /* truncate */
- while ( getCount() > nCount )
- {
- /* do not delete bound records */
- if ( listRecords.last()->getDataPtr() && !bUnbind )
- break;
-
- delete listRecords.takeLast();
- }
-
- MYODBCDbgReturn( SQL_SUCCESS );
+ MYODBCDbgReturn3( "%p", p );
}
-void MYODBCDesIPD::doInit()
-{
- MYODBCDes::doInit();
-
- /* add bookmark record at index 0 */
- /*
- \internal ODBC Rule
-
- When ColumnNumber is equal to 0 (for a bookmark column),
- SQL_BINARY is returned in *DataTypePtr for variable-length
- bookmarks. (SQL_INTEGER is returned if bookmarks are used
- by an ODBC 3.x application working with an ODBC 2.x driver
- or by an ODBC 2.x application working with an ODBC 3.x
- driver.)
- */
- MYODBCDesRecIPD *precord = new MYODBCDesRecIPD( this );
- precord->setConciseType( SQL_BINARY );
- precord->setType( SQL_BINARY );
- precord->setDatetimeIntervalCode( 0 );
- listRecords.prepend( precord );
-}
Modified: MYODBCDes/MYODBCDesLib/MYODBCDesIRD.cpp
===================================================================
--- MYODBCDes/MYODBCDesLib/MYODBCDesIRD.cpp 2006-01-31 08:51:33 UTC (rev 51)
+++ MYODBCDes/MYODBCDesLib/MYODBCDesIRD.cpp 2006-01-31 09:47:34 UTC (rev 52)
@@ -1,9 +1,8 @@
#include "MYODBCDesInternal.h"
MYODBCDesIRD::MYODBCDesIRD( SQLHANDLE hOwner )
- : MYODBCDes( hOwner )
+ : MYODBCDes( hOwner, SQL_DESC_ALLOC_AUTO )
{
- doInit();
}
SQLRETURN MYODBCDesIRD::setDescField( SQLSMALLINT nRecNumber, SQLSMALLINT
nFieldIdentifier, SQLPOINTER pValuePtr, SQLINTEGER nBufferLength )
@@ -36,7 +35,8 @@
IRD: Unused
*/
- MYODBCDbgReturn( getDia()->doAppend( MYODBC_DIA_HY091, 0, NULL ) );
+ nReturn = getDia()->doAppend( MYODBC_DIA_HY091, 0, NULL );
+ MYODBCDbgReturn( nReturn );
case SQL_DESC_ARRAY_STATUS_PTR:
/*!
@@ -44,7 +44,8 @@
IRD: R/W
*/
- MYODBCDbgReturn( setArrayStatusPtr( (SQLUSMALLINT*)pValuePtr ) );
+ nReturn = setArrayStatusPtr( (SQLUSMALLINT*)pValuePtr );
+ MYODBCDbgReturn( nReturn );
case SQL_DESC_BIND_OFFSET_PTR:
/*!
@@ -64,7 +65,8 @@
IRD: R
*/
- MYODBCDbgReturn( getDia()->doAppend( MYODBC_DIA_HY091, 0, NULL ) );
+ nReturn = getDia()->doAppend( MYODBC_DIA_HY091, 0, NULL );
+ MYODBCDbgReturn( nReturn );
case SQL_DESC_ROWS_PROCESSED_PTR:
/*!
@@ -72,82 +74,29 @@
IRD: R/W
*/
- MYODBCDbgReturn( setRowsProcessedPtr( (SQLUINTEGER*)pValuePtr ) );
+ nReturn = setRowsProcessedPtr( (SQLUINTEGER*)pValuePtr );
+ MYODBCDbgReturn( nReturn );
} /* switch (for header fields) */
/* record field needs a valid record */
if ( nRecNumber < 0 || nRecNumber >= getCount() )
- MYODBCDbgReturn( getDia()->doAppend( MYODBC_DIA_07009, 0, NULL ) );
+ {
+ nReturn = getDia()->doAppend( MYODBC_DIA_07009, 0, NULL );
+ MYODBCDbgReturn( nReturn );
+ }
/* handle as record field */
- MYODBCDbgReturn( listRecords[nRecNumber]->setDescField( nFieldIdentifier,
pValuePtr, nBufferLength ) );
+ nReturn = vectorRecords[nRecNumber]->setDescField( nFieldIdentifier, pValuePtr,
nBufferLength );
+ MYODBCDbgReturn( nReturn );
}
-/*!
- \brief Expands or shrinks list of records.
-
- Expands or shrinks list of records while trying to account for some
- rules stated in the ODBC spec in regard to maintaining the records list.
-
- \param pDes any type of descriptor
- \param nCount the desired value for SQL_DESC_COUNT (0-n), records appended
- or truncated as needed
- \param bUnbind - True - is ok to truncate records which are bound
- - False - never truncate a bound record (in this case num-recs
- could be > count)
- \return MYODBC_C_BOOL
-
- \retval MYODBC_C_TRUE success (its possible to have success but count <
- SQL_DESC_COUNT)
- \retval MYODBC_C_FALSE failed
-*/
-SQLRETURN MYODBCDesIRD::setCount( SQLSMALLINT nCount, bool bUnbind )
+MYODBCDesRec *MYODBCDesIRD::doAppend()
{
MYODBCDbgEnter();
- /* We should always have a bookmark record at index 0. */
- if ( nCount < 0 )
- MYODBCDbgReturn( getDia()->doAppend( MYODBC_DIA_07009, 0, NULL ) );
+ MYODBCDesRecIRD *p = new MYODBCDesRecIRD( this );
+ vectorRecords.append( p );
- /* append */
- while ( nCount > getCount() )
- {
- MYODBCDesRecIRD *pdesrec = new MYODBCDesRecIRD( this );
- listRecords.append( pdesrec );
- }
-
- /* truncate */
- while ( getCount() > nCount )
- {
- /* do not delete bound records */
- if ( listRecords.last()->getDataPtr() && !bUnbind )
- break;
-
- delete listRecords.takeLast();
- }
-
- MYODBCDbgReturn( SQL_SUCCESS );
+ MYODBCDbgReturn3( "%p", p );
}
-void MYODBCDesIRD::doInit()
-{
- MYODBCDes::doInit();
-
- /* add bookmark record at index 0 */
- /*
- \internal ODBC Rule
-
- When ColumnNumber is equal to 0 (for a bookmark column),
- SQL_BINARY is returned in *DataTypePtr for variable-length
- bookmarks. (SQL_INTEGER is returned if bookmarks are used
- by an ODBC 3.x application working with an ODBC 2.x driver
- or by an ODBC 2.x application working with an ODBC 3.x
- driver.)
- */
- MYODBCDesRecIRD *precord = new MYODBCDesRecIRD( this );
- precord->setConciseType( SQL_BINARY );
- precord->setType( SQL_BINARY );
- precord->setDatetimeIntervalCode( 0 );
- listRecords.prepend( precord );
-}
-
Modified: MYODBCDes/include/MYODBCDes.h
===================================================================
--- MYODBCDes/include/MYODBCDes.h 2006-01-31 08:51:33 UTC (rev 51)
+++ MYODBCDes/include/MYODBCDes.h 2006-01-31 09:47:34 UTC (rev 52)
@@ -85,7 +85,7 @@
virtual SQLRETURN setArrayStatusPtr( SQLUSMALLINT *pnArrayStatusPtr );
virtual SQLRETURN setBindOffsetPtr( SQLINTEGER *pnBindOffsetPtr );
virtual SQLRETURN setBindType( SQLINTEGER nBindType );
- virtual SQLRETURN setCount( SQLSMALLINT nCount, bool bUnbind = false ) = 0;
+ virtual SQLRETURN setCount( SQLSMALLINT nCount, bool bUnbind = false );
virtual SQLRETURN setRowsProcessedPtr( SQLUINTEGER *pnRowsProcessedPtr );
/* getters */
Modified: MYODBCDes/include/MYODBCDesAPD.h
===================================================================
--- MYODBCDes/include/MYODBCDesAPD.h 2006-01-31 08:51:33 UTC (rev 51)
+++ MYODBCDes/include/MYODBCDesAPD.h 2006-01-31 09:47:34 UTC (rev 52)
@@ -24,17 +24,15 @@
{
friend class MYODBCDesRecAPD;
public:
- MYODBCDesAPD( SQLHANDLE hOwner );
+ MYODBCDesAPD( SQLHANDLE hOwner, SQLSMALLINT nAllocType );
/* setters */
SQLRETURN setDescField( SQLSMALLINT nRecNumber, SQLSMALLINT nFieldIdentifier,
SQLPOINTER pValuePtr, SQLINTEGER nBufferLength );
- SQLRETURN setCount( SQLSMALLINT nCount, bool bUnbind = false );
-
/* getters */
-protected:
- void doInit();
+ /* do'ers */
+ MYODBCDesRec *doAppend();
};
#endif
Modified: MYODBCDes/include/MYODBCDesARD.h
===================================================================
--- MYODBCDes/include/MYODBCDesARD.h 2006-01-31 08:51:33 UTC (rev 51)
+++ MYODBCDes/include/MYODBCDesARD.h 2006-01-31 09:47:34 UTC (rev 52)
@@ -18,17 +18,15 @@
{
friend class MYODBCDesRecARD;
public:
- MYODBCDesARD( SQLHANDLE hOwner );
+ MYODBCDesARD( SQLHANDLE hOwner, SQLSMALLINT nAllocType );
/* setters */
SQLRETURN setDescField( SQLSMALLINT nRecNumber, SQLSMALLINT nFieldIdentifier,
SQLPOINTER pValuePtr, SQLINTEGER nBufferLength );
- SQLRETURN setCount( SQLSMALLINT nCount, bool bUnbind = false );
-
/* getters */
-protected:
- void doInit();
+ /* do'ers */
+ MYODBCDesRec *doAppend();
};
#endif
Modified: MYODBCDes/include/MYODBCDesIPD.h
===================================================================
--- MYODBCDes/include/MYODBCDesIPD.h 2006-01-31 08:51:33 UTC (rev 51)
+++ MYODBCDes/include/MYODBCDesIPD.h 2006-01-31 09:47:34 UTC (rev 52)
@@ -23,12 +23,10 @@
/* setters */
SQLRETURN setDescField( SQLSMALLINT nRecNumber, SQLSMALLINT nFieldIdentifier,
SQLPOINTER pValuePtr, SQLINTEGER nBufferLength );
- SQLRETURN setCount( SQLSMALLINT nCount, bool bUnbind = false );
-
/* getters */
-protected:
- void doInit();
+ /* do'ers */
+ MYODBCDesRec *doAppend();
};
#endif
Modified: MYODBCDes/include/MYODBCDesIRD.h
===================================================================
--- MYODBCDes/include/MYODBCDesIRD.h 2006-01-31 08:51:33 UTC (rev 51)
+++ MYODBCDes/include/MYODBCDesIRD.h 2006-01-31 09:47:34 UTC (rev 52)
@@ -24,14 +24,10 @@
/* setters */
SQLRETURN setDescField( SQLSMALLINT nRecNumber, SQLSMALLINT nFieldIdentifier,
SQLPOINTER pValuePtr, SQLINTEGER nBufferLength );
- SQLRETURN setCount( SQLSMALLINT nCount, bool bUnbind = false );
-
/* getters */
- /* doers */
-
-protected:
- void doInit();
+ /* do'ers */
+ MYODBCDesRec *doAppend();
};
#endif
Modified: MYODBCDes/include/MYODBCDesRec.h
===================================================================
--- MYODBCDes/include/MYODBCDesRec.h 2006-01-31 08:51:33 UTC (rev 51)
+++ MYODBCDes/include/MYODBCDesRec.h 2006-01-31 09:47:34 UTC (rev 52)
@@ -31,8 +31,6 @@
{
public:
MYODBCDesRec( MYODBCDes *pdes );
- MYODBCDesRec( MYODBCDes *pdes, SQLSMALLINT nConciseType, const QString
&stringName, SQLSMALLINT nNullable, SQLSMALLINT nUnsigned );
- virtual SQLRETURN doAppend( SQLSMALLINT nConciseType, const QString &stringName,
SQLSMALLINT nNullable );
~MYODBCDesRec();
/* setters */
| Thread |
|---|
| • Connector/ODBC 5 commit: r52 - in MYODBCDes: . MYODBCDesLib include | pharvey | 31 Jan |