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/include/MYODBCDes.h
MYODBCDes/include/MYODBCDesAPD.h
MYODBCDes/include/MYODBCDesARD.h
MYODBCDes/include/MYODBCDesIPD.h
MYODBCDes/include/MYODBCDesIRD.h
Log:
UNICODE:
- work to get descriptors unicode enabled
Modified: MYODBCDes/MYODBCDesLib/MYODBCDes.cpp
===================================================================
--- MYODBCDes/MYODBCDesLib/MYODBCDes.cpp 2006-01-03 19:29:32 UTC (rev 26)
+++ MYODBCDes/MYODBCDesLib/MYODBCDes.cpp 2006-01-03 23:54:35 UTC (rev 27)
@@ -107,12 +107,12 @@
*/
if ( nRecNumber >= getCount() )
{
- nReturn = setCount( nRecNumber, true );
+ nReturn = setCount( nRecNumber + 1, true );
if ( !SQL_SUCCEEDED( nReturn ) )
MYODBCDbgReturn( nReturn );
}
- /* set record */
+ /* push down to record for further processing */
MYODBCDbgReturn( listRecords[nRecord]->setDescRec( nType, nSubType, nLength,
nPrecision, nScale, pDataPtr, pnStringLengthPtr, pnIndicatorPtr ) );
}
@@ -165,8 +165,8 @@
{
MYODBCDbgEnter();
- if ( nRecord < 0 || nRecord >= listRecords.count() )
- MYODBCDbgReturn( dia.doAppend( MYODBC_DIA_07009, 0, NULL ) );
+ Q_ASSERT( nRecord < 0 );
+ Q_ASSERT( nRecord >= listRecords.count() );
MYODBCDbgReturn( listRecords[nRecord]->setAutoUniqueValue( nAutoUniqueValue ) );
}
@@ -175,8 +175,8 @@
{
MYODBCDbgEnter();
- if ( nRecord < 0 || nRecord >= listRecords.count() )
- MYODBCDbgReturn( dia.doAppend( MYODBC_DIA_07009, 0, NULL ) );
+ Q_ASSERT( nRecord < 0 );
+ Q_ASSERT( nRecord >= listRecords.count() );
MYODBCDbgReturn( listRecords[nRecord]->setBaseColumnName( stringBaseColumnName )
);
}
@@ -185,8 +185,8 @@
{
MYODBCDbgEnter();
- if ( nRecord < 0 || nRecord >= listRecords.count() )
- MYODBCDbgReturn( dia.doAppend( MYODBC_DIA_07009, 0, NULL ) );
+ Q_ASSERT( nRecord < 0 );
+ Q_ASSERT( nRecord >= listRecords.count() );
MYODBCDbgReturn( listRecords[nRecord]->setBaseTableName( stringBaseTableName ) );
}
@@ -195,8 +195,8 @@
{
MYODBCDbgEnter();
- if ( nRecord < 0 || nRecord >= listRecords.count() )
- MYODBCDbgReturn( dia.doAppend( MYODBC_DIA_07009, 0, NULL ) );
+ Q_ASSERT( nRecord < 0 );
+ Q_ASSERT( nRecord >= listRecords.count() );
MYODBCDbgReturn( listRecords[nRecord]->setCaseSensitive( nCaseSensitive ) );
}
@@ -205,8 +205,8 @@
{
MYODBCDbgEnter();
- if ( nRecord < 0 || nRecord >= listRecords.count() )
- MYODBCDbgReturn( dia.doAppend( MYODBC_DIA_07009, 0, NULL ) );
+ Q_ASSERT( nRecord < 0 );
+ Q_ASSERT( nRecord >= listRecords.count() );
MYODBCDbgReturn( listRecords[nRecord]->setCatalogName( stringCatalogName ) );
}
@@ -215,8 +215,8 @@
{
MYODBCDbgEnter();
- if ( nRecord < 0 || nRecord >= listRecords.count() )
- MYODBCDbgReturn( dia.doAppend( MYODBC_DIA_07009, 0, NULL ) );
+ Q_ASSERT( nRecord < 0 );
+ Q_ASSERT( nRecord >= listRecords.count() );
MYODBCDbgReturn( listRecords[nRecord]->setConciseType( nConciseType ) );
}
@@ -225,8 +225,8 @@
{
MYODBCDbgEnter();
- if ( nRecord < 0 || nRecord >= listRecords.count() )
- MYODBCDbgReturn( dia.doAppend( MYODBC_DIA_07009, 0, NULL ) );
+ Q_ASSERT( nRecord < 0 );
+ Q_ASSERT( nRecord >= listRecords.count() );
MYODBCDbgReturn( listRecords[nRecord]->setDataPtr( pDataPtr ) );
}
@@ -235,8 +235,8 @@
{
MYODBCDbgEnter();
- if ( nRecord < 0 || nRecord >= listRecords.count() )
- MYODBCDbgReturn( dia.doAppend( MYODBC_DIA_07009, 0, NULL ) );
+ Q_ASSERT( nRecord < 0 );
+ Q_ASSERT( nRecord >= listRecords.count() );
MYODBCDbgReturn( listRecords[nRecord]->setDatetimeIntervalCode(
nDatetimeIntervalCode ) );
}
@@ -245,8 +245,8 @@
{
MYODBCDbgEnter();
- if ( nRecord < 0 || nRecord >= listRecords.count() )
- MYODBCDbgReturn( dia.doAppend( MYODBC_DIA_07009, 0, NULL ) );
+ Q_ASSERT( nRecord < 0 );
+ Q_ASSERT( nRecord >= listRecords.count() );
MYODBCDbgReturn( listRecords[nRecord]->setDatetimeIntervalPrecision(
nDatetimeIntervalPrecision ) );
}
@@ -255,8 +255,8 @@
{
MYODBCDbgEnter();
- if ( nRecord < 0 || nRecord >= listRecords.count() )
- MYODBCDbgReturn( dia.doAppend( MYODBC_DIA_07009, 0, NULL ) );
+ Q_ASSERT( nRecord < 0 );
+ Q_ASSERT( nRecord >= listRecords.count() );
MYODBCDbgReturn( listRecords[nRecord]->setDisplaySize( nDisplaySize ) );
}
@@ -265,8 +265,8 @@
{
MYODBCDbgEnter();
- if ( nRecord < 0 || nRecord >= listRecords.count() )
- MYODBCDbgReturn( dia.doAppend( MYODBC_DIA_07009, 0, NULL ) );
+ Q_ASSERT( nRecord < 0 );
+ Q_ASSERT( nRecord >= listRecords.count() );
MYODBCDbgReturn( listRecords[nRecord]->setFixedPrecScale( nFixedPrecScale ) );
}
@@ -275,8 +275,8 @@
{
MYODBCDbgEnter();
- if ( nRecord < 0 || nRecord >= listRecords.count() )
- MYODBCDbgReturn( dia.doAppend( MYODBC_DIA_07009, 0, NULL ) );
+ Q_ASSERT( nRecord < 0 );
+ Q_ASSERT( nRecord >= listRecords.count() );
MYODBCDbgReturn( listRecords[nRecord]->setIndicatorPtr( pnIndicatorPtr ) );
}
@@ -285,8 +285,8 @@
{
MYODBCDbgEnter();
- if ( nRecord < 0 || nRecord >= listRecords.count() )
- MYODBCDbgReturn( dia.doAppend( MYODBC_DIA_07009, 0, NULL ) );
+ Q_ASSERT( nRecord < 0 );
+ Q_ASSERT( nRecord >= listRecords.count() );
MYODBCDbgReturn( listRecords[nRecord]->setLabel( stringLabel ) );
}
@@ -295,8 +295,8 @@
{
MYODBCDbgEnter();
- if ( nRecord < 0 || nRecord >= listRecords.count() )
- MYODBCDbgReturn( dia.doAppend( MYODBC_DIA_07009, 0, NULL ) );
+ Q_ASSERT( nRecord < 0 );
+ Q_ASSERT( nRecord >= listRecords.count() );
MYODBCDbgReturn( listRecords[nRecord]->setLength( nLength ) );
}
@@ -305,8 +305,8 @@
{
MYODBCDbgEnter();
- if ( nRecord < 0 || nRecord >= listRecords.count() )
- MYODBCDbgReturn( dia.doAppend( MYODBC_DIA_07009, 0, NULL ) );
+ Q_ASSERT( nRecord < 0 );
+ Q_ASSERT( nRecord >= listRecords.count() );
MYODBCDbgReturn( listRecords[nRecord]->setLiteralPrefix( stringLiteralPrefix ) );
}
@@ -315,8 +315,8 @@
{
MYODBCDbgEnter();
- if ( nRecord < 0 || nRecord >= listRecords.count() )
- MYODBCDbgReturn( dia.doAppend( MYODBC_DIA_07009, 0, NULL ) );
+ Q_ASSERT( nRecord < 0 );
+ Q_ASSERT( nRecord >= listRecords.count() );
MYODBCDbgReturn( listRecords[nRecord]->setLiteralSuffix( stringLiteralSuffix ) );
}
@@ -325,8 +325,8 @@
{
MYODBCDbgEnter();
- if ( nRecord < 0 || nRecord >= listRecords.count() )
- MYODBCDbgReturn( dia.doAppend( MYODBC_DIA_07009, 0, NULL ) );
+ Q_ASSERT( nRecord < 0 );
+ Q_ASSERT( nRecord >= listRecords.count() );
MYODBCDbgReturn( listRecords[nRecord]->setLocalTypeName( stringLocalTypeName ) );
}
@@ -335,8 +335,8 @@
{
MYODBCDbgEnter();
- if ( nRecord < 0 || nRecord >= listRecords.count() )
- MYODBCDbgReturn( dia.doAppend( MYODBC_DIA_07009, 0, NULL ) );
+ Q_ASSERT( nRecord < 0 );
+ Q_ASSERT( nRecord >= listRecords.count() );
MYODBCDbgReturn( listRecords[nRecord]->setName( stringName ) );
}
@@ -345,8 +345,8 @@
{
MYODBCDbgEnter();
- if ( nRecord < 0 || nRecord >= listRecords.count() )
- MYODBCDbgReturn( dia.doAppend( MYODBC_DIA_07009, 0, NULL ) );
+ Q_ASSERT( nRecord < 0 );
+ Q_ASSERT( nRecord >= listRecords.count() );
MYODBCDbgReturn( listRecords[nRecord]->setNullable( nNullable ) );
}
@@ -355,8 +355,8 @@
{
MYODBCDbgEnter();
- if ( nRecord < 0 || nRecord >= listRecords.count() )
- MYODBCDbgReturn( dia.doAppend( MYODBC_DIA_07009, 0, NULL ) );
+ Q_ASSERT( nRecord < 0 );
+ Q_ASSERT( nRecord >= listRecords.count() );
MYODBCDbgReturn( listRecords[nRecord]->setNumPrecRadix( nNumPrecRadix ) );
}
@@ -365,8 +365,8 @@
{
MYODBCDbgEnter();
- if ( nRecord < 0 || nRecord >= listRecords.count() )
- MYODBCDbgReturn( dia.doAppend( MYODBC_DIA_07009, 0, NULL ) );
+ Q_ASSERT( nRecord < 0 );
+ Q_ASSERT( nRecord >= listRecords.count() );
MYODBCDbgReturn( listRecords[nRecord]->setOctetLength( nOctetLength ) );
}
@@ -375,8 +375,8 @@
{
MYODBCDbgEnter();
- if ( nRecord < 0 || nRecord >= listRecords.count() )
- MYODBCDbgReturn( dia.doAppend( MYODBC_DIA_07009, 0, NULL ) );
+ Q_ASSERT( nRecord < 0 );
+ Q_ASSERT( nRecord >= listRecords.count() );
MYODBCDbgReturn( listRecords[nRecord]->setOctetLengthPtr( pnOctetLengthPtr ) );
}
@@ -385,8 +385,8 @@
{
MYODBCDbgEnter();
- if ( nRecord < 0 || nRecord >= listRecords.count() )
- MYODBCDbgReturn( dia.doAppend( MYODBC_DIA_07009, 0, NULL ) );
+ Q_ASSERT( nRecord < 0 );
+ Q_ASSERT( nRecord >= listRecords.count() );
MYODBCDbgReturn( listRecords[nRecord]->setParamterType( nParamterType ) );
}
@@ -395,8 +395,8 @@
{
MYODBCDbgEnter();
- if ( nRecord < 0 || nRecord >= listRecords.count() )
- MYODBCDbgReturn( dia.doAppend( MYODBC_DIA_07009, 0, NULL ) );
+ Q_ASSERT( nRecord < 0 );
+ Q_ASSERT( nRecord >= listRecords.count() );
MYODBCDbgReturn( listRecords[nRecord]->setPrecision( nPrecision ) );
}
@@ -405,8 +405,8 @@
{
MYODBCDbgEnter();
- if ( nRecord < 0 || nRecord >= listRecords.count() )
- MYODBCDbgReturn( dia.doAppend( MYODBC_DIA_07009, 0, NULL ) );
+ Q_ASSERT( nRecord < 0 );
+ Q_ASSERT( nRecord >= listRecords.count() );
MYODBCDbgReturn( listRecords[nRecord]->setRowver( nRowver ) );
}
@@ -415,8 +415,8 @@
{
MYODBCDbgEnter();
- if ( nRecord < 0 || nRecord >= listRecords.count() )
- MYODBCDbgReturn( dia.doAppend( MYODBC_DIA_07009, 0, NULL ) );
+ Q_ASSERT( nRecord < 0 );
+ Q_ASSERT( nRecord >= listRecords.count() );
MYODBCDbgReturn( listRecords[nRecord]->setScale( nScale ) );
}
@@ -425,8 +425,8 @@
{
MYODBCDbgEnter();
- if ( nRecord < 0 || nRecord >= listRecords.count() )
- MYODBCDbgReturn( dia.doAppend( MYODBC_DIA_07009, 0, NULL ) );
+ Q_ASSERT( nRecord < 0 );
+ Q_ASSERT( nRecord >= listRecords.count() );
MYODBCDbgReturn( listRecords[nRecord]->setSchemaName( stringSchemaName ) );
}
@@ -435,8 +435,8 @@
{
MYODBCDbgEnter();
- if ( nRecord < 0 || nRecord >= listRecords.count() )
- MYODBCDbgReturn( dia.doAppend( MYODBC_DIA_07009, 0, NULL ) );
+ Q_ASSERT( nRecord < 0 );
+ Q_ASSERT( nRecord >= listRecords.count() );
MYODBCDbgReturn( listRecords[nRecord]->setSearchable( nSearchable ) );
}
@@ -445,8 +445,8 @@
{
MYODBCDbgEnter();
- if ( nRecord < 0 || nRecord >= listRecords.count() )
- MYODBCDbgReturn( dia.doAppend( MYODBC_DIA_07009, 0, NULL ) );
+ Q_ASSERT( nRecord < 0 );
+ Q_ASSERT( nRecord >= listRecords.count() );
MYODBCDbgReturn( listRecords[nRecord]->setTableName( stringTableName ) );
}
@@ -455,8 +455,8 @@
{
MYODBCDbgEnter();
- if ( nRecord < 0 || nRecord >= listRecords.count() )
- MYODBCDbgReturn( dia.doAppend( MYODBC_DIA_07009, 0, NULL ) );
+ Q_ASSERT( nRecord < 0 );
+ Q_ASSERT( nRecord >= listRecords.count() );
MYODBCDbgReturn( listRecords[nRecord]->setType( nType ) );
}
@@ -465,8 +465,8 @@
{
MYODBCDbgEnter();
- if ( nRecord < 0 || nRecord >= listRecords.count() )
- MYODBCDbgReturn( dia.doAppend( MYODBC_DIA_07009, 0, NULL ) );
+ Q_ASSERT( nRecord < 0 );
+ Q_ASSERT( nRecord >= listRecords.count() );
MYODBCDbgReturn( listRecords[nRecord]->setTypeName( stringTypeName ) );
}
@@ -475,8 +475,8 @@
{
MYODBCDbgEnter();
- if ( nRecord < 0 || nRecord >= listRecords.count() )
- MYODBCDbgReturn( dia.doAppend( MYODBC_DIA_07009, 0, NULL ) );
+ Q_ASSERT( nRecord < 0 );
+ Q_ASSERT( nRecord >= listRecords.count() );
MYODBCDbgReturn( listRecords[nRecord]->setUnnamed( nUnnamed ) );
}
@@ -485,8 +485,8 @@
{
MYODBCDbgEnter();
- if ( nRecord < 0 || nRecord >= listRecords.count() )
- MYODBCDbgReturn( dia.doAppend( MYODBC_DIA_07009, 0, NULL ) );
+ Q_ASSERT( nRecord < 0 );
+ Q_ASSERT( nRecord >= listRecords.count() );
MYODBCDbgReturn( listRecords[nRecord]->setUnsigned( nUnsigned ) );
}
@@ -495,13 +495,105 @@
{
MYODBCDbgEnter();
- if ( nRecord < 0 || nRecord >= listRecords.count() )
- MYODBCDbgReturn( dia.doAppend( MYODBC_DIA_07009, 0, NULL ) );
+ Q_ASSERT( nRecord < 0 );
+ Q_ASSERT( nRecord >= listRecords.count() );
MYODBCDbgReturn( listRecords[nRecord]->setUpdatable( nUpdatable ) );
}
+SQLRETURN MYODBCDes::getDescRec( SQLSMALLINT nRecNumber, SQLWCHAR *pszName, SQLSMALLINT
nBufferLength, SQLSMALLINT *pnStringLengthPtr, SQLSMALLINT *pnTypePtr, SQLSMALLINT
*pnSubTypePtr, SQLINTEGER *pnLengthPtr, SQLSMALLINT *pnPrecisionPtr, SQLSMALLINT
*pnScalePtr, SQLSMALLINT *pnNullablePtr )
+{
+ SQLINTEGER nStringLengthPtr;
+ SQLRETURN nReturn;
+ bool bHasInfo = false;
+
+ MYODBCDbgEnter();
+
+ if ( nRecNumber < 0 )
+ MYODBCDbgReturn( dia.doAppend( MYODBC_DIA_07009, 0, NULL ) );
+
+ /*! \internal ODBC Rule
+
+ SQL_NO_DATA is returned if RecNumber is greater than the current number of
descriptor records.
+ */
+ if ( nRecNumber >= getCount() )
+ MYODBCDbgReturn( SQL_NO_DATA );
+
+ /* push down to record for further processing */
+ MYODBCDbgReturn( listRecords[nRecNumber]->getDescRec( pszName, nBufferLength,
pnStringLengthPtr, pnTypePtr, pnSubTypePtr, pnLengthPtr, pnPrecisionPtr, pnScalePtr,
pnNullablePtr );
+}
+
+SQLRETURN MYODBCDes::getDescField( SQLSMALLINT nRecNumber, SQLSMALLINT nFieldIdentifier,
SQLPOINTER pValuePtr, SQLINTEGER nBufferLength, SQLINTEGER *pnStringLengthPtr )
+{
+ MYODBCDbgEnter();
+
+ /*! \internal ODBC Rule
+
+ When an application calls SQLGetDescField to retrieve the value of a field that
is undefined for a particular descriptor
+ type, the function returns SQL_SUCCESS but the value returned for the field is
undefined. For example, calling
+ SQLGetDescField for the SQL_DESC_NAME or SQL_DESC_NULLABLE field of an APD or ARD
will return SQL_SUCCESS but an
+ undefined value for the field.
+ */
+
+ /*! \internal ODBC Rule
+
+ When an application calls SQLGetDescField to retrieve the value of a field that
is defined for a particular descriptor
+ type but that has no default value and has not been set yet, the function returns
SQL_SUCCESS but the value returned for
+ the field is undefined. For more information on the initialization of descriptor
fields and descriptions of the fields,
+ see "Initialization of Descriptor Fields" in SQLSetDescField. For more
information on descriptors, see Descriptors.
+ */
+
+ /* header field */
+ switch ( nFieldIdentifier )
+ {
+ case SQL_DESC_ALLOC_TYPE:
+ *((SQLSMALLINT *)pValuePtr) = getAllocType();
+ MYODBCDbgReturn( SQL_SUCCESS );
+
+ case SQL_DESC_ARRAY_SIZE:
+ *((SQLUINTEGER *)pValuePtr) = getArraySize();
+ MYODBCDbgReturn( SQL_SUCCESS );
+
+ case SQL_DESC_ARRAY_STATUS_PTR:
+ *((SQLUSMALLINT **)pValuePtr) = getArrayStatusPtr();
+ MYODBCDbgReturn( SQL_SUCCESS );
+
+ case SQL_DESC_BIND_OFFSET_PTR:
+ *((SQLINTEGER **)ppValuePtr) = getBindOffsetPtr();
+ MYODBCDbgReturn( SQL_SUCCESS );
+
+ case SQL_DESC_BIND_TYPE:
+ *((SQLINTEGER **)pValuePtr) = getBindType();
+ MYODBCDbgReturn( SQL_SUCCESS );
+
+ case SQL_DESC_COUNT:
+ *((SQLSMALLINT *)pValuePtr) = getCount() - 1;
+ MYODBCDbgReturn( SQL_SUCCESS );
+
+ case SQL_DESC_ROWS_PROCESSED_PTR:
+ *((SQLUINTEGER **)pValuePtr) = getRowsProcessedPtr();
+ MYODBCDbgReturn( SQL_SUCCESS );
+ }
+
+ /*! \internal ODBC Rule
+
+ The RecNumber argument was less than 0.
+ */
+ if ( nRecNumber < 0 )
+ MYODBCDbgReturn( dia.doAppend( MYODBC_DIA_07009, 0, NULL ) );
+
+ /*! \internal ODBC Rule
+
+ SQL_NO_DATA is returned if RecNumber is greater than the current number of
descriptor records.
+ */
+ if ( nRecNumber >= getCount() )
+ MYODBCDbgReturn( SQL_NO_DATA );
+
+ /* push down to record for further processing */
+ MYODBCDbgReturn( listRecords[nRecNumber]->getDescField( nFieldIdentifier,
pValuePtr, nBufferLength, pnStringLengthPtr );
+}
+
SQLSMALLINT MYODBCDes::getAllocType()
{
MYODBCDbgEnter();
@@ -556,10 +648,8 @@
{
MYODBCDbgEnter();
- if ( nRecord < 0 )
- MYODBCDbgReturn( dia.doAppend( MYODBC_DIA_07009, 0, NULL ) );
- if ( nRecord >= listRecords.count() )
- MYODBCDbgReturn( SQL_NO_DATA );
+ Q_ASSERT( nRecord < 0 );
+ Q_ASSERT( nRecord >= listRecords.count() );
MYODBCDbgReturn3( listRecords[nRecord]->getAutoUniqueValue() );
}
@@ -568,10 +658,8 @@
{
MYODBCDbgEnter();
- if ( nRecord < 0 )
- MYODBCDbgReturn( dia.doAppend( MYODBC_DIA_07009, 0, NULL ) );
- if ( nRecord >= listRecords.count() )
- MYODBCDbgReturn( SQL_NO_DATA );
+ Q_ASSERT( nRecord < 0 );
+ Q_ASSERT( nRecord >= listRecords.count() );
MYODBCDbgReturn3( listRecords[nRecord]->getBaseColumnName() );
}
@@ -580,10 +668,8 @@
{
MYODBCDbgEnter();
- if ( nRecord < 0 )
- MYODBCDbgReturn( dia.doAppend( MYODBC_DIA_07009, 0, NULL ) );
- if ( nRecord >= listRecords.count() )
- MYODBCDbgReturn( SQL_NO_DATA );
+ Q_ASSERT( nRecord < 0 );
+ Q_ASSERT( nRecord >= listRecords.count() );
MYODBCDbgReturn3( listRecords[nRecord]->getBaseTableName() );
}
@@ -592,10 +678,8 @@
{
MYODBCDbgEnter();
- if ( nRecord < 0 )
- MYODBCDbgReturn( dia.doAppend( MYODBC_DIA_07009, 0, NULL ) );
- if ( nRecord >= listRecords.count() )
- MYODBCDbgReturn( SQL_NO_DATA );
+ Q_ASSERT( nRecord < 0 );
+ Q_ASSERT( nRecord >= listRecords.count() );
MYODBCDbgReturn3( listRecords[nRecord]->getCaseSensitive() );
}
@@ -604,10 +688,8 @@
{
MYODBCDbgEnter();
- if ( nRecord < 0 )
- MYODBCDbgReturn( dia.doAppend( MYODBC_DIA_07009, 0, NULL ) );
- if ( nRecord >= listRecords.count() )
- MYODBCDbgReturn( SQL_NO_DATA );
+ Q_ASSERT( nRecord < 0 );
+ Q_ASSERT( nRecord >= listRecords.count() );
MYODBCDbgReturn3( listRecords[nRecord]->getCatalogName() );
}
@@ -616,10 +698,8 @@
{
MYODBCDbgEnter();
- if ( nRecord < 0 )
- MYODBCDbgReturn( dia.doAppend( MYODBC_DIA_07009, 0, NULL ) );
- if ( nRecord >= listRecords.count() )
- MYODBCDbgReturn( SQL_NO_DATA );
+ Q_ASSERT( nRecord < 0 );
+ Q_ASSERT( nRecord >= listRecords.count() );
MYODBCDbgReturn3( listRecords[nRecord]->getConciseType() );
}
@@ -628,10 +708,8 @@
{
MYODBCDbgEnter();
- if ( nRecord < 0 )
- MYODBCDbgReturn( dia.doAppend( MYODBC_DIA_07009, 0, NULL ) );
- if ( nRecord >= listRecords.count() )
- MYODBCDbgReturn( SQL_NO_DATA );
+ Q_ASSERT( nRecord < 0 );
+ Q_ASSERT( nRecord >= listRecords.count() );
MYODBCDbgReturn3( listRecords[nRecord]->getDataPtr() );
}
@@ -640,10 +718,8 @@
{
MYODBCDbgEnter();
- if ( nRecord < 0 )
- MYODBCDbgReturn( dia.doAppend( MYODBC_DIA_07009, 0, NULL ) );
- if ( nRecord >= listRecords.count() )
- MYODBCDbgReturn( SQL_NO_DATA );
+ Q_ASSERT( nRecord < 0 );
+ Q_ASSERT( nRecord >= listRecords.count() );
MYODBCDbgReturn3( listRecords[nRecord]->getDatetimeIntervalCode() );
}
@@ -652,10 +728,8 @@
{
MYODBCDbgEnter();
- if ( nRecord < 0 )
- MYODBCDbgReturn( dia.doAppend( MYODBC_DIA_07009, 0, NULL ) );
- if ( nRecord >= listRecords.count() )
- MYODBCDbgReturn( SQL_NO_DATA );
+ Q_ASSERT( nRecord < 0 );
+ Q_ASSERT( nRecord >= listRecords.count() );
MYODBCDbgReturn3( listRecords[nRecord]->getDatetimeIntervalPrecision() );
}
@@ -664,10 +738,8 @@
{
MYODBCDbgEnter();
- if ( nRecord < 0 )
- MYODBCDbgReturn( dia.doAppend( MYODBC_DIA_07009, 0, NULL ) );
- if ( nRecord >= listRecords.count() )
- MYODBCDbgReturn( SQL_NO_DATA );
+ Q_ASSERT( nRecord < 0 );
+ Q_ASSERT( nRecord >= listRecords.count() );
MYODBCDbgReturn3( listRecords[nRecord]->getDisplaySize() );
}
@@ -676,10 +748,8 @@
{
MYODBCDbgEnter();
- if ( nRecord < 0 )
- MYODBCDbgReturn( dia.doAppend( MYODBC_DIA_07009, 0, NULL ) );
- if ( nRecord >= listRecords.count() )
- MYODBCDbgReturn( SQL_NO_DATA );
+ Q_ASSERT( nRecord < 0 );
+ Q_ASSERT( nRecord >= listRecords.count() );
MYODBCDbgReturn3( listRecords[nRecord]->getFixedPrecScale() );
}
@@ -688,10 +758,8 @@
{
MYODBCDbgEnter();
- if ( nRecord < 0 )
- MYODBCDbgReturn( dia.doAppend( MYODBC_DIA_07009, 0, NULL ) );
- if ( nRecord >= listRecords.count() )
- MYODBCDbgReturn( SQL_NO_DATA );
+ Q_ASSERT( nRecord < 0 );
+ Q_ASSERT( nRecord >= listRecords.count() );
MYODBCDbgReturn3( listRecords[nRecord]->getIndicatorPtr() );
}
@@ -700,10 +768,8 @@
{
MYODBCDbgEnter();
- if ( nRecord < 0 )
- MYODBCDbgReturn( dia.doAppend( MYODBC_DIA_07009, 0, NULL ) );
- if ( nRecord >= listRecords.count() )
- MYODBCDbgReturn( SQL_NO_DATA );
+ Q_ASSERT( nRecord < 0 );
+ Q_ASSERT( nRecord >= listRecords.count() );
MYODBCDbgReturn3( listRecords[nRecord]->getLabel() );
}
@@ -712,10 +778,8 @@
{
MYODBCDbgEnter();
- if ( nRecord < 0 )
- MYODBCDbgReturn( dia.doAppend( MYODBC_DIA_07009, 0, NULL ) );
- if ( nRecord >= listRecords.count() )
- MYODBCDbgReturn( SQL_NO_DATA );
+ Q_ASSERT( nRecord < 0 );
+ Q_ASSERT( nRecord >= listRecords.count() );
MYODBCDbgReturn3( listRecords[nRecord]->getLength() );
}
@@ -724,10 +788,8 @@
{
MYODBCDbgEnter();
- if ( nRecord < 0 )
- MYODBCDbgReturn( dia.doAppend( MYODBC_DIA_07009, 0, NULL ) );
- if ( nRecord >= listRecords.count() )
- MYODBCDbgReturn( SQL_NO_DATA );
+ Q_ASSERT( nRecord < 0 );
+ Q_ASSERT( nRecord >= listRecords.count() );
MYODBCDbgReturn3( listRecords[nRecord]->getLiteralPrefix() );
}
@@ -736,10 +798,8 @@
{
MYODBCDbgEnter();
- if ( nRecord < 0 )
- MYODBCDbgReturn( dia.doAppend( MYODBC_DIA_07009, 0, NULL ) );
- if ( nRecord >= listRecords.count() )
- MYODBCDbgReturn( SQL_NO_DATA );
+ Q_ASSERT( nRecord < 0 );
+ Q_ASSERT( nRecord >= listRecords.count() );
MYODBCDbgReturn3( listRecords[nRecord]->getLiteralSuffix() );
}
@@ -748,10 +808,8 @@
{
MYODBCDbgEnter();
- if ( nRecord < 0 )
- MYODBCDbgReturn( dia.doAppend( MYODBC_DIA_07009, 0, NULL ) );
- if ( nRecord >= listRecords.count() )
- MYODBCDbgReturn( SQL_NO_DATA );
+ Q_ASSERT( nRecord < 0 );
+ Q_ASSERT( nRecord >= listRecords.count() );
MYODBCDbgReturn3( listRecords[nRecord]->getLocalTypeName() );
}
@@ -760,10 +818,8 @@
{
MYODBCDbgEnter();
- if ( nRecord < 0 )
- MYODBCDbgReturn( dia.doAppend( MYODBC_DIA_07009, 0, NULL ) );
- if ( nRecord >= listRecords.count() )
- MYODBCDbgReturn( SQL_NO_DATA );
+ Q_ASSERT( nRecord < 0 );
+ Q_ASSERT( nRecord >= listRecords.count() );
MYODBCDbgReturn3( listRecords[nRecord]->getName() );
}
@@ -772,10 +828,8 @@
{
MYODBCDbgEnter();
- if ( nRecord < 0 )
- MYODBCDbgReturn( dia.doAppend( MYODBC_DIA_07009, 0, NULL ) );
- if ( nRecord >= listRecords.count() )
- MYODBCDbgReturn( SQL_NO_DATA );
+ Q_ASSERT( nRecord < 0 );
+ Q_ASSERT( nRecord >= listRecords.count() );
MYODBCDbgReturn3( listRecords[nRecord]->getNullable() );
}
@@ -784,10 +838,8 @@
{
MYODBCDbgEnter();
- if ( nRecord < 0 )
- MYODBCDbgReturn( dia.doAppend( MYODBC_DIA_07009, 0, NULL ) );
- if ( nRecord >= listRecords.count() )
- MYODBCDbgReturn( SQL_NO_DATA );
+ Q_ASSERT( nRecord < 0 );
+ Q_ASSERT( nRecord >= listRecords.count() );
MYODBCDbgReturn3( listRecords[nRecord]->getNumPrecRadix() );
}
@@ -796,10 +848,8 @@
{
MYODBCDbgEnter();
- if ( nRecord < 0 )
- MYODBCDbgReturn( dia.doAppend( MYODBC_DIA_07009, 0, NULL ) );
- if ( nRecord >= listRecords.count() )
- MYODBCDbgReturn( SQL_NO_DATA );
+ Q_ASSERT( nRecord < 0 );
+ Q_ASSERT( nRecord >= listRecords.count() );
MYODBCDbgReturn3( listRecords[nRecord]->getOctetLength() );
}
@@ -808,10 +858,8 @@
{
MYODBCDbgEnter();
- if ( nRecord < 0 )
- MYODBCDbgReturn( dia.doAppend( MYODBC_DIA_07009, 0, NULL ) );
- if ( nRecord >= listRecords.count() )
- MYODBCDbgReturn( SQL_NO_DATA );
+ Q_ASSERT( nRecord < 0 );
+ Q_ASSERT( nRecord >= listRecords.count() );
MYODBCDbgReturn3( listRecords[nRecord]->getOctetLengthPtr() );
}
@@ -820,10 +868,8 @@
{
MYODBCDbgEnter();
- if ( nRecord < 0 )
- MYODBCDbgReturn( dia.doAppend( MYODBC_DIA_07009, 0, NULL ) );
- if ( nRecord >= listRecords.count() )
- MYODBCDbgReturn( SQL_NO_DATA );
+ Q_ASSERT( nRecord < 0 );
+ Q_ASSERT( nRecord >= listRecords.count() );
MYODBCDbgReturn3( listRecords[nRecord]->getParamterType() );
}
@@ -832,10 +878,8 @@
{
MYODBCDbgEnter();
- if ( nRecord < 0 )
- MYODBCDbgReturn( dia.doAppend( MYODBC_DIA_07009, 0, NULL ) );
- if ( nRecord >= listRecords.count() )
- MYODBCDbgReturn( SQL_NO_DATA );
+ Q_ASSERT( nRecord < 0 );
+ Q_ASSERT( nRecord >= listRecords.count() );
MYODBCDbgReturn3( listRecords[nRecord]->getPrecision() );
}
@@ -844,10 +888,8 @@
{
MYODBCDbgEnter();
- if ( nRecord < 0 )
- MYODBCDbgReturn( dia.doAppend( MYODBC_DIA_07009, 0, NULL ) );
- if ( nRecord >= listRecords.count() )
- MYODBCDbgReturn( SQL_NO_DATA );
+ Q_ASSERT( nRecord < 0 );
+ Q_ASSERT( nRecord >= listRecords.count() );
MYODBCDbgReturn3( listRecords[nRecord]->getRowver() );
}
@@ -856,10 +898,8 @@
{
MYODBCDbgEnter();
- if ( nRecord < 0 )
- MYODBCDbgReturn( dia.doAppend( MYODBC_DIA_07009, 0, NULL ) );
- if ( nRecord >= listRecords.count() )
- MYODBCDbgReturn( SQL_NO_DATA );
+ Q_ASSERT( nRecord < 0 );
+ Q_ASSERT( nRecord >= listRecords.count() );
MYODBCDbgReturn3( listRecords[nRecord]->getScale() );
}
@@ -868,10 +908,8 @@
{
MYODBCDbgEnter();
- if ( nRecord < 0 )
- MYODBCDbgReturn( dia.doAppend( MYODBC_DIA_07009, 0, NULL ) );
- if ( nRecord >= listRecords.count() )
- MYODBCDbgReturn( SQL_NO_DATA );
+ Q_ASSERT( nRecord < 0 );
+ Q_ASSERT( nRecord >= listRecords.count() );
MYODBCDbgReturn3( listRecords[nRecord]->getSchemaName() );
}
@@ -880,10 +918,8 @@
{
MYODBCDbgEnter();
- if ( nRecord < 0 )
- MYODBCDbgReturn( dia.doAppend( MYODBC_DIA_07009, 0, NULL ) );
- if ( nRecord >= listRecords.count() )
- MYODBCDbgReturn( SQL_NO_DATA );
+ Q_ASSERT( nRecord < 0 );
+ Q_ASSERT( nRecord >= listRecords.count() );
MYODBCDbgReturn3( listRecords[nRecord]->getSearchable() );
}
@@ -892,10 +928,8 @@
{
MYODBCDbgEnter();
- if ( nRecord < 0 )
- MYODBCDbgReturn( dia.doAppend( MYODBC_DIA_07009, 0, NULL ) );
- if ( nRecord >= listRecords.count() )
- MYODBCDbgReturn( SQL_NO_DATA );
+ Q_ASSERT( nRecord < 0 );
+ Q_ASSERT( nRecord >= listRecords.count() );
MYODBCDbgReturn3( listRecords[nRecord]->getTableName() );
}
@@ -904,10 +938,8 @@
{
MYODBCDbgEnter();
- if ( nRecord < 0 )
- MYODBCDbgReturn( dia.doAppend( MYODBC_DIA_07009, 0, NULL ) );
- if ( nRecord >= listRecords.count() )
- MYODBCDbgReturn( SQL_NO_DATA );
+ Q_ASSERT( nRecord < 0 );
+ Q_ASSERT( nRecord >= listRecords.count() );
MYODBCDbgReturn3( listRecords[nRecord]->getType() );
}
@@ -916,10 +948,8 @@
{
MYODBCDbgEnter();
- if ( nRecord < 0 )
- MYODBCDbgReturn( dia.doAppend( MYODBC_DIA_07009, 0, NULL ) );
- if ( nRecord >= listRecords.count() )
- MYODBCDbgReturn( SQL_NO_DATA );
+ Q_ASSERT( nRecord < 0 );
+ Q_ASSERT( nRecord >= listRecords.count() );
MYODBCDbgReturn3( listRecords[nRecord]->getTypeName() );
}
@@ -928,10 +958,8 @@
{
MYODBCDbgEnter();
- if ( nRecord < 0 )
- MYODBCDbgReturn( dia.doAppend( MYODBC_DIA_07009, 0, NULL ) );
- if ( nRecord >= listRecords.count() )
- MYODBCDbgReturn( SQL_NO_DATA );
+ Q_ASSERT( nRecord < 0 );
+ Q_ASSERT( nRecord >= listRecords.count() );
MYODBCDbgReturn3( listRecords[nRecord]->getUnnamed() );
}
@@ -940,10 +968,8 @@
{
MYODBCDbgEnter();
- if ( nRecord < 0 )
- MYODBCDbgReturn( dia.doAppend( MYODBC_DIA_07009, 0, NULL ) );
- if ( nRecord >= listRecords.count() )
- MYODBCDbgReturn( SQL_NO_DATA );
+ Q_ASSERT( nRecord < 0 );
+ Q_ASSERT( nRecord >= listRecords.count() );
MYODBCDbgReturn3( listRecords[nRecord]->getUnsigned() );
}
@@ -952,10 +978,8 @@
{
MYODBCDbgEnter();
- if ( nRecord < 0 )
- MYODBCDbgReturn( dia.doAppend( MYODBC_DIA_07009, 0, NULL ) );
- if ( nRecord >= listRecords.count() )
- MYODBCDbgReturn( SQL_NO_DATA );
+ Q_ASSERT( nRecord < 0 );
+ Q_ASSERT( nRecord >= listRecords.count() );
MYODBCDbgReturn3( listRecords[nRecord]->getUpdatable() );
}
Modified: MYODBCDes/MYODBCDesLib/MYODBCDesAPD.cpp
===================================================================
--- MYODBCDes/MYODBCDesLib/MYODBCDesAPD.cpp 2006-01-03 19:29:32 UTC (rev 26)
+++ MYODBCDes/MYODBCDesLib/MYODBCDesAPD.cpp 2006-01-03 23:54:35 UTC (rev 27)
@@ -21,52 +21,50 @@
pdesrec->setDatetimeIntervalCode( 0 );
}
-SQLRETURN MYODBCDesAPD::setDescRec( SQLSMALLINT nRecNumber, SQLSMALLINT nType,
SQLSMALLINT nSubType, SQLINTEGER nLength, SQLSMALLINT nPrecision, SQLSMALLINT nScale,
SQLPOINTER pDataPtr, SQLINTEGER *pnStringLengthPtr, SQLINTEGER *pnIndicatorPtr )
+SQLRETURN MYODBCDesRecAPD::setDescRec( SQLSMALLINT nType, SQLSMALLINT nSubType,
SQLINTEGER nLength, SQLSMALLINT nPrecision, SQLSMALLINT nScale, SQLPOINTER pDataPtr,
SQLINTEGER *pnStringLengthPtr, SQLINTEGER *pnIndicatorPtr )
{
+ SQLRETURN nReturn = SQL_SUCCESS;
+ bool bHasInfo = false;
+
MYODBCDbgEnter();
- /*
- \internal ODBC Rule
+ nReturn = MYODBCDesRecType( nType );
+ if ( !SQL_SUCCEEDED( nReturn ) )
+ MYODBCDbgReturn( nReturn );
- This argument must be equal to or greater than 0.
- */
- if ( nRecNumber < 0 )
- MYODBCDbgReturn( dia.doAppend( MYODBC_DIA_07009, 0, NULL ) );
+ /* set SQL_DESC_DATETIME_INTERVAL_CODE as appropriate */
+ if ( the_type == SQL_DATETIME || the_type == SQL_INTERVAL )
+ {
+ nReturn = MYODBCDesRecIntervalCode( pDesRec, the_type);
+ if ( !SQL_SUCCEEDED( nReturn ) )
+ MYODBCDbgReturn( nReturn );
+ }
- /*
- \internal ODBC Rule
+ /* set remainder */
+ nReturn = MYODBCDrvSetDescField( pDes, nRecNum, SQL_DESC_OCTET_LENGTH,
(SQLPOINTER)octet_length, SQL_IS_INTEGER );
+ if ( !SQL_SUCCEEDED( nReturn ) )
+ MYODBCDbgReturn( nReturn );
- 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.
- */
+ nReturn = MYODBCDrvSetDescField( pDes, nRecNum, SQL_DESC_PRECISION,
(SQLPOINTER)precision, SQL_IS_SMALLINT );
+ if ( !SQL_SUCCEEDED( nReturn ) )
+ MYODBCDbgReturn( nReturn );
- /* do nothing: we have not max so ignore this rule */
+ nReturn = MYODBCDrvSetDescField( pDes, nRecNum, SQL_DESC_SCALE, (SQLPOINTER)scale,
SQL_IS_SMALLINT );
+ if ( !SQL_SUCCEEDED( nReturn ) )
+ MYODBCDbgReturn( nReturn );
- /*
- \internal ODBC Rule
+ nReturn = MYODBCDrvSetDescField( pDes, nRecNum, SQL_DESC_OCTET_LENGTH_PTR,
(SQLPOINTER)scale, SQL_IS_POINTER );
+ if ( !SQL_SUCCEEDED( nReturn ) )
+ MYODBCDbgReturn( nReturn );
- The RecNumber argument was equal to 0, and the DescriptorHandle argument
- referred to an implicitly allocated APD. (This error does not occur with
- an explicitly allocated application descriptor because it is not known
- whether an explicitly allocated application descriptor is an APD or ARD
- until execute time.)
- */
- if ( nRecNumber == 0 getAllocType() == SQL_DESC_ALLOC_AUTO )
- MYODBCDbgReturn( dia.doAppend( MYODBC_DIA_07009, 0, NULL ) );
+ nReturn = MYODBCDrvSetDescField( pDes, nRecNum, SQL_DESC_INDICATOR_PTR,
indicator_ptr, SQL_IS_POINTER );
+ if ( !SQL_SUCCEEDED( nReturn ) )
+ MYODBCDbgReturn( nReturn );
- /*
- Append record as needed to make nRecNumber valid.
- */
- if ( nRecNumber >= getCount() )
- {
- nReturn = setCount( nRecNumber, true );
- if ( !SQL_SUCCEEDED( nReturn ) )
- MYODBCDbgReturn( nReturn );
- }
+ /* do last (causes extra validation) */
+ nReturn = MYODBCDrvSetDescField( pDes, nRecNum, SQL_DESC_DATA_PTR, (SQLPOINTER)scale,
SQL_IS_POINTER );
- /* set record */
- MYODBCDbgReturn( listRecords[nRecord]->setDescRec( nType, nSubType, nLength,
nPrecision, nScale, pDataPtr, pnStringLengthPtr, pnIndicatorPtr ) );
+ MYODBCDbgReturn( nReturn );
}
SQLRETURN MYODBCDesAPD::setDescField( SQLSMALLINT nRecNumber, SQLSMALLINT
nFieldIdentifier, SQLPOINTER pValuePtr, SQLINTEGER nBufferLength )
@@ -166,7 +164,7 @@
} /* switch (for header fields) */
/* record field needs a valid record */
- if ( nRecord < 0 || nRecord >= listRecords.count() )
+ if ( nRecord < 0 || nRecord >= getCount() )
MYODBCDbgReturn( dia.doAppend( MYODBC_DIA_07009, 0, NULL ) );
/* handle as record field */
Modified: MYODBCDes/MYODBCDesLib/MYODBCDesARD.cpp
===================================================================
--- MYODBCDes/MYODBCDesLib/MYODBCDesARD.cpp 2006-01-03 19:29:32 UTC (rev 26)
+++ MYODBCDes/MYODBCDesLib/MYODBCDesARD.cpp 2006-01-03 23:54:35 UTC (rev 27)
@@ -138,7 +138,7 @@
} /* switch (for header fields) */
/* record field needs a valid record */
- if ( nRecord < 0 || nRecord >= listRecords.count() )
+ if ( nRecord < 0 || nRecord >= getCount() )
MYODBCDbgReturn( dia.doAppend( MYODBC_DIA_07009, 0, NULL ) );
/* handle as record field */
Modified: MYODBCDes/MYODBCDesLib/MYODBCDesIPD.cpp
===================================================================
--- MYODBCDes/MYODBCDesLib/MYODBCDesIPD.cpp 2006-01-03 19:29:32 UTC (rev 26)
+++ MYODBCDes/MYODBCDesLib/MYODBCDesIPD.cpp 2006-01-03 23:54:35 UTC (rev 27)
@@ -120,7 +120,7 @@
} /* switch (for header fields) */
/* record field needs a valid record */
- if ( nRecord < 0 || nRecord >= listRecords.count() )
+ if ( nRecord < 0 || nRecord >= getCount() )
MYODBCDbgReturn( dia.doAppend( MYODBC_DIA_07009, 0, NULL ) );
/* handle as record field */
Modified: MYODBCDes/MYODBCDesLib/MYODBCDesIRD.cpp
===================================================================
--- MYODBCDes/MYODBCDesLib/MYODBCDesIRD.cpp 2006-01-03 19:29:32 UTC (rev 26)
+++ MYODBCDes/MYODBCDesLib/MYODBCDesIRD.cpp 2006-01-03 23:54:35 UTC (rev 27)
@@ -1,3 +1,5 @@
+#include "MYODBCDesInternal.h"
+
MYODBCDesIRD::MYODBCDesIRD( SQLHANDLE hOwner )
{
nTypeSubID = MYODBC_RTTI_DES_IRD;
@@ -116,7 +118,7 @@
} /* switch (for header fields) */
/* record field needs a valid record */
- if ( nRecord < 0 || nRecord >= listRecords.count() )
+ if ( nRecord < 0 || nRecord >= getCount() )
MYODBCDbgReturn( dia.doAppend( MYODBC_DIA_07009, 0, NULL ) );
/* handle as record field */
Modified: MYODBCDes/MYODBCDesLib/MYODBCDesRec.cpp
===================================================================
--- MYODBCDes/MYODBCDesLib/MYODBCDesRec.cpp 2006-01-03 19:29:32 UTC (rev 26)
+++ MYODBCDes/MYODBCDesLib/MYODBCDesRec.cpp 2006-01-03 23:54:35 UTC (rev 27)
@@ -352,10 +352,275 @@
MYODBCDbgReturn( SQL_SUCCESS );
}
-SQLINTEGER MYODBCResRec::getAutoUniqueValue()
+SQLRETURN MYODBCResRec::getDescRec( SQLWCHAR *pszName, SQLSMALLINT nBufferLength,
SQLSMALLINT *pnStringLengthPtr, SQLSMALLINT *pnTypePtr, SQLSMALLINT *pnSubTypePtr,
SQLINTEGER *pnLengthPtr, SQLSMALLINT *pnPrecisionPtr, SQLSMALLINT *pnScalePtr,
SQLSMALLINT *pnNullablePtr )
{
+ SQLRETURN nReturn;
+ bool bHasInfo = false;
+ SQLINTEGER nStringLength;
+
MYODBCDbgEnter();
+ nReturn = getDescField( SQL_DESC_NAME, pszName, nBufferLength, &nStringLength );
+ if ( pnStringLengthPtr ) *pnStringLengthPtr = nStringLength;
+ if ( nReturn == SQL_SUCCESS_WITH_INFO )
+ bHasInfo = true;
+ if ( !SQL_SUCCEEDED( nReturn ) )
+ MYODBCDbgReturn( nReturn );
+
+ nReturn = getDescField( SQL_DESC_TYPE, pnTypePtr, SQL_IS_SMALLINT, NULL );
+ if ( nReturn == SQL_SUCCESS_WITH_INFO )
+ bHasInfo = true;
+ if ( !SQL_SUCCEEDED( nReturn ) )
+ MYODBCDbgReturn( nReturn );
+
+ nReturn = getDescField( SQL_DESC_DATETIME_INTERVAL_CODE, pnSubTypePtr,
SQL_IS_SMALLINT, NULL );
+ if ( nReturn == SQL_SUCCESS_WITH_INFO )
+ bHasInfo = true;
+ if ( !SQL_SUCCEEDED( nReturn ) )
+ MYODBCDbgReturn( nReturn );
+
+ nReturn = getDescField( SQL_DESC_OCTET_LENGTH, pnLengthPtr, SQL_IS_INTEGER, NULL );
+ if ( nReturn == SQL_SUCCESS_WITH_INFO )
+ bHasInfo = true;
+ if ( !SQL_SUCCEEDED( nReturn ) )
+ MYODBCDbgReturn( nReturn );
+
+ nReturn = getDescField( SQL_DESC_PRECISION, pnPrecisionPtr, SQL_IS_SMALLINT, NULL );
+ if ( nReturn == SQL_SUCCESS_WITH_INFO )
+ bHasInfo = true;
+ if ( !SQL_SUCCEEDED( nReturn ) )
+ MYODBCDbgReturn( nReturn );
+
+ nReturn = getDescField( SQL_DESC_SCALE, pnScalePtr, SQL_IS_SMALLINT, NULL );
+ if ( nReturn == SQL_SUCCESS_WITH_INFO )
+ bHasInfo = true;
+ if ( !SQL_SUCCEEDED( nReturn ) )
+ MYODBCDbgReturn( nReturn );
+
+ nReturn = getDescField( SQL_DESC_NULLABLE, pnNullablePtr, SQL_IS_SMALLINT, NULL );
+ if ( nReturn == SQL_SUCCESS_WITH_INFO )
+ bHasInfo = true;
+ if ( !SQL_SUCCEEDED( nReturn ) )
+ MYODBCDbgReturn( nReturn );
+
+ if ( bHasInfo )
+ MYODBCDbgReturn( SQL_SUCCESS_WITH_INFO );
+
+ MYODBCDbgReturn( SQL_SUCCESS );
+}
+
+SQLRETURN MYODBCResRec::getDescField( SQLSMALLINT nFieldIdentifier, SQLPOINTER pValuePtr,
SQLINTEGER nBufferLength, SQLINTEGER *pnStringLengthPtr )
+{
+ SQLINTEGER nStringLength;
+
+ MYODBCDbgEnter();
+
+ /* use a dummy str len if we must */
+ if ( !pnStringLengthPtr )
+ pnStringLengthPtr = &nStringLength;
+
+ /*! \internal ODBC Rule
+
+ When an application calls SQLGetDescField to retrieve the value of a field that
is undefined for a particular descriptor
+ type, the function returns SQL_SUCCESS but the value returned for the field is
undefined. For example, calling
+ SQLGetDescField for the SQL_DESC_NAME or SQL_DESC_NULLABLE field of an APD or ARD
will return SQL_SUCCESS but an
+ undefined value for the field.
+ */
+
+ /*! \internal ODBC Rule
+
+ When an application calls SQLGetDescField to retrieve the value of a field that
is defined for a particular descriptor
+ type but that has no default value and has not been set yet, the function returns
SQL_SUCCESS but the value returned for
+ the field is undefined. For more information on the initialization of descriptor
fields and descriptions of the fields,
+ see "Initialization of Descriptor Fields" in SQLSetDescField. For more
information on descriptors, see Descriptors.
+ */
+
+ switch ( nFieldIdentifier )
+ {
+ case SQL_DESC_AUTO_UNIQUE_VALUE:
+ *((SQLINTEGER *)pValuePtr) = getAutoUniqueValue();
+ break;
+
+ case SQL_DESC_BASE_COLUMN_NAME:
+ MYODBCCstrncpy( (SQLWCHAR*)pValuePtr, nBufferLength / sizeof(SQLWCHAR),
getBaseColumnName().utf16(), _TRUNCATE );
+ *pnStringLengthPtr = getBaseColumnName().length() * sizeof(SQLWCHAR);
+ if ( *pnStringLengthPtr > nBufferLength )
+ MYODBCDbgReturn( SQL_SUCCESS_WITH_INFO );
+ break;
+
+ case SQL_DESC_BASE_TABLE_NAME:
+ MYODBCCstrncpy( (SQLWCHAR*)pValuePtr, nBufferLength / sizeof(SQLWCHAR),
getBaseTableName().utf16(), _TRUNCATE );
+ *pnStringLengthPtr = getBaseTableName().length() * sizeof(SQLWCHAR);
+ if ( *pnStringLengthPtr > nBufferLength )
+ MYODBCDbgReturn( SQL_SUCCESS_WITH_INFO );
+ break;
+
+ case SQL_DESC_CASE_SENSITIVE:
+ *((SQLINTEGER *)pValuePtr) = getCaseSensitive();
+ break;
+
+ case SQL_DESC_CATALOG_NAME:
+ MYODBCCstrncpy( (SQLWCHAR*)pValuePtr, nBufferLength / sizeof(SQLWCHAR),
getCatalogName().utf16(), _TRUNCATE );
+ *pnStringLengthPtr = getCatalogNameName().length() * sizeof(SQLWCHAR);
+ if ( *pnStringLengthPtr > nBufferLength )
+ MYODBCDbgReturn( SQL_SUCCESS_WITH_INFO );
+ break;
+
+ case SQL_DESC_CONCISE_TYPE:
+ *((SQLSMALLINT *)pValuePtr) = getConciseType();
+ break;
+
+ case SQL_DESC_DATA_PTR:
+ /*!
+ \internal ODBC Rule
+
+ The value that the SQL_DESC_DATA_PTR field of the IPD is set to
+ is not actually stored and cannot be retrieved by a call to
+ SQLGetDescField or SQLGetDescRec; the setting is made only to
+ force the consistency check.
+ */
+ *((char**)pValuePtr) = (char*)getDataPtr();
+ break;
+
+ case SQL_DESC_DATETIME_INTERVAL_CODE:
+ *((SQLSMALLINT *)pValuePtr) = getDatetimeIntervalCode();
+ break;
+
+ case SQL_DESC_DATETIME_INTERVAL_PRECISION:
+ *((SQLINTEGER *)pValuePtr) = getDatetimeIntervalPrecision();
+ break;
+
+ case SQL_DESC_DISPLAY_SIZE:
+ *((SQLINTEGER *)pValuePtr) = getDisplaySize();
+ break;
+
+ case SQL_DESC_FIXED_PREC_SCALE:
+ *((SQLSMALLINT *)pValuePtr) = getFixedPrecScale();
+ break;
+
+ case SQL_DESC_INDICATOR_PTR:
+ *(SQLINTEGER**)pValuePtr = getIndicatorPtr();
+ break;
+
+ case SQL_DESC_LABEL:
+ MYODBCCstrncpy( (SQLWCHAR*)pValuePtr, nBufferLength / sizeof(SQLWCHAR),
getLabel().utf16(), _TRUNCATE );
+ *pnStringLengthPtr = getLabel().length() * sizeof(SQLWCHAR);
+ if ( *pnStringLengthPtr > nBufferLength )
+ MYODBCDbgReturn( SQL_SUCCESS_WITH_INFO );
+ break;
+
+ case SQL_DESC_LENGTH:
+ *pUnsignedInt = getLength();
+ break;
+
+ case SQL_DESC_LITERAL_PREFIX:
+ MYODBCCstrncpy( (SQLWCHAR*)pValuePtr, nBufferLength / sizeof(SQLWCHAR),
getLiteralPrefix().utf16(), _TRUNCATE );
+ *pnStringLengthPtr = getLiteralPrefix().length() * sizeof(SQLWCHAR);
+ if ( *pnStringLengthPtr > nBufferLength )
+ MYODBCDbgReturn( SQL_SUCCESS_WITH_INFO );
+ break;
+
+ case SQL_DESC_LITERAL_SUFFIX:
+ MYODBCCstrncpy( (SQLWCHAR*)pValuePtr, nBufferLength / sizeof(SQLWCHAR),
getLiteralSuffix().utf16(), _TRUNCATE );
+ *pnStringLengthPtr = getLiteralSuffix().length() * sizeof(SQLWCHAR);
+ if ( *pnStringLengthPtr > nBufferLength )
+ MYODBCDbgReturn( SQL_SUCCESS_WITH_INFO );
+ break;
+
+ case SQL_DESC_LOCAL_TYPE_NAME:
+ MYODBCCstrncpy( (SQLWCHAR*)pValuePtr, nBufferLength / sizeof(SQLWCHAR),
getLocalTypeName().utf16(), _TRUNCATE );
+ *pnStringLengthPtr = getLocalTypeName().length() * sizeof(SQLWCHAR);
+ if ( *pnStringLengthPtr > nBufferLength )
+ MYODBCDbgReturn( SQL_SUCCESS_WITH_INFO );
+ break;
+
+ case SQL_DESC_NAME:
+ MYODBCCstrncpy( (SQLWCHAR*)pValuePtr, nBufferLength / sizeof(SQLWCHAR),
getName().utf16(), _TRUNCATE );
+ *pnStringLengthPtr = getName().length() * sizeof(SQLWCHAR);
+ if ( *pnStringLengthPtr > nBufferLength )
+ MYODBCDbgReturn( SQL_SUCCESS_WITH_INFO );
+ break;
+
+ case SQL_DESC_NULLABLE:
+ *((SQLSMALLINT *)pValuePtr) = getNullable();
+ break;
+
+ case SQL_DESC_OCTET_LENGTH:
+ *((SQLINTEGER *)pValuePtr) = getOctetLength();
+ break;
+
+ case SQL_DESC_OCTET_LENGTH_PTR:
+ *((SQLINTEGER **)pValuePtr) = getOctetLengthPtr();
+ break;
+
+ case SQL_DESC_PARAMETER_TYPE:
+ *((SQLSMALLINT *)pValuePtr) = getParamterType();
+ break;
+
+ case SQL_DESC_PRECISION:
+ *((SQLSMALLINT *)pValuePtr) = getPrecision();
+ break;
+
+ case SQL_DESC_ROWVER:
+ *((SQLSMALLINT *)pValuePtr) = getRowver();
+ break;
+
+ case SQL_DESC_SCALE:
+ *((SQLSMALLINT *)pValuePtr) = getScale();
+ break;
+
+ case SQL_DESC_SCHEMA_NAME:
+ MYODBCCstrncpy( (SQLWCHAR*)pValuePtr, nBufferLength / sizeof(SQLWCHAR),
getSchemaName().utf16(), _TRUNCATE );
+ *pnStringLengthPtr = getSchemaName().length() * sizeof(SQLWCHAR);
+ if ( *pnStringLengthPtr > nBufferLength )
+ MYODBCDbgReturn( SQL_SUCCESS_WITH_INFO );
+ break;
+
+ case SQL_DESC_SEARCHABLE:
+ *((SQLSMALLINT *)pValuePtr) = getSearchable();
+ break;
+
+ case SQL_DESC_TABLE_NAME:
+ MYODBCCstrncpy( (SQLWCHAR*)pValuePtr, nBufferLength / sizeof(SQLWCHAR),
getTableName().utf16(), _TRUNCATE );
+ *pnStringLengthPtr = getTableName().length() * sizeof(SQLWCHAR);
+ if ( *pnStringLengthPtr > nBufferLength )
+ MYODBCDbgReturn( SQL_SUCCESS_WITH_INFO );
+ break;
+
+ case SQL_DESC_TYPE:
+ *((SQLSMALLINT *)pValuePtr) = getType();
+ break;
+
+ case SQL_DESC_TYPE_NAME:
+ MYODBCCstrncpy( (SQLWCHAR*)pValuePtr, nBufferLength / sizeof(SQLWCHAR),
getTypeName().utf16(), _TRUNCATE );
+ *pnStringLengthPtr = getTypeName().length() * sizeof(SQLWCHAR);
+ if ( *pnStringLengthPtr > nBufferLength )
+ MYODBCDbgReturn( SQL_SUCCESS_WITH_INFO );
+ break;
+
+ case SQL_DESC_UNNAMED:
+ *((SQLSMALLINT *)pValuePtr) = getUnnamed();
+ break;
+
+ case SQL_DESC_UNSIGNED:
+ *((SQLSMALLINT *)pValuePtr) = getUnsigned();
+ break;
+
+ case SQL_DESC_UPDATABLE:
+ *((SQLSMALLINT *)pValuePtr) = getUpdatable();
+ break;
+
+ default:
+ MYODBCDbgReturn( pdes->dia.doAppend( MYODBC_DIA_HY091, 0, NULL ) );
+ }
+
+ MYODBCDbgReturn( SQL_SUCCESS );
+}
+
+SQLINTEGER MYODBCResRec::getAutoUniqueValue()
+{
+ MYODBCDbgEnter();
+
MYODBCDbgReturn3( nAutoUniqueValue );
}
Modified: MYODBCDes/MYODBCDesLib/MYODBCDesRec.h
===================================================================
--- MYODBCDes/MYODBCDesLib/MYODBCDesRec.h 2006-01-03 19:29:32 UTC (rev 26)
+++ MYODBCDes/MYODBCDesLib/MYODBCDesRec.h 2006-01-03 23:54:35 UTC (rev 27)
@@ -75,8 +75,8 @@
/* getters */
/* ODBC validated */
- virtual SQLRETURN getDescRec( SQLCHAR *pszName, SQLSMALLINT nBufferLength,
SQLSMALLINT *pnStringLengthPtr, SQLSMALLINT *pnTypePtr, SQLSMALLINT *pnSubTypePtr,
SQLINTEGER *pnLengthPtr, SQLSMALLINT *pnPrecisionPtr, SQLSMALLINT *pnScalePtr,
SQLSMALLINT *pnNullablePtr ) = 0;
- virtual SQLRETURN getDescField( SQLSMALLINT nFieldIdentifier, SQLPOINTER pValuePtr,
SQLINTEGER nBufferLength, SQLINTEGER *pnStringLengthPtr ) = 0;
+ virtual SQLRETURN getDescRec( SQLWCHAR *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 );
/* record fields */
virtual SQLINTEGER getAutoUniqueValue();
Modified: MYODBCDes/include/MYODBCDes.h
===================================================================
--- MYODBCDes/include/MYODBCDes.h 2006-01-03 19:29:32 UTC (rev 26)
+++ MYODBCDes/include/MYODBCDes.h 2006-01-03 23:54:35 UTC (rev 27)
@@ -130,8 +130,8 @@
/* getters */
/* ODBC validated */
- virtual SQLRETURN getDescRec( SQLSMALLINT nRecNumber, SQLCHAR *pszName, SQLSMALLINT
nBufferLength, SQLSMALLINT *pnStringLengthPtr, SQLSMALLINT *pnTypePtr, SQLSMALLINT
*pnSubTypePtr, SQLINTEGER *pnLengthPtr, SQLSMALLINT *pnPrecisionPtr, SQLSMALLINT
*pnScalePtr, SQLSMALLINT *pnNullablePtr ) = 0;
- virtual SQLRETURN getDescField( SQLSMALLINT nRecNumber, SQLSMALLINT nFieldIdentifier,
SQLPOINTER pValuePtr, SQLINTEGER nBufferLength, SQLINTEGER *pnStringLengthPtr ) = 0;
+ virtual SQLRETURN getDescRec( SQLSMALLINT nRecNumber, SQLWCHAR *pszName, SQLSMALLINT
nBufferLength, SQLSMALLINT *pnStringLengthPtr, SQLSMALLINT *pnTypePtr, SQLSMALLINT
*pnSubTypePtr, SQLINTEGER *pnLengthPtr, SQLSMALLINT *pnPrecisionPtr, SQLSMALLINT
*pnScalePtr, SQLSMALLINT *pnNullablePtr );
+ virtual SQLRETURN getDescField( SQLSMALLINT nRecNumber, SQLSMALLINT nFieldIdentifier,
SQLPOINTER pValuePtr, SQLINTEGER nBufferLength, SQLINTEGER *pnStringLengthPtr );
/* header fields */
virtual SQLSMALLINT getAllocType();
Modified: MYODBCDes/include/MYODBCDesAPD.h
===================================================================
--- MYODBCDes/include/MYODBCDesAPD.h 2006-01-03 19:29:32 UTC (rev 26)
+++ MYODBCDes/include/MYODBCDesAPD.h 2006-01-03 23:54:35 UTC (rev 27)
@@ -22,14 +22,11 @@
~MYODBCDesAPD();
/* 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 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 );
};
#endif
Modified: MYODBCDes/include/MYODBCDesARD.h
===================================================================
--- MYODBCDes/include/MYODBCDesARD.h 2006-01-03 19:29:32 UTC (rev 26)
+++ MYODBCDes/include/MYODBCDesARD.h 2006-01-03 23:54:35 UTC (rev 27)
@@ -27,8 +27,6 @@
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 );
};
#endif
Modified: MYODBCDes/include/MYODBCDesIPD.h
===================================================================
--- MYODBCDes/include/MYODBCDesIPD.h 2006-01-03 19:29:32 UTC (rev 26)
+++ MYODBCDes/include/MYODBCDesIPD.h 2006-01-03 23:54:35 UTC (rev 27)
@@ -27,8 +27,6 @@
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 );
};
#endif
Modified: MYODBCDes/include/MYODBCDesIRD.h
===================================================================
--- MYODBCDes/include/MYODBCDesIRD.h 2006-01-03 19:29:32 UTC (rev 26)
+++ MYODBCDes/include/MYODBCDesIRD.h 2006-01-03 23:54:35 UTC (rev 27)
@@ -23,12 +23,9 @@
/* setters */
SQLRETURN setDescField( SQLSMALLINT nRecNumber, SQLSMALLINT nFieldIdentifier,
SQLPOINTER pValuePtr, SQLINTEGER nBufferLength );
-
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 );
};
#endif
| Thread |
|---|
| • Connector/ODBC 5 commit: r27 - in MYODBCDes: MYODBCDesLib include | pharvey | 4 Jan |