List:Commits« Previous MessageNext Message »
From:pharvey Date:January 3 2006 7:29pm
Subject:Connector/ODBC 5 commit: r26 - in MYODBCDes: MYODBCDesLib include
View as plain text  
Modified:
   MYODBCDes/MYODBCDesLib/MYODBCDes.cpp
   MYODBCDes/MYODBCDesLib/MYODBCDesAPD.cpp
   MYODBCDes/MYODBCDesLib/MYODBCDesARD.cpp
   MYODBCDes/MYODBCDesLib/MYODBCDesIPD.cpp
   MYODBCDes/MYODBCDesLib/MYODBCDesIRD.cpp
   MYODBCDes/MYODBCDesLib/MYODBCDesRec.cpp
   MYODBCDes/MYODBCDesLib/MYODBCDesRec.h
   MYODBCDes/MYODBCDesLib/MYODBCDesRecIRD.h
   MYODBCDes/include/MYODBCDes.h
   MYODBCDes/include/MYODBCDesARD.h
   MYODBCDes/include/MYODBCDesIPD.h
   MYODBCDes/include/MYODBCDesIRD.h
Log:
UNICODE:
- work to get descriptors unicode enabled (not done yet)

Modified: MYODBCDes/MYODBCDesLib/MYODBCDes.cpp
===================================================================
--- MYODBCDes/MYODBCDesLib/MYODBCDes.cpp	2006-01-03 08:52:27 UTC (rev 25)
+++ MYODBCDes/MYODBCDesLib/MYODBCDes.cpp	2006-01-03 19:29:32 UTC (rev 26)
@@ -80,6 +80,42 @@
     MYODBCDbgReturn2();
 }
 
+SQLRETURN MYODBCDes::setDescRec( SQLSMALLINT nRecNumber, SQLSMALLINT nType, SQLSMALLINT
nSubType, SQLINTEGER nLength, SQLSMALLINT nPrecision, SQLSMALLINT nScale, SQLPOINTER
pDataPtr, SQLINTEGER *pnStringLengthPtr, SQLINTEGER *pnIndicatorPtr )
+{
+    MYODBCDbgEnter();
+
+    /*
+        \internal ODBC Rule
+
+        This argument must be equal to or greater than 0.
+    */
+    if ( nRecNumber < 0 )
+        MYODBCDbgReturn( dia.doAppend( MYODBC_DIA_07009, 0, NULL ) );
+
+    /*
+        \internal ODBC Rule
+
+        The RecNumber argument was greater than the maximum number of columns 
+        or parameters that the data source can support, and the DescriptorHandle 
+        argument was an APD, IPD, or ARD.
+    */
+
+    /* do nothing: we have not max so ignore this rule  */
+
+    /* 
+        Append record as needed to make nRecNumber valid.
+    */
+    if ( nRecNumber >= getCount()  )
+    {
+        nReturn = setCount( nRecNumber, true );
+        if ( !SQL_SUCCEEDED( nReturn ) )
+            MYODBCDbgReturn( nReturn );
+    }
+
+    /* set record */
+    MYODBCDbgReturn( listRecords[nRecord]->setDescRec( nType, nSubType, nLength,
nPrecision, nScale, pDataPtr, pnStringLengthPtr, pnIndicatorPtr ) );
+}
+
 SQLRETURN MYODBCDes::setArraySize( SQLUINTEGER nArraySize )
 {
     MYODBCDbgEnter();
@@ -938,4 +974,308 @@
     MYODBCDbgReturn3( nDesType );
 }
 
+SQLRETURN MYODBCDes::setConciseTypeC( MYODBCDesRec *pdesrec, SQLSMALLINT nConciseType )
+{
+    MYODBCDbgEnter();
 
+    /*
+        \internal ODBC Rule
+
+        The values in the SQL_DESC_CONCISE_TYPE, SQL_DESC_TYPE, and 
+        SQL_DESC_DATETIME_INTERVAL_CODE fields are interdependent. Each 
+        time one of the fields is set, the other must also be set.
+    */
+
+    /*
+        \internal ODBC Rule
+
+        If SQL_DESC_CONCISE_TYPE is set to a concise data type other than 
+        an interval or datetime data type, the SQL_DESC_TYPE field is set 
+        to the same value and the SQL_DESC_DATETIME_INTERVAL_CODE field is 
+        set to 0.
+    */
+
+    /*
+        \internal ODBC Rule
+
+        If SQL_DESC_CONCISE_TYPE is set to the concise datetime or interval
+        data type, the SQL_DESC_TYPE field is set to the corresponding 
+        verbose type (SQL_DATETIME or SQL_INTERVAL) and the 
+        SQL_DESC_DATETIME_INTERVAL_CODE field is set to the appropriate 
+        subcode. 
+    */
+
+    /*
+        C concise types
+
+        These are listed in the order given in the ODBC specification.
+    */
+    switch ( nConciseType )
+    {
+        case SQL_C_CHAR:              /*              1 */
+        case SQL_C_SSHORT:            /*  5 + -20 = -15 */
+        case SQL_C_USHORT:            /*  5 + -22 = -17 */
+        case SQL_C_SLONG:             /*  4 + -20 = -16 */
+        case SQL_C_ULONG:             /*  4 + -22 = -18 */   
+        case SQL_C_FLOAT:             /*              7 */
+        case SQL_C_DOUBLE:            /*              8 */
+        case SQL_C_BIT:               /*             -7 */
+        case SQL_C_STINYINT:          /* -6 + -20 = -26 */ 
+        case SQL_C_UTINYINT:          /* -6 + -22 = -28 */ 
+        case SQL_C_SBIGINT:           /* -5 + -20 = -25 */
+        case SQL_C_UBIGINT:           /* -5 + -22 = -27 */
+        case SQL_C_BINARY:            /*             -2 */
+            /* case SQL_C_XML:          *//*              ? */
+            /* case SQL_C_BOOKMARK:     *//*  SQL_C_UBIGINT */ 
+            /* case SQL_C_VARBOOKMARK:  *//*   SQL_C_BINARY */
+            pdesrec->setConciseType( nConciseType );
+            pdesrec->setType( nConciseType );
+            pdesrec->setDatetimeIntervalCode = 0;
+            MYODBCDbgReturn( SQL_SUCCESS );
+        case SQL_C_TYPE_DATE:         /*             91 */
+            pdesrec->setConciseType( nConciseType );
+            pdesrec->setType( SQL_DATETIME );
+            pdesrec->setDatetimeIntervalCode( SQL_CODE_DATE );
+            MYODBCDbgReturn( SQL_SUCCESS );
+        case SQL_C_TYPE_TIME:         /*             92 */
+            pdesrec->setConciseType( nConciseType );
+            pdesrec->setType( SQL_DATETIME );
+            pdesrec->setDatetimeIntervalCode( SQL_CODE_TIME );
+            MYODBCDbgReturn( SQL_SUCCESS );
+        case SQL_C_TYPE_TIMESTAMP:    /*             93 */
+            pdesrec->setConciseType( nConciseType );
+            pdesrec->setType( SQL_DATETIME );
+            pdesrec->setDatetimeIntervalCode( SQL_CODE_TIMESTAMP );
+            MYODBCDbgReturn( SQL_SUCCESS );
+        case SQL_C_NUMERIC:           /*              2 */
+        case SQL_C_GUID:              /*            -11 */
+        case SQL_C_DEFAULT:           /*             99 */
+            pdesrec->setConciseType( nConciseType );
+            pdesrec->setType( nConciseType );
+            pdesrec->setDatetimeIntervalCode( 0 );
+            MYODBCDbgReturn( SQL_SUCCESS );
+        case SQL_C_INTERVAL_MONTH:                    /* 102  */
+            pdesrec->setConciseType( nConciseType );
+            pdesrec->setType( SQL_INTERVAL );
+            pdesrec->setDatetimeIntervalCode( SQL_CODE_MONTH );
+            MYODBCDbgReturn( SQL_SUCCESS );
+        case SQL_C_INTERVAL_YEAR:                     /* 101  */
+            pdesrec->setConciseType( nConciseType );
+            pdesrec->setType( SQL_INTERVAL );
+            pdesrec->setDatetimeIntervalCode( SQL_CODE_YEAR );
+            MYODBCDbgReturn( SQL_SUCCESS );
+        case SQL_C_INTERVAL_YEAR_TO_MONTH:            /* 107  */
+            pdesrec->setConciseType( nConciseType );
+            pdesrec->setType( SQL_INTERVAL );
+            pdesrec->setDatetimeIntervalCode( SQL_CODE_YEAR_TO_MONTH );
+            MYODBCDbgReturn( SQL_SUCCESS );
+        case SQL_C_INTERVAL_DAY:                      /* 103  */
+            pdesrec->setConciseType( nConciseType );
+            pdesrec->setType( SQL_INTERVAL );
+            pdesrec->setDatetimeIntervalCode( SQL_CODE_DAY );
+            MYODBCDbgReturn( SQL_SUCCESS );
+        case SQL_C_INTERVAL_HOUR:                     /* 104  */
+            pdesrec->setConciseType( nConciseType );
+            pdesrec->setType( SQL_INTERVAL );
+            pdesrec->setDatetimeIntervalCode( SQL_CODE_HOUR );
+            MYODBCDbgReturn( SQL_SUCCESS );
+        case SQL_C_INTERVAL_MINUTE:                   /* 105  */
+            pdesrec->setConciseType( nConciseType );
+            pdesrec->setType( SQL_INTERVAL );
+            pdesrec->setDatetimeIntervalCode( SQL_CODE_MINUTE );
+            MYODBCDbgReturn( SQL_SUCCESS );
+        case SQL_C_INTERVAL_SECOND:                   /* 106  */
+            pdesrec->setConciseType( nConciseType );
+            pdesrec->setType( SQL_INTERVAL );
+            pdesrec->setDatetimeIntervalCode( SQL_CODE_SECOND );
+            MYODBCDbgReturn( SQL_SUCCESS );
+        case SQL_C_INTERVAL_DAY_TO_HOUR:              /* 108  */
+            pdesrec->setConciseType( nConciseType );
+            pdesrec->setType( SQL_INTERVAL );
+            pdesrec->setDatetimeIntervalCode( SQL_CODE_DAY_TO_HOUR );
+            MYODBCDbgReturn( SQL_SUCCESS );
+        case SQL_C_INTERVAL_DAY_TO_MINUTE:            /* 109  */  
+            pdesrec->setConciseType( nConciseType );
+            pdesrec->setType( SQL_INTERVAL );
+            pdesrec->setDatetimeIntervalCode( SQL_CODE_DAY_TO_MINUTE );
+            MYODBCDbgReturn( SQL_SUCCESS );
+        case SQL_C_INTERVAL_DAY_TO_SECOND:            /* 110  */
+            pdesrec->setConciseType( nConciseType );
+            pdesrec->setType( SQL_INTERVAL );
+            pdesrec->setDatetimeIntervalCode( SQL_CODE_DAY_TO_SECOND );
+            MYODBCDbgReturn( SQL_SUCCESS );
+        case SQL_C_INTERVAL_HOUR_TO_MINUTE:           /* 111  */
+            pdesrec->setConciseType( nConciseType );
+            pdesrec->setType( SQL_INTERVAL );
+            pdesrec->setDatetimeIntervalCode( SQL_CODE_HOUR_TO_MINUTE );
+            MYODBCDbgReturn( SQL_SUCCESS );
+        case SQL_C_INTERVAL_HOUR_TO_SECOND:           /* 112  */
+            pdesrec->setConciseType( nConciseType );
+            pdesrec->setType( SQL_INTERVAL );
+            pdesrec->setDatetimeIntervalCode( SQL_CODE_HOUR_TO_SECOND );
+            MYODBCDbgReturn( SQL_SUCCESS );
+        case SQL_C_INTERVAL_MINUTE_TO_SECOND:         /* 113  */
+            pdesrec->setConciseType( nConciseType );
+            pdesrec->setType( SQL_INTERVAL );
+            pdesrec->setDatetimeIntervalCode( SQL_CODE_MINUTE_TO_SECOND );
+            MYODBCDbgReturn( SQL_SUCCESS );
+    }
+
+    MYODBCDbgReturn( dia.doAppend( MYODBC_DIA_HY092, 0, NULL ) );
+}
+
+SQLRETURN MYODBCDes::setConciseTypeSQL( MYODBCDesRec *pdesrec, SQLSMALLINT nConciseType )
+{
+    MYODBCDbgEnter();
+
+    /*
+        \internal ODBC Rule
+
+        The values in the SQL_DESC_CONCISE_TYPE, SQL_DESC_TYPE, and 
+        SQL_DESC_DATETIME_INTERVAL_CODE fields are interdependent. Each 
+        time one of the fields is set, the other must also be set.
+    */
+
+    /*
+        \internal ODBC Rule
+
+        If SQL_DESC_CONCISE_TYPE is set to a concise data type other than 
+        an interval or datetime data type, the SQL_DESC_TYPE field is set 
+        to the same value and the SQL_DESC_DATETIME_INTERVAL_CODE field is 
+        set to 0.
+    */
+
+    /*
+        \internal ODBC Rule
+
+        If SQL_DESC_CONCISE_TYPE is set to the concise datetime or interval
+        data type, the SQL_DESC_TYPE field is set to the corresponding 
+        verbose type (SQL_DATETIME or SQL_INTERVAL) and the 
+        SQL_DESC_DATETIME_INTERVAL_CODE field is set to the appropriate 
+        subcode. 
+    */
+
+    /*
+        SQL concise types
+
+        These are listed in the order given in the ODBC specification.
+    */
+    switch ( nConciseType )
+    {
+        case SQL_CHAR:                              /*   1  */
+        case SQL_VARCHAR:                           /*  12  */
+        case SQL_LONGVARCHAR:                       /*  -1  */
+        case SQL_WCHAR:                             /*  -8  */
+        case SQL_WVARCHAR:                          /*  -9  */
+        case SQL_WLONGVARCHAR:                      /* -10  */
+        case SQL_DECIMAL:                           /*   3  */
+        case SQL_NUMERIC:                           /*   2  */
+        case SQL_SMALLINT:                          /*   5  */
+        case SQL_INTEGER:                           /*   4  */
+        case SQL_REAL:                              /*   7  */
+        case SQL_FLOAT:                             /*   6  */
+        case SQL_DOUBLE:                            /*   8  */
+        case SQL_BIT:                               /*  -7  */
+        case SQL_TINYINT:                           /*  -6  */
+        case SQL_BIGINT:                            /*  -5  */
+        case SQL_BINARY:                            /*  -2  */
+        case SQL_VARBINARY:                         /*  -3  */
+        case SQL_LONGVARBINARY:                     /*  -4  */
+            pdesrec->setConciseType( nConciseType );
+            pdesrec->setType( nConciseType );
+            pdesrec->setDatetimeIntervalCode( 0 );
+            MYODBCDbgReturn( SQL_SUCCESS );
+        case SQL_TYPE_DATE:                         /*  91  */
+            pdesrec->setConciseType( nConciseType );
+            pdesrec->setType( SQL_DATETIME );
+            pdesrec->setDatetimeIntervalCode( SQL_CODE_DATE );
+            MYODBCDbgReturn( SQL_SUCCESS );
+        case SQL_TYPE_TIME:                         /*  92  */
+            pdesrec->setConciseType( nConciseType );
+            pdesrec->setType( SQL_DATETIME );
+            pdesrec->setDatetimeIntervalCode( SQL_CODE_TIME );
+            MYODBCDbgReturn( SQL_SUCCESS );
+        case SQL_TYPE_TIMESTAMP:                    /*  93  */
+            pdesrec->setConciseType( nConciseType );
+            pdesrec->setType( SQL_DATETIME );
+            pdesrec->setDatetimeIntervalCode( SQL_CODE_TIMESTAMP );
+            MYODBCDbgReturn( SQL_SUCCESS );
+            /* case SQL_TYPE_UTCDATETIME: */            /*   ?  */
+            /* case SQL_TYPE_UTCTIME:     */            /*   ?  */
+        case SQL_INTERVAL_MONTH:                    /* 102  */
+            pdesrec->setConciseType( nConciseType );
+            pdesrec->setType( SQL_INTERVAL );
+            pdesrec->setDatetimeIntervalCode( SQL_CODE_MONTH );
+            MYODBCDbgReturn( SQL_SUCCESS );
+        case SQL_INTERVAL_YEAR:                     /* 101  */
+            pdesrec->setConciseType( nConciseType );
+            pdesrec->setType( SQL_INTERVAL );
+            pdesrec->setDatetimeIntervalCode( SQL_CODE_YEAR );
+            MYODBCDbgReturn( SQL_SUCCESS );
+        case SQL_INTERVAL_YEAR_TO_MONTH:            /* 107  */
+            pdesrec->setConciseType( nConciseType );
+            pdesrec->setType( SQL_INTERVAL );
+            pdesrec->setDatetimeIntervalCode( SQL_CODE_YEAR_TO_MONTH );
+            MYODBCDbgReturn( SQL_SUCCESS );
+        case SQL_INTERVAL_DAY:                      /* 103  */
+            pdesrec->setConciseType( nConciseType );
+            pdesrec->setType( SQL_INTERVAL );
+            pdesrec->setDatetimeIntervalCode( SQL_CODE_DAY );
+            MYODBCDbgReturn( SQL_SUCCESS );
+        case SQL_INTERVAL_HOUR:                     /* 104  */
+            pdesrec->setConciseType( nConciseType );
+            pdesrec->setType( SQL_INTERVAL );
+            pdesrec->setDatetimeIntervalCode( SQL_CODE_HOUR );
+            MYODBCDbgReturn( SQL_SUCCESS );
+        case SQL_INTERVAL_MINUTE:                   /* 105  */
+            pdesrec->setConciseType( nConciseType );
+            pdesrec->setType( SQL_INTERVAL );
+            pdesrec->setDatetimeIntervalCode( SQL_CODE_MINUTE );
+            MYODBCDbgReturn( SQL_SUCCESS );
+        case SQL_INTERVAL_SECOND:                   /* 106  */
+            pdesrec->setConciseType( nConciseType );
+            pdesrec->setType( SQL_INTERVAL );
+            pdesrec->setDatetimeIntervalCode( SQL_CODE_SECOND );
+            MYODBCDbgReturn( SQL_SUCCESS );
+        case SQL_INTERVAL_DAY_TO_HOUR:              /* 108  */
+            pdesrec->setConciseType( nConciseType );
+            pdesrec->setType( SQL_INTERVAL );
+            pdesrec->setDatetimeIntervalCode( SQL_CODE_DAY_TO_HOUR );
+            MYODBCDbgReturn( SQL_SUCCESS );
+        case SQL_INTERVAL_DAY_TO_MINUTE:            /* 109  */  
+            pdesrec->setConciseType( nConciseType );
+            pdesrec->setType( SQL_INTERVAL );
+            pdesrec->setDatetimeIntervalCode( SQL_CODE_DAY_TO_MINUTE );
+            MYODBCDbgReturn( SQL_SUCCESS );
+        case SQL_INTERVAL_DAY_TO_SECOND:            /* 110  */
+            pdesrec->setConciseType( nConciseType );
+            pdesrec->setType( SQL_INTERVAL );
+            pdesrec->setDatetimeIntervalCode( SQL_CODE_DAY_TO_SECOND );
+            MYODBCDbgReturn( SQL_SUCCESS );
+        case SQL_INTERVAL_HOUR_TO_MINUTE:           /* 111  */
+            pdesrec->setConciseType( nConciseType );
+            pdesrec->setType( SQL_INTERVAL );
+            pdesrec->setDatetimeIntervalCode( SQL_CODE_HOUR_TO_MINUTE );
+            MYODBCDbgReturn( SQL_SUCCESS );
+        case SQL_INTERVAL_HOUR_TO_SECOND:           /* 112  */
+            pdesrec->setConciseType( nConciseType );
+            pdesrec->setType( SQL_INTERVAL );
+            pdesrec->setDatetimeIntervalCode( SQL_CODE_HOUR_TO_SECOND );
+            MYODBCDbgReturn( SQL_SUCCESS );
+        case SQL_INTERVAL_MINUTE_TO_SECOND:         /* 113  */
+            pdesrec->setConciseType( nConciseType );
+            pdesrec->setType( SQL_INTERVAL );
+            pdesrec->setDatetimeIntervalCode( SQL_CODE_MINUTE_TO_SECOND );
+            MYODBCDbgReturn( SQL_SUCCESS );
+        case SQL_GUID:                              /* -11  */
+            pdesrec->setConciseType( nConciseType );
+            pdesrec->setType( nConciseType );
+            pdesrec->setDatetimeIntervalCode( 0 );
+            MYODBCDbgReturn( SQL_SUCCESS );
+    }
+
+    MYODBCDbgReturn( dia.doAppend( MYODBC_DIA_HY092, 0, NULL ) );
+}
+
+
+

Modified: MYODBCDes/MYODBCDesLib/MYODBCDesAPD.cpp
===================================================================
--- MYODBCDes/MYODBCDesLib/MYODBCDesAPD.cpp	2006-01-03 08:52:27 UTC (rev 25)
+++ MYODBCDes/MYODBCDesLib/MYODBCDesAPD.cpp	2006-01-03 19:29:32 UTC (rev 26)
@@ -15,10 +15,10 @@
         or by an ODBC 2.x application working with an ODBC 3.x 
         driver.)
     */    
-    pdesrecord = new MYODBCResRecAPD( this );
-    pdesrecord->nConciseType            = SQL_BINARY;
-    pdesrecord->nType                   = SQL_BINARY;
-    pdesrecord->nDatetimeIntervalCode   = 0;
+    pdesrec = new MYODBCDesRecAPD( this );
+    pdesrec->setConciseType( SQL_BINARY );
+    pdesrec->setType( SQL_BINARY );
+    pdesrec->setDatetimeIntervalCode( 0 );
 }
 
 SQLRETURN MYODBCDesAPD::setDescRec( SQLSMALLINT nRecNumber, SQLSMALLINT nType,
SQLSMALLINT nSubType, SQLINTEGER nLength, SQLSMALLINT nPrecision, SQLSMALLINT nScale,
SQLPOINTER pDataPtr, SQLINTEGER *pnStringLengthPtr, SQLINTEGER *pnIndicatorPtr )
@@ -66,7 +66,7 @@
     }
 
     /* set record */
-    MYODBCDbgReturn( listRecords[nRecord]->setDescRec( nType, nSubType, nLength,
nPrecision, nScale, pDataPtr, pnStringLengthPtr, pnIndicatorPtr );
+    MYODBCDbgReturn( listRecords[nRecord]->setDescRec( nType, nSubType, nLength,
nPrecision, nScale, pDataPtr, pnStringLengthPtr, pnIndicatorPtr ) );
 }
 
 SQLRETURN MYODBCDesAPD::setDescField( SQLSMALLINT nRecNumber, SQLSMALLINT
nFieldIdentifier, SQLPOINTER pValuePtr, SQLINTEGER nBufferLength )
@@ -138,15 +138,6 @@
                 value to the length of a structure or an instance of a buffer into 
                 which result columns will be bound.
             */
-
-            /*!
-                \internal MYODBC Rule
-
-                Sanity check. Value must >=0
-            */
-            if ( (SQLINTEGER)pValuePtr < 0 )
-                MYODBCDbgReturn( dia.doAppend( MYODBC_DIA_HY000, 0, "Value must be >=
0." ) );
-
             MYODBCDbgReturn( setBindType( (SQLINTEGER)pValuePtr) );
 
         case SQL_DESC_COUNT:
@@ -158,15 +149,6 @@
                 IRD: R
                 IPD: R/W
             */
-            /*!
-                \internal ODBC Rule
-
-                The FieldIdentifier argument was SQL_DESC_COUNT, and *ValuePtr argument
was 
-                less than 0.
-            */
-            if ( (SQLINTEGER)pValuePtr < 0 )
-                MYODBCDbgReturn( dia.doAppend(  MYODBC_DIA_HY000, 0, "Set SQL_DESC_COUNT
failed. Value must be >=0." ) );
-
             /* expand/shrink record list; free, even, bound records as needed */
             MYODBCDbgReturn( setCount( (SQLINTEGER)pValuePtr, true ) );
 
@@ -180,6 +162,7 @@
                 IPD: R/W          
             */    
             MYODBCDbgReturn( dia.doAppend( MYODBC_DIA_HY091, 0, NULL ) );
+
     } /* switch (for header fields) */
 
     /* record field needs a valid record */
@@ -190,8 +173,6 @@
     MYODBCDbgReturn( listRecords[nRecord]->setDescField( nFieldIdentifier, pValuePtr,
nBufferLength ) );
 }
 
-
-
 /*!
     \brief  Expands or shrinks list of records.
             
@@ -214,21 +195,26 @@
 {
     MYODBCDbgEnter();
 
-    /* We should always have a bookmark record at index 0. */
+    /*!
+        \internal ODBC Rule
+
+        The FieldIdentifier argument was SQL_DESC_COUNT, and *ValuePtr argument was 
+        less than 0.
+    */
     if ( nCount < 0 )
         MYODBCDbgReturn( dia.doAppend( MYODBC_DIA_07009, 0, NULL ) );
 
     /* append */
     while ( nCount > listRecords.count() )
     {
-        new MYODBCResRecAPD( this );
+        new MYODBCDesRecAPD( this );
     }
 
     /* truncate */
     while ( listRecords.count() > nCount )
     {
         /* do not delete bound records */
-        if ( listRecords.last()->getDataPtr() )
+        if ( listRecords.last()->getDataPtr() && !bUnbind )
             break;
 
         delete listRecords.last();

Modified: MYODBCDes/MYODBCDesLib/MYODBCDesARD.cpp
===================================================================
--- MYODBCDes/MYODBCDesLib/MYODBCDesARD.cpp	2006-01-03 08:52:27 UTC (rev 25)
+++ MYODBCDes/MYODBCDesLib/MYODBCDesARD.cpp	2006-01-03 19:29:32 UTC (rev 26)
@@ -3,23 +3,191 @@
 MYODBCDesARD::MYODBCDesARD( SQLHANDLE hOwner )
 {
     nTypeSubID = MYODBC_RTTI_DES_ARD;
+
+    /* 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.)
+    */    
+    pdesrec = new MYODBCDesRecARD( this );
+    pdesrec->setConciseType( SQL_BINARY );
+    pdesrec->setType( SQL_BINARY );
+    pdesrec->setDatetimeIntervalCode( 0 );
 }
 
-SQLRETURN MYODBCDesARD::setRowsProcessedPtr( SQLUINTEGER *pnRowsProcessedPtr )
+SQLRETURN MYODBCDesARD::setDescField( SQLSMALLINT nRecNumber, SQLSMALLINT
nFieldIdentifier, SQLPOINTER pValuePtr, SQLINTEGER nBufferLength )
 {
-    if ( pdia )
-        pdia->doAppend( MYODBC_DIA_01000, 0, tr("Setting SQL_DESC_ROWS_PROCESSED_PTR
is not relevant in this context.") );
+    MYODBCDbgEnter();
 
-    this->pnRowsProcessedPtr = pnRowsProcessedPtr;
+    /*!
+        \internal ODBC Rule
 
-    return SQL_SUCCESS_WITH_INFO;
+        If an application calls SQLSetDescField to set any field other 
+        than SQL_DESC_COUNT or the deferred fields SQL_DESC_DATA_PTR, 
+        SQL_DESC_OCTET_LENGTH_PTR, or SQL_DESC_INDICATOR_PTR, the record 
+        becomes unbound.
+    */
+
+    /* the above rule is covered by the; doUnbind() calls */
+
+    /* header field? */
+    switch ( nFieldIdentifier )
+    {
+        case SQL_DESC_ALLOC_TYPE:
+            /*!
+                \internal ODBC Rule
+
+                ARD: R
+                APD: R
+                IRD: R
+                IPD: R
+            */
+            MYODBCDbgReturn( dia.doAppend( MYODBC_DIA_HY091, 0, NULL ) );
+
+        case SQL_DESC_ARRAY_SIZE:
+            /*!
+                \internal ODBC Rule
+
+                ARD: R/W
+                APD: R/W
+                IRD: Unused
+                IPD: Unused
+            */
+            MYODBCDbgReturn( setArraySize( (SQLUINTEGER)pValuePtr ) );
+
+        case SQL_DESC_ARRAY_STATUS_PTR:
+            /*!
+                \internal ODBC Rule
+
+                ARD: R/W
+                APD: R/W
+                IRD: R/W
+                IPD: R/W          
+            */    
+            MYODBCDbgReturn( setArrayStatusPtr( (SQLUSMALLINT*)pValuePtr ) );
+
+        case SQL_DESC_BIND_OFFSET_PTR:
+            /*! 
+                \internal ODBC Rule
+
+                ARD: R/W
+                APD: R/W
+                IRD: Unused
+                IPD: Unused
+            */
+            MYODBCDbgReturn( setBindOffsetPtr( (SQLUINTEGER*)pValuePtr ) );
+
+        case SQL_DESC_BIND_TYPE:
+            /*!
+                \internal ODBC Rule
+
+                ARD: R/W
+                APD: R/W
+                IRD: Unused
+                IPD: Unused
+            */
+
+            /*
+                An SQLUINTEGER value that sets the binding orientation to be used when 
+                SQLFetch or SQLFetchScroll is called on the associated statement. 
+                Column-wise binding is selected by setting the value 
+                to SQL_BIND_BY_COLUMN (0). Row-wise binding is selected by setting the 
+                value to the length of a structure or an instance of a buffer into 
+                which result columns will be bound.
+            */
+
+            /*!
+                \internal MYODBC Rule
+
+                Sanity check. Value must >=0
+            */
+            if ( (SQLINTEGER)pValuePtr < 0 )
+                MYODBCDbgReturn( dia.doAppend( MYODBC_DIA_HY000, 0, "Value must be >=
0." ) );
+
+            MYODBCDbgReturn( setBindType( (SQLINTEGER)pValuePtr) );
+
+        case SQL_DESC_COUNT:
+            /*!
+                \internal ODBC Rule
+
+                ARD: R/W
+                APD: R/W
+                IRD: R
+                IPD: R/W
+            */
+            /* expand/shrink record list; free, even, bound records as needed */
+            MYODBCDbgReturn( setCount( (SQLINTEGER)pValuePtr, true ) );
+
+        case SQL_DESC_ROWS_PROCESSED_PTR:
+            /*!
+                \internal ODBC Rule
+
+                ARD: Unused
+                APD: Unused
+                IRD: R/W
+                IPD: R/W          
+            */    
+            MYODBCDbgReturn( dia.doAppend( MYODBC_DIA_HY091, 0, NULL ) );
+
+    } /* switch (for header fields) */
+
+    /* record field needs a valid record */
+    if ( nRecord < 0 || nRecord >= listRecords.count() )
+        MYODBCDbgReturn( dia.doAppend( MYODBC_DIA_07009, 0, NULL ) );
+
+    /* handle as record field */
+    MYODBCDbgReturn( listRecords[nRecord]->setDescField( nFieldIdentifier, pValuePtr,
nBufferLength ) );
 }
 
-SQLUINTEGER *MYODBCDesARD::getRowsProcessedPtr()
+/*!
+    \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 )
 {
-    if ( pdia )
-        pdia->doAppend( MYODBC_DIA_01000, 0, tr("Getting SQL_DESC_ROWS_PROCESSED_PTR
is not relevant in this context.") );
+    MYODBCDbgEnter();
 
-    return pnRowsProcessedPtr;
+    /* We should always have a bookmark record at index 0. */
+    if ( nCount < 0 )
+        MYODBCDbgReturn( dia.doAppend( MYODBC_DIA_07009, 0, NULL ) );
+
+    /* append */
+    while ( nCount > listRecords.count() )
+    {
+        new MYODBCDesRecARD( this );
+    }
+
+    /* truncate */
+    while ( listRecords.count() > nCount )
+    {
+        /* do not delete bound records */
+        if ( listRecords.last()->getDataPtr() && !bUnbind )
+            break;
+
+        delete listRecords.last();
+    }
+
+    MYODBCDbgReturn( SQL_SUCCESS );
 }
 
+

Modified: MYODBCDes/MYODBCDesLib/MYODBCDesIPD.cpp
===================================================================
--- MYODBCDes/MYODBCDesLib/MYODBCDesIPD.cpp	2006-01-03 08:52:27 UTC (rev 25)
+++ MYODBCDes/MYODBCDesLib/MYODBCDesIPD.cpp	2006-01-03 19:29:32 UTC (rev 26)
@@ -3,60 +3,175 @@
 MYODBCDesIPD::MYODBCDesIPD( SQLHANDLE hOwner )
 {
     nTypeSubID = MYODBC_RTTI_DES_IPD;
+
+    /* 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.)
+    */    
+    pdesrec = new MYODBCDesRecIPD( this );
+    pdesrec->setConciseType( SQL_BINARY );
+    pdesrec->setType( SQL_BINARY );
+    pdesrec->setDatetimeIntervalCode( 0 );
 }
 
-SQLRETURN MYODBCDesIPD::setArraySize( SQLUINTEGER nArraySize )
+SQLRETURN MYODBCDesIPD::setDescField( SQLSMALLINT nRecNumber, SQLSMALLINT
nFieldIdentifier, SQLPOINTER pValuePtr, SQLINTEGER nBufferLength )
 {
-    if ( pdia )
-        pdia->doAppend( MYODBC_DIA_01000, 0, tr("Setting SQL_DESC_ARRAY_SIZE is not
relevant in this context.") );
+    MYODBCDbgEnter();
 
-    this->nArraySize = nArraySize;
+    /*!
+        \internal ODBC Rule
 
-    return SQL_SUCCESS_WITH_INFO;
-}
+        If an application calls SQLSetDescField to set any field other 
+        than SQL_DESC_COUNT or the deferred fields SQL_DESC_DATA_PTR, 
+        SQL_DESC_OCTET_LENGTH_PTR, or SQL_DESC_INDICATOR_PTR, the record 
+        becomes unbound.
+    */
 
-SQLRETURN MYODBCDesIPD::setBindOffsetPtr( SQLINTEGER *pnBindOffsetPtr )
-{
-    if ( pdia )
-        pdia->doAppend( MYODBC_DIA_01000, 0, tr("Setting SQL_DESC_BIND_OFFSET_PTR is
not relevant in this context.") );
+    /* the above rule is covered by the; doUnbind() calls */
 
-    this->pnBindOffsetPtr = pnBindOffsetPtr;
+    /* header field? */
+    switch ( nFieldIdentifier )
+    {
+        case SQL_DESC_ALLOC_TYPE:
+            /*!
+                \internal ODBC Rule
 
-    return SQL_SUCCESS_WITH_INFO;
-}
+                ARD: R
+                APD: R
+                IRD: R
+                IPD: R
+            */
+            MYODBCDbgReturn( dia.doAppend( MYODBC_DIA_HY091, 0, NULL ) );
 
-SQLRETURN MYODBCDesIPD::setBindType( SQLINTEGER nBindType )
-{
-    if ( pdia )
-        pdia->doAppend( MYODBC_DIA_01000, 0, tr("Setting SQL_DESC_BIND_TYPE is not
relevant in this context.") );
+        case SQL_DESC_ARRAY_SIZE:
+            /*!
+                \internal ODBC Rule
 
-    this->nBindType = nBindType;
+                ARD: R/W
+                APD: R/W
+                IRD: Unused
+                IPD: Unused
+            */
+            MYODBCDbgReturn( dia.doAppend( MYODBC_DIA_HY091, 0, NULL ) );
 
-    return SQL_SUCCESS_WITH_INFO;
-}
+        case SQL_DESC_ARRAY_STATUS_PTR:
+            /*!
+                \internal ODBC Rule
 
-SQLUINTEGER MYODBCDesIPD::getArraySize()
-{
-    if ( pdia )
-        pdia->doAppend( MYODBC_DIA_01000, 0, tr("Getting SQL_DESC_ARRAY_SIZE is not
relevant in this context.") );
+                ARD: R/W
+                APD: R/W
+                IRD: R/W
+                IPD: R/W          
+            */    
+            MYODBCDbgReturn( setArrayStatusPtr( (SQLUSMALLINT*)pValuePtr ) );
 
-    return nArraySize;
-}
+        case SQL_DESC_BIND_OFFSET_PTR:
+            /*! 
+                \internal ODBC Rule
 
-SQLINTEGER *MYODBCDesIPD::getBindOffsetPtr()
-{
-    if ( pdia )
-        pdia->doAppend( MYODBC_DIA_01000, 0, tr("Getting SQL_DESC_BIND_OFFSET_PTR is
not relevant in this context.") );
+                ARD: R/W
+                APD: R/W
+                IRD: Unused
+                IPD: Unused
+            */
+            MYODBCDbgReturn( dia.doAppend( MYODBC_DIA_HY091, 0, NULL ) );
 
-    return pnBindOffsetPtr;
+        case SQL_DESC_BIND_TYPE:
+            /*!
+                \internal ODBC Rule
+
+                ARD: R/W
+                APD: R/W
+                IRD: Unused
+                IPD: Unused
+            */
+            MYODBCDbgReturn( dia.doAppend( MYODBC_DIA_HY091, 0, NULL ) );
+
+        case SQL_DESC_COUNT:
+            /*!
+                \internal ODBC Rule
+
+                ARD: R/W
+                APD: R/W
+                IRD: R
+                IPD: R/W
+            */
+            /* expand/shrink record list; free, even, bound records as needed */
+            MYODBCDbgReturn( setCount( (SQLINTEGER)pValuePtr, true ) );
+
+        case SQL_DESC_ROWS_PROCESSED_PTR:
+            /*!
+                \internal ODBC Rule
+
+                ARD: Unused
+                APD: Unused
+                IRD: R/W
+                IPD: R/W          
+            */    
+            MYODBCDbgReturn( setRowsProcessedPtr( (SQLUINTEGER*)pValuePtr ) );
+
+    } /* switch (for header fields) */
+
+    /* record field needs a valid record */
+    if ( nRecord < 0 || nRecord >= listRecords.count() )
+        MYODBCDbgReturn( dia.doAppend( MYODBC_DIA_07009, 0, NULL ) );
+
+    /* handle as record field */
+    MYODBCDbgReturn( listRecords[nRecord]->setDescField( nFieldIdentifier, pValuePtr,
nBufferLength ) );
 }
 
-SQLINTEGER MYODBCDesIPD::getBindType()
+/*!
+    \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 )
 {
-    if ( pdia )
-        pdia->doAppend( MYODBC_DIA_01000, 0, tr("Getting SQL_DESC_BIND_TYPE is not
relevant in this context.") );
+    MYODBCDbgEnter();
 
-    return nBindType;
+    /* We should always have a bookmark record at index 0. */
+    if ( nCount < 0 )
+        MYODBCDbgReturn( dia.doAppend( MYODBC_DIA_07009, 0, NULL ) );
+
+    /* append */
+    while ( nCount > listRecords.count() )
+    {
+        new MYODBCDesRecIPD( this );
+    }
+
+    /* truncate */
+    while ( listRecords.count() > nCount )
+    {
+        /* do not delete bound records */
+        if ( listRecords.last()->getDataPtr() && !bUnbind )
+            break;
+
+        delete listRecords.last();
+    }
+
+    MYODBCDbgReturn( SQL_SUCCESS );
 }
 
 
+
+

Modified: MYODBCDes/MYODBCDesLib/MYODBCDesIRD.cpp
===================================================================
--- MYODBCDes/MYODBCDesLib/MYODBCDesIRD.cpp	2006-01-03 08:52:27 UTC (rev 25)
+++ MYODBCDes/MYODBCDesLib/MYODBCDesIRD.cpp	2006-01-03 19:29:32 UTC (rev 26)
@@ -1,60 +1,174 @@
 MYODBCDesIRD::MYODBCDesIRD( SQLHANDLE hOwner )
 {
     nTypeSubID = MYODBC_RTTI_DES_IRD;
+
+    /* 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.)
+    */    
+    pdesrec = new MYODBCDesRecIRD( this );
+    pdesrec->setConciseType( SQL_BINARY );
+    pdesrec->setType( SQL_BINARY );
+    pdesrec->setDatetimeIntervalCode( 0 );
 }
 
-SQLRETURN MYODBCDesIRD::setArraySize( SQLUINTEGER nArraySize )
+SQLRETURN MYODBCDesIRD::setDescField( SQLSMALLINT nRecNumber, SQLSMALLINT
nFieldIdentifier, SQLPOINTER pValuePtr, SQLINTEGER nBufferLength )
 {
-    if ( pdia )
-        pdia->doAppend( MYODBC_DIA_01000, 0, tr("Setting SQL_DESC_ARRAY_SIZE is not
relevant in this context.") );
+    MYODBCDbgEnter();
 
-    this->nArraySize = nArraySize;
+    /*!
+        \internal ODBC Rule
 
-    return SQL_SUCCESS_WITH_INFO;
-}
+        If an application calls SQLSetDescField to set any field other 
+        than SQL_DESC_COUNT or the deferred fields SQL_DESC_DATA_PTR, 
+        SQL_DESC_OCTET_LENGTH_PTR, or SQL_DESC_INDICATOR_PTR, the record 
+        becomes unbound.
+    */
 
-SQLRETURN MYODBCDesIRD::setBindOffsetPtr( SQLINTEGER *pnBindOffsetPtr )
-{
-    if ( pdia )
-        pdia->doAppend( MYODBC_DIA_01000, 0, tr("Setting SQL_DESC_BIND_OFFSET_PTR is
not relevant in this context.") );
+    /* the above rule is covered by the; doUnbind() calls */
 
-    this->pnBindOffsetPtr = pnBindOffsetPtr;
+    /* header field? */
+    switch ( nFieldIdentifier )
+    {
+        case SQL_DESC_ALLOC_TYPE:
+            /*!
+                \internal ODBC Rule
 
-    return SQL_SUCCESS_WITH_INFO;
-}
+                ARD: R
+                APD: R
+                IRD: R
+                IPD: R
+            */
+            MYODBCDbgReturn( dia.doAppend( MYODBC_DIA_HY091, 0, NULL ) );
 
-SQLRETURN MYODBCDesIRD::setBindType( SQLINTEGER nBindType )
-{
-    if ( pdia )
-        pdia->doAppend( MYODBC_DIA_01000, 0, tr("Setting SQL_DESC_BIND_TYPE is not
relevant in this context.") );
+        case SQL_DESC_ARRAY_SIZE:
+            /*!
+                \internal ODBC Rule
 
-    this->nBindType = nBindType;
+                ARD: R/W
+                APD: R/W
+                IRD: Unused
+                IPD: Unused
+            */
+            MYODBCDbgReturn( dia.doAppend( MYODBC_DIA_HY091, 0, NULL ) );
 
-    return SQL_SUCCESS_WITH_INFO;
-}
+        case SQL_DESC_ARRAY_STATUS_PTR:
+            /*!
+                \internal ODBC Rule
 
-SQLUINTEGER MYODBCDesIRD::getArraySize()
-{
-    if ( pdia )
-        pdia->doAppend( MYODBC_DIA_01000, 0, tr("Getting SQL_DESC_ARRAY_SIZE is not
relevant in this context.") );
+                ARD: R/W
+                APD: R/W
+                IRD: R/W
+                IPD: R/W          
+            */    
+            MYODBCDbgReturn( setArrayStatusPtr( (SQLUSMALLINT*)pValuePtr ) );
 
-    return nArraySize;
-}
+        case SQL_DESC_BIND_OFFSET_PTR:
+            /*! 
+                \internal ODBC Rule
 
-SQLINTEGER *MYODBCDesIRD::getBindOffsetPtr()
-{
-    if ( pdia )
-        pdia->doAppend( MYODBC_DIA_01000, 0, tr("Getting SQL_DESC_BIND_OFFSET_PTR is
not relevant in this context.") );
+                ARD: R/W
+                APD: R/W
+                IRD: Unused
+                IPD: Unused
+            */
+            MYODBCDbgReturn( dia.doAppend( MYODBC_DIA_HY091, 0, NULL ) );
 
-    return pnBindOffsetPtr;
+        case SQL_DESC_BIND_TYPE:
+            /*!
+                \internal ODBC Rule
+
+                ARD: R/W
+                APD: R/W
+                IRD: Unused
+                IPD: Unused
+            */
+            MYODBCDbgReturn( dia.doAppend( MYODBC_DIA_HY091, 0, NULL ) );
+
+        case SQL_DESC_COUNT:
+            /*!
+                \internal ODBC Rule
+
+                ARD: R/W
+                APD: R/W
+                IRD: R
+                IPD: R/W
+            */
+            MYODBCDbgReturn( dia.doAppend( MYODBC_DIA_HY091, 0, NULL ) );
+
+        case SQL_DESC_ROWS_PROCESSED_PTR:
+            /*!
+                \internal ODBC Rule
+
+                ARD: Unused
+                APD: Unused
+                IRD: R/W
+                IPD: R/W          
+            */    
+            MYODBCDbgReturn( setRowsProcessedPtr( (SQLUINTEGER*)pValuePtr ) );
+    } /* switch (for header fields) */
+
+    /* record field needs a valid record */
+    if ( nRecord < 0 || nRecord >= listRecords.count() )
+        MYODBCDbgReturn( dia.doAppend( MYODBC_DIA_07009, 0, NULL ) );
+
+    /* handle as record field */
+    MYODBCDbgReturn( listRecords[nRecord]->setDescField( nFieldIdentifier, pValuePtr,
nBufferLength ) );
 }
 
-SQLINTEGER MYODBCDesIRD::getBindType()
+/*!
+    \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 )
 {
-    if ( pdia )
-        pdia->doAppend( MYODBC_DIA_01000, 0, tr("Getting SQL_DESC_BIND_TYPE is not
relevant in this context.") );
+    MYODBCDbgEnter();
 
-    return nBindType;
+    /* We should always have a bookmark record at index 0. */
+    if ( nCount < 0 )
+        MYODBCDbgReturn( dia.doAppend( MYODBC_DIA_07009, 0, NULL ) );
+
+    /* append */
+    while ( nCount > listRecords.count() )
+    {
+        new MYODBCDesRecIRD( this );
+    }
+
+    /* truncate */
+    while ( listRecords.count() > nCount )
+    {
+        /* do not delete bound records */
+        if ( listRecords.last()->getDataPtr() && !bUnbind )
+            break;
+
+        delete listRecords.last();
+    }
+
+    MYODBCDbgReturn( SQL_SUCCESS );
 }
 
 
+
+
+

Modified: MYODBCDes/MYODBCDesLib/MYODBCDesRec.cpp
===================================================================
--- MYODBCDes/MYODBCDesLib/MYODBCDesRec.cpp	2006-01-03 08:52:27 UTC (rev 25)
+++ MYODBCDes/MYODBCDesLib/MYODBCDesRec.cpp	2006-01-03 19:29:32 UTC (rev 26)
@@ -591,6 +591,15 @@
 }
 
 
+SQLRETURN MYODBCResRec::doUnbind()
+{
+    MYODBCDbgEnter();
+
+    pDataPtr = NULL;
+
+    MYODBCDbgReturn( SQL_SUCCESS );
+}
+
 SQLRETURN MYODBCResRec::setIntervalCode( SQLSMALLINT nDateTimeIntervalCode )
 {
     MYODBCDbgEnter();

Modified: MYODBCDes/MYODBCDesLib/MYODBCDesRec.h
===================================================================
--- MYODBCDes/MYODBCDesLib/MYODBCDesRec.h	2006-01-03 08:52:27 UTC (rev 25)
+++ MYODBCDes/MYODBCDesLib/MYODBCDesRec.h	2006-01-03 19:29:32 UTC (rev 26)
@@ -114,6 +114,9 @@
     virtual SQLSMALLINT getUnsigned();
     virtual SQLSMALLINT getUpdatable();
 
+    /* do'rs */
+    virtual SQLRETURN doUnbind();
+
 protected:
     MYODBCDes * pdes;                           /* parent & owner */
 

Modified: MYODBCDes/MYODBCDesLib/MYODBCDesRecIRD.h
===================================================================
--- MYODBCDes/MYODBCDesLib/MYODBCDesRecIRD.h	2006-01-03 08:52:27 UTC (rev 25)
+++ MYODBCDes/MYODBCDesLib/MYODBCDesRecIRD.h	2006-01-03 19:29:32 UTC (rev 26)
@@ -18,5 +18,156 @@
     virtual SQLRETURN getDescField( SQLSMALLINT nFieldIdentifier, SQLPOINTER pValuePtr,
SQLINTEGER nBufferLength, SQLINTEGER *pnStringLengthPtr );
 };
 
+SQLRETURN MYODBCDesIRD::setDescField( SQLSMALLINT nRecNumber, SQLSMALLINT
nFieldIdentifier, SQLPOINTER pValuePtr, SQLINTEGER nBufferLength )
+{
+    MYODBCDbgEnter();
+
+    /*!
+        \internal ODBC Rule
+
+        If an application calls SQLSetDescField to set any field other 
+        than SQL_DESC_COUNT or the deferred fields SQL_DESC_DATA_PTR, 
+        SQL_DESC_OCTET_LENGTH_PTR, or SQL_DESC_INDICATOR_PTR, the record 
+        becomes unbound.
+    */
+
+    /* the above rule is covered by the; doUnbind() calls */
+
+    /* header field? */
+    switch ( nFieldIdentifier )
+    {
+        case SQL_DESC_ALLOC_TYPE:
+            /*!
+                \internal ODBC Rule
+
+                ARD: R
+                APD: R
+                IRD: R
+                IPD: R
+            */
+            MYODBCDbgReturn( dia.doAppend( MYODBC_DIA_HY091, 0, NULL ) );
+
+        case SQL_DESC_ARRAY_SIZE:
+            /*!
+                \internal ODBC Rule
+
+                ARD: R/W
+                APD: R/W
+                IRD: Unused
+                IPD: Unused
+            */
+            MYODBCDbgReturn( dia.doAppend( MYODBC_DIA_HY091, 0, NULL ) );
+
+        case SQL_DESC_ARRAY_STATUS_PTR:
+            /*!
+                \internal ODBC Rule
+
+                ARD: R/W
+                APD: R/W
+                IRD: R/W
+                IPD: R/W          
+            */    
+            MYODBCDbgReturn( setArrayStatusPtr( (SQLUSMALLINT*)pValuePtr ) );
+
+        case SQL_DESC_BIND_OFFSET_PTR:
+            /*! 
+                \internal ODBC Rule
+
+                ARD: R/W
+                APD: R/W
+                IRD: Unused
+                IPD: Unused
+            */
+            MYODBCDbgReturn( dia.doAppend( MYODBC_DIA_HY091, 0, NULL ) );
+
+        case SQL_DESC_BIND_TYPE:
+            /*!
+                \internal ODBC Rule
+
+                ARD: R/W
+                APD: R/W
+                IRD: Unused
+                IPD: Unused
+            */
+            MYODBCDbgReturn( dia.doAppend( MYODBC_DIA_HY091, 0, NULL ) );
+
+        case SQL_DESC_COUNT:
+            /*!
+                \internal ODBC Rule
+
+                ARD: R/W
+                APD: R/W
+                IRD: R
+                IPD: R/W
+            */
+            MYODBCDbgReturn( dia.doAppend( MYODBC_DIA_HY091, 0, NULL ) );
+
+        case SQL_DESC_ROWS_PROCESSED_PTR:
+            /*!
+                \internal ODBC Rule
+
+                ARD: Unused
+                APD: Unused
+                IRD: R/W
+                IPD: R/W          
+            */    
+            MYODBCDbgReturn( setRowsProcessedPtr( (SQLUINTEGER*)pValuePtr ) );
+    } /* switch (for header fields) */
+
+    /* record field needs a valid record */
+    if ( nRecord < 0 || nRecord >= listRecords.count() )
+        MYODBCDbgReturn( dia.doAppend( MYODBC_DIA_07009, 0, NULL ) );
+
+    /* handle as record field */
+    MYODBCDbgReturn( listRecords[nRecord]->setDescField( nFieldIdentifier, pValuePtr,
nBufferLength ) );
+}
+
+/*!
+    \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 )
+{
+    MYODBCDbgEnter();
+
+    /* We should always have a bookmark record at index 0. */
+    if ( nCount < 0 )
+        MYODBCDbgReturn( dia.doAppend( MYODBC_DIA_07009, 0, NULL ) );
+
+    /* append */
+    while ( nCount > listRecords.count() )
+    {
+        new MYODBCDesRecIRD( this );
+    }
+
+    /* truncate */
+    while ( listRecords.count() > nCount )
+    {
+        /* do not delete bound records */
+        if ( listRecords.last()->getDataPtr() && !bUnbind )
+            break;
+
+        delete listRecords.last();
+    }
+
+    MYODBCDbgReturn( SQL_SUCCESS );
+}
+
+
+
 #endif
 

Modified: MYODBCDes/include/MYODBCDes.h
===================================================================
--- MYODBCDes/include/MYODBCDes.h	2006-01-03 08:52:27 UTC (rev 25)
+++ MYODBCDes/include/MYODBCDes.h	2006-01-03 19:29:32 UTC (rev 26)
@@ -80,7 +80,7 @@
     /* setters */
 
     /* ODBC validated */
-    virtual SQLRETURN setDescRec( SQLSMALLINT nRecNumber, SQLSMALLINT nType, SQLSMALLINT
nSubType, SQLINTEGER nLength, SQLSMALLINT nPrecision, SQLSMALLINT nScale, SQLPOINTER
pDataPtr, SQLINTEGER *pnStringLengthPtr, SQLINTEGER *pnIndicatorPtr ) = 0;
+    virtual SQLRETURN setDescRec( SQLSMALLINT nRecNumber, SQLSMALLINT nType, SQLSMALLINT
nSubType, SQLINTEGER nLength, SQLSMALLINT nPrecision, SQLSMALLINT nScale, SQLPOINTER
pDataPtr, SQLINTEGER *pnStringLengthPtr, SQLINTEGER *pnIndicatorPtr );
     virtual SQLRETURN setDescField( SQLSMALLINT nRecNumber, SQLSMALLINT nFieldIdentifier,
SQLPOINTER pValuePtr, SQLINTEGER nBufferLength ) = 0;
 
     /* header fields */
@@ -203,6 +203,10 @@
     QList<MYODBCResRec*> listRecords;        /*!< An array of MYODBC_DES_REC. We
should always
                                                     have record at index 0. Index 0 is
used for  
                                                     bookmarks when an ARD desc.          
              */
+
+    /* putting these here breaks the design but means less duplicate code */
+    static SQLRETURN setConciseTypeC( MYODBCDesRec *pdesrec, SQLSMALLINT nConciseType );
+    static SQLRETURN setConciseTypeSQL( MYODBCDesRec *pdesrec, SQLSMALLINT nConciseType
);
 };
 
 #include "MYODBCDesAPD.h"

Modified: MYODBCDes/include/MYODBCDesARD.h
===================================================================
--- MYODBCDes/include/MYODBCDesARD.h	2006-01-03 08:52:27 UTC (rev 25)
+++ MYODBCDes/include/MYODBCDesARD.h	2006-01-03 19:29:32 UTC (rev 26)
@@ -22,16 +22,13 @@
     ~MYODBCDesARD();
 
     /* setters */
-    SQLRETURN setDescRec( SQLSMALLINT nRecNumber, SQLSMALLINT nType, SQLSMALLINT
nSubType, SQLINTEGER nLength, SQLSMALLINT nPrecision, SQLSMALLINT nScale, SQLPOINTER
pDataPtr, SQLINTEGER *pnStringLengthPtr, SQLINTEGER *pnIndicatorPtr );
     SQLRETURN setDescField( SQLSMALLINT nRecNumber, SQLSMALLINT nFieldIdentifier,
SQLPOINTER pValuePtr, SQLINTEGER nBufferLength );
 
-    SQLRETURN setRowsProcessedPtr( SQLUINTEGER *pnRowsProcessedPtr );
+    SQLRETURN setCount( SQLSMALLINT nCount, bool bUnbind );
 
     /* getters */
     SQLRETURN getDescRec( SQLSMALLINT nRecNumber, SQLCHAR *pszName, SQLSMALLINT
nBufferLength, SQLSMALLINT *pnStringLengthPtr, SQLSMALLINT *pnTypePtr, SQLSMALLINT
*pnSubTypePtr, SQLINTEGER *pnLengthPtr, SQLSMALLINT *pnPrecisionPtr, SQLSMALLINT
*pnScalePtr, SQLSMALLINT *pnNullablePtr );
     SQLRETURN getDescField( SQLSMALLINT nRecNumber, SQLSMALLINT nFieldIdentifier,
SQLPOINTER pValuePtr, SQLINTEGER nBufferLength, SQLINTEGER *pnStringLengthPtr );
-
-    SQLUINTEGER *getRowsProcessedPtr();
 };
 
 #endif

Modified: MYODBCDes/include/MYODBCDesIPD.h
===================================================================
--- MYODBCDes/include/MYODBCDesIPD.h	2006-01-03 08:52:27 UTC (rev 25)
+++ MYODBCDes/include/MYODBCDesIPD.h	2006-01-03 19:29:32 UTC (rev 26)
@@ -22,20 +22,13 @@
     ~MYODBCDesIPD();
 
     /* setters */
-    SQLRETURN setDescRec( SQLSMALLINT nRecNumber, SQLSMALLINT nType, SQLSMALLINT
nSubType, SQLINTEGER nLength, SQLSMALLINT nPrecision, SQLSMALLINT nScale, SQLPOINTER
pDataPtr, SQLINTEGER *pnStringLengthPtr, SQLINTEGER *pnIndicatorPtr );
     SQLRETURN setDescField( SQLSMALLINT nRecNumber, SQLSMALLINT nFieldIdentifier,
SQLPOINTER pValuePtr, SQLINTEGER nBufferLength );
 
-    SQLRETURN setArraySize( SQLUINTEGER nArraySize );
-    SQLRETURN setBindOffsetPtr( SQLINTEGER *pnBindOffsetPtr );
-    SQLRETURN setBindType( SQLINTEGER nBindType );
+    SQLRETURN setCount( SQLSMALLINT nCount, bool bUnbind );
 
     /* getters */
     SQLRETURN getDescRec( SQLSMALLINT nRecNumber, SQLCHAR *pszName, SQLSMALLINT
nBufferLength, SQLSMALLINT *pnStringLengthPtr, SQLSMALLINT *pnTypePtr, SQLSMALLINT
*pnSubTypePtr, SQLINTEGER *pnLengthPtr, SQLSMALLINT *pnPrecisionPtr, SQLSMALLINT
*pnScalePtr, SQLSMALLINT *pnNullablePtr );
     SQLRETURN getDescField( SQLSMALLINT nRecNumber, SQLSMALLINT nFieldIdentifier,
SQLPOINTER pValuePtr, SQLINTEGER nBufferLength, SQLINTEGER *pnStringLengthPtr );
-
-    SQLUINTEGER getArraySize();
-    SQLINTEGER *getBindOffsetPtr();
-    SQLINTEGER getBindType();
 };
 
 #endif

Modified: MYODBCDes/include/MYODBCDesIRD.h
===================================================================
--- MYODBCDes/include/MYODBCDesIRD.h	2006-01-03 08:52:27 UTC (rev 25)
+++ MYODBCDes/include/MYODBCDesIRD.h	2006-01-03 19:29:32 UTC (rev 26)
@@ -22,20 +22,13 @@
     ~MYODBCDesIRD();
 
     /* setters */
-    SQLRETURN setDescRec( SQLSMALLINT nRecNumber, SQLSMALLINT nType, SQLSMALLINT
nSubType, SQLINTEGER nLength, SQLSMALLINT nPrecision, SQLSMALLINT nScale, SQLPOINTER
pDataPtr, SQLINTEGER *pnStringLengthPtr, SQLINTEGER *pnIndicatorPtr );
     SQLRETURN setDescField( SQLSMALLINT nRecNumber, SQLSMALLINT nFieldIdentifier,
SQLPOINTER pValuePtr, SQLINTEGER nBufferLength );
 
-    SQLRETURN setArraySize( SQLUINTEGER nArraySize );
-    SQLRETURN setBindOffsetPtr( SQLINTEGER *pnBindOffsetPtr );
-    SQLRETURN setBindType( SQLINTEGER nBindType );
+    SQLRETURN setCount( SQLSMALLINT nCount, bool bUnbind );
 
     /* getters */
     SQLRETURN getDescRec( SQLSMALLINT nRecNumber, SQLCHAR *pszName, SQLSMALLINT
nBufferLength, SQLSMALLINT *pnStringLengthPtr, SQLSMALLINT *pnTypePtr, SQLSMALLINT
*pnSubTypePtr, SQLINTEGER *pnLengthPtr, SQLSMALLINT *pnPrecisionPtr, SQLSMALLINT
*pnScalePtr, SQLSMALLINT *pnNullablePtr );
     SQLRETURN getDescField( SQLSMALLINT nRecNumber, SQLSMALLINT nFieldIdentifier,
SQLPOINTER pValuePtr, SQLINTEGER nBufferLength, SQLINTEGER *pnStringLengthPtr );
-
-    SQLUINTEGER getArraySize();
-    SQLINTEGER *getBindOffsetPtr();
-    SQLINTEGER getBindType();
 };
 
 #endif

Thread
Connector/ODBC 5 commit: r26 - in MYODBCDes: MYODBCDesLib includepharvey3 Jan