From: Date: April 25 2006 11:27pm Subject: Connector/ODBC 5 commit: r119 - M/MYSQLCCLib List-Archive: http://lists.mysql.com/commits/5519 Message-Id: <200604252127.k3PLRTYD001201@bk-internal.mysql.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Added: M/MYSQLCCLib/MDesAPD.cpp M/MYSQLCCLib/MDesAPD.h M/MYSQLCCLib/MDesARD.cpp M/MYSQLCCLib/MDesARD.h M/MYSQLCCLib/MDesIPD.cpp M/MYSQLCCLib/MDesIPD.h M/MYSQLCCLib/MDesIRD.cpp M/MYSQLCCLib/MDesIRD.h M/MYSQLCCLib/MDesRec.cpp M/MYSQLCCLib/MDesRec.h M/MYSQLCCLib/MDesRecAPD.cpp M/MYSQLCCLib/MDesRecAPD.h M/MYSQLCCLib/MDesRecARD.cpp M/MYSQLCCLib/MDesRecARD.h M/MYSQLCCLib/MDesRecIPD.cpp M/MYSQLCCLib/MDesRecIPD.h M/MYSQLCCLib/MDesRecIRD.cpp M/MYSQLCCLib/MDesRecIRD.h M/MYSQLCCLib/MDescriptor.cpp Log: Added: M/MYSQLCCLib/MDesAPD.cpp =================================================================== --- M/MYSQLCCLib/MDesAPD.cpp 2006-04-25 21:24:28 UTC (rev 118) +++ M/MYSQLCCLib/MDesAPD.cpp 2006-04-25 21:27:27 UTC (rev 119) @@ -0,0 +1,117 @@ +#include "MYODBCDesInternal.h" + +MYODBCDesAPD::MYODBCDesAPD( SQLHANDLE hOwner, SQLSMALLINT nAllocType ) + : MYODBCDes( hOwner, nAllocType ) +{ + doAppendBookmark(); +} + +SQLRETURN MYODBCDesAPD::setDescField( SQLSMALLINT nRecNumber, SQLSMALLINT nFieldIdentifier, SQLPOINTER pValuePtr, SQLINTEGER nBufferLength ) +{ + MYODBCDbgEnter(); + + /* header field? */ + switch ( nFieldIdentifier ) + { + case SQL_DESC_ALLOC_TYPE: + /*! + \internal ODBC Rule + + APD: R + */ + MYODBCDbgReturn( getDia()->doAppend( MYODBC_DIA_HY091, 0, NULL ) ); + + case SQL_DESC_ARRAY_SIZE: + /*! + \internal ODBC Rule + + APD: R/W + */ + MYODBCDbgReturn( setArraySize( (SQLUINTEGER)pValuePtr ) ); + + case SQL_DESC_ARRAY_STATUS_PTR: + /*! + \internal ODBC Rule + + APD: R/W + */ + MYODBCDbgReturn( setArrayStatusPtr( (SQLUSMALLINT*)pValuePtr ) ); + + case SQL_DESC_BIND_OFFSET_PTR: + /*! + \internal ODBC Rule + + APD: R/W + */ + MYODBCDbgReturn( setBindOffsetPtr( (SQLINTEGER*)pValuePtr ) ); + + case SQL_DESC_BIND_TYPE: + /*! + \internal ODBC Rule + + APD: R/W + */ + + /* + An SQLUINTEGER value that sets the binding orientation to be used when + SQLFetch or SQLFetchScroll is called on the associated statement. + Column-wise binding is selected by setting the value + to SQL_BIND_BY_COLUMN (0). Row-wise binding is selected by setting the + value to the length of a structure or an instance of a buffer into + which result columns will be bound. + */ + MYODBCDbgReturn( setBindType( (SQLINTEGER)pValuePtr ) ); + + case SQL_DESC_COUNT: + /*! + \internal ODBC Rule + + APD: R/W + */ + /*! \internal ODBC Rule + + (DM) The FieldIdentifier argument was SQL_DESC_COUNT, and *ValuePtr + argument was less than 0. + */ + if ( (SQLSMALLINT)pValuePtr < 0 ) + MYODBCDbgReturn( getDia()->doAppend( MYODBC_DIA_07009, 0, NULL ) ); + + MYODBCDbgReturn( setCount( (SQLSMALLINT)pValuePtr, true ) ); + + case SQL_DESC_ROWS_PROCESSED_PTR: + /*! + \internal ODBC Rule + + APD: Unused + */ + MYODBCDbgReturn( getDia()->doAppend( MYODBC_DIA_HY091, 0, NULL ) ); + + } /* switch (for header fields) */ + + /*! \internal ODBC Rule + + The RecNumber argument was less than 0, and the DescriptorHandle argument + referred to an ARD or an APD. + */ + if ( nRecNumber < 0 ) + MYODBCDbgReturn( getDia()->doAppend( MYODBC_DIA_07009, 0, NULL ) ); + + /* auto expand record list... */ + if ( nRecNumber >= getCount() ) + setCount( nRecNumber ); + + /* handle as record field */ + MYODBCDbgReturn( vectorRecords[nRecNumber]->setDescField( nFieldIdentifier, pValuePtr, nBufferLength ) ); +} + +MYODBCDesRec *MYODBCDesAPD::doAppend() +{ + MYODBCDbgEnter(); + + MYODBCDesRecAPD *p = new MYODBCDesRecAPD( this ); + vectorRecords.append( p ); + + MYODBCDbgReturn3( "%p", p ); +} + + Added: M/MYSQLCCLib/MDesAPD.h =================================================================== --- M/MYSQLCCLib/MDesAPD.h 2006-04-25 21:24:28 UTC (rev 118) +++ M/MYSQLCCLib/MDesAPD.h 2006-04-25 21:27:27 UTC (rev 119) @@ -0,0 +1,39 @@ +/*! \file MYODBCDesAPD.h + \author Peter Harvey + \brief This code is used to support Descriptors (IPD, APD, IRD, ARD). + + This is the Application row descriptor (ARD) class. +*/ +#ifndef MYODBC_DES_APD_H +#define MYODBC_DES_APD_H + +#include "MYODBCInternal.h" + +/*! + \brief Application parameter descriptor (APD). + + This is the base class for all descriptors. + + \sa MYODBCDesAPD + MYODBCDesARD + MYODBCDesIPD + MYODBCDesIRD +*/ +class MYODBCDesAPD : public MYODBCDes +{ + friend class MYODBCDesRecAPD; +public: + MYODBCDesAPD( SQLHANDLE hOwner, SQLSMALLINT nAllocType ); + + /* setters */ + SQLRETURN setDescField( SQLSMALLINT nRecNumber, SQLSMALLINT nFieldIdentifier, SQLPOINTER pValuePtr, SQLINTEGER nBufferLength ); + + /* getters */ + + /* do'ers */ + MYODBCDesRec *doAppend(); +}; + +#endif + + Added: M/MYSQLCCLib/MDesARD.cpp =================================================================== --- M/MYSQLCCLib/MDesARD.cpp 2006-04-25 21:24:28 UTC (rev 118) +++ M/MYSQLCCLib/MDesARD.cpp 2006-04-25 21:27:27 UTC (rev 119) @@ -0,0 +1,136 @@ +#include "MYODBCDesInternal.h" + +MYODBCDesARD::MYODBCDesARD( SQLHANDLE hOwner, SQLSMALLINT nAllocType ) + : MYODBCDes( hOwner, nAllocType ) +{ + doAppendBookmark(); +} + +SQLRETURN MYODBCDesARD::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 + */ + MYODBCDbgReturn( getDia()->doAppend( MYODBC_DIA_HY091, 0, NULL ) ); + + case SQL_DESC_ARRAY_SIZE: + /*! + \internal ODBC Rule + + ARD: R/W + */ + MYODBCDbgReturn( setArraySize( (SQLUINTEGER)pValuePtr ) ); + + case SQL_DESC_ARRAY_STATUS_PTR: + /*! + \internal ODBC Rule + + ARD: R/W + */ + MYODBCDbgReturn( setArrayStatusPtr( (SQLUSMALLINT*)pValuePtr ) ); + + case SQL_DESC_BIND_OFFSET_PTR: + /*! + \internal ODBC Rule + + ARD: R/W + */ + MYODBCDbgReturn( setBindOffsetPtr( (SQLINTEGER*)pValuePtr ) ); + + case SQL_DESC_BIND_TYPE: + /*! + \internal ODBC Rule + + ARD: R/W + */ + + /* + An SQLUINTEGER value that sets the binding orientation to be used when + SQLFetch or SQLFetchScroll is called on the associated statement. + Column-wise binding is selected by setting the value + to SQL_BIND_BY_COLUMN (0). Row-wise binding is selected by setting the + value to the length of a structure or an instance of a buffer into + which result columns will be bound. + */ + + /*! + \internal MYODBC Rule + + Sanity check. Value must >=0 + */ + if ( (SQLINTEGER)pValuePtr < 0 ) + MYODBCDbgReturn( getDia()->doAppend( MYODBC_DIA_HY000, 0, "Value must be >= 0." ) ); + + MYODBCDbgReturn( setBindType( (SQLINTEGER)pValuePtr ) ); + + case SQL_DESC_COUNT: + /*! + \internal ODBC Rule + + ARD: R/W + */ + /*! \internal ODBC Rule + + (DM) The FieldIdentifier argument was SQL_DESC_COUNT, and *ValuePtr + argument was less than 0. + */ + if ( (SQLSMALLINT)pValuePtr < 0 ) + MYODBCDbgReturn( getDia()->doAppend( MYODBC_DIA_07009, 0, NULL ) ); + + MYODBCDbgReturn( setCount( (SQLSMALLINT)pValuePtr, true ) ); + + case SQL_DESC_ROWS_PROCESSED_PTR: + /*! + \internal ODBC Rule + + ARD: Unused + */ + MYODBCDbgReturn( getDia()->doAppend( MYODBC_DIA_HY091, 0, NULL ) ); + + } /* switch (for header fields) */ + + /*! \internal ODBC Rule + + The RecNumber argument was less than 0, and the DescriptorHandle argument + referred to an ARD or an APD. + */ + if ( nRecNumber < 0 ) + MYODBCDbgReturn( getDia()->doAppend( MYODBC_DIA_07009, 0, NULL ) ); + + /* auto expand record list... */ + if ( nRecNumber >= getCount() ) + setCount( nRecNumber ); + + /* handle as record field */ + MYODBCDbgReturn( vectorRecords[nRecNumber]->setDescField( nFieldIdentifier, pValuePtr, nBufferLength ) ); +} + +MYODBCDesRec *MYODBCDesARD::doAppend() +{ + MYODBCDbgEnter(); + + MYODBCDesRecARD *p = new MYODBCDesRecARD( this ); + vectorRecords.append( p ); + + MYODBCDbgReturn3( "%p", p ); +} + Added: M/MYSQLCCLib/MDesARD.h =================================================================== --- M/MYSQLCCLib/MDesARD.h 2006-04-25 21:24:28 UTC (rev 118) +++ M/MYSQLCCLib/MDesARD.h 2006-04-25 21:27:27 UTC (rev 119) @@ -0,0 +1,33 @@ +/*! \file MYODBCDesARD.h + \author Peter Harvey + \brief This code is used to support Descriptors (IPD, APD, IRD, ARD). + + This is the Application row descriptor (ARD) class. +*/ +#ifndef MYODBC_DES_ARD_H +#define MYODBC_DES_ARD_H + +#include "MYODBCInternal.h" + +/*! + \brief + \sa +*/ +class MYODBCDesARD : public MYODBCDes +{ + friend class MYODBCDesRecARD; +public: + MYODBCDesARD( SQLHANDLE hOwner, SQLSMALLINT nAllocType ); + + /* setters */ + SQLRETURN setDescField( SQLSMALLINT nRecNumber, SQLSMALLINT nFieldIdentifier, SQLPOINTER pValuePtr, SQLINTEGER nBufferLength ); + + /* getters */ + + /* do'ers */ + MYODBCDesRec *doAppend(); +}; + +#endif + + Added: M/MYSQLCCLib/MDesIPD.cpp =================================================================== --- M/MYSQLCCLib/MDesIPD.cpp 2006-04-25 21:24:28 UTC (rev 118) +++ M/MYSQLCCLib/MDesIPD.cpp 2006-04-25 21:27:27 UTC (rev 119) @@ -0,0 +1,132 @@ +#include "MYODBCDesInternal.h" + +MYODBCDesIPD::MYODBCDesIPD( SQLHANDLE hOwner ) + : MYODBCDes( hOwner, SQL_DESC_ALLOC_AUTO ) +{ + doAppendBookmark(); +} + +SQLRETURN MYODBCDesIPD::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( getDia()->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( getDia()->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( getDia()->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( getDia()->doAppend( MYODBC_DIA_HY091, 0, NULL ) ); + + case SQL_DESC_COUNT: + /*! + \internal ODBC Rule + + ARD: R/W + APD: R/W + IRD: R + IPD: R/W + */ + /* expand/shrink record list; free, even, bound records as needed */ + MYODBCDbgReturn( setCount( (SQLSMALLINT)pValuePtr, true ) ); + + case SQL_DESC_ROWS_PROCESSED_PTR: + /*! + \internal ODBC Rule + + ARD: Unused + APD: Unused + IRD: R/W + IPD: R/W + */ + MYODBCDbgReturn( setRowsProcessedPtr( (SQLUINTEGER*)pValuePtr ) ); + + } /* switch (for header fields) */ + + /*! \internal ODBC Rule + + The FieldIdentifier argument was a record field, the RecNumber argument + was 0, and the DescriptorHandle argument referred to an IPD handle. + */ + if ( nRecNumber == 0 ) + MYODBCDbgReturn( getDia()->doAppend( MYODBC_DIA_07009, 0, NULL ) ); + + /* record field needs a valid record */ + if ( nRecNumber < 0 || nRecNumber >= getCount() ) + MYODBCDbgReturn( getDia()->doAppend( MYODBC_DIA_07009, 0, NULL ) ); + + /* handle as record field */ + MYODBCDbgReturn( vectorRecords[nRecNumber]->setDescField( nFieldIdentifier, pValuePtr, nBufferLength ) ); +} + +MYODBCDesRec *MYODBCDesIPD::doAppend() +{ + MYODBCDbgEnter(); + + MYODBCDesRecIPD *p = new MYODBCDesRecIPD( this ); + vectorRecords.append( p ); + + MYODBCDbgReturn3( "%p", p ); +} + Added: M/MYSQLCCLib/MDesIPD.h =================================================================== --- M/MYSQLCCLib/MDesIPD.h 2006-04-25 21:24:28 UTC (rev 118) +++ M/MYSQLCCLib/MDesIPD.h 2006-04-25 21:27:27 UTC (rev 119) @@ -0,0 +1,33 @@ +/*! \file MYODBCDesIPD.h + \author Peter Harvey + \brief This code is used to support Descriptors (IPD, IPD, IPD, ARD). + + This is the Application row descriptor (ARD) class. +*/ +#ifndef MYODBC_DES_IPD_H +#define MYODBC_DES_IPD_H + +#include "MYODBCInternal.h" + +/*! + \brief + \sa +*/ +class MYODBCDesIPD : public MYODBCDes +{ + friend class MYODBCDesRecIPD; +public: + MYODBCDesIPD( SQLHANDLE hOwner ); + + /* setters */ + SQLRETURN setDescField( SQLSMALLINT nRecNumber, SQLSMALLINT nFieldIdentifier, SQLPOINTER pValuePtr, SQLINTEGER nBufferLength ); + + /* getters */ + + /* do'ers */ + MYODBCDesRec *doAppend(); +}; + +#endif + + Added: M/MYSQLCCLib/MDesIRD.cpp =================================================================== --- M/MYSQLCCLib/MDesIRD.cpp 2006-04-25 21:24:28 UTC (rev 118) +++ M/MYSQLCCLib/MDesIRD.cpp 2006-04-25 21:27:27 UTC (rev 119) @@ -0,0 +1,96 @@ +#include "MYODBCDesInternal.h" + +MYODBCDesIRD::MYODBCDesIRD( SQLHANDLE hOwner ) + : MYODBCDes( hOwner, SQL_DESC_ALLOC_AUTO ) +{ + doAppendBookmark(); +} + +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 + + IRD: R + */ + case SQL_DESC_ARRAY_SIZE: + /*! + \internal ODBC Rule + + IRD: Unused + */ + MYODBCDbgReturn( getDia()->doAppend( MYODBC_DIA_HY091, 0, NULL ) ); + + case SQL_DESC_ARRAY_STATUS_PTR: + /*! + \internal ODBC Rule + + IRD: R/W + */ + MYODBCDbgReturn( setArrayStatusPtr( (SQLUSMALLINT*)pValuePtr ) ); + + case SQL_DESC_BIND_OFFSET_PTR: + /*! + \internal ODBC Rule + + IRD: Unused + */ + case SQL_DESC_BIND_TYPE: + /*! + \internal ODBC Rule + + IRD: Unused + */ + case SQL_DESC_COUNT: + /*! + \internal ODBC Rule + + IRD: R + */ + MYODBCDbgReturn( getDia()->doAppend( MYODBC_DIA_HY091, 0, NULL ) ); + + case SQL_DESC_ROWS_PROCESSED_PTR: + /*! + \internal ODBC Rule + + IRD: R/W + */ + MYODBCDbgReturn( setRowsProcessedPtr( (SQLUINTEGER*)pValuePtr ) ); + } /* switch (for header fields) */ + + /* record field needs a valid record */ + if ( nRecNumber < 0 || nRecNumber >= getCount() ) + MYODBCDbgReturn( getDia()->doAppend( MYODBC_DIA_07009, 0, NULL ) ); + + /* handle as record field */ + MYODBCDbgReturn( vectorRecords[nRecNumber]->setDescField( nFieldIdentifier, pValuePtr, nBufferLength ) ); +} + +MYODBCDesRec *MYODBCDesIRD::doAppend() +{ + MYODBCDbgEnter(); + + MYODBCDesRecIRD *p = new MYODBCDesRecIRD( this ); + vectorRecords.append( p ); + + MYODBCDbgReturn3( "%p", p ); +} + + Added: M/MYSQLCCLib/MDesIRD.h =================================================================== --- M/MYSQLCCLib/MDesIRD.h 2006-04-25 21:24:28 UTC (rev 118) +++ M/MYSQLCCLib/MDesIRD.h 2006-04-25 21:27:27 UTC (rev 119) @@ -0,0 +1,33 @@ +/*! \file MYODBCDesIRD.h + \author Peter Harvey + \brief This code is used to support Descriptors (IPD, IRD, IRD, ARD). + + This is the Application row descriptor (ARD) class. +*/ +#ifndef MYODBC_DES_IRD_H +#define MYODBC_DES_IRD_H + +#include "MYODBCInternal.h" + +/*! + \brief + \sa +*/ +class MYODBCDesIRD : public MYODBCDes +{ + friend class MYODBCDesRecIRD; +public: + MYODBCDesIRD( SQLHANDLE hOwner ); + + /* setters */ + SQLRETURN setDescField( SQLSMALLINT nRecNumber, SQLSMALLINT nFieldIdentifier, SQLPOINTER pValuePtr, SQLINTEGER nBufferLength ); + + /* getters */ + + /* do'ers */ + MYODBCDesRec *doAppend(); +}; + +#endif + + Added: M/MYSQLCCLib/MDesRec.cpp =================================================================== --- M/MYSQLCCLib/MDesRec.cpp 2006-04-25 21:24:28 UTC (rev 118) +++ M/MYSQLCCLib/MDesRec.cpp 2006-04-25 21:27:27 UTC (rev 119) @@ -0,0 +1,1977 @@ +#include "MYODBCDesInternal.h" + +/*! + \brief Allocate a descriptor record. + + Allocate a descriptor record. This may include some initialization + based upon the type requested. + + \param nType Descriptor type. + + \return MYODBC_DES_REC_PTR + + \sa MYODBCDesRecFree +*/ +MYODBCDesRec::MYODBCDesRec( MYODBCDescriptor *pDescriptor ) + : QObject( pDescriptor ) +{ + MYODBCDbgEnter(); + + Q_ASSERT( !pdes ); + + this->pdes = pdes; + + nConciseType = SQL_C_DEFAULT; + pDataPtr = NULL; + pnIndicatorPtr = NULL; + pnOctetLengthPtr = NULL; + nParamterType = SQL_PARAM_INPUT; + nType = SQL_C_DEFAULT; + + MYODBCDbgReturn2(); +} + +/*! + \brief Frees all resources used by record. + + Removes the nRecord from pDess array of records and + then frees the resources used by the record including the + record itself. + + \param pDes A viable MYODBC_DES_PTR. + \param nRecord 0 based + + \return void + + \sa MYODBCDesRecAllocExt +*/ +MYODBCDesRec::~MYODBCDesRec() +{ + MYODBCDbgEnter(); + + MYODBCDbgReturn2(); +} + +SQLRETURN MYODBCDesRec::setDescRec( SQLSMALLINT nType, SQLSMALLINT nSubType, SQLINTEGER nLength, SQLSMALLINT nPrecision, SQLSMALLINT nScale, SQLPOINTER pDataPtr, SQLINTEGER *pnStringLengthPtr, SQLINTEGER *pnIndicatorPtr ) +{ + bool bHasInfo = false; + SQLRETURN nReturn = SQL_SUCCESS; + + MYODBCDbgEnter(); + + /*! \internal ODBC Rule + + When setting descriptor fields by calling SQLSetDescField, the + application must follow a specific sequence: + + 1. The application must first set the SQL_DESC_TYPE, + SQL_DESC_CONCISE_TYPE, or SQL_DESC_DATETIME_INTERVAL_CODE field. + 2. After one of these fields has been set, the application can set an + attribute of a data type, and the driver sets data type attribute + fields to the appropriate default values for the data type. Automatic + defaulting of type attribute fields ensures that the descriptor is + always ready to use once the application has specified a data type. + If the application explicitly sets a data type attribute, it is + overriding the default attribute. + 3. After one of the fields listed in step 1 has been set, and data type + attributes have been set, the application can set SQL_DESC_DATA_PTR. + This prompts a consistency check of descriptor fields. If the + application changes the data type or attributes after setting the + SQL_DESC_DATA_PTR field, the driver sets SQL_DESC_DATA_PTR to a null + pointer, unbinding the pDesRec. This forces the application to complete + the proper steps in sequence, before the descriptor pDesRec is usable. + + */ + + nReturn = setDescField( SQL_DESC_TYPE, (SQLPOINTER)nType, SQL_IS_SMALLINT ); + if ( nReturn == SQL_SUCCESS_WITH_INFO ) + bHasInfo = true; + if ( !SQL_SUCCEEDED( nReturn ) ) + MYODBCDbgReturn( nReturn ); + + /*! \internal ODBC Rule + + For records whose type is SQL_DATETIME or SQL_INTERVAL, nSubType is the value + to which to set the SQL_DESC_DATETIME_INTERVAL_CODE field. + */ + if ( nType == SQL_DATETIME || nType == SQL_INTERVAL ) + { + nReturn = setDescField( SQL_DESC_DATETIME_INTERVAL_CODE, (SQLPOINTER)nSubType, SQL_IS_SMALLINT ); + if ( nReturn == SQL_SUCCESS_WITH_INFO ) + bHasInfo = true; + if ( !SQL_SUCCEEDED( nReturn ) ) + MYODBCDbgReturn( nReturn ); + } + + nReturn = setDescField( SQL_DESC_OCTET_LENGTH, (SQLPOINTER)nLength, SQL_IS_INTEGER ); + if ( nReturn == SQL_SUCCESS_WITH_INFO ) + bHasInfo = true; + if ( !SQL_SUCCEEDED( nReturn ) ) + MYODBCDbgReturn( nReturn ); + + nReturn = setDescField( SQL_DESC_PRECISION, (SQLPOINTER)nPrecision, SQL_IS_SMALLINT ); + if ( nReturn == SQL_SUCCESS_WITH_INFO ) + bHasInfo = true; + if ( !SQL_SUCCEEDED( nReturn ) ) + MYODBCDbgReturn( nReturn ); + + nReturn = setDescField( SQL_DESC_SCALE, (SQLPOINTER)nScale, SQL_IS_SMALLINT ); + if ( nReturn == SQL_SUCCESS_WITH_INFO ) + bHasInfo = true; + if ( !SQL_SUCCEEDED( nReturn ) ) + MYODBCDbgReturn( nReturn ); + + nReturn = setDescField( SQL_DESC_OCTET_LENGTH_PTR, (SQLPOINTER)pnStringLengthPtr, SQL_IS_POINTER ); + if ( nReturn == SQL_SUCCESS_WITH_INFO ) + bHasInfo = true; + if ( !SQL_SUCCEEDED( nReturn ) ) + MYODBCDbgReturn( nReturn ); + + nReturn = setDescField( SQL_DESC_INDICATOR_PTR, (SQLPOINTER)pnIndicatorPtr, SQL_IS_POINTER ); + if ( nReturn == SQL_SUCCESS_WITH_INFO ) + bHasInfo = true; + if ( !SQL_SUCCEEDED( nReturn ) ) + MYODBCDbgReturn( nReturn ); + + /* do last (causes extra validation) */ + nReturn = setDescField( SQL_DESC_DATA_PTR, pDataPtr, SQL_IS_POINTER ); + if ( nReturn == SQL_SUCCESS_WITH_INFO ) + bHasInfo = true; + if ( !SQL_SUCCEEDED( nReturn ) ) + MYODBCDbgReturn( nReturn ); + + /* fini */ + if ( bHasInfo ) + MYODBCDbgReturn( SQL_SUCCESS_WITH_INFO ); + + MYODBCDbgReturn( nReturn ); +} + +SQLRETURN MYODBCDesRec::setAutoUniqueValue( SQLINTEGER nAutoUniqueValue ) +{ + MYODBCDbgEnter(); + + this->nAutoUniqueValue = nAutoUniqueValue; + + MYODBCDbgReturn( SQL_SUCCESS ); +} + +SQLRETURN MYODBCDesRec::setBaseColumnName( const QString &stringBaseColumnName ) +{ + MYODBCDbgEnter(); + + this->stringBaseColumnName = stringBaseColumnName; + + MYODBCDbgReturn( SQL_SUCCESS ); +} + +SQLRETURN MYODBCDesRec::setBaseTableName( const QString &stringBaseTableName ) +{ + MYODBCDbgEnter(); + + this->stringBaseTableName = stringBaseTableName; + + MYODBCDbgReturn( SQL_SUCCESS ); +} + +SQLRETURN MYODBCDesRec::setCaseSensitive( SQLINTEGER nCaseSensitive ) +{ + MYODBCDbgEnter(); + + this->nCaseSensitive = nCaseSensitive; + + MYODBCDbgReturn( SQL_SUCCESS ); +} + +SQLRETURN MYODBCDesRec::setCatalogName( const QString &stringCatalogName ) +{ + MYODBCDbgEnter(); + + this->stringCatalogName = stringCatalogName; + + MYODBCDbgReturn( SQL_SUCCESS ); +} + +SQLRETURN MYODBCDesRec::setDataPtr( SQLPOINTER pDataPtr ) +{ + MYODBCDbgEnter(); + + this->pDataPtr = pDataPtr; + + MYODBCDbgReturn( SQL_SUCCESS ); +} + +SQLRETURN MYODBCDesRec::setDatetimeIntervalCode( SQLSMALLINT nDatetimeIntervalCode ) +{ + MYODBCDbgEnter(); + + this->nDatetimeIntervalCode = nDatetimeIntervalCode; + + MYODBCDbgReturn( SQL_SUCCESS ); +} + +SQLRETURN MYODBCDesRec::setDatetimeIntervalPrecision( SQLINTEGER nDatetimeIntervalPrecision ) +{ + MYODBCDbgEnter(); + + this->nDatetimeIntervalPrecision = nDatetimeIntervalPrecision; + + MYODBCDbgReturn( SQL_SUCCESS ); +} + +SQLRETURN MYODBCDesRec::setDisplaySize( SQLINTEGER nDisplaySize ) +{ + MYODBCDbgEnter(); + + this->nDisplaySize = nDisplaySize; + + MYODBCDbgReturn( SQL_SUCCESS ); +} + +SQLRETURN MYODBCDesRec::setFixedPrecScale( SQLSMALLINT nFixedPrecScale ) +{ + MYODBCDbgEnter(); + + this->nFixedPrecScale = nFixedPrecScale; + + MYODBCDbgReturn( SQL_SUCCESS ); +} + +SQLRETURN MYODBCDesRec::setIndicatorPtr( SQLINTEGER *pnIndicatorPtr ) +{ + MYODBCDbgEnter(); + + this->pnIndicatorPtr = pnIndicatorPtr; + + MYODBCDbgReturn( SQL_SUCCESS ); +} + +SQLRETURN MYODBCDesRec::setLabel( const QString &stringLabel ) +{ + MYODBCDbgEnter(); + + this->stringLabel = stringLabel; + + MYODBCDbgReturn( SQL_SUCCESS ); +} + +SQLRETURN MYODBCDesRec::setLength( SQLUINTEGER nLength ) +{ + MYODBCDbgEnter(); + + this->nLength = nLength; + + MYODBCDbgReturn( SQL_SUCCESS ); +} + +SQLRETURN MYODBCDesRec::setLiteralPrefix( const QString &stringLiteralPrefix ) +{ + MYODBCDbgEnter(); + + this->stringLiteralPrefix = stringLiteralPrefix; + + MYODBCDbgReturn( SQL_SUCCESS ); +} + +SQLRETURN MYODBCDesRec::setLiteralSuffix( const QString &stringLiteralSuffix ) +{ + MYODBCDbgEnter(); + + this->stringLiteralSuffix = stringLiteralSuffix; + + MYODBCDbgReturn( SQL_SUCCESS ); +} + +SQLRETURN MYODBCDesRec::setLocalTypeName( const QString &stringLocalTypeName ) +{ + MYODBCDbgEnter(); + + this->stringLocalTypeName = stringLocalTypeName; + + MYODBCDbgReturn( SQL_SUCCESS ); +} + +SQLRETURN MYODBCDesRec::setName( const QString &stringName ) +{ + MYODBCDbgEnter(); + + this->stringName = stringName; + + if ( stringName.isEmpty() ) + setUnnamed( SQL_UNNAMED ); + else + setUnnamed( SQL_NAMED ); + + MYODBCDbgReturn( SQL_SUCCESS ); +} + +SQLRETURN MYODBCDesRec::setNullable( SQLSMALLINT nNullable ) +{ + MYODBCDbgEnter(); + + this->nNullable = nNullable; + + MYODBCDbgReturn( SQL_SUCCESS ); +} + +SQLRETURN MYODBCDesRec::setNumPrecRadix( SQLINTEGER nNumPrecRadix ) +{ + MYODBCDbgEnter(); + + this->nNumPrecRadix = nNumPrecRadix; + + MYODBCDbgReturn( SQL_SUCCESS ); +} + +SQLRETURN MYODBCDesRec::setOctetLength( SQLINTEGER nOctetLength ) +{ + MYODBCDbgEnter(); + + this->nOctetLength = nOctetLength; + + MYODBCDbgReturn( SQL_SUCCESS ); +} + +SQLRETURN MYODBCDesRec::setOctetLengthPtr( SQLINTEGER *pnOctetLengthPtr ) +{ + MYODBCDbgEnter(); + + this->pnOctetLengthPtr = pnOctetLengthPtr; + + MYODBCDbgReturn( SQL_SUCCESS ); +} + +SQLRETURN MYODBCDesRec::setParamterType( SQLSMALLINT nParamterType ) +{ + MYODBCDbgEnter(); + + this->nParamterType = nParamterType; + + MYODBCDbgReturn( SQL_SUCCESS ); +} + +SQLRETURN MYODBCDesRec::setPrecision( SQLSMALLINT nPrecision ) +{ + MYODBCDbgEnter(); + + this->nPrecision = nPrecision; + + MYODBCDbgReturn( SQL_SUCCESS ); +} + +SQLRETURN MYODBCDesRec::setRowver( SQLSMALLINT nRowver ) +{ + MYODBCDbgEnter(); + + this->nRowver = nRowver; + + MYODBCDbgReturn( SQL_SUCCESS ); +} + +SQLRETURN MYODBCDesRec::setScale( SQLSMALLINT nScale ) +{ + MYODBCDbgEnter(); + + this->nScale = nScale; + + MYODBCDbgReturn( SQL_SUCCESS ); +} + +SQLRETURN MYODBCDesRec::setSchemaName( const QString &stringSchemaName ) +{ + MYODBCDbgEnter(); + + this->stringSchemaName = stringSchemaName; + + MYODBCDbgReturn( SQL_SUCCESS ); +} + +SQLRETURN MYODBCDesRec::setSearchable( SQLSMALLINT nSearchable ) +{ + MYODBCDbgEnter(); + + this->nSearchable = nSearchable; + + MYODBCDbgReturn( SQL_SUCCESS ); +} + +SQLRETURN MYODBCDesRec::setTableName( const QString &stringTableName ) +{ + MYODBCDbgEnter(); + + this->stringTableName = stringTableName; + + MYODBCDbgReturn( SQL_SUCCESS ); +} + +SQLRETURN MYODBCDesRec::setType( SQLSMALLINT nType ) +{ + MYODBCDbgEnter(); + + this->nType = nType; + + MYODBCDbgReturn( SQL_SUCCESS ); +} + +SQLRETURN MYODBCDesRec::setTypeName( const QString &stringTypeName ) +{ + MYODBCDbgEnter(); + + this->stringTypeName = stringTypeName; + + MYODBCDbgReturn( SQL_SUCCESS ); +} + +SQLRETURN MYODBCDesRec::setUnnamed( SQLSMALLINT nUnnamed ) +{ + MYODBCDbgEnter(); + + this->nUnnamed = nUnnamed; + + MYODBCDbgReturn( SQL_SUCCESS ); +} + +SQLRETURN MYODBCDesRec::setUnsigned( SQLSMALLINT nUnsigned ) +{ + MYODBCDbgEnter(); + + this->nUnsigned = nUnsigned; + + MYODBCDbgReturn( SQL_SUCCESS ); +} + +SQLRETURN MYODBCDesRec::setUpdatable( SQLSMALLINT nUpdatable ) +{ + MYODBCDbgEnter(); + + this->nUpdatable = nUpdatable; + + MYODBCDbgReturn( SQL_SUCCESS ); +} + +SQLRETURN MYODBCDesRec::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 MYODBCDesRec::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: + MYODBCC::doStrNCpy( (SQLWCHAR*)pValuePtr, nBufferLength / sizeof(SQLWCHAR), getBaseColumnName().utf16() ); + *pnStringLengthPtr = getBaseColumnName().length() * sizeof(SQLWCHAR); + if ( *pnStringLengthPtr > nBufferLength ) + MYODBCDbgReturn( SQL_SUCCESS_WITH_INFO ); + break; + + case SQL_DESC_BASE_TABLE_NAME: + MYODBCC::doStrNCpy( (SQLWCHAR*)pValuePtr, nBufferLength / sizeof(SQLWCHAR), getBaseTableName().utf16() ); + *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: + MYODBCC::doStrNCpy( (SQLWCHAR*)pValuePtr, nBufferLength / sizeof(SQLWCHAR), getCatalogName().utf16() ); + *pnStringLengthPtr = getCatalogName().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: + MYODBCC::doStrNCpy( (SQLWCHAR*)pValuePtr, nBufferLength / sizeof(SQLWCHAR), getLabel().utf16() ); + *pnStringLengthPtr = getLabel().length() * sizeof(SQLWCHAR); + if ( *pnStringLengthPtr > nBufferLength ) + MYODBCDbgReturn( SQL_SUCCESS_WITH_INFO ); + break; + + case SQL_DESC_LENGTH: + *(SQLUINTEGER*)pValuePtr = getLength(); + break; + + case SQL_DESC_LITERAL_PREFIX: + MYODBCC::doStrNCpy( (SQLWCHAR*)pValuePtr, nBufferLength / sizeof(SQLWCHAR), getLiteralPrefix().utf16() ); + *pnStringLengthPtr = getLiteralPrefix().length() * sizeof(SQLWCHAR); + if ( *pnStringLengthPtr > nBufferLength ) + MYODBCDbgReturn( SQL_SUCCESS_WITH_INFO ); + break; + + case SQL_DESC_LITERAL_SUFFIX: + MYODBCC::doStrNCpy( (SQLWCHAR*)pValuePtr, nBufferLength / sizeof(SQLWCHAR), getLiteralSuffix().utf16() ); + *pnStringLengthPtr = getLiteralSuffix().length() * sizeof(SQLWCHAR); + if ( *pnStringLengthPtr > nBufferLength ) + MYODBCDbgReturn( SQL_SUCCESS_WITH_INFO ); + break; + + case SQL_DESC_LOCAL_TYPE_NAME: + MYODBCC::doStrNCpy( (SQLWCHAR*)pValuePtr, nBufferLength / sizeof(SQLWCHAR), getLocalTypeName().utf16() ); + *pnStringLengthPtr = getLocalTypeName().length() * sizeof(SQLWCHAR); + if ( *pnStringLengthPtr > nBufferLength ) + MYODBCDbgReturn( SQL_SUCCESS_WITH_INFO ); + break; + + case SQL_DESC_NAME: + MYODBCC::doStrNCpy( (SQLWCHAR*)pValuePtr, nBufferLength / sizeof(SQLWCHAR), getName().utf16() ); + *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: + MYODBCC::doStrNCpy( (SQLWCHAR*)pValuePtr, nBufferLength / sizeof(SQLWCHAR), getSchemaName().utf16() ); + *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: + MYODBCC::doStrNCpy( (SQLWCHAR*)pValuePtr, nBufferLength / sizeof(SQLWCHAR), getTableName().utf16() ); + *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: + MYODBCC::doStrNCpy( (SQLWCHAR*)pValuePtr, nBufferLength / sizeof(SQLWCHAR), getTypeName().utf16() ); + *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( getDes()->getDia()->doAppend( MYODBC_DIA_HY091, 0, NULL ) ); + } + + MYODBCDbgReturn( SQL_SUCCESS ); +} + +SQLINTEGER MYODBCDesRec::getAutoUniqueValue() +{ + MYODBCDbgEnter(); + + MYODBCDbgReturn3( "%d", nAutoUniqueValue ); +} + +QString MYODBCDesRec::getBaseColumnName() +{ + MYODBCDbgEnter(); + + MYODBCDbgReturn3( "%s", stringBaseColumnName ); +} + +QString MYODBCDesRec::getBaseTableName() +{ + MYODBCDbgEnter(); + + MYODBCDbgReturn3( "%s", stringBaseTableName ); +} + +SQLINTEGER MYODBCDesRec::getCaseSensitive() +{ + MYODBCDbgEnter(); + + MYODBCDbgReturn3( "%d", nCaseSensitive ); +} + +QString MYODBCDesRec::getCatalogName() +{ + MYODBCDbgEnter(); + + MYODBCDbgReturn3( "%s", stringCatalogName ); +} + +SQLSMALLINT MYODBCDesRec::getConciseType() +{ + MYODBCDbgEnter(); + + MYODBCDbgReturn3( "%d", nConciseType ); +} + +SQLPOINTER MYODBCDesRec::getDataPtr() +{ + MYODBCDbgEnter(); + + MYODBCDbgReturn3( "%p", pDataPtr ); +} + +SQLSMALLINT MYODBCDesRec::getDatetimeIntervalCode() +{ + MYODBCDbgEnter(); + + MYODBCDbgReturn3( "%d", nDatetimeIntervalCode ); +} + +SQLINTEGER MYODBCDesRec::getDatetimeIntervalPrecision() +{ + MYODBCDbgEnter(); + + MYODBCDbgReturn3( "%d", nDatetimeIntervalPrecision ); +} + +SQLINTEGER MYODBCDesRec::getDisplaySize() +{ + MYODBCDbgEnter(); + + MYODBCDbgReturn3( "%d", nDisplaySize ); +} + +SQLSMALLINT MYODBCDesRec::getFixedPrecScale() +{ + MYODBCDbgEnter(); + + MYODBCDbgReturn3( "%d", nFixedPrecScale ); +} + +SQLINTEGER *MYODBCDesRec::getIndicatorPtr() +{ + MYODBCDbgEnter(); + + MYODBCDbgReturn3( "%p", pnIndicatorPtr ); +} + +QString MYODBCDesRec::getLabel() +{ + MYODBCDbgEnter(); + + MYODBCDbgReturn3( "%s", stringLabel ); +} + +SQLUINTEGER MYODBCDesRec::getLength() +{ + MYODBCDbgEnter(); + + MYODBCDbgReturn3( "%d", nLength ); +} + +QString MYODBCDesRec::getLiteralPrefix() +{ + MYODBCDbgEnter(); + + MYODBCDbgReturn3( "%s", stringLiteralPrefix ); +} + +QString MYODBCDesRec::getLiteralSuffix() +{ + MYODBCDbgEnter(); + + MYODBCDbgReturn3( "%s", stringLiteralSuffix ); +} + +QString MYODBCDesRec::getLocalTypeName() +{ + MYODBCDbgEnter(); + + MYODBCDbgReturn3( "%s", stringLocalTypeName ); +} + +QString MYODBCDesRec::getName() +{ + MYODBCDbgEnter(); + + MYODBCDbgReturn3( "%s", stringName ); +} + +SQLSMALLINT MYODBCDesRec::getNullable() +{ + MYODBCDbgEnter(); + + MYODBCDbgReturn3( "%d", nNullable ); +} + +SQLINTEGER MYODBCDesRec::getNumPrecRadix() +{ + MYODBCDbgEnter(); + + MYODBCDbgReturn3( "%d", nNumPrecRadix ); +} + +SQLINTEGER MYODBCDesRec::getOctetLength() +{ + MYODBCDbgEnter(); + + MYODBCDbgReturn3( "%d", nOctetLength ); +} + +SQLINTEGER *MYODBCDesRec::getOctetLengthPtr() +{ + MYODBCDbgEnter(); + + MYODBCDbgReturn3( "%p", pnOctetLengthPtr ); +} + +SQLSMALLINT MYODBCDesRec::getParamterType() +{ + MYODBCDbgEnter(); + + MYODBCDbgReturn3( "%d", nParamterType ); +} + +SQLSMALLINT MYODBCDesRec::getPrecision() +{ + MYODBCDbgEnter(); + + MYODBCDbgReturn3( "%d", nPrecision ); +} + +SQLSMALLINT MYODBCDesRec::getRowver() +{ + MYODBCDbgEnter(); + + MYODBCDbgReturn3( "%d", nRowver ); +} + +SQLSMALLINT MYODBCDesRec::getScale() +{ + MYODBCDbgEnter(); + + MYODBCDbgReturn3( "%d", nScale ); +} + +QString MYODBCDesRec::getSchemaName() +{ + MYODBCDbgEnter(); + + MYODBCDbgReturn3( "%s", stringSchemaName ); +} + +SQLSMALLINT MYODBCDesRec::getSearchable() +{ + MYODBCDbgEnter(); + + MYODBCDbgReturn3( "%d", nSearchable ); +} + +QString MYODBCDesRec::getTableName() +{ + MYODBCDbgEnter(); + + MYODBCDbgReturn3( "%s", stringTableName ); +} + +SQLSMALLINT MYODBCDesRec::getType() +{ + MYODBCDbgEnter(); + + MYODBCDbgReturn3( "%d", nType ); +} + +QString MYODBCDesRec::getTypeName() +{ + MYODBCDbgEnter(); + + MYODBCDbgReturn3( "%s", stringTypeName ); +} + +SQLSMALLINT MYODBCDesRec::getUnnamed() +{ + MYODBCDbgEnter(); + + MYODBCDbgReturn3( "%d", nUnnamed ); +} + +SQLSMALLINT MYODBCDesRec::getUnsigned() +{ + MYODBCDbgEnter(); + + MYODBCDbgReturn3( "%d", nUnsigned ); +} + +SQLSMALLINT MYODBCDesRec::getUpdatable() +{ + MYODBCDbgEnter(); + + MYODBCDbgReturn3( "%d", nUpdatable ); +} + +MYODBCDes *MYODBCDesRec::getDes() +{ + MYODBCDbgEnter(); + + MYODBCDbgReturn3( "%p", pdes ); +} + +SQLRETURN MYODBCDesRec::doUnbind() +{ + MYODBCDbgEnter(); + + pDataPtr = NULL; + + MYODBCDbgReturn( SQL_SUCCESS ); +} + +bool MYODBCDesRec::isBound() +{ + MYODBCDbgEnter(); + + MYODBCDbgReturn3( "%d", ( pDataPtr ? true : false ) ); +} + +MYODBCDesRec &MYODBCDesRec::operator=( MYODBCDesRec &desrec ) +{ + desrec.nAutoUniqueValue = nAutoUniqueValue; + desrec.nCaseSensitive = nCaseSensitive; + desrec.nConciseType = nConciseType; + desrec.nDatetimeIntervalCode = nDatetimeIntervalCode; + desrec.nDatetimeIntervalPrecision = nDatetimeIntervalPrecision; + desrec.nDisplaySize = nDisplaySize; + desrec.nFixedPrecScale = nFixedPrecScale; + desrec.nLength = nLength; + desrec.nNullable = nNullable; + desrec.nNumPrecRadix = nNumPrecRadix; + desrec.nOctetLength = nOctetLength; + desrec.nParamterType = nParamterType; + desrec.nPrecision = nPrecision; + desrec.nRowver = nRowver; + desrec.nScale = nScale; + desrec.nSearchable = nSearchable; + desrec.nType = nType; + desrec.nUnnamed = nUnnamed; + desrec.nUnsigned = nUnsigned; + desrec.nUpdatable = nUpdatable; + desrec.pDataPtr = pDataPtr; + desrec.pnIndicatorPtr = pnIndicatorPtr; + desrec.pnOctetLengthPtr = pnOctetLengthPtr; + desrec.stringBaseColumnName = stringBaseColumnName; + desrec.stringBaseTableName = stringBaseTableName; + desrec.stringCatalogName = stringCatalogName; + desrec.stringLabel = stringLabel; + desrec.stringLiteralPrefix = stringLiteralPrefix; + desrec.stringLiteralSuffix = stringLiteralSuffix; + desrec.stringLocalTypeName = stringLocalTypeName; + desrec.stringName = stringName; + desrec.stringSchemaName = stringSchemaName; + desrec.stringTableName = stringTableName; + desrec.stringTypeName = stringTypeName; + + MYODBCDbgReturn3( "%p", *this ); +} + +SQLRETURN MYODBCDesRec::setIntervalCode( SQLSMALLINT nDateTimeIntervalCode ) +{ + MYODBCDbgEnter(); + + /* + \internal ODBC Rule + + This SQLSMALLINT record field contains the subcode for the specific datetime + or interval data type when the SQL_DESC_TYPE field is SQL_DATETIME or + SQL_INTERVAL. + */ + if ( getType() != SQL_DATETIME && getType() != SQL_INTERVAL ) + MYODBCDbgReturn( getDes()->getDia()->doAppend( MYODBC_DIA_HY092, 0, NULL ) ); + + switch ( nDateTimeIntervalCode ) + { + case SQL_CODE_YEAR: /* = 1 = SQL_CODE_DATE */ + case SQL_CODE_MONTH: /* = 2 = SQL_CODE_TIME */ + case SQL_CODE_DAY: /* = 3 = SQL_CODE_TIMESTAMP */ + case SQL_CODE_HOUR: + case SQL_CODE_MINUTE: + case SQL_CODE_SECOND: + case SQL_CODE_YEAR_TO_MONTH: + case SQL_CODE_DAY_TO_HOUR: + case SQL_CODE_DAY_TO_MINUTE: + case SQL_CODE_DAY_TO_SECOND: + case SQL_CODE_HOUR_TO_MINUTE: + case SQL_CODE_HOUR_TO_SECOND: + case SQL_CODE_MINUTE_TO_SECOND: + MYODBCDbgReturn( setDatetimeIntervalCode( nDateTimeIntervalCode ) ); + } + + MYODBCDbgReturn( getDes()->getDia()->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( getDes()->getDia()->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 ( getDatetimeIntervalCode() ) + { + 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( getDes()->getDia()->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 ( getDatetimeIntervalCode() ) + { + 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( getDes()->getDia()->doAppend( MYODBC_DIA_HY021, 0, NULL ) ); + } + } + + MYODBCDbgReturn( getDes()->getDia()->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( getDes()->getDia()->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: + case SQL_WCHAR: + case SQL_WVARCHAR: + case SQL_WLONGVARCHAR: + 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 ( getDatetimeIntervalCode() ) + { + 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( getDes()->getDia()->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 ( getDatetimeIntervalCode() ) + { + 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( getDes()->getDia()->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( getDes()->getDia()->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 */ + this->nConciseType = nConciseType; + setType( nConciseType ); + setDatetimeIntervalCode( 0 ); + MYODBCDbgReturn( SQL_SUCCESS ); + case SQL_C_TYPE_DATE: /* 91 */ + this->nConciseType = nConciseType; + setType( SQL_DATETIME ); + setDatetimeIntervalCode( SQL_CODE_DATE ); + MYODBCDbgReturn( SQL_SUCCESS ); + case SQL_C_TYPE_TIME: /* 92 */ + this->nConciseType = nConciseType; + setType( SQL_DATETIME ); + setDatetimeIntervalCode( SQL_CODE_TIME ); + MYODBCDbgReturn( SQL_SUCCESS ); + case SQL_C_TYPE_TIMESTAMP: /* 93 */ + this->nConciseType = 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 */ + this->nConciseType = nConciseType; + setType( nConciseType ); + setDatetimeIntervalCode( 0 ); + MYODBCDbgReturn( SQL_SUCCESS ); + case SQL_C_INTERVAL_MONTH: /* 102 */ + this->nConciseType = nConciseType; + setType( SQL_INTERVAL ); + setDatetimeIntervalCode( SQL_CODE_MONTH ); + MYODBCDbgReturn( SQL_SUCCESS ); + case SQL_C_INTERVAL_YEAR: /* 101 */ + this->nConciseType = nConciseType; + setType( SQL_INTERVAL ); + setDatetimeIntervalCode( SQL_CODE_YEAR ); + MYODBCDbgReturn( SQL_SUCCESS ); + case SQL_C_INTERVAL_YEAR_TO_MONTH: /* 107 */ + this->nConciseType = nConciseType; + setType( SQL_INTERVAL ); + setDatetimeIntervalCode( SQL_CODE_YEAR_TO_MONTH ); + MYODBCDbgReturn( SQL_SUCCESS ); + case SQL_C_INTERVAL_DAY: /* 103 */ + this->nConciseType = nConciseType; + setType( SQL_INTERVAL ); + setDatetimeIntervalCode( SQL_CODE_DAY ); + MYODBCDbgReturn( SQL_SUCCESS ); + case SQL_C_INTERVAL_HOUR: /* 104 */ + this->nConciseType = nConciseType; + setType( SQL_INTERVAL ); + setDatetimeIntervalCode( SQL_CODE_HOUR ); + MYODBCDbgReturn( SQL_SUCCESS ); + case SQL_C_INTERVAL_MINUTE: /* 105 */ + this->nConciseType = nConciseType; + setType( SQL_INTERVAL ); + setDatetimeIntervalCode( SQL_CODE_MINUTE ); + MYODBCDbgReturn( SQL_SUCCESS ); + case SQL_C_INTERVAL_SECOND: /* 106 */ + this->nConciseType = nConciseType; + setType( SQL_INTERVAL ); + setDatetimeIntervalCode( SQL_CODE_SECOND ); + MYODBCDbgReturn( SQL_SUCCESS ); + case SQL_C_INTERVAL_DAY_TO_HOUR: /* 108 */ + this->nConciseType = nConciseType; + setType( SQL_INTERVAL ); + setDatetimeIntervalCode( SQL_CODE_DAY_TO_HOUR ); + MYODBCDbgReturn( SQL_SUCCESS ); + case SQL_C_INTERVAL_DAY_TO_MINUTE: /* 109 */ + this->nConciseType = nConciseType; + setType( SQL_INTERVAL ); + setDatetimeIntervalCode( SQL_CODE_DAY_TO_MINUTE ); + MYODBCDbgReturn( SQL_SUCCESS ); + case SQL_C_INTERVAL_DAY_TO_SECOND: /* 110 */ + this->nConciseType = nConciseType; + setType( SQL_INTERVAL ); + setDatetimeIntervalCode( SQL_CODE_DAY_TO_SECOND ); + MYODBCDbgReturn( SQL_SUCCESS ); + case SQL_C_INTERVAL_HOUR_TO_MINUTE: /* 111 */ + this->nConciseType = nConciseType; + setType( SQL_INTERVAL ); + setDatetimeIntervalCode( SQL_CODE_HOUR_TO_MINUTE ); + MYODBCDbgReturn( SQL_SUCCESS ); + case SQL_C_INTERVAL_HOUR_TO_SECOND: /* 112 */ + this->nConciseType = nConciseType; + setType( SQL_INTERVAL ); + setDatetimeIntervalCode( SQL_CODE_HOUR_TO_SECOND ); + MYODBCDbgReturn( SQL_SUCCESS ); + case SQL_C_INTERVAL_MINUTE_TO_SECOND: /* 113 */ + this->nConciseType = nConciseType; + setType( SQL_INTERVAL ); + setDatetimeIntervalCode( SQL_CODE_MINUTE_TO_SECOND ); + MYODBCDbgReturn( SQL_SUCCESS ); + } + + MYODBCDbgReturn( getDes()->getDia()->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 */ + this->nConciseType = nConciseType; + setType( nConciseType ); + setDatetimeIntervalCode( 0 ); + MYODBCDbgReturn( SQL_SUCCESS ); + case SQL_TYPE_DATE: /* 91 */ + this->nConciseType = nConciseType; + setType( SQL_DATETIME ); +// \todo set SQL_DESC_TYPE_NAME to MySQL data type.... +// setTypeName( "DATETIME" ); +// + setDatetimeIntervalCode( SQL_CODE_DATE ); + MYODBCDbgReturn( SQL_SUCCESS ); + case SQL_TYPE_TIME: /* 92 */ + this->nConciseType = nConciseType; + setType( SQL_DATETIME ); + setDatetimeIntervalCode( SQL_CODE_TIME ); + MYODBCDbgReturn( SQL_SUCCESS ); + case SQL_TYPE_TIMESTAMP: /* 93 */ + this->nConciseType = nConciseType; + setType( SQL_DATETIME ); + setDatetimeIntervalCode( SQL_CODE_TIMESTAMP ); + MYODBCDbgReturn( SQL_SUCCESS ); + /* case SQL_TYPE_UTCDATETIME: */ /* ? */ + /* case SQL_TYPE_UTCTIME: */ /* ? */ + case SQL_INTERVAL_MONTH: /* 102 */ + this->nConciseType = nConciseType; + setType( SQL_INTERVAL ); + setDatetimeIntervalCode( SQL_CODE_MONTH ); + MYODBCDbgReturn( SQL_SUCCESS ); + case SQL_INTERVAL_YEAR: /* 101 */ + this->nConciseType = nConciseType; + setType( SQL_INTERVAL ); + setDatetimeIntervalCode( SQL_CODE_YEAR ); + MYODBCDbgReturn( SQL_SUCCESS ); + case SQL_INTERVAL_YEAR_TO_MONTH: /* 107 */ + this->nConciseType = nConciseType; + setType( SQL_INTERVAL ); + setDatetimeIntervalCode( SQL_CODE_YEAR_TO_MONTH ); + MYODBCDbgReturn( SQL_SUCCESS ); + case SQL_INTERVAL_DAY: /* 103 */ + this->nConciseType = nConciseType; + setType( SQL_INTERVAL ); + setDatetimeIntervalCode( SQL_CODE_DAY ); + MYODBCDbgReturn( SQL_SUCCESS ); + case SQL_INTERVAL_HOUR: /* 104 */ + this->nConciseType = nConciseType; + setType( SQL_INTERVAL ); + setDatetimeIntervalCode( SQL_CODE_HOUR ); + MYODBCDbgReturn( SQL_SUCCESS ); + case SQL_INTERVAL_MINUTE: /* 105 */ + this->nConciseType = nConciseType; + setType( SQL_INTERVAL ); + setDatetimeIntervalCode( SQL_CODE_MINUTE ); + MYODBCDbgReturn( SQL_SUCCESS ); + case SQL_INTERVAL_SECOND: /* 106 */ + this->nConciseType = nConciseType; + setType( SQL_INTERVAL ); + setDatetimeIntervalCode( SQL_CODE_SECOND ); + MYODBCDbgReturn( SQL_SUCCESS ); + case SQL_INTERVAL_DAY_TO_HOUR: /* 108 */ + this->nConciseType = nConciseType; + setType( SQL_INTERVAL ); + setDatetimeIntervalCode( SQL_CODE_DAY_TO_HOUR ); + MYODBCDbgReturn( SQL_SUCCESS ); + case SQL_INTERVAL_DAY_TO_MINUTE: /* 109 */ + this->nConciseType = nConciseType; + setType( SQL_INTERVAL ); + setDatetimeIntervalCode( SQL_CODE_DAY_TO_MINUTE ); + MYODBCDbgReturn( SQL_SUCCESS ); + case SQL_INTERVAL_DAY_TO_SECOND: /* 110 */ + this->nConciseType = nConciseType; + setType( SQL_INTERVAL ); + setDatetimeIntervalCode( SQL_CODE_DAY_TO_SECOND ); + MYODBCDbgReturn( SQL_SUCCESS ); + case SQL_INTERVAL_HOUR_TO_MINUTE: /* 111 */ + this->nConciseType = nConciseType; + setType( SQL_INTERVAL ); + setDatetimeIntervalCode( SQL_CODE_HOUR_TO_MINUTE ); + MYODBCDbgReturn( SQL_SUCCESS ); + case SQL_INTERVAL_HOUR_TO_SECOND: /* 112 */ + this->nConciseType = nConciseType; + setType( SQL_INTERVAL ); + setDatetimeIntervalCode( SQL_CODE_HOUR_TO_SECOND ); + MYODBCDbgReturn( SQL_SUCCESS ); + case SQL_INTERVAL_MINUTE_TO_SECOND: /* 113 */ + this->nConciseType = nConciseType; + setType( SQL_INTERVAL ); + setDatetimeIntervalCode( SQL_CODE_MINUTE_TO_SECOND ); + MYODBCDbgReturn( SQL_SUCCESS ); + case SQL_GUID: /* -11 */ + this->nConciseType = nConciseType; + setType( nConciseType ); + setDatetimeIntervalCode( 0 ); + MYODBCDbgReturn( SQL_SUCCESS ); + } + + MYODBCDbgReturn( getDes()->getDia()->doAppend( MYODBC_DIA_HY092, 0, NULL ) ); +} + +SQLRETURN MYODBCDesRec::setDefaultC( SQLSMALLINT /* nConciseType */ ) +{ + MYODBCDbgEnter(); + + /*! \todo */ + + MYODBCDbgReturn( getDes()->getDia()->doAppend( MYODBC_DIA_HY092, 0, NULL ) ); +} + +SQLRETURN MYODBCDesRec::setDefaultSQL( SQLSMALLINT nConciseType ) +{ + MYODBCDbgEnter(); + + switch ( nConciseType ) + { + case SQL_INTEGER: + setAutoUniqueValue( SQL_FALSE ); + setBaseColumnName( "" ); + setBaseTableName( "" ); + setCaseSensitive( SQL_FALSE ); + setCatalogName( "" ); + setConciseTypeSQL( nConciseType ); + setDisplaySize( 28 ); + setFixedPrecScale( SQL_TRUE ); + setLabel( "" ); + setLiteralPrefix( "" ); + setLiteralSuffix( "" ); + setLocalTypeName( "" ); + setName( "" ); + setNullable( SQL_NULLABLE_UNKNOWN ); + setNumPrecRadix( 10 ); + setOctetLength( 0 ); + setPrecision( 10 ); + setScale( 0 ); + setSchemaName( "" ); + setSearchable( SQL_PRED_NONE ); + setTableName( "" ); + setTypeName( "INTEGER" ); + setUnsigned( SQL_FALSE ); + setUpdatable( SQL_ATTR_READONLY ); + break; + case SQL_SMALLINT: + setAutoUniqueValue( SQL_FALSE ); + setBaseColumnName( "" ); + setBaseTableName( "" ); + setCaseSensitive( SQL_FALSE ); + setCatalogName( "" ); + setConciseTypeSQL( nConciseType ); + setDisplaySize( 7 ); + setFixedPrecScale( SQL_TRUE ); + setLabel( "" ); + setLiteralPrefix( "" ); + setLiteralSuffix( "" ); + setLocalTypeName( "" ); + setName( "" ); + setNullable( SQL_NULLABLE_UNKNOWN ); + setNumPrecRadix( 10 ); + setOctetLength( 0 ); + setPrecision( 5 ); + setScale( 0 ); + setSchemaName( "" ); + setSearchable( SQL_PRED_NONE ); + setTableName( "" ); + setTypeName( "SMALLINT" ); + setUnsigned( SQL_FALSE ); + setUpdatable( SQL_ATTR_READONLY ); + break; + case SQL_VARCHAR: + setAutoUniqueValue( SQL_FALSE ); + setBaseColumnName( "" ); + setBaseTableName( "" ); + setCaseSensitive( SQL_TRUE ); + setCatalogName( "" ); + setConciseTypeSQL( nConciseType ); + setDisplaySize( 255 ); + setLabel( "" ); + setLength( 255 ); + setLiteralPrefix( "" ); + setLiteralSuffix( "" ); + setLocalTypeName( "" ); + setName( "" ); + setNullable( SQL_NULLABLE_UNKNOWN ); + setNumPrecRadix( 0 ); + setOctetLength( 255 ); + setSchemaName( "" ); + setSearchable( SQL_PRED_NONE ); + setTableName( "" ); + setTypeName( "VARCHAR" ); + setUnsigned( SQL_TRUE ); + setUpdatable( SQL_ATTR_READONLY ); + break; + default: + MYODBCDbgReturn( getDes()->getDia()->doAppend( MYODBC_DIA_HY092, 0, NULL ) ); + } + + MYODBCDbgReturn( SQL_SUCCESS ); +} + + +QString MYODBCDesRec::getTypeNameSQL( SQLSMALLINT nType ) +{ + MYODBCDbgEnter(); + + /*! \TODO make this accuratly reflect data mapping to/from mysql supported types */ + + switch ( nType ) + { + case SQL_CHAR: + MYODBCDbgReturn3( "%s", "CHAR" ); + + case SQL_VARCHAR: + MYODBCDbgReturn3( "%s", "VARCHAR" ); + + case SQL_LONGVARCHAR: + MYODBCDbgReturn3( "%s", "LONGVARCHAR" ); + + case SQL_WCHAR: + MYODBCDbgReturn3( "%s", "WCHAR" ); + + case SQL_WVARCHAR: + MYODBCDbgReturn3( "%s", "WVARCHAR" ); + + case SQL_WLONGVARCHAR: + MYODBCDbgReturn3( "%s", "WLONGVARCHAR" ); + + case SQL_DECIMAL: + MYODBCDbgReturn3( "%s", "DECIMAL" ); + + case SQL_NUMERIC: + MYODBCDbgReturn3( "%s", "NUMERIC" ); + + case SQL_SMALLINT: + MYODBCDbgReturn3( "%s", "SMALLINT" ); + + case SQL_INTEGER: + MYODBCDbgReturn3( "%s", "INTEGER" ); + + case SQL_REAL: + MYODBCDbgReturn3( "%s", "REAL" ); + + case SQL_FLOAT: + MYODBCDbgReturn3( "%s", "FLOAT" ); + + case SQL_DOUBLE: + MYODBCDbgReturn3( "%s", "DOUBLE" ); + + case SQL_BIT: + MYODBCDbgReturn3( "%s", "BIT" ); + + case SQL_TINYINT: + MYODBCDbgReturn3( "%s", "TINYINT" ); + + case SQL_BIGINT: + MYODBCDbgReturn3( "%s", "BIGINT" ); + + case SQL_BINARY: + MYODBCDbgReturn3( "%s", "BINARY" ); + + case SQL_VARBINARY: + MYODBCDbgReturn3( "%s", "VARBINARY" ); + + case SQL_LONGVARBINARY: + MYODBCDbgReturn3( "%s", "LONGVARBINARY" ); + + case SQL_DATETIME: + MYODBCDbgReturn3( "%s", "DATETIME" ); + + case SQL_INTERVAL: + MYODBCDbgReturn3( "%s", "INTERVAL" ); + + case SQL_GUID: + MYODBCDbgReturn3( "%s", "GUID" ); + } + + MYODBCDbgReturn3( "%s", "VARCHAR" ); +} + +SQLRETURN MYODBCDesRec::doConsistencyCheck() +{ + MYODBCDbgEnter(); + + /*! \todo + + Most of this stuff is done when fields set but need to ensure all is + addressed as per spec. + */ + + MYODBCDbgReturn( SQL_SUCCESS ); +} + + Added: M/MYSQLCCLib/MDesRec.h =================================================================== --- M/MYSQLCCLib/MDesRec.h 2006-04-25 21:24:28 UTC (rev 118) +++ M/MYSQLCCLib/MDesRec.h 2006-04-25 21:27:27 UTC (rev 119) @@ -0,0 +1,179 @@ +#ifndef MYODBC_DES_REC_H +#define MYODBC_DES_REC_H + +/*! + \brief Descriptor records represent different things depending + upon the type of descriptor; + + APD - one record for each buffer bound to a paramter marker + IPD - one record for each paramter marker + ARD - one record for each buffer bound to a column + IRD - one record for each column + + This structure reflects *all* fields given in the ODBC + specification. However; some fields may be calculated or + not used when part of a particular descriptor type. + + In particular; the read-only fields can, in some cases, be + optimized away. + + All fields are included for completeness and to help make + the code more understandable. Any storage which can be + optimized away would be very minimal so please leave all. + + \sa MYODBCDescriptor +*/ + +/* forward declare */ +class MYODBCDescriptor; + +class MYODBCDesRec : public QObject +{ +public: + MYODBCDesRec( MYODBCDescriptor *pDescriptor ); + ~MYODBCDesRec(); + + /* setters */ + virtual SQLRETURN setDescRec( SQLSMALLINT nType, SQLSMALLINT nSubType, SQLINTEGER nLength, SQLSMALLINT nPrecision, SQLSMALLINT nScale, SQLPOINTER pDataPtr, SQLINTEGER *pnStringLengthPtr, SQLINTEGER *pnIndicatorPtr ); + virtual SQLRETURN setDescField( SQLSMALLINT nFieldIdentifier, SQLPOINTER pValuePtr, SQLINTEGER nBufferLength ); + + virtual SQLRETURN setAutoUniqueValue( SQLINTEGER nAutoUniqueValue ); + virtual SQLRETURN setBaseColumnName( const QString &stringBaseColumnName ); + virtual SQLRETURN setBaseTableName( const QString &stringBaseTableName ); + virtual SQLRETURN setCaseSensitive( SQLINTEGER nCaseSensitive ); + virtual SQLRETURN setCatalogName( const QString &stringCatalogName ); + virtual SQLRETURN setConciseType( SQLSMALLINT nConciseType ) = 0; + virtual SQLRETURN setDataPtr( SQLPOINTER pDataPtr ); + virtual SQLRETURN setDatetimeIntervalCode( SQLSMALLINT nDatetimeIntervalCode ); + virtual SQLRETURN setDatetimeIntervalPrecision( SQLINTEGER nDatetimeIntervalPrecision ); + virtual SQLRETURN setDisplaySize( SQLINTEGER nDisplaySize ); + virtual SQLRETURN setFixedPrecScale( SQLSMALLINT nFixedPrecScale ); + virtual SQLRETURN setIndicatorPtr( SQLINTEGER *pnIndicatorPtr ); + virtual SQLRETURN setLabel( const QString &stringLabel ); + virtual SQLRETURN setLength( SQLUINTEGER nLength ); + virtual SQLRETURN setLiteralPrefix( const QString &stringLiteralPrefix ); + virtual SQLRETURN setLiteralSuffix( const QString &stringLiteralSuffix ); + virtual SQLRETURN setLocalTypeName( const QString &stringLocalTypeName ); + virtual SQLRETURN setName( const QString &stringName ); + virtual SQLRETURN setNullable( SQLSMALLINT nNullable ); + virtual SQLRETURN setNumPrecRadix( SQLINTEGER nNumPrecRadix ); + virtual SQLRETURN setOctetLength( SQLINTEGER nOctetLength ); + virtual SQLRETURN setOctetLengthPtr( SQLINTEGER *pnOctetLengthPtr ); + virtual SQLRETURN setParamterType( SQLSMALLINT nParamterType ); + virtual SQLRETURN setPrecision( SQLSMALLINT nPrecision ); + virtual SQLRETURN setRowver( SQLSMALLINT nRowver ); + virtual SQLRETURN setScale( SQLSMALLINT nScale ); + virtual SQLRETURN setSchemaName( const QString &stringSchemaName ); + virtual SQLRETURN setSearchable( SQLSMALLINT nSearchable ); + virtual SQLRETURN setTableName( const QString &stringTableName ); + virtual SQLRETURN setType( SQLSMALLINT nType ); + virtual SQLRETURN setTypeName( const QString &stringTypeName ); + virtual SQLRETURN setUnnamed( SQLSMALLINT nUnnamed ); + virtual SQLRETURN setUnsigned( SQLSMALLINT nUnsigned ); + virtual SQLRETURN setUpdatable( SQLSMALLINT nUpdatable ); + + virtual SQLRETURN setDefault( SQLSMALLINT nConciseType ); + + /* getters */ + 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 ); + + virtual SQLINTEGER getAutoUniqueValue(); + virtual QString getBaseColumnName(); + virtual QString getBaseTableName(); + virtual SQLINTEGER getCaseSensitive(); + virtual QString getCatalogName(); + virtual SQLSMALLINT getConciseType(); + virtual SQLPOINTER getDataPtr(); + virtual SQLSMALLINT getDatetimeIntervalCode(); + virtual SQLINTEGER getDatetimeIntervalPrecision(); + virtual SQLINTEGER getDisplaySize(); + virtual SQLSMALLINT getFixedPrecScale(); + virtual SQLINTEGER *getIndicatorPtr(); + virtual QString getLabel(); + virtual SQLUINTEGER getLength(); + virtual QString getLiteralPrefix(); + virtual QString getLiteralSuffix(); + virtual QString getLocalTypeName(); + virtual QString getName(); + virtual SQLSMALLINT getNullable(); + virtual SQLINTEGER getNumPrecRadix(); + virtual SQLINTEGER getOctetLength(); + virtual SQLINTEGER *getOctetLengthPtr(); + virtual SQLSMALLINT getParamterType(); + virtual SQLSMALLINT getPrecision(); + virtual SQLSMALLINT getRowver(); + virtual SQLSMALLINT getScale(); + virtual QString getSchemaName(); + virtual SQLSMALLINT getSearchable(); + virtual QString getTableName(); + virtual SQLSMALLINT getType(); + virtual QString getTypeName(); + virtual SQLSMALLINT getUnnamed(); + virtual SQLSMALLINT getUnsigned(); + virtual SQLSMALLINT getUpdatable(); + + /* do'rs */ + virtual SQLRETURN doUnbind(); + + /* is'rs */ + virtual bool isBound(); + + /* operators */ + virtual MYODBCDesRec &operator=( MYODBCDesRec &des ); + +protected: + /* some of these 'fields' will be calculated and not stored in the future */ + /* these 'fields' are named as per odbc spec to make xref easier */ + SQLINTEGER nAutoUniqueValue; /*!< SQL_DESC_AUTO_UNIQUE_VALUE */ + QString stringBaseColumnName; /*!< SQL_DESC_BASE_COLUMN_NAME */ + QString stringBaseTableName; /*!< SQL_DESC_BASE_TABLE_NAME */ + SQLINTEGER nCaseSensitive; /*!< */ + QString stringCatalogName; /*!< */ + SQLSMALLINT nConciseType; /*!< */ + SQLPOINTER pDataPtr; /*!< IF null THEN unbound ELSE bound */ + SQLSMALLINT nDatetimeIntervalCode; /*!< */ + SQLINTEGER nDatetimeIntervalPrecision; /*!< */ + SQLINTEGER nDisplaySize; /*!< calculated? */ + SQLSMALLINT nFixedPrecScale; /*!< */ + SQLINTEGER *pnIndicatorPtr; /*!< */ + QString stringLabel; /*!< */ + SQLUINTEGER nLength; /*!< */ + QString stringLiteralPrefix; /*!< */ + QString stringLiteralSuffix; /*!< */ + QString stringLocalTypeName; /*!< */ + QString stringName; /*!< */ + SQLSMALLINT nNullable; /*!< */ + SQLINTEGER nNumPrecRadix; /*!< */ + SQLINTEGER nOctetLength; /*!< */ + SQLINTEGER *pnOctetLengthPtr; /*!< */ + SQLSMALLINT nParamterType; /*!< */ + SQLSMALLINT nPrecision; /*!< */ + SQLSMALLINT nRowver; /*!< */ + SQLSMALLINT nScale; /*!< */ + QString stringSchemaName; /*!< */ + SQLSMALLINT nSearchable; /*!< */ + QString stringTableName; /*!< */ + SQLSMALLINT nType; /*!< */ + QString stringTypeName; /*!< */ + SQLSMALLINT nUnnamed; /*!< */ + SQLSMALLINT nUnsigned; /*!< */ + SQLSMALLINT nUpdatable; /*!< */ + + /* 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 ); + + virtual SQLRETURN setDefaultC( SQLSMALLINT nConciseType ); + virtual SQLRETURN setDefaultSQL( SQLSMALLINT nConciseType ); + + virtual QString getTypeNameSQL( SQLSMALLINT nType ); + + virtual SQLRETURN doConsistencyCheck(); +}; + +#endif + Added: M/MYSQLCCLib/MDesRecAPD.cpp =================================================================== --- M/MYSQLCCLib/MDesRecAPD.cpp 2006-04-25 21:24:28 UTC (rev 118) +++ M/MYSQLCCLib/MDesRecAPD.cpp 2006-04-25 21:27:27 UTC (rev 119) @@ -0,0 +1,434 @@ +#include "MYODBCDesInternal.h" + +/*! + \brief zzzzz + + zzzzz + + \param zzzzz + + \return zzzzz + + \sa zzzzz +*/ +MYODBCDesRecAPD::MYODBCDesRecAPD( MYODBCDesAPD *pdes ) + : MYODBCDesRec( pdes ) +{ + MYODBCDbgEnter(); + + Q_ASSERT( !pdes ); + + MYODBCDbgReturn2(); +} + +SQLRETURN MYODBCDesRecAPD::setDescField( SQLSMALLINT nFieldIdentifier, SQLPOINTER pValuePtr, SQLINTEGER /* nBufferLength */ ) +{ + MYODBCDbgEnter(); + + SQLRETURN nReturn = SQL_SUCCESS; + + /*! \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 + */ + nReturn = getDes()->getDia()->doAppend( MYODBC_DIA_HY091, 0, NULL ); + break; + + case SQL_DESC_CONCISE_TYPE: + /*! + \internal ODBC Rule + + APD: R/W + */ + nReturn = setConciseTypeC( (SQLSMALLINT)pValuePtr ); + break; + + 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 ); + } + break; + + case SQL_DESC_DATETIME_INTERVAL_CODE: + /*! + \internal ODBC Rule + + APD: R/W + */ + nReturn = setIntervalCode( (SQLSMALLINT)pValuePtr ); + break; + + 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. + */ + nReturn = setDatetimeIntervalPrecision( (SQLSMALLINT)pValuePtr ); + break; + + case SQL_DESC_DISPLAY_SIZE: + /*! + \internal ODBC Rule + + APD: Unused + */ + case SQL_DESC_FIXED_PREC_SCALE: + /*! + \internal ODBC Rule + + APD: Unused + */ + nReturn = getDes()->getDia()->doAppend( MYODBC_DIA_HY091, 0, NULL ); + break; + + case SQL_DESC_INDICATOR_PTR: + /*! + \internal ODBC Rule + + APD: R/W + */ + nReturn = setIndicatorPtr( (SQLINTEGER*)pValuePtr ); + break; + + case SQL_DESC_LABEL: + /*! + \internal ODBC Rule + + APD: Unused + */ + nReturn = getDes()->getDia()->doAppend( MYODBC_DIA_HY091, 0, NULL ); + break; + + case SQL_DESC_LENGTH: + /*! + \internal ODBC Rule + + APD: R/W + */ + nReturn = setLength( (SQLUINTEGER)pValuePtr ); + break; + + 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 + */ + nReturn = getDes()->getDia()->doAppend( MYODBC_DIA_HY091, 0, NULL ); + break; + + 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 ) + nReturn = getDes()->getDia()->doAppend( MYODBC_DIA_HY092, 0, NULL ); + else + nReturn = setNumPrecRadix( (SQLINTEGER)pValuePtr ); + } + break; + + 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. + */ + nReturn = setOctetLength( (SQLINTEGER)pValuePtr ); + break; + + 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. + */ + nReturn = setOctetLengthPtr( (SQLINTEGER*)pValuePtr ); + break; + + case SQL_DESC_PARAMETER_TYPE: + /*! + \internal ODBC Rule + + APD: Unused + */ + nReturn = getDes()->getDia()->doAppend( MYODBC_DIA_HY091, 0, NULL ); + break; + + 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. + */ + nReturn = setPrecision( (SQLSMALLINT)pValuePtr ); + break; + + case SQL_DESC_ROWVER: + /*! + \internal ODBC Rule + + APD: Unused + */ + nReturn = getDes()->getDia()->doAppend( MYODBC_DIA_HY091, 0, NULL ); + break; + + 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. + */ + nReturn = setScale( (SQLSMALLINT)pValuePtr ); + break; + + 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 + */ + nReturn = getDes()->getDia()->doAppend( MYODBC_DIA_HY091, 0, NULL ); + break; + + case SQL_DESC_TYPE: + /*! + \internal ODBC Rule + + APD: R/W + */ + nReturn = setTypeC( (SQLSMALLINT)pValuePtr ); + break; + + 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 + */ + nReturn = getDes()->getDia()->doAppend( MYODBC_DIA_HY091, 0, NULL ); + break; + + default: + nReturn = getDes()->getDia()->doAppend( MYODBC_DIA_HY091, 0, NULL ); + break; + } + + MYODBCDbgReturn( nReturn ); +} + +SQLRETURN MYODBCDesRecAPD::setConciseType( SQLSMALLINT nConciseType ) +{ + MYODBCDbgEnter(); + + SQLRETURN nReturn = setConciseTypeC( nConciseType ); + + MYODBCDbgReturn( nReturn ); +} + +SQLRETURN MYODBCDesRecAPD::setDefault( SQLSMALLINT nConciseType ) +{ + MYODBCDbgEnter(); + + MYODBCDbgReturn( setDefaultC( nConciseType ) ); +} + + Added: M/MYSQLCCLib/MDesRecAPD.h =================================================================== --- M/MYSQLCCLib/MDesRecAPD.h 2006-04-25 21:24:28 UTC (rev 118) +++ M/MYSQLCCLib/MDesRecAPD.h 2006-04-25 21:27:27 UTC (rev 119) @@ -0,0 +1,20 @@ +#ifndef MYODBC_DES_REC_APD_H +#define MYODBC_DES_REC_APD_H + +class MYODBCDesAPD; + +class MYODBCDesRecAPD : public MYODBCDesRec +{ +public: + MYODBCDesRecAPD( MYODBCDesAPD *pdes ); + + /* setters */ + SQLRETURN setDescField( SQLSMALLINT nFieldIdentifier, SQLPOINTER pValuePtr, SQLINTEGER nBufferLength ); + SQLRETURN setConciseType( SQLSMALLINT nConciseType ); + SQLRETURN setDefault( SQLSMALLINT nConciseType ); + + /* getters */ +}; + +#endif + Added: M/MYSQLCCLib/MDesRecARD.cpp =================================================================== --- M/MYSQLCCLib/MDesRecARD.cpp 2006-04-25 21:24:28 UTC (rev 118) +++ M/MYSQLCCLib/MDesRecARD.cpp 2006-04-25 21:27:27 UTC (rev 119) @@ -0,0 +1,418 @@ +#include "MYODBCDesInternal.h" + +/*! + \brief zzzzz + + zzzzz + + \param zzzzz + + \return zzzzz + + \sa zzzzz +*/ +MYODBCDesRecARD::MYODBCDesRecARD( MYODBCDesARD *pdes ) + : MYODBCDesRec( pdes ) +{ + MYODBCDbgEnter(); + + Q_ASSERT( !pdes ); + + nType = SQL_C_DEFAULT; + + MYODBCDbgReturn2(); +} + +SQLRETURN MYODBCDesRecARD::setDescField( SQLSMALLINT nFieldIdentifier, SQLPOINTER pValuePtr, SQLINTEGER /* nBufferLength */ ) +{ + MYODBCDbgEnter(); + + SQLRETURN nReturn = SQL_SUCCESS; + + /*! \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 + + ARD: Unused + */ + case SQL_DESC_BASE_COLUMN_NAME: + /*! + \internal ODBC Rule + + ARD: Unused + */ + case SQL_DESC_BASE_TABLE_NAME: + /*! + \internal ODBC Rule + + ARD: Unused + */ + case SQL_DESC_CASE_SENSITIVE: + /*! + \internal ODBC Rule + + ARD: Unused + */ + case SQL_DESC_CATALOG_NAME: + /*! + \internal ODBC Rule + + ARD: Unused + */ + nReturn = getDes()->getDia()->doAppend( MYODBC_DIA_HY091, 0, NULL ); + break; + + case SQL_DESC_CONCISE_TYPE: + /*! + \internal ODBC Rule + + ARD: R/W + */ + nReturn = setConciseTypeC( (SQLSMALLINT)pValuePtr ); + break; + + case SQL_DESC_DATA_PTR: + /*! + \internal ODBC Rule + + ARD: 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 ARD, APD, 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 ); + } + break; + + case SQL_DESC_DATETIME_INTERVAL_CODE: + /*! + \internal ODBC Rule + + ARD: R/W + */ + nReturn = setIntervalCode( (SQLSMALLINT)pValuePtr ); + break; + + case SQL_DESC_DATETIME_INTERVAL_PRECISION: + /*! + \internal ODBC Rule + + ARD: 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. + */ + nReturn = setDatetimeIntervalPrecision( (SQLSMALLINT)pValuePtr ); + break; + + case SQL_DESC_DISPLAY_SIZE: + /*! + \internal ODBC Rule + + ARD: Unused + */ + case SQL_DESC_FIXED_PREC_SCALE: + /*! + \internal ODBC Rule + + ARD: Unused + */ + nReturn = getDes()->getDia()->doAppend( MYODBC_DIA_HY091, 0, NULL ); + break; + + case SQL_DESC_INDICATOR_PTR: + /*! + \internal ODBC Rule + + ARD: R/W + */ + nReturn = setIndicatorPtr( (SQLINTEGER*)pValuePtr ); + break; + + case SQL_DESC_LABEL: + /*! + \internal ODBC Rule + + ARD: Unused + */ + nReturn = getDes()->getDia()->doAppend( MYODBC_DIA_HY091, 0, NULL ); + break; + + case SQL_DESC_LENGTH: + /*! + \internal ODBC Rule + + ARD: R/W + */ + nReturn = setLength( (SQLUINTEGER)pValuePtr ); + + case SQL_DESC_LITERAL_PREFIX: + /*! + \internal ODBC Rule + + ARD: Unused + */ + case SQL_DESC_LITERAL_SUFFIX: + /*! + \internal ODBC Rule + + ARD: Unused + */ + case SQL_DESC_LOCAL_TYPE_NAME: + /*! + \internal ODBC Rule + + ARD: Unused + */ + case SQL_DESC_NAME: + /*! + \internal ODBC Rule + + ARD: Unused + */ + case SQL_DESC_NULLABLE: + /*! + \internal ODBC Rule + + ARD: Unused + */ + nReturn = getDes()->getDia()->doAppend( MYODBC_DIA_HY091, 0, NULL ); + break; + + case SQL_DESC_NUM_PREC_RADIX: + /*! + \internal ODBC Rule + + ARD: 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 ) + nReturn = getDes()->getDia()->doAppend( MYODBC_DIA_HY092, 0, NULL ); + else + nReturn = setNumPrecRadix( (SQLINTEGER)pValuePtr ); + } + break; + + case SQL_DESC_OCTET_LENGTH: + /*! + \internal ODBC Rule + + ARD: R/W + */ + + /*! + \internal ODBC Rule + + For ARDs, this field is defined only for output or input/output + parameters. + */ + nReturn = setOctetLength( (SQLINTEGER)pValuePtr ); + break; + + case SQL_DESC_OCTET_LENGTH_PTR: + /*! + \internal ODBC Rule + + ARD: R/W + */ + nReturn = setOctetLengthPtr( (SQLINTEGER*)pValuePtr ); + break; + + case SQL_DESC_PARAMETER_TYPE: + /*! + \internal ODBC Rule + + ARD: Unused + */ + nReturn = getDes()->getDia()->doAppend( MYODBC_DIA_HY091, 0, NULL ); + break; + + case SQL_DESC_PRECISION: + /*! + \internal ODBC Rule + + ARD: 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. + */ + nReturn = setPrecision( (SQLSMALLINT)pValuePtr ); + break; + + case SQL_DESC_ROWVER: + /*! + \internal ODBC Rule + + ARD: Unused + */ + nReturn = getDes()->getDia()->doAppend( MYODBC_DIA_HY091, 0, NULL ); + break; + + case SQL_DESC_SCALE: + /*! + \internal ODBC Rule + + ARD: 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. + */ + nReturn = setScale( (SQLSMALLINT)pValuePtr ); + break; + + case SQL_DESC_SCHEMA_NAME: + /*! + \internal ODBC Rule + + ARD: Unused + */ + case SQL_DESC_SEARCHABLE: + /*! + \internal ODBC Rule + + ARD: Unused + */ + case SQL_DESC_TABLE_NAME: + /*! + \internal ODBC Rule + + ARD: Unused + */ + nReturn = getDes()->getDia()->doAppend( MYODBC_DIA_HY091, 0, NULL ); + break; + + case SQL_DESC_TYPE: + /*! + \internal ODBC Rule + + ARD: R/W + */ + nReturn = setTypeC( (SQLSMALLINT)pValuePtr ); + break; + + case SQL_DESC_TYPE_NAME: + /*! + \internal ODBC Rule + + ARD: Unused + */ + case SQL_DESC_UNNAMED: + /*! + \internal ODBC Rule + + ARD: Unused + */ + case SQL_DESC_UNSIGNED: + /*! + \internal ODBC Rule + + ARD: Unused + */ + case SQL_DESC_UPDATABLE: + /*! + \internal ODBC Rule + + ARD: Unused + */ + nReturn = getDes()->getDia()->doAppend( MYODBC_DIA_HY091, 0, NULL ); + break; + + default: + nReturn = getDes()->getDia()->doAppend( MYODBC_DIA_HY091, 0, NULL ); + break; + } + + MYODBCDbgReturn( nReturn ); +} + +SQLRETURN MYODBCDesRecARD::setConciseType( SQLSMALLINT nConciseType ) +{ + MYODBCDbgEnter(); + + MYODBCDbgReturn( setConciseTypeC( nConciseType ) ); +} + +SQLRETURN MYODBCDesRecARD::setDefault( SQLSMALLINT nConciseType ) +{ + MYODBCDbgEnter(); + + MYODBCDbgReturn( setDefaultC( nConciseType ) ); +} + + Added: M/MYSQLCCLib/MDesRecARD.h =================================================================== --- M/MYSQLCCLib/MDesRecARD.h 2006-04-25 21:24:28 UTC (rev 118) +++ M/MYSQLCCLib/MDesRecARD.h 2006-04-25 21:27:27 UTC (rev 119) @@ -0,0 +1,20 @@ +#ifndef MYODBC_DES_REC_ARD_H +#define MYODBC_DES_REC_ARD_H + +class MYODBCDesARD; + +class MYODBCDesRecARD : public MYODBCDesRec +{ +public: + MYODBCDesRecARD( MYODBCDesARD *pdes ); + + /* setters */ + SQLRETURN setDescField( SQLSMALLINT nFieldIdentifier, SQLPOINTER pValuePtr, SQLINTEGER nBufferLength ); + SQLRETURN setConciseType( SQLSMALLINT nConciseType ); + SQLRETURN setDefault( SQLSMALLINT nConciseType ); + + /* getters */ +}; + +#endif + Added: M/MYSQLCCLib/MDesRecIPD.cpp =================================================================== --- M/MYSQLCCLib/MDesRecIPD.cpp 2006-04-25 21:24:28 UTC (rev 118) +++ M/MYSQLCCLib/MDesRecIPD.cpp 2006-04-25 21:27:27 UTC (rev 119) @@ -0,0 +1,394 @@ +#include "MYODBCDesInternal.h" + +/*! + \brief zzzzz + + zzzzz + + \param zzzzz + + \return zzzzz + + \sa zzzzz +*/ +MYODBCDesRecIPD::MYODBCDesRecIPD( MYODBCDesIPD *pdes ) + : MYODBCDesRec( pdes ) +{ + MYODBCDbgEnter(); + + Q_ASSERT( !pdes ); + + MYODBCDbgReturn2(); +} + +SQLRETURN MYODBCDesRecIPD::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 + + IPD: Unused + */ + case SQL_DESC_BASE_COLUMN_NAME: + /*! + \internal ODBC Rule + + IPD: Unused + */ + case SQL_DESC_BASE_TABLE_NAME: + /*! + \internal ODBC Rule + + IPD: Unused + */ + case SQL_DESC_CASE_SENSITIVE: + /*! + \internal ODBC Rule + + IPD: Unused + */ + case SQL_DESC_CATALOG_NAME: + /*! + \internal ODBC Rule + + IPD: Unused + */ + MYODBCDbgReturn( getDes()->getDia()->doAppend( MYODBC_DIA_HY091, 0, NULL ) ); + + case SQL_DESC_CONCISE_TYPE: + /*! + \internal ODBC Rule + + IPD: R/W + */ + MYODBCDbgReturn( setConciseTypeC( (SQLSMALLINT)pValuePtr ) ); + + case SQL_DESC_DATA_PTR: + /*! + \internal ODBC Rule + + IPD: 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 IPD, APD, 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_SUCCESS ); + + case SQL_DESC_DATETIME_INTERVAL_CODE: + /*! + \internal ODBC Rule + + IPD: R/W + */ + MYODBCDbgReturn( setIntervalCode( (SQLSMALLINT)pValuePtr ) ); + + case SQL_DESC_DATETIME_INTERVAL_PRECISION: + /*! + \internal ODBC Rule + + IPD: 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 + + IPD: Unused + */ + case SQL_DESC_FIXED_PREC_SCALE: + /*! + \internal ODBC Rule + + IPD: Unused + */ + MYODBCDbgReturn( getDes()->getDia()->doAppend( MYODBC_DIA_HY091, 0, NULL ) ); + + case SQL_DESC_INDICATOR_PTR: + /*! + \internal ODBC Rule + + IPD: R/W + */ + MYODBCDbgReturn( setIndicatorPtr( (SQLINTEGER*)pValuePtr ) ); + + case SQL_DESC_LABEL: + /*! + \internal ODBC Rule + + IPD: Unused + */ + MYODBCDbgReturn( getDes()->getDia()->doAppend( MYODBC_DIA_HY091, 0, NULL ) ); + + case SQL_DESC_LENGTH: + /*! + \internal ODBC Rule + + IPD: R/W + */ + MYODBCDbgReturn( setLength( (SQLUINTEGER)pValuePtr ) ); + + case SQL_DESC_LITERAL_PREFIX: + /*! + \internal ODBC Rule + + IPD: Unused + */ + case SQL_DESC_LITERAL_SUFFIX: + /*! + \internal ODBC Rule + + IPD: Unused + */ + case SQL_DESC_LOCAL_TYPE_NAME: + /*! + \internal ODBC Rule + + IPD: Unused + */ + case SQL_DESC_NAME: + /*! + \internal ODBC Rule + + IPD: Unused + */ + case SQL_DESC_NULLABLE: + /*! + \internal ODBC Rule + + IPD: Unused + */ + MYODBCDbgReturn( getDes()->getDia()->doAppend( MYODBC_DIA_HY091, 0, NULL ) ); + + case SQL_DESC_NUM_PREC_RADIX: + /*! + \internal ODBC Rule + + IPD: 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( getDes()->getDia()->doAppend( MYODBC_DIA_HY092, 0, NULL ) ); + } + MYODBCDbgReturn( setNumPrecRadix( (SQLINTEGER)pValuePtr ) ); + + case SQL_DESC_OCTET_LENGTH: + /*! + \internal ODBC Rule + + IPD: R/W + */ + + /*! + \internal ODBC Rule + + For IPDs, this field is defined only for output or input/output + parameters. + */ + MYODBCDbgReturn( setOctetLength( (SQLINTEGER)pValuePtr ) ); + + case SQL_DESC_OCTET_LENGTH_PTR: + /*! + \internal ODBC Rule + + IPD: R/W + */ + MYODBCDbgReturn( setOctetLengthPtr( (SQLINTEGER*)pValuePtr ) ); + + case SQL_DESC_PARAMETER_TYPE: + /*! + \internal ODBC Rule + + IPD: Unused + */ + MYODBCDbgReturn( getDes()->getDia()->doAppend( MYODBC_DIA_HY091, 0, NULL ) ); + + case SQL_DESC_PRECISION: + /*! + \internal ODBC Rule + + IPD: 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 + + IPD: Unused + */ + MYODBCDbgReturn( getDes()->getDia()->doAppend( MYODBC_DIA_HY091, 0, NULL ) ); + + case SQL_DESC_SCALE: + /*! + \internal ODBC Rule + + IPD: 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 + + IPD: Unused + */ + case SQL_DESC_SEARCHABLE: + /*! + \internal ODBC Rule + + IPD: Unused + */ + case SQL_DESC_TABLE_NAME: + /*! + \internal ODBC Rule + + IPD: Unused + */ + MYODBCDbgReturn( getDes()->getDia()->doAppend( MYODBC_DIA_HY091, 0, NULL ) ); + + case SQL_DESC_TYPE: + /*! + \internal ODBC Rule + + IPD: R/W + */ + MYODBCDbgReturn( setTypeC( (SQLSMALLINT)pValuePtr ) ); + + case SQL_DESC_TYPE_NAME: + /*! + \internal ODBC Rule + + IPD: Unused + */ + case SQL_DESC_UNNAMED: + /*! + \internal ODBC Rule + + IPD: Unused + */ + case SQL_DESC_UNSIGNED: + /*! + \internal ODBC Rule + + IPD: Unused + */ + case SQL_DESC_UPDATABLE: + /*! + \internal ODBC Rule + + IPD: Unused + */ + MYODBCDbgReturn( getDes()->getDia()->doAppend( MYODBC_DIA_HY091, 0, NULL ) ); + + default: + MYODBCDbgReturn( getDes()->getDia()->doAppend( MYODBC_DIA_HY091, 0, NULL ) ); + } + + MYODBCDbgReturn( SQL_SUCCESS ); +} + +SQLRETURN MYODBCDesRecIPD::setConciseType( SQLSMALLINT nConciseType ) +{ + MYODBCDbgEnter(); + + MYODBCDbgReturn( setConciseTypeSQL( nConciseType ) ); +} + +SQLRETURN MYODBCDesRecIPD::setDefault( SQLSMALLINT nConciseType ) +{ + MYODBCDbgEnter(); + + MYODBCDbgReturn( setDefaultSQL( nConciseType ) ); +} + + Added: M/MYSQLCCLib/MDesRecIPD.h =================================================================== --- M/MYSQLCCLib/MDesRecIPD.h 2006-04-25 21:24:28 UTC (rev 118) +++ M/MYSQLCCLib/MDesRecIPD.h 2006-04-25 21:27:27 UTC (rev 119) @@ -0,0 +1,20 @@ +#ifndef MYODBC_DES_REC_IPD_H +#define MYODBC_DES_REC_IPD_H + +class MYODBCDesIPD; + +class MYODBCDesRecIPD : public MYODBCDesRec +{ +public: + MYODBCDesRecIPD( MYODBCDesIPD *pdes ); + + /* setters */ + SQLRETURN setDescField( SQLSMALLINT nFieldIdentifier, SQLPOINTER pValuePtr, SQLINTEGER nBufferLength ); + SQLRETURN setConciseType( SQLSMALLINT nConciseType ); + SQLRETURN setDefault( SQLSMALLINT nConciseType ); + + /* getters */ +}; + +#endif + Added: M/MYSQLCCLib/MDesRecIRD.cpp =================================================================== --- M/MYSQLCCLib/MDesRecIRD.cpp 2006-04-25 21:24:28 UTC (rev 118) +++ M/MYSQLCCLib/MDesRecIRD.cpp 2006-04-25 21:27:27 UTC (rev 119) @@ -0,0 +1,51 @@ +#include "MYODBCDesInternal.h" + +/*! + \brief zzzzz + + zzzzz + + \param zzzzz + + \return zzzzz + + \sa zzzzz +*/ +MYODBCDesRecIRD::MYODBCDesRecIRD( MYODBCDesIRD *pdes ) + : MYODBCDesRec( pdes ) +{ + MYODBCDbgEnter(); + + Q_ASSERT( !pdes ); + + MYODBCDbgReturn2(); +} + +SQLRETURN MYODBCDesRecIRD::setDescField( SQLSMALLINT /* nFieldIdentifier */, SQLPOINTER /* pValuePtr */, SQLINTEGER /* nBufferLength */ ) +{ + MYODBCDbgEnter(); + + /*! \internal ODBC Rule + + The DescriptorHandle argument was associated with an IRD, and the FieldIdentifier + argument was not SQL_DESC_ARRAY_STATUS_PTR or SQL_DESC_ROWS_PROCESSED_PTR. + */ + + MYODBCDbgReturn( getDes()->getDia()->doAppend( MYODBC_DIA_HY016, 0, NULL ) ); +} + +SQLRETURN MYODBCDesRecIRD::setConciseType( SQLSMALLINT nConciseType ) +{ + MYODBCDbgEnter(); + + MYODBCDbgReturn( setConciseTypeSQL( nConciseType ) ); +} + +SQLRETURN MYODBCDesRecIRD::setDefault( SQLSMALLINT nConciseType ) +{ + MYODBCDbgEnter(); + + MYODBCDbgReturn( setDefaultSQL( nConciseType ) ); +} + + Added: M/MYSQLCCLib/MDesRecIRD.h =================================================================== --- M/MYSQLCCLib/MDesRecIRD.h 2006-04-25 21:24:28 UTC (rev 118) +++ M/MYSQLCCLib/MDesRecIRD.h 2006-04-25 21:27:27 UTC (rev 119) @@ -0,0 +1,21 @@ +#ifndef MYODBC_DES_REC_IRD_H +#define MYODBC_DES_REC_IRD_H + +class MYODBCDesIRD; + +class MYODBCDesRecIRD : public MYODBCDesRec +{ +public: + MYODBCDesRecIRD( MYODBCDesIRD *pdes ); + + /* setters */ + SQLRETURN setDescField( SQLSMALLINT nFieldIdentifier, SQLPOINTER pValuePtr, SQLINTEGER nBufferLength ); + SQLRETURN setConciseType( SQLSMALLINT nConciseType ); + SQLRETURN setDefault( SQLSMALLINT nConciseType ); + + /* getters */ +}; + + +#endif + Added: M/MYSQLCCLib/MDescriptor.cpp =================================================================== --- M/MYSQLCCLib/MDescriptor.cpp 2006-04-25 21:24:28 UTC (rev 118) +++ M/MYSQLCCLib/MDescriptor.cpp 2006-04-25 21:27:27 UTC (rev 119) @@ -0,0 +1 @@ +