Added:
MYODBCDes/MYODBCDesLib/MYODBCDesRecAPD.cpp
MYODBCDes/MYODBCDesLib/MYODBCDesRecARD.cpp
MYODBCDes/MYODBCDesLib/MYODBCDesRecIPD.cpp
MYODBCDes/MYODBCDesLib/MYODBCDesRecIRD.cpp
Modified:
MYODBCDes/MYODBCDesLib/MYODBCDes.cpp
MYODBCDes/MYODBCDesLib/MYODBCDesLib.vpj
MYODBCDes/MYODBCDesLib/MYODBCDesRec.cpp
MYODBCDes/MYODBCDesLib/MYODBCDesRec.h
MYODBCDes/MYODBCDesLib/MYODBCDesRecAPD.h
MYODBCDes/MYODBCDesLib/MYODBCDesRecARD.h
MYODBCDes/MYODBCDesLib/MYODBCDesRecIPD.h
MYODBCDes/MYODBCDesLib/MYODBCDesRecIRD.h
MYODBCDes/include/MYODBCDes.h
Log:
UNICODE:
- code to enable unicode and objectify descriptors
- not done yet
Modified: MYODBCDes/MYODBCDesLib/MYODBCDes.cpp
===================================================================
--- MYODBCDes/MYODBCDesLib/MYODBCDes.cpp 2006-01-03 23:54:35 UTC (rev 27)
+++ MYODBCDes/MYODBCDesLib/MYODBCDes.cpp 2006-01-04 06:58:46 UTC (rev 28)
@@ -998,308 +998,7 @@
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/MYODBCDesLib.vpj
===================================================================
--- MYODBCDes/MYODBCDesLib/MYODBCDesLib.vpj 2006-01-03 23:54:35 UTC (rev 27)
+++ MYODBCDes/MYODBCDesLib/MYODBCDesLib.vpj 2006-01-04 06:58:46 UTC (rev 28)
@@ -198,6 +198,8 @@
<F N="MYODBCDesRec.cpp"/>
<F N="MYODBCDesRecAlloc.c"/>
<F N="MYODBCDesRecAllocExt.c"/>
+ <F N="MYODBCDesRecAPD.cpp"/>
+ <F N="MYODBCDesRecARD.cpp"/>
<F N="MYODBCDesRecClear.c"/>
<F N="MYODBCDesRecConciseType.c"/>
<F N="MYODBCDesRecConciseTypeC.c"/>
@@ -207,6 +209,8 @@
<F N="MYODBCDesRecFree.c"/>
<F N="MYODBCDesRecGet.c"/>
<F N="MYODBCDesRecIntervalCode.c"/>
+ <F N="MYODBCDesRecIPD.cpp"/>
+ <F N="MYODBCDesRecIRD.cpp"/>
<F N="MYODBCDesRecIrdInteger.c"/>
<F N="MYODBCDesRecIrdSmallInt.c"/>
<F N="MYODBCDesRecIrdVarChar.c"/>
Modified: MYODBCDes/MYODBCDesLib/MYODBCDesRec.cpp
===================================================================
--- MYODBCDes/MYODBCDesLib/MYODBCDesRec.cpp 2006-01-03 23:54:35 UTC (rev 27)
+++ MYODBCDes/MYODBCDesLib/MYODBCDesRec.cpp 2006-01-04 06:58:46 UTC (rev 28)
@@ -897,6 +897,740 @@
MYODBCDbgReturn( setDatetimeIntervalCode( nDateTimeIntervalCode ) );
}
- return MYODBCDbgReturn( pdes->dia.doAppend( MYODBC_DIA_HY092, 0, NULL ) );
+ MYODBCDbgReturn( pdes->dia.doAppend( MYODBC_DIA_HY092, 0, NULL ) );
}
+SQLRETURN MYODBCDesRec::setTypeC( SQLSMALLINT nType );
+{
+ MYODBCDbgEnter();
+
+ /*
+ \internal ODBC Rule
+
+ SQL_DESC_TYPE record field specifies the concise SQL or C data type
+ for all data types except datetime and interval data types. For the
+ datetime and interval data types, this field specifies the verbose data
+ type, which is SQL_DATETIME or SQL_INTERVAL.
+ */
+
+ /*
+ \internal ODBC Rule
+
+ Trying to set SQL_DESC_TYPE to one of the concise datetime or
+ interval types will return SQLSTATE HY021 (Inconsistent
+ descriptor information).
+ */
+
+ switch ( nType )
+ {
+ case SQL_C_TYPE_DATE:
+ case SQL_C_TYPE_TIME:
+ case SQL_C_TYPE_TIMESTAMP:
+ case SQL_C_INTERVAL_YEAR:
+ case SQL_C_INTERVAL_MONTH:
+ case SQL_C_INTERVAL_DAY:
+ case SQL_C_INTERVAL_HOUR:
+ case SQL_C_INTERVAL_MINUTE:
+ case SQL_C_INTERVAL_SECOND:
+ case SQL_C_INTERVAL_YEAR_TO_MONTH:
+ case SQL_C_INTERVAL_DAY_TO_HOUR:
+ case SQL_C_INTERVAL_DAY_TO_MINUTE:
+ case SQL_C_INTERVAL_DAY_TO_SECOND:
+ case SQL_C_INTERVAL_HOUR_TO_MINUTE:
+ case SQL_C_INTERVAL_HOUR_TO_SECOND:
+ case SQL_C_INTERVAL_MINUTE_TO_SECOND:
+ MYODBCDbgReturn( pdes->dia.doAppend( MYODBC_DIA_HY021, 0, NULL ) );
+ }
+
+ /*
+ \internal ODBC Rule
+
+ If SQL_DESC_TYPE is set to a concise data type other than an interval
+ or datetime data type, the SQL_DESC_CONCISE_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_TYPE is set to the verbose datetime or interval data type
+ (SQL_DATETIME or SQL_INTERVAL) and the SQL_DESC_DATETIME_INTERVAL_CODE
+ field is set to the appropriate subcode, the SQL_DESC_CONCISE TYPE field
+ is set to the corresponding concise type.
+ */
+
+ /*
+ C concise types
+
+ These are listed in the order given in the ODBC specification to make
+ xref to specification easier.
+ */
+ switch ( nType )
+ {
+ case SQL_C_CHAR:
+ case SQL_C_SSHORT:
+ case SQL_C_USHORT:
+ case SQL_C_SLONG:
+ case SQL_C_ULONG:
+ case SQL_C_FLOAT:
+ case SQL_C_DOUBLE:
+ case SQL_C_BIT:
+ case SQL_C_STINYINT:
+ case SQL_C_UTINYINT:
+ case SQL_C_SBIGINT:
+ case SQL_C_UBIGINT:
+ case SQL_C_BINARY:
+ /* case SQL_C_VARBOOKMARK: */ /* = SQL_C_BINARY */
+ case SQL_C_NUMERIC:
+ case SQL_C_GUID:
+ case SQL_C_DEFAULT: /* SQL_C_DEFAULT means make intelligent choice i.e. based
upon the SQL type */
+ setType( nType );
+ setConciseType( nType );
+ setDatetimeIntervalCode( 0 );
+ MYODBCDbgReturn( SQL_SUCCESS );
+ }
+
+ /* Handle special cases; SQL_DATETIME and SQL_INTERVAL */
+ switch ( nType )
+ {
+ case SQL_DATETIME: /* ( 9) verbose type (generalization) */
+ /*
+ \internal ODBC Rule
+
+ Whenever this field contains SQL_DATETIME the
+ SQL_DESC_DATETIME_INTERVAL_CODE field must contain the appropriate
+ subcode for the concise type.
+
+ For datetime data types, SQL_DESC_TYPE contains SQL_DATETIME,
+ and the SQL_DESC_DATETIME_INTERVAL_CODE field contains a subcode for
+ the specific datetime data type.
+ */
+
+ /*
+ NOTE
+
+ These values (i.e. SQL_TYPE_DATE and SQL_CODE_DATE) are offset
+ from each other by 100. This is likely true for unixODBC and XP but
+ I am not sure about other SDKs. So I do not rely on this.
+ */
+ switch ( pDesRec->desc_datetime_interval_code )
+ {
+ case SQL_CODE_DATE:
+ setType( nType );
+ setConciseType( SQL_C_TYPE_DATE );
+ MYODBCDbgReturn( SQL_SUCCESS );
+ case SQL_CODE_TIME:
+ setType( nType );
+ setConciseType( SQL_C_TYPE_TIME );
+ MYODBCDbgReturn( SQL_SUCCESS );
+ case SQL_CODE_TIMESTAMP:
+ setType( nType );
+ setConciseType( SQL_C_TYPE_TIMESTAMP );
+ MYODBCDbgReturn( SQL_SUCCESS );
+ default:
+ MYODBCDbgReturn( pdes->dia.doAppend( MYODBC_DIA_HY021, 0, NULL )
);
+ }
+
+ case SQL_INTERVAL: /* (10) verbose type (generalization) */
+ /*
+ \internal ODBC Rule
+
+ Whenever this field contains SQL_INTERVAL the
+ SQL_DESC_DATETIME_INTERVAL_CODE field must contain the appropriate
+ subcode for the concise type.
+
+ For interval data types, SQL_DESC_TYPE contains SQL_INTERVAL and the
+ SQL_DESC_DATETIME_INTERVAL_CODE field contains a subcode for the
+ specific interval data type.
+ */
+
+ /*
+ NOTE
+
+ These values (i.e. SQL_INTERVAL_MONTH and SQL_CODE_MONTH) are offset
+ from each other by 100. This is likely true for unixODBC and XP but
+ I am not sure about other SDKs. So I do not rely on this.
+ */
+ switch ( pDesRec->desc_datetime_interval_code )
+ {
+ case SQL_CODE_MONTH:
+ setType( nType );
+ setConciseType( SQL_C_INTERVAL_MONTH );
+ MYODBCDbgReturn( SQL_SUCCESS );
+ case SQL_CODE_YEAR:
+ setType( nType );
+ setConciseType( SQL_C_INTERVAL_YEAR );
+ MYODBCDbgReturn( SQL_SUCCESS );
+ case SQL_CODE_YEAR_TO_MONTH:
+ setType( nType );
+ setConciseType( SQL_C_INTERVAL_YEAR_TO_MONTH );
+ MYODBCDbgReturn( SQL_SUCCESS );
+ case SQL_CODE_DAY:
+ setType( nType );
+ setConciseType( SQL_C_INTERVAL_DAY );
+ MYODBCDbgReturn( SQL_SUCCESS );
+ case SQL_CODE_HOUR:
+ setType( nType );
+ setConciseType( SQL_C_INTERVAL_HOUR );
+ MYODBCDbgReturn( SQL_SUCCESS );
+ case SQL_CODE_MINUTE:
+ setType( nType );
+ setConciseType( SQL_C_INTERVAL_MINUTE );
+ MYODBCDbgReturn( SQL_SUCCESS );
+ case SQL_CODE_SECOND:
+ setType( nType );
+ setConciseType( SQL_C_INTERVAL_SECOND );
+ MYODBCDbgReturn( SQL_SUCCESS );
+ case SQL_CODE_DAY_TO_HOUR:
+ setType( nType );
+ setConciseType( SQL_C_INTERVAL_DAY_TO_HOUR );
+ MYODBCDbgReturn( SQL_SUCCESS );
+ case SQL_CODE_DAY_TO_MINUTE:
+ setType( nType );
+ setConciseType( SQL_C_INTERVAL_DAY_TO_MINUTE );
+ MYODBCDbgReturn( SQL_SUCCESS );
+ case SQL_CODE_DAY_TO_SECOND:
+ setType( nType );
+ setConciseType( SQL_C_INTERVAL_DAY_TO_SECOND );
+ MYODBCDbgReturn( SQL_SUCCESS );
+ case SQL_CODE_HOUR_TO_MINUTE:
+ setType( nType );
+ setConciseType( SQL_C_INTERVAL_HOUR_TO_MINUTE );
+ MYODBCDbgReturn( SQL_SUCCESS );
+ case SQL_CODE_HOUR_TO_SECOND:
+ setType( nType );
+ setConciseType( SQL_C_INTERVAL_HOUR_TO_SECOND );
+ MYODBCDbgReturn( SQL_SUCCESS );
+ case SQL_CODE_MINUTE_TO_SECOND:
+ setType( nType );
+ setConciseType( SQL_C_INTERVAL_MINUTE_TO_SECOND );
+ MYODBCDbgReturn( SQL_SUCCESS );
+ default:
+ MYODBCDbgReturn( pdes->dia.doAppend( MYODBC_DIA_HY021, 0, NULL )
);
+ }
+ }
+
+ MYODBCDbgReturn( pdes->dia.doAppend( MYODBC_DIA_HY092, 0, NULL ) );
+}
+
+SQLRETURN MYODBCDesRec::setTypeSQL( SQLSMALLINT nType );
+{
+ /*
+ \internal ODBC Rule
+
+ SQL_DESC_TYPE record field specifies the concise SQL or C data type
+ for all data types except datetime and interval data types. For the
+ datetime and interval data types, this field specifies the verbose data
+ type, which is SQL_DATETIME or SQL_INTERVAL.
+ */
+
+ /*
+ \internal ODBC Rule
+
+ Trying to set SQL_DESC_TYPE to one of the concise datetime or
+ interval types will return SQLSTATE HY021 (Inconsistent
+ descriptor information).
+ */
+
+ switch ( nType )
+ {
+ case SQL_TYPE_DATE: /* 91 = SQL_C_TYPE_DATE */
+ case SQL_TYPE_TIME: /* 92 = SQL_C_TYPE_TIME */
+ case SQL_TYPE_TIMESTAMP: /* 93 = SQL_C_TYPE_TIMESTAMP */
+ case SQL_INTERVAL_MONTH:
+ case SQL_INTERVAL_YEAR:
+ case SQL_INTERVAL_YEAR_TO_MONTH:
+ case SQL_INTERVAL_DAY:
+ case SQL_INTERVAL_HOUR:
+ case SQL_INTERVAL_MINUTE:
+ case SQL_INTERVAL_SECOND:
+ case SQL_INTERVAL_DAY_TO_HOUR:
+ case SQL_INTERVAL_DAY_TO_MINUTE:
+ case SQL_INTERVAL_DAY_TO_SECOND:
+ case SQL_INTERVAL_HOUR_TO_MINUTE:
+ case SQL_INTERVAL_HOUR_TO_SECOND:
+ case SQL_INTERVAL_MINUTE_TO_SECOND:
+ MYODBCDbgReturn( pdes->dia.doAppend( MYODBC_DIA_HY021, 0, NULL ) );
+ }
+
+ /*
+ \internal ODBC Rule
+
+ If SQL_DESC_TYPE is set to a concise data type other than an interval
+ or datetime data type, the SQL_DESC_CONCISE_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_TYPE is set to the verbose datetime or interval data type
+ (SQL_DATETIME or SQL_INTERVAL) and the SQL_DESC_DATETIME_INTERVAL_CODE
+ field is set to the appropriate subcode, the SQL_DESC_CONCISE TYPE field
+ is set to the corresponding concise type.
+ */
+
+ /*
+ SQL concise types
+
+ These are listed in the order given in the ODBC specification to make
+ xref to specification easier.
+ */
+ switch ( nType )
+ {
+ case SQL_CHAR:
+ case SQL_VARCHAR:
+ case SQL_LONGVARCHAR:
+#ifdef UNICODE
+ case SQL_WCHAR:
+ case SQL_WVARCHAR:
+ case SQL_WLONGVARCHAR:
+#endif
+ case SQL_DECIMAL:
+ case SQL_NUMERIC:
+ case SQL_SMALLINT:
+ case SQL_INTEGER:
+ case SQL_REAL:
+ case SQL_FLOAT:
+ case SQL_DOUBLE:
+ case SQL_BIT:
+ case SQL_TINYINT:
+ case SQL_BIGINT:
+ case SQL_BINARY:
+ case SQL_VARBINARY:
+ case SQL_LONGVARBINARY:
+ setType( nType );
+ setConciseType( nType );
+ setDatetimeIntervalCode( 0 );
+ MYODBCDbgReturn( SQL_SUCCESS );
+
+ case SQL_DATETIME: /* ( 9) verbose type (generalization) */
+ /*
+ \internal ODBC Rule
+
+ Whenever this field contains SQL_DATETIME the
+ SQL_DESC_DATETIME_INTERVAL_CODE field must contain the appropriate
+ subcode for the concise type.
+
+ For datetime data types, SQL_DESC_TYPE contains SQL_DATETIME,
+ and the SQL_DESC_DATETIME_INTERVAL_CODE field contains a subcode for
+ the specific datetime data type.
+ */
+
+ /*
+ NOTE
+
+ These values (i.e. SQL_TYPE_DATE and SQL_CODE_DATE) are offset
+ from each other by 100. This is likely true for unixODBC and XP but
+ I am not sure about other SDKs. So I do not rely on this.
+ */
+ switch ( pDesRec->desc_datetime_interval_code )
+ {
+ case SQL_CODE_DATE:
+ setType( nType );
+ setConciseType( SQL_TYPE_DATE );
+ MYODBCDbgReturn( SQL_SUCCESS );
+ case SQL_CODE_TIME:
+ setType( nType );
+ setConciseType( SQL_TYPE_TIME );
+ MYODBCDbgReturn( SQL_SUCCESS );
+ case SQL_CODE_TIMESTAMP:
+ setType( nType );
+ setConciseType( SQL_TYPE_TIMESTAMP );
+ MYODBCDbgReturn( SQL_SUCCESS );
+ default:
+ MYODBCDbgReturn( pdes->dia.doAppend( MYODBC_DIA_HY021, 0, NULL )
);
+ }
+
+ case SQL_INTERVAL: /* (10) verbose type (generalization) */
+ /*
+ \internal ODBC Rule
+
+ Whenever this field contains SQL_INTERVAL the
+ SQL_DESC_DATETIME_INTERVAL_CODE field must contain the appropriate
+ subcode for the concise type.
+
+ For interval data types, SQL_DESC_TYPE contains SQL_INTERVAL and the
+ SQL_DESC_DATETIME_INTERVAL_CODE field contains a subcode for the
+ specific interval data type.
+ */
+
+ /*
+ NOTE
+
+ These values (i.e. SQL_INTERVAL_MONTH and SQL_CODE_MONTH) are offset
+ from each other by 100. This is likely true for unixODBC and XP but
+ I am not sure about other SDKs. So I do not rely on this.
+ */
+ switch ( pDesRec->desc_datetime_interval_code )
+ {
+ case SQL_CODE_MONTH:
+ setType( nType );
+ setConciseType( SQL_INTERVAL_MONTH );
+ MYODBCDbgReturn( SQL_SUCCESS );
+ case SQL_CODE_YEAR:
+ setType( nType );
+ setConciseType( SQL_INTERVAL_YEAR );
+ MYODBCDbgReturn( SQL_SUCCESS );
+ case SQL_CODE_YEAR_TO_MONTH:
+ setType( nType );
+ setConciseType( SQL_INTERVAL_YEAR_TO_MONTH );
+ MYODBCDbgReturn( SQL_SUCCESS );
+ case SQL_CODE_DAY:
+ setType( nType );
+ setConciseType( SQL_INTERVAL_DAY );
+ MYODBCDbgReturn( SQL_SUCCESS );
+ case SQL_CODE_HOUR:
+ setType( nType );
+ setConciseType( SQL_INTERVAL_HOUR );
+ MYODBCDbgReturn( SQL_SUCCESS );
+ case SQL_CODE_MINUTE:
+ setType( nType );
+ setConciseType( SQL_INTERVAL_MINUTE );
+ MYODBCDbgReturn( SQL_SUCCESS );
+ case SQL_CODE_SECOND:
+ setType( nType );
+ setConciseType( SQL_INTERVAL_SECOND );
+ MYODBCDbgReturn( SQL_SUCCESS );
+ case SQL_CODE_DAY_TO_HOUR:
+ setType( nType );
+ setConciseType( SQL_INTERVAL_DAY_TO_HOUR );
+ MYODBCDbgReturn( SQL_SUCCESS );
+ case SQL_CODE_DAY_TO_MINUTE:
+ setType( nType );
+ setConciseType( SQL_INTERVAL_DAY_TO_MINUTE );
+ MYODBCDbgReturn( SQL_SUCCESS );
+ case SQL_CODE_DAY_TO_SECOND:
+ setType( nType );
+ setConciseType( SQL_INTERVAL_DAY_TO_SECOND );
+ MYODBCDbgReturn( SQL_SUCCESS );
+ case SQL_CODE_HOUR_TO_MINUTE:
+ setType( nType );
+ setConciseType( SQL_INTERVAL_HOUR_TO_MINUTE );
+ MYODBCDbgReturn( SQL_SUCCESS );
+ case SQL_CODE_HOUR_TO_SECOND:
+ setType( nType );
+ setConciseType( SQL_INTERVAL_HOUR_TO_SECOND );
+ MYODBCDbgReturn( SQL_SUCCESS );
+ case SQL_CODE_MINUTE_TO_SECOND:
+ setType( nType );
+ setConciseType( SQL_INTERVAL_MINUTE_TO_SECOND );
+ MYODBCDbgReturn( SQL_SUCCESS );
+ default:
+ MYODBCDbgReturn( pdes->dia.doAppend( MYODBC_DIA_HY021, 0, NULL )
);
+ }
+
+ case SQL_GUID: /* not in *real* ODBC spec - likely an MS'ism */
+ setType( nType );
+ setConciseType( nType );
+ setDatetimeIntervalCode( 0 );
+ MYODBCDbgReturn( SQL_SUCCESS );
+ }
+
+ MYODBCDbgReturn( pdes->dia.doAppend( MYODBC_DIA_HY092, 0, NULL ) );
+}
+
+SQLRETURN MYODBCDesRec::setConciseTypeC( 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 */
+ setConciseType( nConciseType );
+ setType( nConciseType );
+ setDatetimeIntervalCode( 0 );
+ MYODBCDbgReturn( SQL_SUCCESS );
+ case SQL_C_TYPE_DATE: /* 91 */
+ setConciseType( nConciseType );
+ setType( SQL_DATETIME );
+ setDatetimeIntervalCode( SQL_CODE_DATE );
+ MYODBCDbgReturn( SQL_SUCCESS );
+ case SQL_C_TYPE_TIME: /* 92 */
+ setConciseType( nConciseType );
+ setType( SQL_DATETIME );
+ setDatetimeIntervalCode( SQL_CODE_TIME );
+ MYODBCDbgReturn( SQL_SUCCESS );
+ case SQL_C_TYPE_TIMESTAMP: /* 93 */
+ setConciseType( nConciseType );
+ setType( SQL_DATETIME );
+ setDatetimeIntervalCode( SQL_CODE_TIMESTAMP );
+ MYODBCDbgReturn( SQL_SUCCESS );
+ case SQL_C_NUMERIC: /* 2 */
+ case SQL_C_GUID: /* -11 */
+ case SQL_C_DEFAULT: /* 99 */
+ setConciseType( nConciseType );
+ setType( nConciseType );
+ setDatetimeIntervalCode( 0 );
+ MYODBCDbgReturn( SQL_SUCCESS );
+ case SQL_C_INTERVAL_MONTH: /* 102 */
+ setConciseType( nConciseType );
+ setType( SQL_INTERVAL );
+ setDatetimeIntervalCode( SQL_CODE_MONTH );
+ MYODBCDbgReturn( SQL_SUCCESS );
+ case SQL_C_INTERVAL_YEAR: /* 101 */
+ setConciseType( nConciseType );
+ setType( SQL_INTERVAL );
+ setDatetimeIntervalCode( SQL_CODE_YEAR );
+ MYODBCDbgReturn( SQL_SUCCESS );
+ case SQL_C_INTERVAL_YEAR_TO_MONTH: /* 107 */
+ setConciseType( nConciseType );
+ setType( SQL_INTERVAL );
+ setDatetimeIntervalCode( SQL_CODE_YEAR_TO_MONTH );
+ MYODBCDbgReturn( SQL_SUCCESS );
+ case SQL_C_INTERVAL_DAY: /* 103 */
+ setConciseType( nConciseType );
+ setType( SQL_INTERVAL );
+ setDatetimeIntervalCode( SQL_CODE_DAY );
+ MYODBCDbgReturn( SQL_SUCCESS );
+ case SQL_C_INTERVAL_HOUR: /* 104 */
+ setConciseType( nConciseType );
+ setType( SQL_INTERVAL );
+ setDatetimeIntervalCode( SQL_CODE_HOUR );
+ MYODBCDbgReturn( SQL_SUCCESS );
+ case SQL_C_INTERVAL_MINUTE: /* 105 */
+ setConciseType( nConciseType );
+ setType( SQL_INTERVAL );
+ setDatetimeIntervalCode( SQL_CODE_MINUTE );
+ MYODBCDbgReturn( SQL_SUCCESS );
+ case SQL_C_INTERVAL_SECOND: /* 106 */
+ setConciseType( nConciseType );
+ setType( SQL_INTERVAL );
+ setDatetimeIntervalCode( SQL_CODE_SECOND );
+ MYODBCDbgReturn( SQL_SUCCESS );
+ case SQL_C_INTERVAL_DAY_TO_HOUR: /* 108 */
+ setConciseType( nConciseType );
+ setType( SQL_INTERVAL );
+ setDatetimeIntervalCode( SQL_CODE_DAY_TO_HOUR );
+ MYODBCDbgReturn( SQL_SUCCESS );
+ case SQL_C_INTERVAL_DAY_TO_MINUTE: /* 109 */
+ setConciseType( nConciseType );
+ setType( SQL_INTERVAL );
+ setDatetimeIntervalCode( SQL_CODE_DAY_TO_MINUTE );
+ MYODBCDbgReturn( SQL_SUCCESS );
+ case SQL_C_INTERVAL_DAY_TO_SECOND: /* 110 */
+ setConciseType( nConciseType );
+ setType( SQL_INTERVAL );
+ setDatetimeIntervalCode( SQL_CODE_DAY_TO_SECOND );
+ MYODBCDbgReturn( SQL_SUCCESS );
+ case SQL_C_INTERVAL_HOUR_TO_MINUTE: /* 111 */
+ setConciseType( nConciseType );
+ setType( SQL_INTERVAL );
+ setDatetimeIntervalCode( SQL_CODE_HOUR_TO_MINUTE );
+ MYODBCDbgReturn( SQL_SUCCESS );
+ case SQL_C_INTERVAL_HOUR_TO_SECOND: /* 112 */
+ setConciseType( nConciseType );
+ setType( SQL_INTERVAL );
+ setDatetimeIntervalCode( SQL_CODE_HOUR_TO_SECOND );
+ MYODBCDbgReturn( SQL_SUCCESS );
+ case SQL_C_INTERVAL_MINUTE_TO_SECOND: /* 113 */
+ setConciseType( nConciseType );
+ setType( SQL_INTERVAL );
+ setDatetimeIntervalCode( SQL_CODE_MINUTE_TO_SECOND );
+ MYODBCDbgReturn( SQL_SUCCESS );
+ }
+
+ MYODBCDbgReturn( pdes->dia.doAppend( MYODBC_DIA_HY092, 0, NULL ) );
+}
+
+SQLRETURN MYODBCDesRec::setConciseTypeSQL( 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 */
+ setConciseType( nConciseType );
+ setType( nConciseType );
+ setDatetimeIntervalCode( 0 );
+ MYODBCDbgReturn( SQL_SUCCESS );
+ case SQL_TYPE_DATE: /* 91 */
+ setConciseType( nConciseType );
+ setType( SQL_DATETIME );
+ setDatetimeIntervalCode( SQL_CODE_DATE );
+ MYODBCDbgReturn( SQL_SUCCESS );
+ case SQL_TYPE_TIME: /* 92 */
+ setConciseType( nConciseType );
+ setType( SQL_DATETIME );
+ setDatetimeIntervalCode( SQL_CODE_TIME );
+ MYODBCDbgReturn( SQL_SUCCESS );
+ case SQL_TYPE_TIMESTAMP: /* 93 */
+ setConciseType( nConciseType );
+ setType( SQL_DATETIME );
+ setDatetimeIntervalCode( SQL_CODE_TIMESTAMP );
+ MYODBCDbgReturn( SQL_SUCCESS );
+ /* case SQL_TYPE_UTCDATETIME: */ /* ? */
+ /* case SQL_TYPE_UTCTIME: */ /* ? */
+ case SQL_INTERVAL_MONTH: /* 102 */
+ setConciseType( nConciseType );
+ setType( SQL_INTERVAL );
+ setDatetimeIntervalCode( SQL_CODE_MONTH );
+ MYODBCDbgReturn( SQL_SUCCESS );
+ case SQL_INTERVAL_YEAR: /* 101 */
+ setConciseType( nConciseType );
+ setType( SQL_INTERVAL );
+ setDatetimeIntervalCode( SQL_CODE_YEAR );
+ MYODBCDbgReturn( SQL_SUCCESS );
+ case SQL_INTERVAL_YEAR_TO_MONTH: /* 107 */
+ setConciseType( nConciseType );
+ setType( SQL_INTERVAL );
+ setDatetimeIntervalCode( SQL_CODE_YEAR_TO_MONTH );
+ MYODBCDbgReturn( SQL_SUCCESS );
+ case SQL_INTERVAL_DAY: /* 103 */
+ setConciseType( nConciseType );
+ setType( SQL_INTERVAL );
+ setDatetimeIntervalCode( SQL_CODE_DAY );
+ MYODBCDbgReturn( SQL_SUCCESS );
+ case SQL_INTERVAL_HOUR: /* 104 */
+ setConciseType( nConciseType );
+ setType( SQL_INTERVAL );
+ setDatetimeIntervalCode( SQL_CODE_HOUR );
+ MYODBCDbgReturn( SQL_SUCCESS );
+ case SQL_INTERVAL_MINUTE: /* 105 */
+ setConciseType( nConciseType );
+ setType( SQL_INTERVAL );
+ setDatetimeIntervalCode( SQL_CODE_MINUTE );
+ MYODBCDbgReturn( SQL_SUCCESS );
+ case SQL_INTERVAL_SECOND: /* 106 */
+ setConciseType( nConciseType );
+ setType( SQL_INTERVAL );
+ setDatetimeIntervalCode( SQL_CODE_SECOND );
+ MYODBCDbgReturn( SQL_SUCCESS );
+ case SQL_INTERVAL_DAY_TO_HOUR: /* 108 */
+ setConciseType( nConciseType );
+ setType( SQL_INTERVAL );
+ setDatetimeIntervalCode( SQL_CODE_DAY_TO_HOUR );
+ MYODBCDbgReturn( SQL_SUCCESS );
+ case SQL_INTERVAL_DAY_TO_MINUTE: /* 109 */
+ setConciseType( nConciseType );
+ setType( SQL_INTERVAL );
+ setDatetimeIntervalCode( SQL_CODE_DAY_TO_MINUTE );
+ MYODBCDbgReturn( SQL_SUCCESS );
+ case SQL_INTERVAL_DAY_TO_SECOND: /* 110 */
+ setConciseType( nConciseType );
+ setType( SQL_INTERVAL );
+ setDatetimeIntervalCode( SQL_CODE_DAY_TO_SECOND );
+ MYODBCDbgReturn( SQL_SUCCESS );
+ case SQL_INTERVAL_HOUR_TO_MINUTE: /* 111 */
+ setConciseType( nConciseType );
+ setType( SQL_INTERVAL );
+ setDatetimeIntervalCode( SQL_CODE_HOUR_TO_MINUTE );
+ MYODBCDbgReturn( SQL_SUCCESS );
+ case SQL_INTERVAL_HOUR_TO_SECOND: /* 112 */
+ setConciseType( nConciseType );
+ setType( SQL_INTERVAL );
+ setDatetimeIntervalCode( SQL_CODE_HOUR_TO_SECOND );
+ MYODBCDbgReturn( SQL_SUCCESS );
+ case SQL_INTERVAL_MINUTE_TO_SECOND: /* 113 */
+ setConciseType( nConciseType );
+ setType( SQL_INTERVAL );
+ setDatetimeIntervalCode( SQL_CODE_MINUTE_TO_SECOND );
+ MYODBCDbgReturn( SQL_SUCCESS );
+ case SQL_GUID: /* -11 */
+ setConciseType( nConciseType );
+ setType( nConciseType );
+ setDatetimeIntervalCode( 0 );
+ MYODBCDbgReturn( SQL_SUCCESS );
+ }
+
+ MYODBCDbgReturn( pdes->dia.doAppend( MYODBC_DIA_HY092, 0, NULL ) );
+}
+
+
Modified: MYODBCDes/MYODBCDesLib/MYODBCDesRec.h
===================================================================
--- MYODBCDes/MYODBCDesLib/MYODBCDesRec.h 2006-01-03 23:54:35 UTC (rev 27)
+++ MYODBCDes/MYODBCDesLib/MYODBCDesRec.h 2006-01-04 06:58:46 UTC (rev 28)
@@ -131,7 +131,7 @@
SQLPOINTER pDataPtr; /*!< IF null THEN unbound ELSE bound
*/
SQLSMALLINT nDatetimeIntervalCode;
SQLINTEGER nDatetimeIntervalPrecision;
- SQLINTEGER nDisplaySize; /*! calculated? */
+ SQLINTEGER nDisplaySize; /*! calculated? */
SQLSMALLINT nFixedPrecScale;
SQLINTEGER *pnIndicatorPtr;
QString stringLabel;
@@ -159,6 +159,10 @@
/* supports setDescRec and/or setDescField */
virtual SQLRETURN setIntervalCode( SQLSMALLINT nDateTimeIntervalCode );
+ virtual SQLRETURN setTypeC( SQLSMALLINT nType );
+ virtual SQLRETURN setTypeSQL( SQLSMALLINT nType );
+ virtual SQLRETURN setConciseTypeC( SQLSMALLINT nConciseType );
+ virtual SQLRETURN setConciseTypeSQL( SQLSMALLINT nConciseType );
};
#endif
Added: MYODBCDes/MYODBCDesLib/MYODBCDesRecAPD.cpp
===================================================================
--- MYODBCDes/MYODBCDesLib/MYODBCDesRecAPD.cpp 2006-01-03 23:54:35 UTC (rev 27)
+++ MYODBCDes/MYODBCDesLib/MYODBCDesRecAPD.cpp 2006-01-04 06:58:46 UTC (rev 28)
@@ -0,0 +1,371 @@
+#include "MYODBCDesInternal.h"
+
+SQLRETURN MYODBCDesIRD::setDescField( 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.
+ */
+ if ( nFieldIdentifier != SQL_DESC_DATA_PTR &&
+ nFieldIdentifier != SQL_DESC_OCTET_LENGTH_PTR &&
+ nFieldIdentifier != SQL_DESC_INDICATOR_PTR )
+ {
+ doUnbind();
+ }
+
+ switch ( nFieldIdentifier )
+ {
+ case SQL_DESC_AUTO_UNIQUE_VALUE:
+ /*!
+ \internal ODBC Rule
+
+ APD: Unused
+ */
+ case SQL_DESC_BASE_COLUMN_NAME:
+ /*!
+ \internal ODBC Rule
+
+ APD: Unused
+ */
+ case SQL_DESC_BASE_TABLE_NAME:
+ /*!
+ \internal ODBC Rule
+
+ APD: Unused
+ */
+ case SQL_DESC_CASE_SENSITIVE:
+ /*!
+ \internal ODBC Rule
+
+ APD: Unused
+ */
+ case SQL_DESC_CATALOG_NAME:
+ /*!
+ \internal ODBC Rule
+
+ APD: Unused
+ */
+ MYODBCDbgReturn( pdes->dia.doAppend( MYODBC_DIA_HY091, 0, NULL ) );
+
+ case SQL_DESC_CONCISE_TYPE:
+ /*!
+ \internal ODBC Rule
+
+ APD: R/W
+ */
+ MYODBCDbgReturn( setConciseTypeC( (SQLSMALLINT)pValuePtr ) );
+
+ case SQL_DESC_DATA_PTR:
+ /*!
+ \internal ODBC Rule
+
+ APD: R/W
+ */
+ {
+ bool bHasInfo = false;
+ SQLRETURN nReturn = setDataPtr( pValuePtr );
+
+ if ( nReturn == SQL_SUCCESS_WITH_INFO )
+ bHasInfo = true;
+ if ( !SQL_SUCCEEDED( nReturn ) )
+ MYODBCDbgReturn( nReturn );
+
+ /*!
+ \internal ODBC Rule
+
+ The SQL_DESC_DATA_PTR field in the IPD can be set to force a
+ consistency check. In a subsequent call to SQLGetDescField or
+ SQLGetDescRec, the driver is not required to return the value
+ that SQL_DESC_DATA_PTR was set to.
+
+ Whenever the SQL_DESC_DATA_PTR field of an APD, ARD, or IPD is set,
+ the driver checks that the value in the SQL_DESC_TYPE field contains
+ one of the valid ODBC C data types or a driver-specific data type,
+ and that all other fields affecting the data types are consistent.
+ */
+ nReturn = doConsistencyCheck();
+ if ( nReturn == SQL_SUCCESS_WITH_INFO )
+ bHasInfo = true;
+ if ( !SQL_SUCCEEDED( nReturn ) )
+ MYODBCDbgReturn( nReturn );
+
+ if ( bHasInfo )
+ MYODBCDbgReturn( SQL_SUCCESS_WITH_INFO );
+ }
+ MYODBCDbgReturn( SQL_SUCCEEDED );
+
+ case SQL_DESC_DATETIME_INTERVAL_CODE:
+ /*!
+ \internal ODBC Rule
+
+ APD: R/W
+ */
+ MYODBCDbgReturn( setIntervalCode( (SQLSMALLINT)pValuePtr ) );
+
+ case SQL_DESC_DATETIME_INTERVAL_PRECISION:
+ /*!
+ \internal ODBC Rule
+
+ APD: R/W
+ */
+
+ /*!
+ \internal ODBC Rule
+
+ The number of digits for an exact numeric type, the number
+ of bits in the mantissa (binary precision) for an approximate
+ numeric type, or the numbers of digits in the fractional
+ seconds component for the SQL_TYPE_TIME, SQL_TYPE_TIMESTAMP,
+ or SQL_INTERVAL_SECOND data type. This field is undefined for
+ all other data types.
+ */
+ MYODBCDbgReturn( setDatetimeIntervalPrecision( (SQLSMALLINT)pValuePtr ) );
+
+ case SQL_DESC_DISPLAY_SIZE:
+ /*!
+ \internal ODBC Rule
+
+ APD: Unused
+ */
+ case SQL_DESC_FIXED_PREC_SCALE:
+ /*!
+ \internal ODBC Rule
+
+ APD: Unused
+ */
+ MYODBCDbgReturn( pdes->dia.doAppend( MYODBC_DIA_HY091, 0, NULL ) );
+
+ case SQL_DESC_INDICATOR_PTR:
+ /*!
+ \internal ODBC Rule
+
+ APD: R/W
+ */
+ MYODBCDbgReturn( setIndicatorPtr( (SQLINTEGER*)pValuePtr ) );
+
+ case SQL_DESC_LABEL:
+ /*!
+ \internal ODBC Rule
+
+ APD: Unused
+ */
+ MYODBCDbgReturn( pdes->dia.doAppend( MYODBC_DIA_HY091, 0, NULL ) );
+
+ case SQL_DESC_LENGTH:
+ /*!
+ \internal ODBC Rule
+
+ APD: R/W
+ */
+ MYODBCDbgReturn( setLength( (SQLUINTEGER)pValuePtr ) );
+
+ case SQL_DESC_LITERAL_PREFIX:
+ /*!
+ \internal ODBC Rule
+
+ APD: Unused
+ */
+ case SQL_DESC_LITERAL_SUFFIX:
+ /*!
+ \internal ODBC Rule
+
+ APD: Unused
+ */
+ case SQL_DESC_LOCAL_TYPE_NAME:
+ /*!
+ \internal ODBC Rule
+
+ APD: Unused
+ */
+ case SQL_DESC_NAME:
+ /*!
+ \internal ODBC Rule
+
+ APD: Unused
+ */
+ case SQL_DESC_NULLABLE:
+ /*!
+ \internal ODBC Rule
+
+ APD: Unused
+ */
+ MYODBCDbgReturn( pdes->dia.doAppend( MYODBC_DIA_HY091, 0, NULL ) );
+
+ case SQL_DESC_NUM_PREC_RADIX:
+ /*!
+ \internal ODBC Rule
+
+ APD: R/W
+ */
+
+ /*!
+ \internal ODBC Rule
+
+ This SQLINTEGER field contains a value of 2 if the data type in
+ the SQL_DESC_TYPE field is an approximate numeric data type,
+ because the SQL_DESC_PRECISION field contains the number of bits.
+ This field contains a value of 10 if the data type in the
+ SQL_DESC_TYPE field is an exact numeric data type, because the
+ SQL_DESC_PRECISION field contains the number of decimal digits.
+ This field is set to 0 for all non-numeric data types.
+ */
+ {
+ SQLINTEGER n = (SQLINTEGER)pValuePtr;
+
+ if ( n != 0 && n != 2 && n != 10 )
+ MYODBCDbgReturn( pdes->dia.doAppend( MYODBC_DIA_HY092, 0, NULL )
);
+ }
+
+ MYODBCDbgReturn( setNumPrecRadix( (SQLINTEGER)pValuePtr ) );
+
+ case SQL_DESC_OCTET_LENGTH:
+ /*!
+ \internal ODBC Rule
+
+ APD: R/W
+ */
+
+ /*!
+ \internal ODBC Rule
+
+ For APDs, this field is defined only for output or input/output
+ parameters.
+ */
+ MYODBCDbgReturn( setOctetLength( (SQLINTEGER)pValuePtr ) );
+
+ case SQL_DESC_OCTET_LENGTH_PTR:
+ /*!
+ \internal ODBC Rule
+
+ APD: R/W
+ */
+
+ /*!
+ \internal ODBC Rule
+
+ For an APD, this value is ignored for all arguments except
+ character string and binary; if this field points to SQL_NTS,
+ the dynamic argument must be null-terminated. To indicate that
+ a bound parameter will be a data-at-execution parameter, an
+ application sets this field in the appropriate pDesRec of the APD
+ to a variable that, at execute time, will contain the value
+ SQL_DATA_AT_EXEC or the result of the SQL_LEN_DATA_AT_EXEC macro.
+ If there is more than one such field, SQL_DESC_DATA_PTR can be
+ set to a value uniquely identifying the parameter to help the
+ application determine which parameter is being requested.
+ */
+ MYODBCDbgReturn( setOctetLengthPtr( (SQLINTEGER*)pValuePtr ) );
+
+ case SQL_DESC_PARAMETER_TYPE:
+ /*!
+ \internal ODBC Rule
+
+ APD: Unused
+ */
+ MYODBCDbgReturn( pdes->dia.doAppend( MYODBC_DIA_HY091, 0, NULL ) );
+
+ case SQL_DESC_PRECISION:
+ /*!
+ \internal ODBC Rule
+
+ APD: R/W
+ */
+
+ /*!
+ \internal ODBC Rule
+
+ This SQLSMALLINT pDesRec field contains the number of digits
+ for an exact numeric type, the number of bits in the mantissa
+ (binary precision) for an approximate numeric type, or the numbers
+ of digits in the fractional seconds component for the SQL_TYPE_TIME,
+ SQL_TYPE_TIMESTAMP, or SQL_INTERVAL_SECOND data type. This field
+ is undefined for all other data types.
+ */
+ MYODBCDbgReturn( setPrecision( (SQLSMALLINT)pValuePtr ) );
+
+ case SQL_DESC_ROWVER:
+ /*!
+ \internal ODBC Rule
+
+ APD: Unused
+ */
+ MYODBCDbgReturn( pdes->dia.doAppend( MYODBC_DIA_HY091, 0, NULL ) );
+
+ case SQL_DESC_SCALE:
+ /*!
+ \internal ODBC Rule
+
+ APD: R/W
+ */
+
+ /*!
+ \internal ODBC Rule
+
+ This SQLSMALLINT pDesRec field contains the defined scale for
+ decimal and numeric data types. The field is undefined for all
+ other data types.
+ */
+ MYODBCDbgReturn( setScale( (SQLSMALLINT)pValuePtr ) );
+
+ case SQL_DESC_SCHEMA_NAME:
+ /*!
+ \internal ODBC Rule
+
+ APD: Unused
+ */
+ case SQL_DESC_SEARCHABLE:
+ /*!
+ \internal ODBC Rule
+
+ APD: Unused
+ */
+ case SQL_DESC_TABLE_NAME:
+ /*!
+ \internal ODBC Rule
+
+ APD: Unused
+ */
+ MYODBCDbgReturn( pdes->dia.doAppend( MYODBC_DIA_HY091, 0, NULL ) );
+
+ case SQL_DESC_TYPE:
+ /*!
+ \internal ODBC Rule
+
+ APD: R/W
+ */
+ MYODBCDbgReturn( setTypeC( (SQLSMALLINT)pValuePtr ) );
+
+ case SQL_DESC_TYPE_NAME:
+ /*!
+ \internal ODBC Rule
+
+ APD: Unused
+ */
+ case SQL_DESC_UNNAMED:
+ /*!
+ \internal ODBC Rule
+
+ APD: Unused
+ */
+ case SQL_DESC_UNSIGNED:
+ /*!
+ \internal ODBC Rule
+
+ APD: Unused
+ */
+ case SQL_DESC_UPDATABLE:
+ /*!
+ \internal ODBC Rule
+
+ APD: Unused
+ */
+ MYODBCDbgReturn( pdes->dia.doAppend( MYODBC_DIA_HY091, 0, NULL ) );
+ }
+
+ MYODBCDbgReturn( pdes->dia.doAppend( MYODBC_DIA_HY091, 0, NULL ) );
+}
+
Modified: MYODBCDes/MYODBCDesLib/MYODBCDesRecAPD.h
===================================================================
--- MYODBCDes/MYODBCDesLib/MYODBCDesRecAPD.h 2006-01-03 23:54:35 UTC (rev 27)
+++ MYODBCDes/MYODBCDesLib/MYODBCDesRecAPD.h 2006-01-04 06:58:46 UTC (rev 28)
@@ -14,8 +14,6 @@
virtual SQLRETURN setDescField( SQLSMALLINT nFieldIdentifier, SQLPOINTER pValuePtr,
SQLINTEGER nBufferLength );
/* getters */
- virtual SQLRETURN getDescRec( SQLCHAR *pszName, SQLSMALLINT nBufferLength,
SQLSMALLINT *pnStringLengthPtr, SQLSMALLINT *pnTypePtr, SQLSMALLINT *pnSubTypePtr,
SQLINTEGER *pnLengthPtr, SQLSMALLINT *pnPrecisionPtr, SQLSMALLINT *pnScalePtr,
SQLSMALLINT *pnNullablePtr );
- virtual SQLRETURN getDescField( SQLSMALLINT nFieldIdentifier, SQLPOINTER pValuePtr,
SQLINTEGER nBufferLength, SQLINTEGER *pnStringLengthPtr );
};
#endif
Added: MYODBCDes/MYODBCDesLib/MYODBCDesRecARD.cpp
===================================================================
--- MYODBCDes/MYODBCDesLib/MYODBCDesRecARD.cpp 2006-01-03 23:54:35 UTC (rev 27)
+++ MYODBCDes/MYODBCDesLib/MYODBCDesRecARD.cpp 2006-01-04 06:58:46 UTC (rev 28)
@@ -0,0 +1,153 @@
+#include "MYODBCDesInternal.h"
+
+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 );
+}
+
+
+
Modified: MYODBCDes/MYODBCDesLib/MYODBCDesRecARD.h
===================================================================
--- MYODBCDes/MYODBCDesLib/MYODBCDesRecARD.h 2006-01-03 23:54:35 UTC (rev 27)
+++ MYODBCDes/MYODBCDesLib/MYODBCDesRecARD.h 2006-01-04 06:58:46 UTC (rev 28)
@@ -14,8 +14,6 @@
virtual SQLRETURN setDescField( SQLSMALLINT nFieldIdentifier, SQLPOINTER pValuePtr,
SQLINTEGER nBufferLength );
/* getters */
- virtual SQLRETURN getDescRec( SQLCHAR *pszName, SQLSMALLINT nBufferLength,
SQLSMALLINT *pnStringLengthPtr, SQLSMALLINT *pnTypePtr, SQLSMALLINT *pnSubTypePtr,
SQLINTEGER *pnLengthPtr, SQLSMALLINT *pnPrecisionPtr, SQLSMALLINT *pnScalePtr,
SQLSMALLINT *pnNullablePtr );
- virtual SQLRETURN getDescField( SQLSMALLINT nFieldIdentifier, SQLPOINTER pValuePtr,
SQLINTEGER nBufferLength, SQLINTEGER *pnStringLengthPtr );
};
#endif
Added: MYODBCDes/MYODBCDesLib/MYODBCDesRecIPD.cpp
===================================================================
--- MYODBCDes/MYODBCDesLib/MYODBCDesRecIPD.cpp 2006-01-03 23:54:35 UTC (rev 27)
+++ MYODBCDes/MYODBCDesLib/MYODBCDesRecIPD.cpp 2006-01-04 06:58:46 UTC (rev 28)
@@ -0,0 +1,153 @@
+#include "MYODBCDesInternal.h"
+
+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 );
+}
+
+
+
Modified: MYODBCDes/MYODBCDesLib/MYODBCDesRecIPD.h
===================================================================
--- MYODBCDes/MYODBCDesLib/MYODBCDesRecIPD.h 2006-01-03 23:54:35 UTC (rev 27)
+++ MYODBCDes/MYODBCDesLib/MYODBCDesRecIPD.h 2006-01-04 06:58:46 UTC (rev 28)
@@ -14,8 +14,6 @@
virtual SQLRETURN setDescField( SQLSMALLINT nFieldIdentifier, SQLPOINTER pValuePtr,
SQLINTEGER nBufferLength );
/* getters */
- virtual SQLRETURN getDescRec( SQLCHAR *pszName, SQLSMALLINT nBufferLength,
SQLSMALLINT *pnStringLengthPtr, SQLSMALLINT *pnTypePtr, SQLSMALLINT *pnSubTypePtr,
SQLINTEGER *pnLengthPtr, SQLSMALLINT *pnPrecisionPtr, SQLSMALLINT *pnScalePtr,
SQLSMALLINT *pnNullablePtr );
- virtual SQLRETURN getDescField( SQLSMALLINT nFieldIdentifier, SQLPOINTER pValuePtr,
SQLINTEGER nBufferLength, SQLINTEGER *pnStringLengthPtr );
};
#endif
Added: MYODBCDes/MYODBCDesLib/MYODBCDesRecIRD.cpp
===================================================================
--- MYODBCDes/MYODBCDesLib/MYODBCDesRecIRD.cpp 2006-01-03 23:54:35 UTC (rev 27)
+++ MYODBCDes/MYODBCDesLib/MYODBCDesRecIRD.cpp 2006-01-04 06:58:46 UTC (rev 28)
@@ -0,0 +1,153 @@
+#include "MYODBCDesInternal.h"
+
+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 );
+}
+
+
+
Modified: MYODBCDes/MYODBCDesLib/MYODBCDesRecIRD.h
===================================================================
--- MYODBCDes/MYODBCDesLib/MYODBCDesRecIRD.h 2006-01-03 23:54:35 UTC (rev 27)
+++ MYODBCDes/MYODBCDesLib/MYODBCDesRecIRD.h 2006-01-04 06:58:46 UTC (rev 28)
@@ -14,160 +14,8 @@
virtual SQLRETURN setDescField( SQLSMALLINT nFieldIdentifier, SQLPOINTER pValuePtr,
SQLINTEGER nBufferLength );
/* getters */
- virtual SQLRETURN getDescRec( SQLCHAR *pszName, SQLSMALLINT nBufferLength,
SQLSMALLINT *pnStringLengthPtr, SQLSMALLINT *pnTypePtr, SQLSMALLINT *pnSubTypePtr,
SQLINTEGER *pnLengthPtr, SQLSMALLINT *pnPrecisionPtr, SQLSMALLINT *pnScalePtr,
SQLSMALLINT *pnNullablePtr );
- 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 23:54:35 UTC (rev 27)
+++ MYODBCDes/include/MYODBCDes.h 2006-01-04 06:58:46 UTC (rev 28)
@@ -203,10 +203,6 @@
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"
| Thread |
|---|
| • Connector/ODBC 5 commit: r28 - in MYODBCDes: MYODBCDesLib include | pharvey | 4 Jan |