List:Commits« Previous MessageNext Message »
From:pharvey Date:January 8 2006 7:43am
Subject:Connector/ODBC 5 commit: r35 - in MYODBCDia: . MYODBCDiaLib include
View as plain text  
Added:
   MYODBCDia/MYODBCDiaLib/MYODBCDiaRec.cpp
   MYODBCDia/MYODBCDiaLib/MYODBCDiaRec.h
Removed:
   MYODBCDia/MYODBCDiaLib/MYODBCDiaRecord.cpp
   MYODBCDia/include/MYODBCDiaRecord.h
Modified:
   MYODBCDia/MYODBCDia.vpj
   MYODBCDia/MYODBCDiaLib/MYODBCDia.cpp
   MYODBCDia/MYODBCDiaLib/MYODBCDiaLib.pro
   MYODBCDia/MYODBCDiaLib/MYODBCDiaLib.vpj
   MYODBCDia/include/MYODBCDia.h
Log:
UNICODE:
- refinements to diagnostics; add use of MYODBCDbg, hide record objects, etc etc
- one more func to be fleshed out then back to higher level functionality

Modified: MYODBCDia/MYODBCDia.vpj
===================================================================
--- MYODBCDia/MYODBCDia.vpj	2006-01-08 01:24:26 UTC (rev 34)
+++ MYODBCDia/MYODBCDia.vpj	2006-01-08 07:43:04 UTC (rev 35)
@@ -189,7 +189,7 @@
 			Name="Header Files"
 			Filters="*.h;*.H;*.hh;*.hpp;*.hxx;*.inc;*.sh;*.cpy;*.if">
 			<F N="include/MYODBCDia.h"/>
-			<F N="include/MYODBCDiaRecord.h"/>
+			<F N="include/MYODBCDiaState.h"/>
 		</Folder>
 		<Folder
 			Name="Resource Files"

Modified: MYODBCDia/MYODBCDiaLib/MYODBCDia.cpp
===================================================================
--- MYODBCDia/MYODBCDiaLib/MYODBCDia.cpp	2006-01-08 01:24:26 UTC (rev 34)
+++ MYODBCDia/MYODBCDiaLib/MYODBCDia.cpp	2006-01-08 07:43:04 UTC (rev 35)
@@ -12,6 +12,8 @@
 */
 MYODBCDia::MYODBCDia()
 {
+    MYODBCDbgEnter();
+
     nCursorRowCount         = 0;
     nDynamicFunctionCode    = SQL_DIAG_UNKNOWN_STATEMENT;
     nReturnCode             = SQL_SUCCESS;
@@ -27,6 +29,8 @@
     */    
     stringConnectionName    = "";
     stringServerName        = "";
+
+    MYODBCDbgReturn2();
 }
 
 /*!
@@ -41,319 +45,386 @@
 */
 MYODBCDia::~MYODBCDia()
 {
+    MYODBCDbgEnter();
+
     while ( !listRecords.isEmpty() )
-        delete listRecords[0];
+        delete listRecords.takeFirst();
+
+    MYODBCDbgReturn2();
 }
 
-bool MYODBCDia::setCursorRowCount( SQLINTEGER nCursorRowCount )
+SQLRETURN MYODBCDia::setCursorRowCount( SQLINTEGER nCursorRowCount )
 {
+    MYODBCDbgEnter();
+
     this->nCursorRowCount = nCursorRowCount;
-    return true;
+
+    MYODBCDbgReturn( SQL_SUCCESS );
 }
 
-bool MYODBCDia::setDynamicFunctionCode( SQLINTEGER nDynamicFunctionCode )
+SQLRETURN MYODBCDia::setDynamicFunctionCode( SQLINTEGER nDynamicFunctionCode )
 {
+    MYODBCDbgEnter();
+
     this->nDynamicFunctionCode = nDynamicFunctionCode;
-    return true;
+
+    MYODBCDbgReturn( SQL_SUCCESS );
 }
 
-bool MYODBCDia::setReturnCode( SQLRETURN nReturn )
+SQLRETURN MYODBCDia::setReturnCode( SQLRETURN nReturn )
 {
+    MYODBCDbgEnter();
+
     this->nReturnCode = nReturn;
-    return true;
+
+    MYODBCDbgReturn( SQL_SUCCESS );
 }
 
-bool MYODBCDia::setRowCount( SQLINTEGER nRowCount )
+SQLRETURN MYODBCDia::setRowCount( SQLINTEGER nRowCount )
 {
+    MYODBCDbgEnter();
+
     this->nRowCount = nRowCount;
-    return true;
+
+    MYODBCDbgReturn( SQL_SUCCESS );
 }
 
-bool MYODBCDia::setConnectionName( const QString &stringConnectionName )
+SQLRETURN MYODBCDia::setConnectionName( const QString &stringConnectionName )
 {
+    MYODBCDbgEnter();
+
     if ( stringConnectionName.isNull() )
         this->stringConnectionName = "";
     else
         this->stringConnectionName = stringConnectionName;
-    return true;
+
+    MYODBCDbgReturn( SQL_SUCCESS );
 }
 
-bool MYODBCDia::setServerName( const QString &stringServerName )
+SQLRETURN MYODBCDia::setServerName( const QString &stringServerName )
 {
+    MYODBCDbgEnter();
+
     if ( stringServerName.isNull() )
         this->stringServerName = "";
     else
         this->stringServerName = stringServerName;
-    return true;
+
+    MYODBCDbgReturn( SQL_SUCCESS );
 }
 
+SQLRETURN MYODBCDia::getDiagRec( SQLSMALLINT nRecNumber, SQLWCHAR *psSqlstate, SQLINTEGER
*pnNativeErrorPtr, SQLWCHAR *pszMessageText, SQLSMALLINT nBufferLength, SQLSMALLINT
*pnTextLengthPtr )
+{
+    MYODBCDbgEnter();
+
+    if ( nRecNumber < 1 )
+        MYODBCDbgReturn( SQL_ERROR );
+    if ( nRecNumber >= getNumber(); )
+        MYODBCDbgReturn( SQL_NO_DATA );
+
+    MYODBCDbgReturn( listRecords[nRecNumber]->getDiagRec( psSqlstate,
pnNativeErrorPtr, pszMessageText, nBufferLength, pnTextLengthPtr ) );
+}
+
 /*!
-    \brief  Sets a specific diagnostic field value.
+    \brief  Gets a specific diagnostic field value.
 
             The field can be a header field or a record field.
 
     \param  hDia            Diagnostic handle allocated with MYODBCDiaAlloc.
     \param  nRecord         The desired record. 0 if header field else 1+.
     \param  nField          Header or record diagnostic field.
-    \param  pValue          Value to use.
-    \param  nStringLength   The length of a strng (if pValue is a string).
+    \param  pBuffer         Place to return the value.
+    \param  nBufferLength   The size of pBuffer.
+    \param  pnStrLenPtr     Length of string data available.
 
     \return SQLRETURN
 
     \retval SQL_SUCCESS             Success!
-    \retval SQL_SUCCESS_WITH_INFO   Altered value used.
+    \retval SQL_SUCCESS_WITH_INFO   Character data was truncated.
     \retval SQL_ERROR               General error.
+    \retval SQL_NO_DATA             No data to return (ie requested record does not
exist).
 */
-SQLRETURN MYODBCDia::setField( SQLSMALLINT /* nRecord */ /* 1 based */, SQLSMALLINT
nField, SQLPOINTER pValue, SQLINTEGER /* nStringLength */ )
+SQLRETURN MYODBCDia::getDiagField( SQLSMALLINT nRecNumber, SQLSMALLINT nDiagIdentifier,
SQLPOINTER pDiagInfoPtr, SQLSMALLINT nBufferLength, SQLSMALLINT *pnStringLengthPtr )
 {
+    SQLSMALLINT  nStringLength;
+
+    MYODBCDbgEnter();
+
+    /* use dummy when no pnStringLengthPtr */
+    if ( !pnStringLengthPtr )
+        pnStringLengthPtr = &nStringLength;
+
     /* 
         These are the fields we know about listed by category
         (header/record) and in _alpha_ order.
     */
-    switch ( nField )
+    switch ( nDiagIdentifier )
     {
-        /* HEADER FIELD  */
         case SQL_DIAG_CURSOR_ROW_COUNT:
+            *(SQLINTEGER*)pDiagInfoPtr = getCursorRowCount();
+            break;
+
         case SQL_DIAG_DYNAMIC_FUNCTION:
+            {
+                QString stringDynamicFunction = getDynamicFunction();
+                if ( nBufferLength < 1 || stringDynamicFunction.isNull() )
+                    MYODBCDbgReturn( SQL_ERROR );
+
+                MYODBCCstrncpy( (SQLWCHAR*)pDiagInfoPtr, nBufferLength /
sizeof(SQLWCHAR), stringDynamicFunction.utf16(), _TRUNCATE );
+                *pnStringLengthPtr = stringDynamicFunction.length() * sizeof(SQLWCHAR);
+
+                if ( *pnStringLengthPtr > nBufferLength )
+                    MYODBCDbgReturn( SQL_SUCCESS_WITH_INFO );
+            }
+            break;
+
         case SQL_DIAG_DYNAMIC_FUNCTION_CODE:
+            *(SQLINTEGER*)pDiagInfoPtr = getDynamicFunctionCode();
+            break;
+
         case SQL_DIAG_NUMBER:
+            *(SQLINTEGER*)pDiagInfoPtr = getNumber();
+            break;
+
         case SQL_DIAG_RETURNCODE:
-            return SQL_ERROR;
+            *(SQLRETURN*)pDiagInfoPtr = getReturnCode();
+            break;
 
         case SQL_DIAG_ROW_COUNT:
-            setRowCount( (SQLINTEGER)pValue );
+            *(SQLINTEGER*)pDiagInfoPtr = getRowCount();
             break;
-
-        /*  RECORD FIELD  */
-        case SQL_DIAG_CLASS_ORIGIN:
-        case SQL_DIAG_COLUMN_NUMBER:
-        case SQL_DIAG_CONNECTION_NAME:
-        case SQL_DIAG_MESSAGE_TEXT:
-        case SQL_DIAG_NATIVE:
-        case SQL_DIAG_ROW_NUMBER:
-        case SQL_DIAG_SERVER_NAME:
-        case SQL_DIAG_SQLSTATE:
-        case SQL_DIAG_SUBCLASS_ORIGIN:
         default:
-            return SQL_ERROR;
+            if ( nRecNumber < 1 )
+                MYODBCDbgReturn( SQL_ERROR );
+            if ( nRecNumber >= getNumber(); )
+                MYODBCDbgReturn( SQL_NO_DATA );
+            MYODBCDbgReturn( listRecords[nRecNumber]->getDiagField( nDiagIdentifier,
pDiagInfoPtr, nBufferLength, pnStringLengthPtr ) );
     }
 
-    return SQL_SUCCESS;
+    MYODBCDbgReturn( SQL_SUCCESS );
 }
 
+
 SQLINTEGER MYODBCDia::getCursorRowCount()
 {
+    MYODBCDbgEnter();
+
     return nCursorRowCount;
 }
 
 QString MYODBCDia::getDynamicFunction()
 {
+    MYODBCDbgEnter();
+
     switch ( nDynamicFunctionCode )
     {
         case SQL_DIAG_ALTER_DOMAIN:
-            return "ALTER DOMAIN";
+            MYODBCDbgReturn( "ALTER DOMAIN" );
         case SQL_DIAG_ALTER_TABLE:
-            return "ALTER TABLE";
+            MYODBCDbgReturn( "ALTER TABLE" );
         case SQL_DIAG_CALL:
-            return "CALL";
+            MYODBCDbgReturn( "CALL" );
         case SQL_DIAG_CREATE_ASSERTION:
-            return "CREATE ASSERTION";
+            MYODBCDbgReturn( "CREATE ASSERTION" );
         case SQL_DIAG_CREATE_CHARACTER_SET:
-            return "CREATE CHARACTER SET";
+            MYODBCDbgReturn( "CREATE CHARACTER SET)" );
         case SQL_DIAG_CREATE_COLLATION:
-            return "CREATE COLLATION";
+            MYODBCDbgReturn( "CREATE COLLATION" );
         case SQL_DIAG_CREATE_DOMAIN:
-            return "CREATE DOMAIN";
+            MYODBCDbgReturn( "CREATE DOMAIN" );
         case SQL_DIAG_CREATE_INDEX:
-            return "CREATE INDEX";
+            MYODBCDbgReturn( "CREATE INDEX" );
         case SQL_DIAG_CREATE_SCHEMA:
-            return "CREATE SCHEMA";
+            MYODBCDbgReturn( "CREATE SCHEMA" );
         case SQL_DIAG_CREATE_TABLE:
-            return "CREATE TABLE";
+            MYODBCDbgReturn( "CREATE TABLE" );
         case SQL_DIAG_CREATE_TRANSLATION:
-            return "CREATE TRANSLATION";
+            MYODBCDbgReturn( "CREATE TRANSLATION" );
         case SQL_DIAG_CREATE_VIEW:
-            return "CREATE VIEW";
+            MYODBCDbgReturn( "CREATE VIEW" );
         case SQL_DIAG_DELETE_WHERE:
-            return "DELETE WHERE";
+            MYODBCDbgReturn( "DELETE WHERE" );
         case SQL_DIAG_DROP_ASSERTION:
-            return "DROP ASSERTION";
+            MYODBCDbgReturn( "DROP ASSERTION" );
         case SQL_DIAG_DROP_CHARACTER_SET:
-            return "DROP CHARACTER SET";
+            MYODBCDbgReturn( "DROP CHARACTER SET" );
         case SQL_DIAG_DROP_COLLATION:
-            return "DROP COLLATION";
+            MYODBCDbgReturn( "DROP COLLATION" );
         case SQL_DIAG_DROP_DOMAIN:
-            return "DROP DOMAIN";
+            MYODBCDbgReturn( "DROP DOMAIN" );
         case SQL_DIAG_DROP_INDEX:
-            return "DROP INDEX";
+            MYODBCDbgReturn( "DROP INDEX" );
         case SQL_DIAG_DROP_SCHEMA:
-            return "DROP SCHEMA";
+            MYODBCDbgReturn( "DROP SCHEMA" );
         case SQL_DIAG_DROP_TABLE:
-            return "DROP TABLE";
+            MYODBCDbgReturn( "DROP TABLE" );
         case SQL_DIAG_DROP_TRANSLATION:
-            return "DROP TRANSLATION";
+            MYODBCDbgReturn( "DROP TRANSLATION" );
         case SQL_DIAG_DROP_VIEW:
-            return "DROP VIEW";
+            MYODBCDbgReturn( "DROP VIEW" );
         case SQL_DIAG_DYNAMIC_DELETE_CURSOR:
-            return "DYNAMIC DELETE CURSOR";
+            MYODBCDbgReturn( "DYNAMIC DELETE CURSOR" );
         case SQL_DIAG_DYNAMIC_UPDATE_CURSOR:
-            return "DYNAMIC UPDATE CURSOR";
+            MYODBCDbgReturn( "DYNAMIC UPDATE CURSOR" );
         case SQL_DIAG_GRANT:
-            return "GRANT";
+            MYODBCDbgReturn( "GRANT" );
         case SQL_DIAG_INSERT:
-            return "INSERT";
+            MYODBCDbgReturn( "INSERT" );
         case SQL_DIAG_REVOKE:
-            return "REVOKE";
+            MYODBCDbgReturn( "REVOKE" );
         case SQL_DIAG_SELECT_CURSOR:
-            return "SELECT CURSOR";
+            MYODBCDbgReturn( "SELECT CURSOR" );
         case SQL_DIAG_UPDATE_WHERE:
-            return "UPDATE_WHERE";
+            MYODBCDbgReturn( "UPDATE_WHERE" );
 /*        case SQL_DIAG_UNKNOWN_STATEMENT:
             return "UNKNOWN_STATEMENT"; */
     }
 
-    return "UNKNOWN_STATEMENT";
+    MYODBCDbgReturn( "UNKNOWN_STATEMENT" );
 }
 
 SQLINTEGER MYODBCDia::getDynamicFunctionCode()
 {
-    return nDynamicFunctionCode;
+    MYODBCDbgEnter();
+
+    MYODBCDbgReturn3( "%d", nDynamicFunctionCode );
 }
 
 SQLINTEGER MYODBCDia::getNumber()
 {
-    return listRecords.count();
+    MYODBCDbgEnter();
+
+    MYODBCDbgReturn3( "%d", listRecords.count() );
 }
 
 SQLRETURN MYODBCDia::getReturnCode()
 {
-    return nReturnCode;
+    MYODBCDbgEnter();
+
+    MYODBCDbgReturn3( "%d", nReturnCode );
 }
 
 SQLINTEGER MYODBCDia::getRowCount()
 {
-    return nRowCount;
+    MYODBCDbgEnter();
+
+    MYODBCDbgReturn3( "%d", nRowCount );
 }
 
-QString MYODBCDia::getConnectionName()
+QString MYODBCDia::getClassOrigin( SQLSMALLINT nRecNumber )
 {
-    return stringConnectionName;
+    MYODBCDbgEnter();
+
+    Q_ASSERT( nRecNumber < 1 );
+    Q_ASSERT( nRecNumber >= getCount() );
+
+    MYODBCDbgReturn3( "%s", listRecords[nRecNumber - 1]->getClassOrigin() );
 }
 
-QString MYODBCDia::getServerName()
+SQLINTEGER MYODBCDia::getColumnNumber( SQLSMALLINT nRecNumber )
 {
-    return stringServerName;
+    MYODBCDbgEnter();
+
+    Q_ASSERT( nRecNumber < 1 );
+    Q_ASSERT( nRecNumber >= getCount() );
+
+    MYODBCDbgReturn3( "%d", listRecords[nRecNumber - 1]->getColumnNumber() );
 }
 
-/*!
-    \brief  Gets a diagnostic record.
-    
-            This function is called to get a diagnostic record from the given 
-            diagnostic handle.
+QString MYODBCDia::getConnectionName( SQLSMALLINT nRecNumber )
+{
+    MYODBCDbgEnter();
 
-    \param  hDia        Diagnostic handle created with MYODBCDiaAlloc.
-    \param  nRecord     Diagnostic record number (1 based).
-    
-    \return             NULL or viable MYODBC_DIA_REC_HANDLE
-    
-    \sa     MYODBCDiaAppend
-*/
-MYODBCDiaRecord *MYODBCDia::getRecord( SQLSMALLINT nRecord /* 1 based */ )
+    Q_ASSERT( nRecNumber < 1 );
+    Q_ASSERT( nRecNumber >= getCount() );
+
+    MYODBCDbgReturn3( "%s", listRecords[nRecNumber - 1]->getConnectionName() );
+}
+
+QString MYODBCDia::getMessageText( SQLSMALLINT nRecNumber )
 {
-    return listRecords.at(nRecord - 1);
+    MYODBCDbgEnter();
+
+    Q_ASSERT( nRecNumber < 1 );
+    Q_ASSERT( nRecNumber >= getCount() );
+
+    MYODBCDbgReturn3( "%s", listRecords[nRecNumber - 1]->getMessageText() );
 }
 
-/*!
-    \brief  Gets a specific diagnostic field value.
+QString MYODBCDia::getMessage( SQLSMALLINT nRecNumber )
+{
+    MYODBCDbgEnter();
 
-            The field can be a header field or a record field.
+    Q_ASSERT( nRecNumber < 1 );
+    Q_ASSERT( nRecNumber >= getCount() );
 
-    \param  hDia            Diagnostic handle allocated with MYODBCDiaAlloc.
-    \param  nRecord         The desired record. 0 if header field else 1+.
-    \param  nField          Header or record diagnostic field.
-    \param  pBuffer         Place to return the value.
-    \param  nBufferLength   The size of pBuffer.
-    \param  pnStrLenPtr     Length of string data available.
+    MYODBCDbgReturn3( "%s", listRecords[nRecNumber - 1]->getMessage() );
+}
 
-    \return SQLRETURN
+SQLINTEGER MYODBCDia::getNative( SQLSMALLINT nRecNumber )
+{
+    MYODBCDbgEnter();
 
-    \retval SQL_SUCCESS             Success!
-    \retval SQL_SUCCESS_WITH_INFO   Character data was truncated.
-    \retval SQL_ERROR               General error.
-    \retval SQL_NO_DATA             No data to return (ie requested record does not
exist).
-*/
-SQLRETURN MYODBCDia::getField( SQLSMALLINT nRecord /* 1 based */, SQLSMALLINT nField,
SQLPOINTER pBuffer, SQLSMALLINT nBufferLength, SQLSMALLINT *pnStrLenPtr )
+    Q_ASSERT( nRecNumber < 1 );
+    Q_ASSERT( nRecNumber >= getCount() );
+
+    MYODBCDbgReturn3( "%d", listRecords[nRecNumber - 1]->getNative() );
+}
+
+SQLINTEGER MYODBCDia::getRowNumber( SQLSMALLINT nRecNumber )
 {
-    SQLSMALLINT  nStrLen;
+    MYODBCDbgEnter();
 
-    /* use dummy when no pnStrLenPtr */
-    if ( !pnStrLenPtr )
-        pnStrLenPtr = &nStrLen;
+    Q_ASSERT( nRecNumber < 1 );
+    Q_ASSERT( nRecNumber >= getCount() );
 
-    /* 
-        These are the fields we know about listed by category
-        (header/record) and in _alpha_ order.
-    */
-    switch ( nField )
-    {
-        /*  GET HEADER FIELD  */
-        case SQL_DIAG_CURSOR_ROW_COUNT:
-            *(SQLINTEGER*)pBuffer = nCursorRowCount;
-            break;
+    MYODBCDbgReturn3( "%d", listRecords[nRecNumber - 1]->getRowNumber() );
+}
 
-        case SQL_DIAG_DYNAMIC_FUNCTION:
-            {
-                QString stringDynamicFunction = getDynamicFunction();
-                if ( nBufferLength < 1 || stringDynamicFunction.isNull() )
-                    return SQL_ERROR;
+QString MYODBCDia::getServerName( SQLSMALLINT nRecNumber )
+{
+    MYODBCDbgEnter();
 
-                MYODBCCstrncpy( (SQLWCHAR*)pBuffer, nBufferLength / sizeof(SQLWCHAR),
stringDynamicFunction.utf16(), _TRUNCATE );
-                *pnStrLenPtr = stringDynamicFunction.length() * sizeof(SQLWCHAR);
+    Q_ASSERT( nRecNumber < 1 );
+    Q_ASSERT( nRecNumber >= getCount() );
 
-                if ( *pnStrLenPtr > nBufferLength )
-                    return SQL_SUCCESS_WITH_INFO;
-            }
-            break;
+    MYODBCDbgReturn3( "%s", listRecords[nRecNumber - 1]->getServerName() );
+}
 
-        case SQL_DIAG_DYNAMIC_FUNCTION_CODE:
-            *(SQLINTEGER*)pBuffer = nDynamicFunctionCode;
-            break;
+QString MYODBCDia::getSQLState( SQLSMALLINT nRecNumber )
+{
+    MYODBCDbgEnter();
 
-        case SQL_DIAG_NUMBER:
-            *(SQLINTEGER*)pBuffer = getNumber();
-            break;
+    Q_ASSERT( nRecNumber < 1 );
+    Q_ASSERT( nRecNumber >= getCount() );
 
-        case SQL_DIAG_RETURNCODE:
-            *(SQLRETURN*)pBuffer = nReturnCode;
-            break;
+    MYODBCDbgReturn3( "%s", listRecords[nRecNumber - 1]->getSQLState() );
+}
 
-        case SQL_DIAG_ROW_COUNT:
-            *(SQLINTEGER*)pBuffer = nRowCount;
-            break;
+QString MYODBCDia::getSubClassOrigin( SQLSMALLINT nRecNumber)
+{
+    MYODBCDbgEnter();
 
-        /*  GET RECORD FIELD  */
-        case SQL_DIAG_CLASS_ORIGIN:
-        case SQL_DIAG_COLUMN_NUMBER:
-        case SQL_DIAG_CONNECTION_NAME:
-        case SQL_DIAG_MESSAGE_TEXT:
-        case SQL_DIAG_NATIVE:
-        case SQL_DIAG_ROW_NUMBER:
-        case SQL_DIAG_SERVER_NAME:
-        case SQL_DIAG_SQLSTATE:
-        case SQL_DIAG_SUBCLASS_ORIGIN:
-            if ( nRecord < 1 )
-                return SQL_ERROR;
-            if ( nRecord > listRecords.count() )
-                return SQL_NO_DATA;
-            return listRecords[nRecord]->getField( nField, pBuffer, nBufferLength,
pnStrLenPtr );
+    Q_ASSERT( nRecNumber < 1 );
+    Q_ASSERT( nRecNumber >= getCount() );
 
-        default:
-            return SQL_ERROR;
-    }
+    MYODBCDbgReturn3( "%s", listRecords[nRecNumber - 1]->getSubClassOrigin() );
+}
 
-    return SQL_SUCCESS;
+QString MYODBCDia::getConnectionName()
+{
+    MYODBCDbgEnter();
+
+    MYODBCDbgReturn3( "%s", stringConnectionName );
 }
 
+QString MYODBCDia::getServerName()
+{
+    MYODBCDbgEnter();
+
+    MYODBCDbgReturn3( "%s", stringServerName );
+}
+
 /*!
     \brief  Appends a diagnostic record to the given handle.
     
@@ -381,7 +452,9 @@
 */
 SQLRETURN MYODBCDia::doAppend( MYODBC_DIA_ID nState, SQLINTEGER nNative, const QString
&stringMessage )
 {
-    return doAppend( nState, nNative, stringMessage, SQL_NO_ROW_NUMBER,
SQL_NO_COLUMN_NUMBER );
+    MYODBCDbgEnter();
+
+    MYODBCDbgReturn( doAppend( nState, nNative, stringMessage, SQL_NO_ROW_NUMBER,
SQL_NO_COLUMN_NUMBER ) );
 }
 
 /*!
@@ -409,16 +482,18 @@
 */
 SQLRETURN MYODBCDia::doAppend( MYODBC_DIA_ID nState, SQLINTEGER nNative, const QString
&stringMessage, SQLINTEGER nRowNumber, SQLINTEGER nColumnNumber )
 {
+    MYODBCDbgEnter();
+
     /* sanity checks */
     Q_ASSERT( nState >= MYODBC_DIA_MAX );
 
-    MYODBCDiaRecord *pdiarecord = new MYODBCDiaRecord( this, nState );
-    pdiarecord->setNative( nNative );
-    pdiarecord->setColumnNumber( nColumnNumber );
-    pdiarecord->setRowNumber( nRowNumber );
-    pdiarecord->setMessage( stringMessage );
+    MYODBCDiaRec *pdiarec = new MYODBCDiaRec( this, nState );
+    pdiarec->setNative( nNative );
+    pdiarec->setColumnNumber( nColumnNumber );
+    pdiarec->setRowNumber( nRowNumber );
+    pdiarec->setMessage( stringMessage );
 
-    return MYODBCDia_pStates[nState].diag_returncode;
+    MYODBCDbgReturn( MYODBCDia_pStates[nState].diag_returncode );
 }
 
 /*!
@@ -435,6 +510,8 @@
 */
 void MYODBCDia::doClear()
 {
+    MYODBCDbgEnter();
+
     /* delete any records we may have */
     while (!listRecords.isEmpty())
         delete listRecords.takeFirst();
@@ -470,16 +547,20 @@
     nCursorRowCount      = 0;
     nDynamicFunctionCode = SQL_DIAG_UNKNOWN_STATEMENT;
     nReturnCode          = SQL_SUCCESS;
+
+    MYODBCDbgReturn2();
 }
 
-bool MYODBCDia::doDelete( SQLSMALLINT nRecord /* 1 based */ )
+SQLRETURN MYODBCDia::doDelete( SQLSMALLINT nRecNumber )
 {
-    if ( nRecord < 1 || nRecord > listRecords.count() )
-        return false;
+    MYODBCDbgEnter();
 
-    delete listRecords[nRecord - 1];
+    if ( nRecNumber < 1 || nRecNumber >= getNumber() )
+        MYODBCDbgReturn( SQL_ERROR );
 
-    return true;
+    delete listRecords.takeAt( nRecNumber - 1 );
+
+    MYODBCDbgReturn( SQL_SUCCESS );
 }
 
 /*!
@@ -499,7 +580,7 @@
     stream << "SQL_DIAG_RETURNCODE           : " << rval.nReturnCode <<
endl;
     stream << "SQL_DIAG_ROW_COUNT            : " << rval.nRowCount <<
endl;
 
-    QListIterator<MYODBCDiaRecord*> i( rval.listRecords );
+    QListIterator<MYODBCDiaRec*> i( rval.listRecords );
     while ( i.hasNext() )
     {
         stream << "Record..." << endl;
@@ -509,3 +590,5 @@
     return stream;
 }
 
+
+

Modified: MYODBCDia/MYODBCDiaLib/MYODBCDiaLib.pro
===================================================================
--- MYODBCDia/MYODBCDiaLib/MYODBCDiaLib.pro	2006-01-08 01:24:26 UTC (rev 34)
+++ MYODBCDia/MYODBCDiaLib/MYODBCDiaLib.pro	2006-01-08 07:43:04 UTC (rev 35)
@@ -35,10 +35,10 @@
 # #########################################################
 HEADERS		= \
 		../include/MYODBCDia.h \
-		../include/MYODBCDiaRecord.h \
+		../include/MYODBCDiaRec.h \
 		MYODBCDiaInternal.h
 
 SOURCES		= \
                 MYODBCDia.cpp \
-		MYODBCDiaRecord.cpp
+		MYODBCDiaRec.cpp
 

Modified: MYODBCDia/MYODBCDiaLib/MYODBCDiaLib.vpj
===================================================================
--- MYODBCDia/MYODBCDiaLib/MYODBCDiaLib.vpj	2006-01-08 01:24:26 UTC (rev 34)
+++ MYODBCDia/MYODBCDiaLib/MYODBCDiaLib.vpj	2006-01-08 07:43:04 UTC (rev 35)
@@ -185,12 +185,13 @@
 			Name="Source Files"
 			Filters="*.c;*.C;*.cc;*.cpp;*.cp;*.cxx;*.prg;*.pas;*.dpr;*.asm;*.s;*.bas;*.java;*.cs;*.sc;*.e;*.cob;*.html;*.rc;*.tcl;*.py;*.pl">
 			<F N="MYODBCDia.cpp"/>
-			<F N="MYODBCDiaRecord.cpp"/>
+			<F N="MYODBCDiaRec.cpp"/>
 		</Folder>
 		<Folder
 			Name="Header Files"
 			Filters="*.h;*.H;*.hh;*.hpp;*.hxx;*.inc;*.sh;*.cpy;*.if">
 			<F N="MYODBCDiaInternal.h"/>
+			<F N="MYODBCDiaRec.h"/>
 		</Folder>
 		<Folder
 			Name="Resource Files"

Copied: MYODBCDia/MYODBCDiaLib/MYODBCDiaRec.cpp (from rev 22,
MYODBCDia/MYODBCDiaLib/MYODBCDiaRecord.cpp)
===================================================================
--- MYODBCDia/MYODBCDiaLib/MYODBCDiaRecord.cpp	2005-12-29 19:48:18 UTC (rev 22)
+++ MYODBCDia/MYODBCDiaLib/MYODBCDiaRec.cpp	2006-01-08 07:43:04 UTC (rev 35)
@@ -0,0 +1,497 @@
+#include "MYODBCDiaInternal.h"
+
+/*!
+    \internal
+    \brief  This is a static table of all SQL state information.
+    
+            This static table is referenced using a corresponding numeric
+            identifier MYODBC_DIA_ID. The information in this table is used
+            to format diagnostic messages.
+        
+            The number of elements in here should ALWAYS be (MYODBC_DIA_MAX - 1).
+    
+    \sa     MYODBC_DIA_ID 
+            MYODBC_DIA_STATE
+*/
+MYODBC_DIA_STATE MYODBCDia_pStates[]=
+{
+    {"ISO 9075","01000","01","General warning",SQL_SUCCESS_WITH_INFO},
+    {"ISO 9075","01001","01","Cursor operation conflict",SQL_SUCCESS_WITH_INFO},
+    {"ISO 9075","01002","01","Disconnect error",SQL_SUCCESS_WITH_INFO},
+    {"ISO 9075","01003","01","NULL value eliminated in set
function",SQL_SUCCESS_WITH_INFO},
+    {"ISO 9075","01004","01","String data right-truncated",SQL_SUCCESS_WITH_INFO},
+    {"ISO 9075","01006","01","Privilege not revoked",SQL_SUCCESS_WITH_INFO},
+    {"ISO 9075","01007","01","Privilege not granted",SQL_SUCCESS_WITH_INFO},
+    {"ISO 9075","01S00","01","Invalid connection string
attribute",SQL_SUCCESS_WITH_INFO},
+    {"ISO 9075","01S01","01","Error in row",SQL_SUCCESS_WITH_INFO},
+    {"ISO 9075","01S02","01","Option value changed",SQL_SUCCESS_WITH_INFO},
+    {"ISO 9075","01S06","01","Attempt to fetch before the result set returned the first
rowset",SQL_SUCCESS_WITH_INFO},
+    {"ISO 9075","01S07","01","Fractional truncation",SQL_SUCCESS_WITH_INFO},
+    {"ISO 9075","01S08","01","Error saving File DSN",SQL_SUCCESS_WITH_INFO},
+    {"ISO 9075","01S09","01","Invalid keyword",SQL_SUCCESS_WITH_INFO},
+    {"ISO 9075","07001","07","Wrong number of parameters",SQL_ERROR},
+    {"ISO 9075","07002","07","COUNT field incorrect",SQL_ERROR},
+    {"ISO 9075","07005","07","Prepared statement not a cursor-specification",SQL_ERROR},
+    {"ISO 9075","07006","07","Restricted data type attribute violation",SQL_ERROR},
+    {"ISO 9075","07009","07","Invalid descriptor index",SQL_ERROR},
+    {"ISO 9075","07S01","07","Invalid use of default parameter",SQL_ERROR},
+    {"ISO 9075","08001","08","Client unable to establish connection",SQL_ERROR},
+    {"ISO 9075","08002","08","Connection name in use",SQL_ERROR},
+    {"ISO 9075","08003","08","Connection does not exist",SQL_ERROR},
+    {"ISO 9075","08004","08","Server rejected the connection",SQL_ERROR},
+    {"ISO 9075","08007","08","Connection failure during transaction",SQL_ERROR},
+    {"ISO 9075","08S01","08","Communication link failure",SQL_ERROR},
+    {"ISO 9075","21S01","21","Insert value list does not match column list",SQL_ERROR},
+    {"ISO 9075","21S02","21","Degree of derived table does not match column
list",SQL_ERROR},
+    {"ISO 9075","22001","22","String data right-truncated",SQL_ERROR},
+    {"ISO 9075","22002","22","Indicator variable required but not supplied",SQL_ERROR},
+    {"ISO 9075","22003","22","Numeric value out of range",SQL_ERROR},
+    {"ISO 9075","22007","22","Invalid datetime format",SQL_ERROR},
+    {"ISO 9075","22008","22","Datetime field overflow",SQL_ERROR},
+    {"ISO 9075","22012","22","Division by zero",SQL_ERROR},
+    {"ISO 9075","22015","22","Interval field overflow",SQL_ERROR},
+    {"ISO 9075","22018","22","Invalid character value for cast specification",SQL_ERROR},
+    {"ISO 9075","22019","22","Invalid escape character",SQL_ERROR},
+    {"ISO 9075","22025","22","Invalid escape sequence",SQL_ERROR},
+    {"ISO 9075","22026","22","String data length mismatch",SQL_ERROR},
+    {"ISO 9075","23000","23","Integrity constraint violation",SQL_ERROR},
+    {"ISO 9075","24000","24","Invalid cursor state",SQL_ERROR},
+    {"ISO 9075","25000","25","Invalid transaction state",SQL_ERROR},
+    {"ISO 9075","25S01","25","Transaction state",SQL_ERROR},
+    {"ISO 9075","25S02","25","Transaction is still active",SQL_ERROR},
+    {"ISO 9075","25S03","25","Transaction is rolled back",SQL_ERROR},
+    {"ISO 9075","28000","28","Invalid authorization specification",SQL_ERROR},
+    {"ISO 9075","34000","34","Invalid cursor name",SQL_ERROR},
+    {"ISO 9075","3C000","3C","Duplicate cursor name",SQL_ERROR},
+    {"ISO 9075","3D000","3D","Invalid catalog name",SQL_ERROR},
+    {"ISO 9075","3F000","3F","Invalid schema name",SQL_ERROR},
+    {"ISO 9075","40001","40","Serialization failure",SQL_ERROR},
+    {"ISO 9075","40002","40","Integrity constraint violation",SQL_ERROR},
+    {"ISO 9075","40003","40","Statement completion unknown",SQL_ERROR},
+    {"ISO 9075","42000","42","Syntax error or access violation",SQL_ERROR},
+    {"ISO 9075","42S01","42","Base table or view already exists",SQL_ERROR},
+    {"ISO 9075","42S02","42","Base table or view not found",SQL_ERROR},
+    {"ISO 9075","42S11","42","Index already exists",SQL_ERROR},
+    {"ISO 9075","42S12","42","Index not found",SQL_ERROR},
+    {"ISO 9075","42S21","42","Column already exists",SQL_ERROR},
+    {"ISO 9075","42S22","42","Column not found",SQL_ERROR},
+    {"ISO 9075","44000","44","WITH CHECK OPTION violation",SQL_ERROR},
+    {"ISO 9075","HY000","HY","General error",SQL_ERROR},
+    {"ISO 9075","HY001","HY","Memory allocation error",SQL_ERROR},
+    {"ISO 9075","HY003","HY","Invalid application buffer type",SQL_ERROR},
+    {"ISO 9075","HY004","HY","Invalid SQL data type",SQL_ERROR},
+    {"ISO 9075","HY007","HY","Associated statement is not prepared",SQL_ERROR},
+    {"ISO 9075","HY008","HY","Operation canceled",SQL_ERROR},
+    {"ISO 9075","HY009","HY","Invalid use of null pointer",SQL_ERROR},
+    {"ISO 9075","HY010","HY","Function sequence error",SQL_ERROR},
+    {"ISO 9075","HY011","HY","Attribute cannot be set now",SQL_ERROR},
+    {"ISO 9075","HY012","HY","Invalid transaction operation code",SQL_ERROR},
+    {"ISO 9075","HY013","HY","Memory management error",SQL_ERROR},
+    {"ISO 9075","HY014","HY","Limit on the number of handles exceeded",SQL_ERROR},
+    {"ISO 9075","HY015","HY","No cursor name available",SQL_ERROR},
+    {"ISO 9075","HY016","HY","Cannot modify an implementation row descriptor",SQL_ERROR},
+    {"ISO 9075","HY017","HY","Invalid use of an automatically allocated descriptor
handle",SQL_ERROR},
+    {"ISO 9075","HY018","HY","Server declined cancel request",SQL_ERROR},
+    {"ISO 9075","HY019","HY","Non-character and non-binary data sent in
pieces",SQL_ERROR},
+    {"ISO 9075","HY020","HY","Attempt to concatenate a null value",SQL_ERROR},
+    {"ISO 9075","HY021","HY","Inconsistent descriptor information",SQL_ERROR},
+    {"ISO 9075","HY024","HY","Invalid attribute value",SQL_ERROR},
+    {"ISO 9075","HY090","HY","Invalid string or buffer length",SQL_ERROR},
+    {"ISO 9075","HY091","HY","Invalid descriptor field identifier",SQL_ERROR},
+    {"ISO 9075","HY092","HY","Invalid attribute/option identifier",SQL_ERROR},
+    {"ISO 9075","HY095","HY","Function type out of range",SQL_ERROR},
+    {"ISO 9075","HY096","HY","Invalid information type",SQL_ERROR},
+    {"ISO 9075","HY097","HY","Column type out of range",SQL_ERROR},
+    {"ISO 9075","HY098","HY","Scope type out of range",SQL_ERROR},
+    {"ISO 9075","HY099","HY","Nullable type out of range",SQL_ERROR},
+    {"ISO 9075","HY100","HY","Uniqueness option type out of range",SQL_ERROR},
+    {"ISO 9075","HY101","HY","Accuracy option type out of range",SQL_ERROR},
+    {"ISO 9075","HY103","HY","Invalid retrieval code",SQL_ERROR},
+    {"ISO 9075","HY104","HY","Invalid precision or scale value",SQL_ERROR},
+    {"ISO 9075","HY105","HY","Invalid parameter type",SQL_ERROR},
+    {"ISO 9075","HY106","HY","Fetch type out of range",SQL_ERROR},
+    {"ISO 9075","HY107","HY","Row value out of range",SQL_ERROR},
+    {"ISO 9075","HY109","HY","Invalid cursor position",SQL_ERROR},
+    {"ISO 9075","HY110","HY","Invalid driver completion",SQL_ERROR},
+    {"ISO 9075","HY111","HY","Invalid bookmark value",SQL_ERROR},
+    {"ISO 9075","HYC00","HY","Optional feature not implemented",SQL_ERROR},
+    {"ISO 9075","HYT00","HY","Timeout expired",SQL_ERROR},
+    {"ISO 9075","HYT01","HY","Connection timeout expired",SQL_ERROR},
+    {"ODBC 3.0","IM001","IM","Driver does not support this function",SQL_ERROR},
+    {"ODBC 3.0","IM002","IM","Data source name not found and no default driver
specified",SQL_ERROR},
+    {"ODBC 3.0","IM003","IM","Specified driver could not be loaded",SQL_ERROR},
+    {"ODBC 3.0","IM004","IM","Driver's SQLAllocHandle on SQL_HANDLE_ENV
failed",SQL_ERROR},
+    {"ODBC 3.0","IM005","IM","Driver's SQLAllocHandle on SQL_HANDLE_DBC
failed",SQL_ERROR},
+    {"ODBC 3.0","IM006","IM","Driver's SQLSetConnectAttr failed",SQL_ERROR},
+    {"ODBC 3.0","IM007","IM","No data source or driver specified; dialog
prohibited",SQL_ERROR},
+    {"ODBC 3.0","IM008","IM","Dialog failed",SQL_ERROR},
+    {"ODBC 3.0","IM009","IM","Unable to load translation DLL",SQL_ERROR},
+    {"ODBC 3.0","IM010","IM","Data source name too long",SQL_ERROR},
+    {"ODBC 3.0","IM011","IM","Driver name too long",SQL_ERROR},
+    {"ODBC 3.0","IM012","IM","DRIVER keyword syntax error",SQL_ERROR},
+    {"ODBC 3.0","IM013","IM","Trace file error",SQL_ERROR},
+    {"ODBC 3.0","IM014","IM","Invalid name of File DSN",SQL_ERROR},
+    {"ODBC 3.0","IM015","IM","Corrupt file data source",SQL_ERROR}
+};
+
+
+/*!
+    \internal
+    \brief  Allocates and initializes a diagnostic record.
+
+            Allocates and initializes a diagnostic record
+            and appends it to the given diagnostic structure.
+            
+            Ultimately this needs to be freed by 
+            MYODBCDiaRecFree but this should be done 
+            automatically by array element call-back.
+
+            Does not set diag_message_text and a couple of 
+            other fields to anything useful so caller should
+            consider doing this.
+            
+    \param  pDiagnostic a diagnostic structure
+    \param  nState      SQL state to initialize record with
+
+    \return pointer to a valid diagnostic record
+
+    \sa     MYODBCDiaRecFree
+*/    
+MYODBCDiaRec::MYODBCDiaRec( MYODBCDia *pdia, MYODBC_DIA_ID nState )
+{
+    MYODBCDbgEnter();
+
+    Q_ASSERT( !pdia );
+
+    this->pdia          = pdia;
+    this->nState        = nState;
+    this->nColumnNumber = SQL_NO_COLUMN_NUMBER;
+    this->nRowNumber    = SQL_NO_ROW_NUMBER;
+    stringServerName    = pdia->getServerName();
+    stringConnectionName= pdia->getConnectionName();
+
+    MYODBCDbgReturn2();
+}
+
+/*!
+    \internal
+    \brief  Free memory used by the given diagnostic record.
+
+            This function is probably only called as a call-back
+            function by MYODBCArray functions when the record is
+            being deleted from array.
+
+    \param  pRecord diagnostic record allocated by MYODBCDiaRecAlloc
+
+    \sa     MYODBCDiaAlloc MYODBCDiaRecAlloc
+*/    
+MYODBCDiaRec::~MYODBCDiaRec()
+{
+    MYODBCDbgEnter();
+
+    MYODBCDbgReturn2();
+}
+
+SQLRETURN MYODBCDiaRec::setColumnNumber( SQLINTEGER nColumnNumber )
+{
+    MYODBCDbgEnter();
+
+    this->nColumnNumber = nColumnNumber;
+
+    MYODBCDDbgReturn( SQL_SUCCESS );
+}
+
+SQLRETURN MYODBCDiaRec::setMessage( const QString &stringMessage )
+{
+    MYODBCDbgEnter();
+
+    this->stringMessage = stringMessage;
+
+    MYODBCDDbgReturn( SQL_SUCCESS );
+}
+
+SQLRETURN MYODBCDiaRec::setNative( SQLINTEGER nNative )
+{
+    MYODBCDbgEnter();
+
+    this->nNative = nNative;
+
+    MYODBCDDbgReturn( SQL_SUCCESS );
+}
+
+SQLRETURN MYODBCDiaRec::setRowNumber( SQLINTEGER nRowNumber )
+{
+    MYODBCDbgEnter();
+
+    this->nRowNumber = nRowNumber;
+
+    MYODBCDDbgReturn( SQL_SUCCESS );
+}
+
+
+SQLRETURN MYODBCDiaRec::getDiagRec( SQLWCHAR *psSqlstate, SQLINTEGER *pnNativeErrorPtr,
SQLWCHAR *pszMessageText, SQLSMALLINT nBufferLength, SQLSMALLINT *pnTextLengthPtr )
+{
+    MYODBCDbgEnter();
+
+    MYODBCDDbgReturn( SQL_SUCCESS );
+}
+
+SQLRETURN MYODBCDiaRec::getDiagField( SQLSMALLINT nDiagIdentifier, SQLPOINTER
pDiagInfoPtr, SQLSMALLINT nBufferLength, SQLSMALLINT *pnStringLengthPtr )
+{
+    SQLSMALLINT nStringLength;
+
+    MYODBCDbgEnter();
+
+    /* use dummy when no pnStringLengthPtr */
+    if ( !pnStringLengthPtr )
+        pnStringLengthPtr = &nStringLength;
+
+    /* which record field? */
+    switch ( nDiagIdentifier )
+    {
+        case SQL_DIAG_CLASS_ORIGIN:
+            {
+                QString stringClassOrigin = getClassOrigin();
+                if ( nBufferLength < 1 || stringClassOrigin.isNull() )
+                    MYODBCDbgReturn( SQL_ERROR );
+
+                MYODBCCstrncpy( (SQLWCHAR*)pDiagInfoPtr, nBufferLength /
sizeof(SQLWCHAR), stringClassOrigin.utf16(), _TRUNCATE );
+                *pnStringLengthPtr = stringClassOrigin.length() * sizeof(SQLWCHAR);
+
+                if ( *pnStringLengthPtr > nBufferLength )
+                    MYODBCDbgReturn( SQL_SUCCESS_WITH_INFO );
+            }
+            break;
+
+        case SQL_DIAG_COLUMN_NUMBER:
+            *(SQLINTEGER*)pDiagInfoPtr = getColumnNumber();
+            break;
+
+        case SQL_DIAG_CONNECTION_NAME:
+            {
+                QString stringConnectionName = getConnectionName();
+                if ( nBufferLength < 1 || stringConnectionName.isNull() )
+                    MYODBCDbgReturn( SQL_ERROR );
+
+                MYODBCCstrncpy( (SQLWCHAR*)pDiagInfoPtr, nBufferLength /
sizeof(SQLWCHAR), stringConnectionName.utf16(), _TRUNCATE );
+                *pnStringLengthPtr = stringConnectionName.length() * sizeof(SQLWCHAR);
+
+                if ( *pnStringLengthPtr > nBufferLength )
+                    MYODBCDbgReturn( SQL_SUCCESS_WITH_INFO );
+            }
+            break;
+
+        case SQL_DIAG_MESSAGE_TEXT:
+            {
+                QString stringMessageText = getMessageText();
+                if ( nBufferLength < 1 || stringMessageText.isNull() )
+                    MYODBCDbgReturn( SQL_ERROR );
+
+                MYODBCCstrncpy( (SQLWCHAR*)pDiagInfoPtr, nBufferLength /
sizeof(SQLWCHAR), stringMessageText.utf16(), _TRUNCATE );
+                *pnStringLengthPtr = stringMessageText.length() * sizeof(SQLWCHAR);
+
+                if ( *pnStringLengthPtr > nBufferLength )
+                    MYODBCDbgReturn( SQL_SUCCESS_WITH_INFO );
+            }
+            break;
+
+        case SQL_DIAG_NATIVE:
+            *(SQLINTEGER*)pDiagInfoPtr = getNative();
+            break;
+
+        case SQL_DIAG_ROW_NUMBER:
+            *(SQLINTEGER*)pDiagInfoPtr = getRowNumber();
+            break;
+
+        case SQL_DIAG_SERVER_NAME:
+            {
+                QString stringServerName = getServerName();
+                if ( nBufferLength < 1 || stringServerName.isNull() )
+                    MYODBCDbgReturn( SQL_ERROR );
+
+                MYODBCCstrncpy( (SQLWCHAR*)pDiagInfoPtr, nBufferLength /
sizeof(SQLWCHAR), stringServerName.utf16(), _TRUNCATE );
+                *pnStringLengthPtr = stringServerName.length() * sizeof(SQLWCHAR);
+
+                if ( *pnStringLengthPtr > nBufferLength )
+                    MYODBCDbgReturn( SQL_SUCCESS_WITH_INFO );
+            }
+            break;
+
+        case SQL_DIAG_SQLSTATE:
+            {
+                QString stringSQLState = getSQLState();
+                if ( nBufferLength < 1 || stringSQLState.isNull() )
+                    MYODBCDbgReturn( SQL_ERROR );
+
+                MYODBCCstrncpy( (SQLWCHAR*)pDiagInfoPtr, nBufferLength /
sizeof(SQLWCHAR), stringSQLState.utf16(), _TRUNCATE );
+                *pnStringLengthPtr = stringSQLState.length() * sizeof(SQLWCHAR);
+
+                if ( *pnStringLengthPtr > nBufferLength )
+                    MYODBCDbgReturn( SQL_SUCCESS_WITH_INFO );
+            }
+            break;
+
+        case SQL_DIAG_SUBCLASS_ORIGIN:
+            {
+                QString stringSubClassOrigin = getSubClassOrigin();
+                if ( nBufferLength < 1 || stringSubClassOrigin.isNull() )
+                    MYODBCDbgReturn( SQL_ERROR );
+
+                MYODBCCstrncpy( (SQLWCHAR*)pDiagInfoPtr, nBufferLength /
sizeof(SQLWCHAR), stringSubClassOrigin.utf16(), _TRUNCATE );
+                *pnStringLengthPtr = stringSubClassOrigin.length() * sizeof(SQLWCHAR);
+
+                if ( *pnStringLengthPtr > nBufferLength )
+                    MYODBCDbgReturn( SQL_SUCCESS_WITH_INFO );
+            }
+            break;
+
+        default:
+            MYODBCDbgReturn( SQL_ERROR );
+    }
+
+    MYODBCDDbgReturn( SQL_SUCCESS );
+}
+
+
+QString MYODBCDiaRec::getClassOrigin()
+{
+    MYODBCDbgEnter();
+
+    MYODBCDbgReturn( MYODBCDia_pStates[nState].diag_class_origin );
+}
+
+SQLINTEGER MYODBCDiaRec::getColumnNumber()
+{
+    MYODBCDbgEnter();
+
+    MYODBCDbgReturn( nColumnNumber );
+}
+
+QString MYODBCDiaRec::getConnectionName()
+{
+    MYODBCDbgEnter();
+
+    MYODBCDbgReturn( stringConnectionName );
+}
+
+QString MYODBCDiaRec::getMessageText()
+{
+    MYODBCDbgEnter();
+
+    /* this message formated according to odbc spec */
+    if ( nNative )
+    {
+        /* server message */
+        if ( stringMessage.isEmpty() )
+            MYODBCDbgReturn( QString( "[%1][%2 %3][%4] %5 %6" )
+                             .arg( MYODBC_VENDOR )
+                             .arg( MYODBC_NAME )
+                             .arg( MYODBC_DRIVER_VER )
+                             .arg( MYODBC_VENDOR )
+                             .arg( nNative )
+                             .arg( MYODBCDia_pStates[nState].diag_text ) );
+        else
+            MYODBCDbgReturn( QString( "[%1][%2 %3][%4] %5 %6" )
+                             .arg( MYODBC_VENDOR )
+                             .arg( MYODBC_NAME )
+                             .arg( MYODBC_DRIVER_VER )
+                             .arg( MYODBC_VENDOR )
+                             .arg( nNative )
+                             .arg( stringMessage ) );
+    }
+    else
+    {
+        /* driver message */
+        if ( stringMessage.isEmpty() )
+            MYODBCDbgReturn( QString( "[%1][%2 %3][%4] %5" )
+                             .arg( MYODBC_VENDOR )
+                             .arg( MYODBC_NAME )
+                             .arg( MYODBC_DRIVER_VER )
+                             .arg( MYODBCDia_pStates[nState].diag_sqlstate )
+                             .arg( MYODBCDia_pStates[nState].diag_text ) );
+        else
+            MYODBCDbgReturn( QString( "[%1][%2 %3][%4] %5" )
+                             .arg( MYODBC_VENDOR )
+                             .arg( MYODBC_NAME )
+                             .arg( MYODBC_DRIVER_VER )
+                             .arg( MYODBCDia_pStates[nState].diag_sqlstate )
+                             .arg( stringMessage ) );
+    }
+
+    MYODBCDbgReturn( stringMessage );
+}
+
+QString MYODBCDiaRec::getMessage()
+{
+    MYODBCDbgEnter();
+
+    MYODBCDbgReturn( stringMessage );
+}
+
+SQLINTEGER MYODBCDiaRec::getNative()
+{
+    MYODBCDbgEnter();
+
+    MYODBCDbgReturn( nNative );
+}
+
+SQLINTEGER MYODBCDiaRec::getRowNumber()
+{
+    MYODBCDbgEnter();
+
+    MYODBCDbgReturn( nRowNumber );
+}
+
+QString MYODBCDiaRec::getServerName()
+{
+    MYODBCDbgEnter();
+
+    MYODBCDbgReturn( stringServerName );
+}
+
+QString MYODBCDiaRec::getSQLState()
+{
+    MYODBCDbgEnter();
+
+    MYODBCDbgReturn( MYODBCDia_pStates[nState].diag_sqlstate );
+}
+
+
+QString MYODBCDiaRec::getSubClassOrigin()
+{
+    MYODBCDbgEnter();
+
+    MYODBCDbgReturn( MYODBCDia_pStates[nState].diag_class_origin );
+}
+
+MYODBCDia *MYODBCDiaRec::getDia()
+{
+    MYODBCDbgEnter();
+
+    MYODBCDbgReturn3( "%p", pdia );
+}
+
+/*!
+    \internal
+    \brief  Dumps the contents to stream.
+
+            This is useful for debugging.
+
+    \param  
+*/  
+QTextStream &operator<<( QTextStream &stream, const MYODBCDiaRec &rval
)
+{
+    stream << "SQL_DIAG_CLASS_ORIGIN    : " <<
MYODBCDia_pStates[rval.nState].diag_class_origin << endl;
+    stream << "SQL_DIAG_COLUMN_NUMBER   : " << rval.nColumnNumber <<
endl;
+    stream << "SQL_DIAG_CONNECTION_NAME : " << rval.stringConnectionName
<< endl;
+    stream << "SQL_DIAG_MESSAGE_TEXT    : " << rval.stringMessage <<
endl;
+    stream << "SQL_DIAG_NATIVE          : " << rval.nNative << endl;
+    stream << "SQL_DIAG_ROW_NUMBER      : " << rval.nRowNumber << endl;
+    stream << "SQL_DIAG_SERVER_NAME     : " << rval.stringServerName <<
endl;
+    stream << "SQL_DIAG_SQLSTATE        : " <<
MYODBCDia_pStates[rval.nState].diag_sqlstate << endl;
+    stream << "SQL_DIAG_SUBCLASS_ORIGIN : " <<
MYODBCDia_pStates[rval.nState].diag_class_origin << endl;
+
+    return stream;
+}
+
+

Added: MYODBCDia/MYODBCDiaLib/MYODBCDiaRec.h
===================================================================
--- MYODBCDia/MYODBCDiaLib/MYODBCDiaRec.h	2006-01-08 01:24:26 UTC (rev 34)
+++ MYODBCDia/MYODBCDiaLib/MYODBCDiaRec.h	2006-01-08 07:43:04 UTC (rev 35)
@@ -0,0 +1,68 @@
+#ifndef MYODBC_DIA_RECORD_H
+#define MYODBC_DIA_RECORD_H
+
+#include "MYODBCDiaInternal.h"
+
+/*!
+    \brief This is a diagnostic record.
+    
+            A new diagnostic record is created whenever an ODBC function
+            generates an error or warning and also under some other 
+            circumstances (to provide general information back to the 
+            application). The exception to this is when no viable handle is
+            available to store the diagnostic information - for example when
+            failure to create an environment handle.
+
+            The formatted message is created when the record is created. This
+            may not be best - certianly not in terms of storage - but may make
+            sense in that some of the information used to format the message
+            may change before the application requests the message.
+*/    
+class MYODBCDiaRec
+{
+    friend QTextStream &operator<<( QTextStream &stream, const MYODBCDiaRec
&rval );
+public:
+    MYODBCDiaRec( MYODBCDia *pdia, MYODBC_DIA_ID nState );
+    ~MYODBCDiaRec();
+
+    /* record fields... */
+    SQLRETURN setColumnNumber( SQLINTEGER nColumnNumber );
+    SQLRETURN setMessage( const QString &stringMessage );
+    SQLRETURN setNative( SQLINTEGER nNative );
+    SQLRETURN setRowNumber( SQLINTEGER nRowNumber );
+
+    /* these for direct support for odbc api calls (most relevant odbc rules in these)...
*/
+    SQLRETURN   getDiagRec( SQLWCHAR *psSqlstate, SQLINTEGER *pnNativeErrorPtr, SQLWCHAR
*pszMessageText, SQLSMALLINT nBufferLength, SQLSMALLINT *pnTextLengthPtr );
+    SQLRETURN   getDiagField( SQLSMALLINT nDiagIdentifier, SQLPOINTER pDiagInfoPtr,
SQLSMALLINT nBufferLength, SQLSMALLINT *pnStringLengthPtr );
+    /* record fields... */
+    QString     getClassOrigin();       /*!< Doc that defines the class portion of the
SQLSTATE val in this rec.    */
+    SQLINTEGER  getColumnNumber();
+    QString     getConnectionName();
+    QString     getMessageText();       /*!< Formatted, informational message on the
error or warning. No max length.                           */
+    QString     getMessage();           /*!< Unformatted, informational message on the
error or warning. Should be !> SQL_MAX_MESSAGE_LENGTH    */
+    SQLINTEGER  getNative();
+    SQLINTEGER  getRowNumber();
+    QString     getServerName();
+    QString     getSQLState();          /*!< A five-character SQLSTATE diagnostic
code.                             */
+    QString     getSubClassOrigin();    /*!< */
+
+    MYODBCDia * getDia(); 
+
+protected:
+    MYODBCDia *     pdia;               /*!< Diagnostic which owns us - we do not
exist without it.                 */
+
+    MYODBC_DIA_ID   nState;
+    QString         stringMessage;      /*! Unformatted/short message.                   
                          */
+
+    /* the var names reflect the field names used in the ODBC specification */
+    SQLINTEGER  nColumnNumber;          /*!< Col num in the result set or the param
num in the set of parameters.   */
+    QString     stringConnectionName;   /*!< This is dbc->server.                  
                                */
+    SQLINTEGER  nNative;                /*!< A driver/data source+    SQLINTEGER  nRowNumber;             /*!< Row num in the rowset, or the param num
in the set of parameters.      */
+    QString     stringServerName;       /*!< This is dbc->dsn. Same as
SQL_DATA_SOURCE_NAME in SQLGetInfo().        */
+
+};
+
+
+#endif
+

Deleted: MYODBCDia/MYODBCDiaLib/MYODBCDiaRecord.cpp
===================================================================
--- MYODBCDia/MYODBCDiaLib/MYODBCDiaRecord.cpp	2006-01-08 01:24:26 UTC (rev 34)
+++ MYODBCDia/MYODBCDiaLib/MYODBCDiaRecord.cpp	2006-01-08 07:43:04 UTC (rev 35)
@@ -1,445 +0,0 @@
-#include "MYODBCDiaInternal.h"
-
-/*!
-    \internal
-    \brief  This is a static table of all SQL state information.
-    
-            This static table is referenced using a corresponding numeric
-            identifier MYODBC_DIA_ID. The information in this table is used
-            to format diagnostic messages.
-        
-            The number of elements in here should ALWAYS be (MYODBC_DIA_MAX - 1).
-    
-    \sa     MYODBC_DIA_ID 
-            MYODBC_DIA_STATE
-*/
-MYODBC_DIA_STATE MYODBCDia_pStates[]=
-{
-    {"ISO 9075","01000","01","General warning",SQL_SUCCESS_WITH_INFO},
-    {"ISO 9075","01001","01","Cursor operation conflict",SQL_SUCCESS_WITH_INFO},
-    {"ISO 9075","01002","01","Disconnect error",SQL_SUCCESS_WITH_INFO},
-    {"ISO 9075","01003","01","NULL value eliminated in set
function",SQL_SUCCESS_WITH_INFO},
-    {"ISO 9075","01004","01","String data right-truncated",SQL_SUCCESS_WITH_INFO},
-    {"ISO 9075","01006","01","Privilege not revoked",SQL_SUCCESS_WITH_INFO},
-    {"ISO 9075","01007","01","Privilege not granted",SQL_SUCCESS_WITH_INFO},
-    {"ISO 9075","01S00","01","Invalid connection string
attribute",SQL_SUCCESS_WITH_INFO},
-    {"ISO 9075","01S01","01","Error in row",SQL_SUCCESS_WITH_INFO},
-    {"ISO 9075","01S02","01","Option value changed",SQL_SUCCESS_WITH_INFO},
-    {"ISO 9075","01S06","01","Attempt to fetch before the result set returned the first
rowset",SQL_SUCCESS_WITH_INFO},
-    {"ISO 9075","01S07","01","Fractional truncation",SQL_SUCCESS_WITH_INFO},
-    {"ISO 9075","01S08","01","Error saving File DSN",SQL_SUCCESS_WITH_INFO},
-    {"ISO 9075","01S09","01","Invalid keyword",SQL_SUCCESS_WITH_INFO},
-    {"ISO 9075","07001","07","Wrong number of parameters",SQL_ERROR},
-    {"ISO 9075","07002","07","COUNT field incorrect",SQL_ERROR},
-    {"ISO 9075","07005","07","Prepared statement not a cursor-specification",SQL_ERROR},
-    {"ISO 9075","07006","07","Restricted data type attribute violation",SQL_ERROR},
-    {"ISO 9075","07009","07","Invalid descriptor index",SQL_ERROR},
-    {"ISO 9075","07S01","07","Invalid use of default parameter",SQL_ERROR},
-    {"ISO 9075","08001","08","Client unable to establish connection",SQL_ERROR},
-    {"ISO 9075","08002","08","Connection name in use",SQL_ERROR},
-    {"ISO 9075","08003","08","Connection does not exist",SQL_ERROR},
-    {"ISO 9075","08004","08","Server rejected the connection",SQL_ERROR},
-    {"ISO 9075","08007","08","Connection failure during transaction",SQL_ERROR},
-    {"ISO 9075","08S01","08","Communication link failure",SQL_ERROR},
-    {"ISO 9075","21S01","21","Insert value list does not match column list",SQL_ERROR},
-    {"ISO 9075","21S02","21","Degree of derived table does not match column
list",SQL_ERROR},
-    {"ISO 9075","22001","22","String data right-truncated",SQL_ERROR},
-    {"ISO 9075","22002","22","Indicator variable required but not supplied",SQL_ERROR},
-    {"ISO 9075","22003","22","Numeric value out of range",SQL_ERROR},
-    {"ISO 9075","22007","22","Invalid datetime format",SQL_ERROR},
-    {"ISO 9075","22008","22","Datetime field overflow",SQL_ERROR},
-    {"ISO 9075","22012","22","Division by zero",SQL_ERROR},
-    {"ISO 9075","22015","22","Interval field overflow",SQL_ERROR},
-    {"ISO 9075","22018","22","Invalid character value for cast specification",SQL_ERROR},
-    {"ISO 9075","22019","22","Invalid escape character",SQL_ERROR},
-    {"ISO 9075","22025","22","Invalid escape sequence",SQL_ERROR},
-    {"ISO 9075","22026","22","String data length mismatch",SQL_ERROR},
-    {"ISO 9075","23000","23","Integrity constraint violation",SQL_ERROR},
-    {"ISO 9075","24000","24","Invalid cursor state",SQL_ERROR},
-    {"ISO 9075","25000","25","Invalid transaction state",SQL_ERROR},
-    {"ISO 9075","25S01","25","Transaction state",SQL_ERROR},
-    {"ISO 9075","25S02","25","Transaction is still active",SQL_ERROR},
-    {"ISO 9075","25S03","25","Transaction is rolled back",SQL_ERROR},
-    {"ISO 9075","28000","28","Invalid authorization specification",SQL_ERROR},
-    {"ISO 9075","34000","34","Invalid cursor name",SQL_ERROR},
-    {"ISO 9075","3C000","3C","Duplicate cursor name",SQL_ERROR},
-    {"ISO 9075","3D000","3D","Invalid catalog name",SQL_ERROR},
-    {"ISO 9075","3F000","3F","Invalid schema name",SQL_ERROR},
-    {"ISO 9075","40001","40","Serialization failure",SQL_ERROR},
-    {"ISO 9075","40002","40","Integrity constraint violation",SQL_ERROR},
-    {"ISO 9075","40003","40","Statement completion unknown",SQL_ERROR},
-    {"ISO 9075","42000","42","Syntax error or access violation",SQL_ERROR},
-    {"ISO 9075","42S01","42","Base table or view already exists",SQL_ERROR},
-    {"ISO 9075","42S02","42","Base table or view not found",SQL_ERROR},
-    {"ISO 9075","42S11","42","Index already exists",SQL_ERROR},
-    {"ISO 9075","42S12","42","Index not found",SQL_ERROR},
-    {"ISO 9075","42S21","42","Column already exists",SQL_ERROR},
-    {"ISO 9075","42S22","42","Column not found",SQL_ERROR},
-    {"ISO 9075","44000","44","WITH CHECK OPTION violation",SQL_ERROR},
-    {"ISO 9075","HY000","HY","General error",SQL_ERROR},
-    {"ISO 9075","HY001","HY","Memory allocation error",SQL_ERROR},
-    {"ISO 9075","HY003","HY","Invalid application buffer type",SQL_ERROR},
-    {"ISO 9075","HY004","HY","Invalid SQL data type",SQL_ERROR},
-    {"ISO 9075","HY007","HY","Associated statement is not prepared",SQL_ERROR},
-    {"ISO 9075","HY008","HY","Operation canceled",SQL_ERROR},
-    {"ISO 9075","HY009","HY","Invalid use of null pointer",SQL_ERROR},
-    {"ISO 9075","HY010","HY","Function sequence error",SQL_ERROR},
-    {"ISO 9075","HY011","HY","Attribute cannot be set now",SQL_ERROR},
-    {"ISO 9075","HY012","HY","Invalid transaction operation code",SQL_ERROR},
-    {"ISO 9075","HY013","HY","Memory management error",SQL_ERROR},
-    {"ISO 9075","HY014","HY","Limit on the number of handles exceeded",SQL_ERROR},
-    {"ISO 9075","HY015","HY","No cursor name available",SQL_ERROR},
-    {"ISO 9075","HY016","HY","Cannot modify an implementation row descriptor",SQL_ERROR},
-    {"ISO 9075","HY017","HY","Invalid use of an automatically allocated descriptor
handle",SQL_ERROR},
-    {"ISO 9075","HY018","HY","Server declined cancel request",SQL_ERROR},
-    {"ISO 9075","HY019","HY","Non-character and non-binary data sent in
pieces",SQL_ERROR},
-    {"ISO 9075","HY020","HY","Attempt to concatenate a null value",SQL_ERROR},
-    {"ISO 9075","HY021","HY","Inconsistent descriptor information",SQL_ERROR},
-    {"ISO 9075","HY024","HY","Invalid attribute value",SQL_ERROR},
-    {"ISO 9075","HY090","HY","Invalid string or buffer length",SQL_ERROR},
-    {"ISO 9075","HY091","HY","Invalid descriptor field identifier",SQL_ERROR},
-    {"ISO 9075","HY092","HY","Invalid attribute/option identifier",SQL_ERROR},
-    {"ISO 9075","HY095","HY","Function type out of range",SQL_ERROR},
-    {"ISO 9075","HY096","HY","Invalid information type",SQL_ERROR},
-    {"ISO 9075","HY097","HY","Column type out of range",SQL_ERROR},
-    {"ISO 9075","HY098","HY","Scope type out of range",SQL_ERROR},
-    {"ISO 9075","HY099","HY","Nullable type out of range",SQL_ERROR},
-    {"ISO 9075","HY100","HY","Uniqueness option type out of range",SQL_ERROR},
-    {"ISO 9075","HY101","HY","Accuracy option type out of range",SQL_ERROR},
-    {"ISO 9075","HY103","HY","Invalid retrieval code",SQL_ERROR},
-    {"ISO 9075","HY104","HY","Invalid precision or scale value",SQL_ERROR},
-    {"ISO 9075","HY105","HY","Invalid parameter type",SQL_ERROR},
-    {"ISO 9075","HY106","HY","Fetch type out of range",SQL_ERROR},
-    {"ISO 9075","HY107","HY","Row value out of range",SQL_ERROR},
-    {"ISO 9075","HY109","HY","Invalid cursor position",SQL_ERROR},
-    {"ISO 9075","HY110","HY","Invalid driver completion",SQL_ERROR},
-    {"ISO 9075","HY111","HY","Invalid bookmark value",SQL_ERROR},
-    {"ISO 9075","HYC00","HY","Optional feature not implemented",SQL_ERROR},
-    {"ISO 9075","HYT00","HY","Timeout expired",SQL_ERROR},
-    {"ISO 9075","HYT01","HY","Connection timeout expired",SQL_ERROR},
-    {"ODBC 3.0","IM001","IM","Driver does not support this function",SQL_ERROR},
-    {"ODBC 3.0","IM002","IM","Data source name not found and no default driver
specified",SQL_ERROR},
-    {"ODBC 3.0","IM003","IM","Specified driver could not be loaded",SQL_ERROR},
-    {"ODBC 3.0","IM004","IM","Driver's SQLAllocHandle on SQL_HANDLE_ENV
failed",SQL_ERROR},
-    {"ODBC 3.0","IM005","IM","Driver's SQLAllocHandle on SQL_HANDLE_DBC
failed",SQL_ERROR},
-    {"ODBC 3.0","IM006","IM","Driver's SQLSetConnectAttr failed",SQL_ERROR},
-    {"ODBC 3.0","IM007","IM","No data source or driver specified; dialog
prohibited",SQL_ERROR},
-    {"ODBC 3.0","IM008","IM","Dialog failed",SQL_ERROR},
-    {"ODBC 3.0","IM009","IM","Unable to load translation DLL",SQL_ERROR},
-    {"ODBC 3.0","IM010","IM","Data source name too long",SQL_ERROR},
-    {"ODBC 3.0","IM011","IM","Driver name too long",SQL_ERROR},
-    {"ODBC 3.0","IM012","IM","DRIVER keyword syntax error",SQL_ERROR},
-    {"ODBC 3.0","IM013","IM","Trace file error",SQL_ERROR},
-    {"ODBC 3.0","IM014","IM","Invalid name of File DSN",SQL_ERROR},
-    {"ODBC 3.0","IM015","IM","Corrupt file data source",SQL_ERROR}
-};
-
-
-/*!
-    \internal
-    \brief  Allocates and initializes a diagnostic record.
-
-            Allocates and initializes a diagnostic record
-            and appends it to the given diagnostic structure.
-            
-            Ultimately this needs to be freed by 
-            MYODBCDiaRecFree but this should be done 
-            automatically by array element call-back.
-
-            Does not set diag_message_text and a couple of 
-            other fields to anything useful so caller should
-            consider doing this.
-            
-    \param  pDiagnostic a diagnostic structure
-    \param  nState      SQL state to initialize record with
-
-    \return pointer to a valid diagnostic record
-
-    \sa     MYODBCDiaRecFree
-*/    
-MYODBCDiaRecord::MYODBCDiaRecord( MYODBCDia *pdiaOwner, MYODBC_DIA_ID nState )
-{
-    this->nState        = nState;
-    this->nColumnNumber = SQL_NO_COLUMN_NUMBER;
-    this->nRowNumber    = SQL_NO_ROW_NUMBER;
-    if ( pdiaOwner )
-    {
-        pdiaOwner->listRecords.append( this );
-        stringServerName        = pdiaOwner->getServerName();
-        stringConnectionName    = pdiaOwner->getConnectionName();
-    }
-}
-
-/*!
-    \internal
-    \brief  Free memory used by the given diagnostic record.
-
-            This function is probably only called as a call-back
-            function by MYODBCArray functions when the record is
-            being deleted from array.
-
-    \param  pRecord diagnostic record allocated by MYODBCDiaRecAlloc
-
-    \sa     MYODBCDiaAlloc MYODBCDiaRecAlloc
-*/    
-MYODBCDiaRecord::~MYODBCDiaRecord()
-{
-    if ( pdiaOwner )
-        pdiaOwner->listRecords.removeAll( this );
-}
-
-bool MYODBCDiaRecord::setColumnNumber( SQLINTEGER nColumnNumber )
-{
-    this->nColumnNumber = nColumnNumber;
-    return true;
-}
-
-bool MYODBCDiaRecord::setMessage( const QString &stringMessage )
-{
-    this->stringMessage = stringMessage;
-    return true;
-}
-
-bool MYODBCDiaRecord::setNative( SQLINTEGER nNative )
-{
-    this->nNative = nNative;
-    return true;
-}
-
-bool MYODBCDiaRecord::setRowNumber( SQLINTEGER nRowNumber )
-{
-    this->nRowNumber = nRowNumber;
-    return true;
-}
-
-QString MYODBCDiaRecord::getClassOrigin()
-{
-    return MYODBCDia_pStates[nState].diag_class_origin;
-}
-
-SQLINTEGER MYODBCDiaRecord::getColumnNumber()
-{
-    return nColumnNumber;
-}
-
-QString MYODBCDiaRecord::getConnectionName()
-{
-    return stringConnectionName;
-}
-
-QString MYODBCDiaRecord::getMessageText()
-{
-    /* this message formated according to odbc spec */
-    if ( nNative )
-    {
-        /* server message */
-        if ( stringMessage.isEmpty() )
-            return QString( "[%1][%2 %3][%4] %5 %6" )
-                        .arg( MYODBC_VENDOR )
-                        .arg( MYODBC_NAME )
-                        .arg( MYODBC_DRIVER_VER )
-                        .arg( MYODBC_VENDOR )
-                        .arg( nNative )
-                        .arg( MYODBCDia_pStates[nState].diag_text );
-        else
-            return QString( "[%1][%2 %3][%4] %5 %6" )
-                        .arg( MYODBC_VENDOR )
-                        .arg( MYODBC_NAME )
-                        .arg( MYODBC_DRIVER_VER )
-                        .arg( MYODBC_VENDOR )
-                        .arg( nNative )
-                        .arg( stringMessage );
-    }
-    else
-    {
-        /* driver message */
-        if ( stringMessage.isEmpty() )
-            return QString( "[%1][%2 %3][%4] %5" )
-                        .arg( MYODBC_VENDOR )
-                        .arg( MYODBC_NAME )
-                        .arg( MYODBC_DRIVER_VER )
-                        .arg( MYODBCDia_pStates[nState].diag_sqlstate )
-                        .arg( MYODBCDia_pStates[nState].diag_text );
-        else
-            return QString( "[%1][%2 %3][%4] %5" )
-                        .arg( MYODBC_VENDOR )
-                        .arg( MYODBC_NAME )
-                        .arg( MYODBC_DRIVER_VER )
-                        .arg( MYODBCDia_pStates[nState].diag_sqlstate )
-                        .arg( stringMessage );
-    }
-
-    return stringMessage;
-}
-
-QString MYODBCDiaRecord::getMessage()
-{
-    return stringMessage;
-}
-
-SQLINTEGER MYODBCDiaRecord::getNative()
-{
-    return nNative;
-}
-
-SQLINTEGER MYODBCDiaRecord::getRowNumber()
-{
-    return nRowNumber;
-}
-
-QString MYODBCDiaRecord::getServerName()
-{
-    return stringServerName;
-}
-
-QString MYODBCDiaRecord::getSQLState()
-{
-    return MYODBCDia_pStates[nState].diag_sqlstate;
-}
-
-QString MYODBCDiaRecord::getSubClassOrigin()
-{
-    return MYODBCDia_pStates[nState].diag_class_origin;
-}
-
-MYODBCDia *MYODBCDiaRecord::getOwner()
-{
-    return pdiaOwner;
-}
-
-SQLRETURN MYODBCDiaRecord::getField( SQLSMALLINT nField, SQLPOINTER pBuffer, SQLSMALLINT
nBufferLength, SQLSMALLINT *pnStrLenPtr )
-{
-    SQLSMALLINT nStrLen;
-
-    /* use dummy when no pnStrLenPtr */
-    if ( !pnStrLenPtr )
-        pnStrLenPtr = &nStrLen;
-
-    /* which record field? */
-    switch ( nField )
-    {
-        case SQL_DIAG_CLASS_ORIGIN:
-            {
-                QString stringClassOrigin = getClassOrigin();
-                if ( nBufferLength < 1 || stringClassOrigin.isNull() )
-                    return SQL_ERROR;
-
-                MYODBCCstrncpy( (SQLWCHAR*)pBuffer, nBufferLength / sizeof(SQLWCHAR),
stringClassOrigin.utf16(), _TRUNCATE );
-                *pnStrLenPtr = stringClassOrigin.length() * sizeof(SQLWCHAR);
-
-                if ( *pnStrLenPtr > nBufferLength )
-                    return SQL_SUCCESS_WITH_INFO;
-            }
-            break;
-
-        case SQL_DIAG_COLUMN_NUMBER:
-            *(SQLINTEGER*)pBuffer = nColumnNumber;
-            break;
-
-        case SQL_DIAG_CONNECTION_NAME:
-            {
-                if ( nBufferLength < 1 || stringConnectionName.isNull() )
-                    return SQL_ERROR;
-
-                MYODBCCstrncpy( (SQLWCHAR*)pBuffer, nBufferLength / sizeof(SQLWCHAR),
stringConnectionName.utf16(), _TRUNCATE );
-                *pnStrLenPtr = stringConnectionName.length() * sizeof(SQLWCHAR);
-
-                if ( *pnStrLenPtr > nBufferLength )
-                    return SQL_SUCCESS_WITH_INFO;
-            }
-            break;
-
-        case SQL_DIAG_MESSAGE_TEXT:
-            {
-                QString stringMessageText = getMessageText();
-                if ( nBufferLength < 1 || stringMessageText.isNull() )
-                    return SQL_ERROR;
-
-                MYODBCCstrncpy( (SQLWCHAR*)pBuffer, nBufferLength / sizeof(SQLWCHAR),
stringMessageText.utf16(), _TRUNCATE );
-                *pnStrLenPtr = stringMessageText.length() * sizeof(SQLWCHAR);
-
-                if ( *pnStrLenPtr > nBufferLength )
-                    return SQL_SUCCESS_WITH_INFO;
-            }
-            break;
-
-        case SQL_DIAG_NATIVE:
-            *(SQLINTEGER*)pBuffer = nNative;
-            break;
-
-        case SQL_DIAG_ROW_NUMBER:
-            *(SQLINTEGER*)pBuffer = nRowNumber;
-            break;
-
-        case SQL_DIAG_SERVER_NAME:
-            {
-                if ( nBufferLength < 1 || stringServerName.isNull() )
-                    return SQL_ERROR;
-
-                MYODBCCstrncpy( (SQLWCHAR*)pBuffer, nBufferLength / sizeof(SQLWCHAR),
stringServerName.utf16(), _TRUNCATE );
-                *pnStrLenPtr = stringServerName.length() * sizeof(SQLWCHAR);
-
-                if ( *pnStrLenPtr > nBufferLength )
-                    return SQL_SUCCESS_WITH_INFO;
-            }
-            break;
-
-        case SQL_DIAG_SQLSTATE:
-            {
-                QString stringSQLState = getSQLState();
-                if ( nBufferLength < 1 || stringSQLState.isNull() )
-                    return SQL_ERROR;
-
-                MYODBCCstrncpy( (SQLWCHAR*)pBuffer, nBufferLength / sizeof(SQLWCHAR),
stringSQLState.utf16(), _TRUNCATE );
-                *pnStrLenPtr = stringSQLState.length() * sizeof(SQLWCHAR);
-
-                if ( *pnStrLenPtr > nBufferLength )
-                    return SQL_SUCCESS_WITH_INFO;
-            }
-            break;
-
-        case SQL_DIAG_SUBCLASS_ORIGIN:
-            {
-                QString stringSubClassOrigin = getSubClassOrigin();
-                if ( nBufferLength < 1 || stringSubClassOrigin.isNull() )
-                    return SQL_ERROR;
-
-                MYODBCCstrncpy( (SQLWCHAR*)pBuffer, nBufferLength / sizeof(SQLWCHAR),
stringSubClassOrigin.utf16(), _TRUNCATE );
-                *pnStrLenPtr = stringSubClassOrigin.length() * sizeof(SQLWCHAR);
-
-                if ( *pnStrLenPtr > nBufferLength )
-                    return SQL_SUCCESS_WITH_INFO;
-            }
-            break;
-
-        default:
-            return SQL_ERROR;
-    }
-
-    return SQL_SUCCESS;
-}
-
-/*!
-    \internal
-    \brief  Dumps the contents to stream.
-
-            This is useful for debugging.
-
-    \param  
-*/  
-QTextStream &operator<<( QTextStream &stream, const MYODBCDiaRecord
&rval )
-{
-    stream << "SQL_DIAG_CLASS_ORIGIN    : " <<
MYODBCDia_pStates[rval.nState].diag_class_origin << endl;
-    stream << "SQL_DIAG_COLUMN_NUMBER   : " << rval.nColumnNumber <<
endl;
-    stream << "SQL_DIAG_CONNECTION_NAME : " << rval.stringConnectionName
<< endl;
-    stream << "SQL_DIAG_MESSAGE_TEXT    : " << rval.stringMessage <<
endl;
-    stream << "SQL_DIAG_NATIVE          : " << rval.nNative << endl;
-    stream << "SQL_DIAG_ROW_NUMBER      : " << rval.nRowNumber << endl;
-    stream << "SQL_DIAG_SERVER_NAME     : " << rval.stringServerName <<
endl;
-    stream << "SQL_DIAG_SQLSTATE        : " <<
MYODBCDia_pStates[rval.nState].diag_sqlstate << endl;
-    stream << "SQL_DIAG_SUBCLASS_ORIGIN : " <<
MYODBCDia_pStates[rval.nState].diag_class_origin << endl;
-
-    return stream;
-}
-
-

Modified: MYODBCDia/include/MYODBCDia.h
===================================================================
--- MYODBCDia/include/MYODBCDia.h	2006-01-08 01:24:26 UTC (rev 34)
+++ MYODBCDia/include/MYODBCDia.h	2006-01-08 07:43:04 UTC (rev 35)
@@ -36,8 +36,10 @@
 #include <QStringList>
 #include <QTextStream>
 
-#include "MYODBCDiaRecord.h"
+#include "MYODBCDiaState.h"
 
+class MYODBCDiaRec;
+
 /*!
     \internal
     \brief  This is the main handle for diagnostic information.
@@ -48,35 +50,52 @@
 */
 class MYODBCDia 
 {
-    friend class MYODBCDiaRecord;
+    friend class MYODBCDiaRec;
     friend QTextStream &operator<<( QTextStream &stream, const MYODBCDia
&rval );
 public:
     MYODBCDia();
     ~MYODBCDia();
 
-    bool setCursorRowCount( SQLINTEGER nCursorRowCount );
-    bool setDynamicFunctionCode( SQLINTEGER nDynamicFunctionCode );
-    bool setReturnCode( SQLRETURN nReturn );
-    bool setRowCount( SQLINTEGER nRowCount );
-    bool setConnectionName( const QString &stringConnectionName );
-    bool setServerName( const QString &stringServerName );
-    SQLRETURN setField( SQLSMALLINT nRecord /* 1 based */, SQLSMALLINT nField, SQLPOINTER
pValue, SQLINTEGER nStringLength );
+    /* header fields... */
+    SQLRETURN setCursorRowCount( SQLINTEGER nCursorRowCount );
+    SQLRETURN setDynamicFunctionCode( SQLINTEGER nDynamicFunctionCode );
+    SQLRETURN setReturnCode( SQLRETURN nReturn );
+    SQLRETURN setRowCount( SQLINTEGER nRowCount );
+    /* record fields... */
+    /* N/A (only set by doAppend) */
+    /* these are cached so doAppend has them when called... */
+    SQLRETURN setConnectionName( const QString &stringConnectionName );
+    SQLRETURN setServerName( const QString &stringServerName );
 
-    SQLINTEGER getCursorRowCount();
-    QString getDynamicFunction();       /*!< String indicating type of SQL executed
(ie "UPDATE WHERE")                   */
-    SQLINTEGER getDynamicFunctionCode();
-    SQLINTEGER getNumber();             /*!< The number of status records in records
array.                               */
-    SQLRETURN getReturnCode();
-    SQLINTEGER getRowCount();
-    QString getConnectionName();
-    QString getServerName();
-    MYODBCDiaRecord *getRecord( SQLSMALLINT nRecord /* 1 based */ );
-    SQLRETURN getField( SQLSMALLINT nRecord /* 1 based */, SQLSMALLINT nField, SQLPOINTER
pBuffer, SQLSMALLINT nBufferLength, SQLSMALLINT *pnStrLenPtr );
+    /* these for direct support for odbc api calls (most relevant odbc rules in these)...
*/
+    SQLRETURN   getDiagRec( SQLSMALLINT nRecNumber /* 1-based */, SQLWCHAR *psSqlstate,
SQLINTEGER *pnNativeErrorPtr, SQLWCHAR *pszMessageText, SQLSMALLINT nBufferLength,
SQLSMALLINT *pnTextLengthPtr );
+    SQLRETURN   getDiagField( SQLSMALLINT nRecNumber /* 1-based */, SQLSMALLINT
nDiagIdentifier, SQLPOINTER pDiagInfoPtr, SQLSMALLINT nBufferLength, SQLSMALLINT
*pnStringLengthPtr );
+    /* header fields... */
+    SQLINTEGER  getCursorRowCount();
+    QString     getDynamicFunction();       /*!< String indicating type of SQL
executed (ie "UPDATE WHERE")                   */
+    SQLINTEGER  getDynamicFunctionCode();
+    SQLINTEGER  getNumber();             /*!< The number of status records in records
array.                               */
+    SQLRETURN   getReturnCode();
+    SQLINTEGER  getRowCount();
+    /* record fields... */
+    QString     getClassOrigin( SQLSMALLINT nRecNumber );       /*!< Doc that defines
the class portion of the SQLSTATE val in this rec.    */
+    SQLINTEGER  getColumnNumber( SQLSMALLINT nRecNumber );
+    QString     getConnectionName( SQLSMALLINT nRecNumber );
+    QString     getMessageText( SQLSMALLINT nRecNumber );       /*!< Formatted,
informational message on the error or warning. No max length.                          
*/
+    QString     getMessage( SQLSMALLINT nRecNumber );           /*!< Unformatted,
informational message on the error or warning. Should be !> SQL_MAX_MESSAGE_LENGTH   
*/
+    SQLINTEGER  getNative( SQLSMALLINT nRecNumber );
+    SQLINTEGER  getRowNumber( SQLSMALLINT nRecNumber );
+    QString     getServerName( SQLSMALLINT nRecNumber );
+    QString     getSQLState( SQLSMALLINT nRecNumber );          /*!< A five-character
SQLSTATE diagnostic code.                             */
+    QString     getSubClassOrigin( SQLSMALLINT nRecNumber);
+    /* these are cached so doAppend has them when called... */
+    QString     getConnectionName();
+    QString     getServerName();
 
-    SQLRETURN doAppend( MYODBC_DIA_ID nState, SQLINTEGER nNative, const QString
&stringMessage );
-    SQLRETURN doAppend( MYODBC_DIA_ID nState, SQLINTEGER nNative, const QString
&stringMessage, SQLINTEGER nRowNumber, SQLINTEGER nColumnNumber );
-    void doClear();
-    bool doDelete( SQLSMALLINT nRecord /* 1 based */ );
+    SQLRETURN   doAppend( MYODBC_DIA_ID nState, SQLINTEGER nNative, const QString
&stringMessage );
+    SQLRETURN   doAppend( MYODBC_DIA_ID nState, SQLINTEGER nNative, const QString
&stringMessage, SQLINTEGER nRowNumber, SQLINTEGER nColumnNumber );
+    void        doClear();
+    SQLRETURN   doDelete( SQLSMALLINT nRecNumber );
 
 protected:
     SQLINTEGER  nCursorRowCount;        /*!< Count of rows in the cursor.             
                                   */
@@ -88,7 +107,7 @@
     QString   stringConnectionName;     /*!< This is dbc->server.                  
                                      */
     QString   stringServerName;         /*!< This is dbc->dsn. Same as
SQL_DATA_SOURCE_NAME in SQLGetInfo().              */
 
-    QList<MYODBCDiaRecord*> listRecords;/*!< the records we own                 
                                         */
+    QList<MYODBCDiaRec*> listRecords;/*!< the records we own                    
                                      */
 };
 
 

Deleted: MYODBCDia/include/MYODBCDiaRecord.h
===================================================================
--- MYODBCDia/include/MYODBCDiaRecord.h	2006-01-08 01:24:26 UTC (rev 34)
+++ MYODBCDia/include/MYODBCDiaRecord.h	2006-01-08 07:43:04 UTC (rev 35)
@@ -1,243 +0,0 @@
-#ifndef MYODBC_DIA_RECORD_H
-#define MYODBC_DIA_RECORD_H
-
-#include <MYODBCC.h>
-#include <MYODBCDbg.h>
-
-#include <QList>
-#include <QString>
-#include <QStringList>
-#include <QTextStream>
-
-/*!
-    \brief These are the numeric constants used to indicated SQL states.
-  
-    ODBC Error Codes
-   
-    SQLGetDiagRec or SQLGetDiagField returns SQLSTATE values as defined by 
-    X/Open Data Management: Structured Query Language (SQL), Version 2 
-    (March 1995). SQLSTATE values are strings that contain five characters. 
-    The following lists SQLSTATE values that a driver can return for 
-    SQLGetDiagRec.
-
-    The character string value returned for an SQLSTATE consists of a 
-    two-character class value followed by a three-character subclass value. 
-    A class value of "01" indicates a warning and is accompanied by a return 
-    code of SQL_SUCCESS_WITH_INFO. Class values other than "01," except 
-    for the class "IM," indicate an error and are accompanied by a return 
-    value of SQL_ERROR. The class "IM" is specific to warnings and errors 
-    that derive from the implementation of ODBC itself. The subclass value 
-    "000" in any class indicates that there is no subclass for that SQLSTATE. 
-    The assignment of class and subclass values is defined by SQL-92.
-    
-    \sa MYODBCDia_pStates MYODBC_DIA_STATE
-*/    
-typedef enum MYODBC_DIA_ID
-{
-    MYODBC_DIA_01000=0,/* General warning                                                
 */
-    MYODBC_DIA_01001,  /* Cursor operation conflict                                      
 */
-    MYODBC_DIA_01002,  /* Disconnect error                                               
 */
-    MYODBC_DIA_01003,  /* NULL value eliminated in set function                          
 */
-    MYODBC_DIA_01004,  /* String data, right-truncated                                   
 */
-    MYODBC_DIA_01006,  /* Privilege not revoked                                          
 */
-    MYODBC_DIA_01007,  /* Privilege not granted                                          
 */
-    MYODBC_DIA_01S00,  /* Invalid connection string attribute                            
 */
-    MYODBC_DIA_01S01,  /* Error in row                                                   
 */
-    MYODBC_DIA_01S02,  /* Option value changed                                           
 */
-    MYODBC_DIA_01S06,  /* Attempt to fetch before the result set returned the first
rowset */
-    MYODBC_DIA_01S07,  /* Fractional truncation                                          
 */
-    MYODBC_DIA_01S08,  /* Error saving File DSN                                          
 */
-    MYODBC_DIA_01S09,  /* Invalid keyword                                                
 */
-    MYODBC_DIA_07001,  /* Wrong number of parameters                                     
 */
-    MYODBC_DIA_07002,  /* COUNT field incorrect                                          
 */
-    MYODBC_DIA_07005,  /* Prepared statement not a cursor-specification                  
 */
-    MYODBC_DIA_07006,  /* Restricted data type attribute violation                       
 */
-    MYODBC_DIA_07009,  /* Invalid descriptor index                                       
 */
-    MYODBC_DIA_07S01,  /* Invalid use of default parameter                               
 */
-    MYODBC_DIA_08001,  /* Client unable to establish connection                          
 */
-    MYODBC_DIA_08002,  /* Connection name in use                                         
 */
-    MYODBC_DIA_08003,  /* Connection does not exist                                      
 */
-    MYODBC_DIA_08004,  /* Server rejected the connection                                 
 */
-    MYODBC_DIA_08007,  /* Connection failure during transaction                          
 */
-    MYODBC_DIA_08S01,  /* Communication link failure                                     
 */
-    MYODBC_DIA_21S01,  /* Insert value list does not match column list                   
 */
-    MYODBC_DIA_21S02,  /* Degree of derived table does not match column list             
 */
-    MYODBC_DIA_22001,  /* String data, right-truncated                                   
 */
-    MYODBC_DIA_22002,  /* Indicator variable required but not supplied                   
 */
-    MYODBC_DIA_22003,  /* Numeric value out of range                                     
 */
-    MYODBC_DIA_22007,  /* Invalid datetime format                                        
 */
-    MYODBC_DIA_22008,  /* Datetime field overflow                                        
 */
-    MYODBC_DIA_22012,  /* Division by zero                                               
 */
-    MYODBC_DIA_22015,  /* Interval field overflow                                        
 */
-    MYODBC_DIA_22018,  /* Invalid character value for cast specification                 
 */
-    MYODBC_DIA_22019,  /* Invalid escape character                                       
 */
-    MYODBC_DIA_22025,  /* Invalid escape sequence                                        
 */
-    MYODBC_DIA_22026,  /* String data, length mismatch                                   
 */
-    MYODBC_DIA_23000,  /* Integrity constraint violation                                 
 */
-    MYODBC_DIA_24000,  /* Invalid cursor state                                           
 */
-    MYODBC_DIA_25000,  /* Invalid transaction state                                      
 */
-    MYODBC_DIA_25S01,  /* Transaction state                                              
 */
-    MYODBC_DIA_25S02,  /* Transaction is still active                                    
 */
-    MYODBC_DIA_25S03,  /* Transaction is rolled back                                     
 */
-    MYODBC_DIA_28000,  /* Invalid authorization specification                            
 */
-    MYODBC_DIA_34000,  /* Invalid cursor name                                            
 */
-    MYODBC_DIA_3C000,  /* Duplicate cursor name                                          
 */
-    MYODBC_DIA_3D000,  /* Invalid catalog name                                           
 */
-    MYODBC_DIA_3F000,  /* Invalid schema name                                            
 */
-    MYODBC_DIA_40001,  /* Serialization failure                                          
 */
-    MYODBC_DIA_40002,  /* Integrity constraint violation                                 
 */
-    MYODBC_DIA_40003,  /* Statement completion unknown                                   
 */
-    MYODBC_DIA_42000,  /* Syntax error or access violation                               
 */
-    MYODBC_DIA_42S01,  /* Base table or view already exists                              
 */
-    MYODBC_DIA_42S02,  /* Base table or view not found                                   
 */
-    MYODBC_DIA_42S11,  /* Index already exists                                           
 */
-    MYODBC_DIA_42S12,  /* Index not found                                                
 */
-    MYODBC_DIA_42S21,  /* Column already exists                                          
 */
-    MYODBC_DIA_42S22,  /* Column not found                                               
 */
-    MYODBC_DIA_44000,  /* WITH CHECK OPTION violation                                    
 */
-    MYODBC_DIA_HY000,  /* General error                                                  
 */
-    MYODBC_DIA_HY001,  /* Memory allocation error                                        
 */
-    MYODBC_DIA_HY003,  /* Invalid application buffer type                                
 */
-    MYODBC_DIA_HY004,  /* Invalid SQL data type                                          
 */
-    MYODBC_DIA_HY007,  /* Associated statement is not prepared                           
 */
-    MYODBC_DIA_HY008,  /* Operation canceled                                             
 */
-    MYODBC_DIA_HY009,  /* Invalid use of null pointer                                    
 */
-    MYODBC_DIA_HY010,  /* Function sequence error                                        
 */
-    MYODBC_DIA_HY011,  /* Attribute cannot be set now                                    
 */
-    MYODBC_DIA_HY012,  /* Invalid transaction operation code                             
 */
-    MYODBC_DIA_HY013,  /* Memory management error                                        
 */
-    MYODBC_DIA_HY014,  /* Limit on the number of handles exceeded                        
 */
-    MYODBC_DIA_HY015,  /* No cursor name available                                       
 */
-    MYODBC_DIA_HY016,  /* Cannot modify an implementation row descriptor                 
 */
-    MYODBC_DIA_HY017,  /* Invalid use of an automatically allocated descriptor handle    
 */
-    MYODBC_DIA_HY018,  /* Server declined cancel request                                 
 */
-    MYODBC_DIA_HY019,  /* Non-character and non-binary data sent in pieces               
 */
-    MYODBC_DIA_HY020,  /* Attempt to concatenate a null value                            
 */
-    MYODBC_DIA_HY021,  /* Inconsistent descriptor information                            
 */
-    MYODBC_DIA_HY024,  /* Invalid attribute value                                        
 */
-    MYODBC_DIA_HY090,  /* Invalid string or buffer length                                
 */
-    MYODBC_DIA_HY091,  /* Invalid descriptor field identifier                            
 */
-    MYODBC_DIA_HY092,  /* Invalid attribute/option identifier                            
 */
-    MYODBC_DIA_HY095,  /* Function type out of range                                     
 */
-    MYODBC_DIA_HY096,  /* Invalid information type                                       
 */
-    MYODBC_DIA_HY097,  /* Column type out of range                                       
 */
-    MYODBC_DIA_HY098,  /* Scope type out of range                                        
 */
-    MYODBC_DIA_HY099,  /* Nullable type out of range                                     
 */
-    MYODBC_DIA_HY100,  /* Uniqueness option type out of range                            
 */
-    MYODBC_DIA_HY101,  /* Accuracy option type out of range                              
 */
-    MYODBC_DIA_HY103,  /* Invalid retrieval code                                         
 */
-    MYODBC_DIA_HY104,  /* Invalid precision or scale value                               
 */
-    MYODBC_DIA_HY105,  /* Invalid parameter type                                         
 */
-    MYODBC_DIA_HY106,  /* Fetch type out of range                                        
 */
-    MYODBC_DIA_HY107,  /* Row value out of range                                         
 */
-    MYODBC_DIA_HY109,  /* Invalid cursor position                                        
 */
-    MYODBC_DIA_HY110,  /* Invalid driver completion                                      
 */
-    MYODBC_DIA_HY111,  /* Invalid bookmark value                                         
 */
-    MYODBC_DIA_HYC00,  /* Optional feature not implemented                               
 */
-    MYODBC_DIA_HYT00,  /* Timeout expired                                                
 */
-    MYODBC_DIA_HYT01,  /* Connection timeout expired                                     
 */
-    MYODBC_DIA_IM001,  /* Driver does not support this function                          
 */
-    MYODBC_DIA_IM002,  /* Data source name not found and no default driver specified     
 */
-    MYODBC_DIA_IM003,  /* Specified driver could not be loaded                           
 */
-    MYODBC_DIA_IM004,  /* Driver's SQLAllocHandle on SQL_HANDLE_ENV failed               
 */
-    MYODBC_DIA_IM005,  /* Driver's SQLAllocHandle on SQL_HANDLE_DBC failed               
 */
-    MYODBC_DIA_IM006,  /* Driver's SQLSetConnectAttr failed                              
 */
-    MYODBC_DIA_IM007,  /* No data source or driver specified; dialog prohibited          
 */
-    MYODBC_DIA_IM008,  /* Dialog failed                                                  
 */
-    MYODBC_DIA_IM009,  /* Unable to load translation DLL                                 
 */
-    MYODBC_DIA_IM010,  /* Data source name too long                                      
 */
-    MYODBC_DIA_IM011,  /* Driver name too long                                           
 */
-    MYODBC_DIA_IM012,  /* DRIVER keyword syntax error                                    
 */
-    MYODBC_DIA_IM013,  /* Trace file error                                               
 */
-    MYODBC_DIA_IM014,  /* Invalid name of File DSN                                       
 */
-    MYODBC_DIA_IM015,  /* Corrupt file data source                                       
 */
-    MYODBC_DIA_MAX
-
-} MYODBC_DIA_ID;
-
-/*!
-    \internal
-    \brief  This is used to generate a static 'table' of all state
-            information and corresponds to numeric state values.
-    
-            The static 'table' of state information generated using this
-            is found in MYODBCDiaAlloc.c as MYODBCDia_pStates. The state 
-            information is then referenced/indexed using MYODBC_DIA_ID.
-    
-    \sa     MYODBC_DIA_ID 
-            MYODBCDia_pStates
-*/
-typedef struct tMYODBC_DIA_STATE
-{
-  QString diag_class_origin;
-  QString diag_sqlstate;
-  QString diag_class;
-  QString diag_text;
-  SQLRETURN diag_returncode;
-
-} MYODBC_DIA_STATE;
-
-extern MYODBC_DIA_STATE MYODBCDia_pStates[];
-
-/* forward declare */
-class MYODBCDia;
-
-/*!
-    \brief This is a diagnostic record.
-    
-            A new diagnostic record is created whenever an ODBC function
-            generates an error or warning and also under some other 
-            circumstances (to provide general information back to the 
-            application). The exception to this is when no viable handle is
-            available to store the diagnostic information - for example when
-            failure to create an environment handle.
-
-            The formatted message is created when the record is created. This
-            may not be best - certianly not in terms of storage - but may make
-            sense in that some of the information used to format the message
-            may change before the application requests the message.
-*/    
-class MYODBCDiaRecord
-{
-    friend QTextStream &operator<<( QTextStream &stream, const
MYODBCDiaRecord &rval );
-public:
-    MYODBCDiaRecord( MYODBCDia *pdiaOwner, MYODBC_DIA_ID nState );
-    ~MYODBCDiaRecord();
-
-    bool setColumnNumber( SQLINTEGER nColumnNumber );
-    bool setMessage( const QString &stringMessage );
-    bool setNative( SQLINTEGER nNative );
-    bool setRowNumber( SQLINTEGER nRowNumber );
-
-    QString getClassOrigin();       /*!< Doc that defines the class portion of the
SQLSTATE val in this rec.    */
-    SQLINTEGER getColumnNumber();
-    QString getConnectionName();
-    QString getMessageText();       /*!< Formatted, informational message on the error
or warning. No max length.                           */
-    QString getMessage();           /*!< Unformatted, informational message on the
error or warning. Should be !> SQL_MAX_MESSAGE_LENGTH    */
-    SQLINTEGER getNative();
-    SQLINTEGER getRowNumber();
-    QString getServerName();
-    QString getSQLState();          /*!< A five-character SQLSTATE diagnostic code.   
                         */
-    QString getSubClassOrigin();    /*!< */
-    MYODBCDia *getOwner(); 
-    SQLRETURN getField( SQLSMALLINT nField, SQLPOINTER pBuffer, SQLSMALLINT
nBufferLength, SQLSMALLINT *pnStrLenPtr );
-
-protected:
-    MYODBC_DIA_ID   nState;
-    QString         stringMessage;      /*! Unformatted/short message.                   
                          */
-
-    /* the var names reflect the field names used in the ODBC specification */
-    SQLINTEGER  nColumnNumber;          /*!< Col num in the result set or the param
num in the set of parameters.   */
-    QString     stringConnectionName;   /*!< This is dbc->server.                  
                                */
-    SQLINTEGER  nNative;                /*!< A driver/data source-    SQLINTEGER  nRowNumber;             /*!< Row num in the rowset, or the param num
in the set of parameters.      */
-    QString     stringServerName;       /*!< This is dbc->dsn. Same as
SQL_DATA_SOURCE_NAME in SQLGetInfo().        */
-
-private:
-    MYODBCDia * pdiaOwner;              /*!< Diagnostic which owns us - we do not
exist without it.                 */
-
-};
-
-
-#endif
-

Thread
Connector/ODBC 5 commit: r35 - in MYODBCDia: . MYODBCDiaLib includepharvey8 Jan