List:Commits« Previous MessageNext Message »
From:pharvey Date:December 29 2005 9:54am
Subject:Connector/ODBC 5 commit: r21 - MYODBCDbg/MYODBCDbgTest MYODBCDia MYODBCDia/MYODBCDiaLib MYODBCDia/include
View as plain text  
Added:
   MYODBCDia/MYODBCDiaLib/MYODBCDia.cpp
   MYODBCDia/MYODBCDiaLib/MYODBCDiaRecord.cpp
   MYODBCDia/include/MYODBCDiaRecord.h
Removed:
   MYODBCDia/MYODBCDiaLib/MYODBCDiaAlloc.c
   MYODBCDia/MYODBCDiaLib/MYODBCDiaAppend.c
   MYODBCDia/MYODBCDiaLib/MYODBCDiaAppend2.c
   MYODBCDia/MYODBCDiaLib/MYODBCDiaClear.c
   MYODBCDia/MYODBCDiaLib/MYODBCDiaDelete.c
   MYODBCDia/MYODBCDiaLib/MYODBCDiaDump.c
   MYODBCDia/MYODBCDiaLib/MYODBCDiaFree.c
   MYODBCDia/MYODBCDiaLib/MYODBCDiaGet.c
   MYODBCDia/MYODBCDiaLib/MYODBCDiaGetField.c
   MYODBCDia/MYODBCDiaLib/MYODBCDiaRecAlloc.c
   MYODBCDia/MYODBCDiaLib/MYODBCDiaRecFree.c
   MYODBCDia/MYODBCDiaLib/MYODBCDiaSetField.c
Modified:
   MYODBCDbg/MYODBCDbgTest/MYODBCDbgTest.cpp
   MYODBCDia/MYODBCDia.vpj
   MYODBCDia/MYODBCDiaLib/MYODBCDiaInternal.h
   MYODBCDia/MYODBCDiaLib/MYODBCDiaLib.pro
   MYODBCDia/MYODBCDiaLib/MYODBCDiaLib.vpj
   MYODBCDia/include/MYODBCDia.h
Log:
UNICODE:
- getting bulk of code in for MYODBCDes (descriptors)

Modified: MYODBCDbg/MYODBCDbgTest/MYODBCDbgTest.cpp
===================================================================
--- MYODBCDbg/MYODBCDbgTest/MYODBCDbgTest.cpp	2005-12-29 04:08:17 UTC (rev 20)
+++ MYODBCDbg/MYODBCDbgTest/MYODBCDbgTest.cpp	2005-12-29 09:54:08 UTC (rev 21)
@@ -58,11 +58,11 @@
 
     MYODBCDbgEnter();
 
-    MYODBCDbgInfo( "", "" );
-    MYODBCDbgInfo( "Got here", "" );
+    MYODBCDbgInfo( "%1", "" );
+    MYODBCDbgInfo( "Got here%1", "" );
     MYODBCDbgInfo( "gpMYODBCDbg = %1", n )
-    MYODBCDbgError( "Ooops", "" );
-    MYODBCDbgWarning( "That smarts", "" );
+    MYODBCDbgError( "Ooops%1", "" );
+    MYODBCDbgWarning( "That smarts%1", "" );
 
     MYODBCDbgReturn( SQL_SUCCESS );
 }

Modified: MYODBCDia/MYODBCDia.vpj
===================================================================
--- MYODBCDia/MYODBCDia.vpj	2005-12-29 04:08:17 UTC (rev 20)
+++ MYODBCDia/MYODBCDia.vpj	2005-12-29 09:54:08 UTC (rev 21)
@@ -189,6 +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"/>
 		</Folder>
 		<Folder
 			Name="Resource Files"

Added: MYODBCDia/MYODBCDiaLib/MYODBCDia.cpp
===================================================================
--- MYODBCDia/MYODBCDiaLib/MYODBCDia.cpp	2005-12-29 04:08:17 UTC (rev 20)
+++ MYODBCDia/MYODBCDiaLib/MYODBCDia.cpp	2005-12-29 09:54:08 UTC (rev 21)
@@ -0,0 +1,623 @@
+#include "MYODBCDiaInternal.h"
+
+/*!
+    \brief  Allocates a new diagnostics structure.
+
+            Allocates and initializes a new diagnostics 
+            structure. Should be free using MYODBCDiaFree().
+
+    \return a viable diagnostic structure
+        
+    \sa     MYODBCDiaFree
+*/
+MYODBCDia::MYODBCDia()
+{
+    nCursorRowCount         = 0;
+    nDynamicFunctionCode    = SQL_DIAG_UNKNOWN_STATEMENT;
+    nReturnCode             = SQL_SUCCESS;
+    nRowCount               = 0;
+
+    /*!
+        \internal ODBC Rule
+
+        A string that indicates the name of the connection that the diagnostic 
+        record relates to. This field is driver-defined. For diagnostic data 
+        structures associated with the environment handle and for diagnostics 
+        that do not relate to any connection, this field is a zero-length string.
+    */    
+    stringConnectionName    = "";
+    stringServerName        = "";
+}
+
+/*!
+    \brief  Frees a diagnostics structure.
+
+            Frees a diagnostics structure previously allocated with
+            MYODBCDiaAlloc(). 
+    
+    \param  hDia    Diagnostic handle created with MYODBCDiaAlloc.
+                        
+    \sa     MYODBCDiaAlloc
+*/
+MYODBCDia::~MYODBCDia()
+{
+    while ( !listRecords.isEmpty() )
+        delete listRecords[0];
+}
+
+bool MYODBCDia::setCursorRowCount( SQLINTEGER nCursorRowCount )
+{
+    this->nCursorRowCount = nCursorRowCount;
+    return true;
+}
+
+bool MYODBCDia::setDynamicFunctionCode( SQLINTEGER nDynamicFunctionCode )
+{
+    this->nDynamicFunctionCode = nDynamicFunctionCode;
+    return true;
+}
+
+bool MYODBCDia::setReturnCode( SQLRETURN nReturn )
+{
+    this->nReturnCode = nReturn;
+    return true;
+}
+
+bool MYODBCDia::setRowCount( SQLINTEGER nRowCount )
+{
+    this->nRowCount = nRowCount;
+    return true;
+}
+
+bool MYODBCDia::setConnectionName( const QString &stringConnectionName )
+{
+    if ( stringConnectionName.isNull() )
+        this->stringConnectionName = "";
+    else
+        this->stringConnectionName = stringConnectionName;
+    return true;
+}
+
+bool MYODBCDia::setServerName( const QString &stringServerName )
+{
+    if ( stringServerName.isNull() )
+        this->stringServerName = "";
+    else
+        this->stringServerName = stringServerName;
+    return true;
+}
+
+/*!
+    \brief  Sets 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).
+
+    \return SQLRETURN
+
+    \retval SQL_SUCCESS             Success!
+    \retval SQL_SUCCESS_WITH_INFO   Altered value used.
+    \retval SQL_ERROR               General error.
+*/
+SQLRETURN MYODBCDia::setField( SQLSMALLINT nRecord /* 1 based */, SQLSMALLINT nField,
SQLPOINTER pValue, SQLINTEGER nStringLength )
+{
+    MYODBC_DIA_PTR pDia = (MYODBC_DIA_PTR)hDia;
+
+#if MYODBC_DEV > 0
+    if ( !hDia )
+        MYODBCCAssert( "hDia" );
+    if ( MYODBCRttiType( hDia ) != MYODBC_RTTI_DIA )
+        MYODBCCAssert( "hDia" );
+#endif
+
+    /* 
+        These are the fields we know about listed by category
+        (header/record) and in _alpha_ order.
+    */
+    switch ( nField )
+    {
+        /* HEADER FIELD  */
+        case SQL_DIAG_CURSOR_ROW_COUNT:
+        case SQL_DIAG_DYNAMIC_FUNCTION:
+        case SQL_DIAG_DYNAMIC_FUNCTION_CODE:
+        case SQL_DIAG_NUMBER:
+        case SQL_DIAG_RETURNCODE:
+            return SQL_ERROR;
+
+        case SQL_DIAG_ROW_COUNT:
+            pDia->diag_row_count = (SQLINTEGER)pValue;
+            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;
+    }
+
+    return SQL_SUCCESS;
+}
+
+SQLINTEGER MYODBCDia::getCursorRowCount()
+{
+    return nCursorRowCount;
+}
+
+QString MYODBCDia::getDynamicFunction()
+{
+    switch ( nDynamicFunctionCode )
+    {
+        case SQL_DIAG_ALTER_DOMAIN:
+            return "ALTER DOMAIN";
+        case SQL_DIAG_ALTER_TABLE:
+            return "ALTER TABLE";
+        case SQL_DIAG_CALL:
+            return "CALL";
+        case SQL_DIAG_CREATE_ASSERTION:
+            return "CREATE ASSERTION";
+        case SQL_DIAG_CREATE_CHARACTER_SET:
+            return "CREATE CHARACTER SET";
+        case SQL_DIAG_CREATE_COLLATION:
+            return "CREATE COLLATION";
+        case SQL_DIAG_CREATE_DOMAIN:
+            return "CREATE DOMAIN";
+        case SQL_DIAG_CREATE_INDEX:
+            return "CREATE INDEX";
+        case SQL_DIAG_CREATE_SCHEMA:
+            return "CREATE SCHEMA";
+        case SQL_DIAG_CREATE_TABLE:
+            return "CREATE TABLE";
+        case SQL_DIAG_CREATE_TRANSLATION:
+            return "CREATE TRANSLATION";
+        case SQL_DIAG_CREATE_VIEW:
+            return "CREATE VIEW";
+        case SQL_DIAG_DELETE_WHERE:
+            return "DELETE WHERE";
+        case SQL_DIAG_DROP_ASSERTION:
+            return "DROP ASSERTION";
+        case SQL_DIAG_DROP_CHARACTER_SET:
+            return "DROP CHARACTER SET";
+        case SQL_DIAG_DROP_COLLATION:
+            return "DROP COLLATION";
+        case SQL_DIAG_DROP_DOMAIN:
+            return "DROP DOMAIN";
+        case SQL_DIAG_DROP_INDEX:
+            return "DROP INDEX";
+        case SQL_DIAG_DROP_SCHEMA:
+            return "DROP SCHEMA";
+        case SQL_DIAG_DROP_TABLE:
+            return "DROP TABLE";
+        case SQL_DIAG_DROP_TRANSLATION:
+            return "DROP TRANSLATION";
+        case SQL_DIAG_DROP_VIEW:
+            return "DROP VIEW";
+        case SQL_DIAG_DYNAMIC_DELETE_CURSOR:
+            return "DYNAMIC DELETE CURSOR";
+        case SQL_DIAG_DYNAMIC_UPDATE_CURSOR:
+            return "DYNAMIC UPDATE CURSOR";
+        case SQL_DIAG_GRANT:
+            return "GRANT";
+        case SQL_DIAG_INSERT:
+            return "INSERT";
+        case SQL_DIAG_REVOKE:
+            return "REVOKE";
+        case SQL_DIAG_SELECT_CURSOR:
+            return "SELECT CURSOR";
+        case SQL_DIAG_UPDATE_WHERE:
+            return "UPDATE_WHERE";
+/*        case SQL_DIAG_UNKNOWN_STATEMENT:
+            return "UNKNOWN_STATEMENT"; */
+    }
+
+    return "UNKNOWN_STATEMENT";
+}
+
+SQLINTEGER MYODBCDia::getDynamicFunctionCode()
+{
+    return nDynamicFunctionCode;
+}
+
+SQLINTEGER MYODBCDia::getNumber()
+{
+    return listRecords.count();
+}
+
+SQLRETURN MYODBCDia::getReturnCode()
+{
+    return nReturnCode;
+}
+
+SQLINTEGER MYODBCDia::getRowCount()
+{
+    return nRowCount;
+}
+
+QString MYODBCDia::getConnectionName()
+{
+    return stringConnectionName;
+}
+
+QString MYODBCDia::getServerName()
+{
+    return stringServerName;
+}
+
+/*!
+    \brief  Gets a diagnostic record.
+    
+            This function is called to get a diagnostic record from the given 
+            diagnostic handle.
+
+    \param  hDia        Diagnostic handle created with MYODBCDiaAlloc.
+    \param  nRecord     Diagnostic record number (1 based).
+    
+    \return             NULL or viable MYODBC_DIA_REC_HANDLE
+    
+    \sa     MYODBCDiaAppend
+*/
+const MYODBCDiaRecord &MYODBCDia::getRecord( SQLSMALLINT nRecord /* 1 based */ )
+{
+    return listRecords.at(nRecord - 1);
+}
+
+/*!
+    \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  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   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 )
+{
+    MYODBC_DIA_PTR      pDia = (MYODBC_DIA_PTR)hDia;
+    MYODBC_DIA_REC_PTR  pDiaRec;
+    SQLSMALLINT         nStrLen;
+
+#if MYODBC_DEV > 0
+    if ( !hDia )
+        MYODBCCAssert( "hDia" );
+    if ( MYODBCRttiType( hDia ) != MYODBC_RTTI_DIA )
+        MYODBCCAssert( "hDia" );
+#endif
+
+    /* use dummy when no pnStrLenPtr */
+    if ( !pnStrLenPtr )
+        pnStrLenPtr = &nStrLen;
+
+    /* 
+        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 = pDia->diag_cursor_row_count;
+            break;
+
+        case SQL_DIAG_DYNAMIC_FUNCTION:
+            if ( !MYODBCCStrCopyOut( (SQLCHAR*)pBuffer, nBufferLength,
pDia->diag_dynamic_function, (SQLINTEGER*)pnStrLenPtr ) )
+                return SQL_SUCCESS_WITH_INFO;
+            break;
+
+        case SQL_DIAG_DYNAMIC_FUNCTION_CODE:
+            *(SQLINTEGER*)pBuffer = pDia->diag_dynamic_function_code;
+            break;
+
+        case SQL_DIAG_NUMBER:
+            *(SQLINTEGER*)pBuffer = pDia->diag_number;
+            break;
+
+        case SQL_DIAG_RETURNCODE:
+            *(SQLRETURN*)pBuffer = pDia->diag_returncode;
+            break;
+
+        case SQL_DIAG_ROW_COUNT:
+            *(SQLINTEGER*)pBuffer = pDia->diag_row_count;
+            break;
+
+            /*  GET RECORD FIELD  */
+        case SQL_DIAG_CLASS_ORIGIN:
+            if ( nBufferLength < 0 )
+                return SQL_ERROR;
+            if ( nRecord < 1 )
+                return SQL_ERROR;
+            if ( nRecord > pDia->diag_number )
+                return SQL_NO_DATA;
+
+            pDiaRec = MYODBCDiaGet( hDia, nRecord );
+            if ( !MYODBCCStrCopyOut( (SQLCHAR*)pBuffer, nBufferLength,
pDiaRec->diag_class_origin, (SQLINTEGER*)pnStrLenPtr ) )
+                return SQL_SUCCESS_WITH_INFO;
+            break;
+
+        case SQL_DIAG_COLUMN_NUMBER:
+            if ( nRecord < 1 )
+                return SQL_ERROR;
+            if ( nRecord > pDia->diag_number )
+                return SQL_NO_DATA;
+
+            pDiaRec = MYODBCDiaGet( hDia, nRecord );
+            *(SQLINTEGER*)pBuffer = pDiaRec->diag_column_number;
+            break;
+
+        case SQL_DIAG_CONNECTION_NAME:
+            if ( nBufferLength < 0 )
+                return SQL_ERROR;
+            if ( nRecord < 1 )
+                return SQL_ERROR;
+            if ( nRecord > pDia->diag_number )
+                return SQL_NO_DATA;
+
+            pDiaRec = MYODBCDiaGet( hDia, nRecord );
+            if ( !MYODBCCStrCopyOut( (SQLCHAR*)pBuffer, nBufferLength,
pDiaRec->diag_connection_name, (SQLINTEGER*)pnStrLenPtr ) )
+                return SQL_SUCCESS_WITH_INFO;
+            break;
+
+        case SQL_DIAG_MESSAGE_TEXT:
+            if ( nBufferLength < 0 )
+                return SQL_ERROR;
+            if ( nRecord < 1 )
+                return SQL_ERROR;
+            if ( nRecord > pDia->diag_number )
+                return SQL_NO_DATA;
+
+            pDiaRec = MYODBCDiaGet( hDia, nRecord );
+            if ( !MYODBCCStrCopyOut( (SQLCHAR*)pBuffer, nBufferLength,
pDiaRec->diag_message_text, (SQLINTEGER*)pnStrLenPtr ) )
+                return SQL_SUCCESS_WITH_INFO;
+            break;
+
+        case SQL_DIAG_NATIVE:
+            if ( nRecord < 1 )
+                return SQL_ERROR;
+            if ( nRecord > pDia->diag_number )
+                return SQL_NO_DATA;
+
+            pDiaRec = MYODBCDiaGet( hDia, nRecord );
+            *(SQLINTEGER*)pBuffer = pDiaRec->diag_native;
+            break;
+
+        case SQL_DIAG_ROW_NUMBER:
+            if ( nRecord < 1 )
+                return SQL_ERROR;
+            if ( nRecord > pDia->diag_number )
+                return SQL_NO_DATA;
+
+            pDiaRec = MYODBCDiaGet( hDia, nRecord );
+            *(SQLINTEGER*)pBuffer = pDiaRec->diag_row_number;
+            break;
+
+        case SQL_DIAG_SERVER_NAME:
+            if ( nBufferLength < 0 )
+                return SQL_ERROR;
+            if ( nRecord < 1 )
+                return SQL_ERROR;
+            if ( nRecord > pDia->diag_number )
+                return SQL_NO_DATA;
+
+            pDiaRec = MYODBCDiaGet( hDia, nRecord );
+            if ( !MYODBCCStrCopyOut( (SQLCHAR*)pBuffer, nBufferLength,
pDiaRec->diag_server_name, (SQLINTEGER*)pnStrLenPtr ) )
+                return SQL_SUCCESS_WITH_INFO;
+            break;
+
+        case SQL_DIAG_SQLSTATE:
+            {
+                SQLINTEGER n;
+
+                if ( nBufferLength < 0 )
+                    return SQL_ERROR;
+                if ( nRecord < 1 )
+                    return SQL_ERROR;
+                if ( nRecord > pDia->diag_number )
+                    return SQL_NO_DATA;
+
+                pDiaRec = MYODBCDiaGet( hDia, nRecord );
+                if ( !MYODBCCStrCopyOut( (SQLCHAR*)pBuffer, 
+                                         nBufferLength, 
+                                         pDiaRec->diag_sqlstate, 
+                                         &n ) )
+                {
+                    *pnStrLenPtr = (SQLSMALLINT)n;
+                    return SQL_SUCCESS_WITH_INFO;
+                }
+                *pnStrLenPtr = (SQLSMALLINT)n;
+            }
+            break;
+
+        case SQL_DIAG_SUBCLASS_ORIGIN:
+            if ( nBufferLength < 0 )
+                return SQL_ERROR;
+            if ( nRecord < 1 )
+                return SQL_ERROR;
+            if ( nRecord > pDia->diag_number )
+                return SQL_NO_DATA;
+
+            pDiaRec = MYODBCDiaGet( hDia, nRecord );
+            if ( !MYODBCCStrCopyOut( (SQLCHAR*)pBuffer, nBufferLength,
pDiaRec->diag_sqlstate, (SQLINTEGER*)pnStrLenPtr ) )
+                return SQL_SUCCESS_WITH_INFO;
+            break;
+
+        default:
+            return SQL_ERROR;
+    }
+    return SQL_SUCCESS;
+}
+
+/*!
+    \brief  Appends a diagnostic record to the given handle.
+    
+            This function is called to append a diagnostic record to the
+            given diagnostic structure. This function is called often 
+            when there are errors or warnings.
+
+            Unlike MYODBCDiaAppend2, this function does not require row 
+            or col number to be passed.
+    
+            The final message stored will conform to the format specified
+            in the ODBC specification and will result in a message larger
+            than anything provided in pszMessage. The final message MUST
+            not be larger than SQL_MAX_MESSAGE_LENGTH (typically 512 bytes).
+             
+    \param  hDia        Diagnostic handle created with MYODBCDiaAlloc.
+    \param  nState      Numeric id for an SQL state.
+    \param  diag_native Native (perhaps DBMS specific) error code.
+    \param  pszMessage  Message (if any) to be associated with 
+                        diagnostic record.
+
+    \return             SQL return code corresponding to the nState.
+
+    \sa     MYODBCDiaAppend2
+*/
+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 );
+}
+
+/*!
+    \brief  Appends a diagnostic record to the given handle.
+    
+            This function is called to append a diagnostic record to the
+            given handle. This function is called when row and/or col
+            number are relevant.
+
+            The final message stored will conform to the format specified
+            in the ODBC specification and will result in a message larger
+            than anything provided in pszMessage. The final message MUST
+            not be larger than SQL_MAX_MESSAGE_LENGTH (typically 512 bytes).
+             
+    \param  hDia            Diagnostic handle created with MYODBCDiaAlloc.
+    \param  nState          numeric id for an SQL state
+    \param  diag_native     native (perhaps DBMS specific) error code
+    \param  pszMessage      message (if any) to be associated with diagnostic record
+    \param  diag_row_number the relevant row number or SQL_NO_ROW_NUMBER
+    \param  diag_col_number the relevant col number or SQL_NO_COLUMN_NUMBER
+
+    \return                 SQL return code corresponding to the nState.
+    
+    \sa     MYODBCDiaAppend
+*/
+SQLRETURN MYODBCDia::doAppend( MYODBC_DIA_ID nState, SQLINTEGER nNative, const QString
&stringMessage, SQLINTEGER nRowNumber, SQLINTEGER nColumnNumber )
+{
+    /* sanity checks */
+    if ( nState >= MYODBC_DIA_MAX )
+        MYODBCCAssert( "nState out of range" );
+
+    MYODBCDiaRecord pdiarecord = new MYODBCDiaRecord( this, nState );
+    pdiarecord->setConnectionName( "unknown connection name" );     /*! \todo get real
connection name  */
+    pdiarecord->setServerName( "unknown server name" );             /*! \todo get real
server name      */
+    pdiarecord->setColumnNumber( nColumnNumber );
+    pdiarecord->setRowNumber( nRowNumber );
+    pdiarecord->setMessage( stringMessage );
+
+    return MYODBCDia_pStates[nState].diag_returncode;
+}
+
+/*!
+    \brief  Clears the diagnostic information for the given handle.
+    
+            This function is called at most entry points to the ODBC 
+            API to clear diagnostic information from a previous call 
+            to the ODBC API.
+    
+    \param  hDia    Diagnostic handle created with MYODBCDiaAlloc.
+
+    \sa     MYODBCDiaAlloc
+            MYODBCDiaFree
+*/
+void MYODBCDia::clear()
+{
+    /* delete any records we may have */
+    while (!listRecords.isEmpty())
+        delete listRecords.takeFirst();
+
+    /*
+        \internal ODBC Rule
+
+        When SQLExecute, SQLExecDirect, SQLBulkOperations, SQLSetPos, or 
+        SQLMoreResults is called, the SQL_DIAG_ROW_COUNT field of the 
+        diagnostic data structure is set to the row count, and the row 
+        count is cached in an implementation-dependent way. SQLRowCount 
+        returns the cached row count value. The cached row count value is 
+        valid until the statement handle is set back to the prepared or 
+        allocated state, the statement is reexecuted, or SQLCloseCursor is 
+        called. Note that if a function has been called since the 
+        SQL_DIAG_ROW_COUNT field was set, the value returned by SQLRowCount 
+        might be different from the value in the SQL_DIAG_ROW_COUNT field 
+        because the SQL_DIAG_ROW_COUNT field is reset to 0 by any function 
+        call.
+
+        see SQLRowCount
+    */      
+    nRowCount = 0;
+
+    /*
+        \internal MYODBC Rule
+
+        It is assumed, by the \internal ODBC Rule on diag_row_count that we should
+        reinit all dia fields with the exception of;
+          diag_connection_name
+          diag_server_name 
+    */      
+    nCursorRowCount      = 0;
+    nDynamicFunctionCode = SQL_DIAG_UNKNOWN_STATEMENT;
+    nReturnCode          = SQL_SUCCESS;
+}
+
+bool MYODBCDia::doDelete( SQLSMALLINT nRecord /* 1 based */ )
+{
+    if ( nRecord < 1 || nRecord > listRecords.count() )
+        return false;
+
+    delete listRecords[nRecord - 1];
+}
+
+/*!
+    \internal
+    \brief  Dumps the contents to stream.
+
+            This is useful for debugging.
+
+    \param  
+*/  
+QTextStream &operator<<( QTextStream &stream, const MYODBCDia &rval )
+{
+    stream << "DIAGNOSTIC..." << endl;
+    stream << "SQL_DIAG_CURSOR_ROW_COUNT     : " << rval.nCursorRowCount
<< endl;
+    stream << "SQL_DIAG_DYNAMIC_FUNCTION_CODE: " << rval.nDynamicFunctionCode
<< endl;
+    stream << "SQL_DIAG_NUMBER               : " << rval.listRecords.count()
<< endl;
+    stream << "SQL_DIAG_RETURNCODE           : " << rval.nReturnCode <<
endl;
+    stream << "SQL_DIAG_ROW_COUNT            : " << rval.nRowCount <<
endl;
+
+    QListIterator<MYODBCDiaRecord*> i( listRecords );
+    while ( i.hasNext() )
+    {
+        stream << "Record..." << endl;
+        stream << i.next();
+    }
+
+    return stream;
+}
+

Deleted: MYODBCDia/MYODBCDiaLib/MYODBCDiaAlloc.c
===================================================================
--- MYODBCDia/MYODBCDiaLib/MYODBCDiaAlloc.c	2005-12-29 04:08:17 UTC (rev 20)
+++ MYODBCDia/MYODBCDiaLib/MYODBCDiaAlloc.c	2005-12-29 09:54:08 UTC (rev 21)
@@ -1,183 +0,0 @@
-/*! 
-    \internal
-    \file     MYODBCDiaAlloc.c
-    \author   Peter Harvey <pharvey@stripped>
-              Copyright MySQL AB 2004-2005 Released under GPL.
-    \version  Connector/ODBC v5
-    \date     2005          
-    \brief    This code is used to support diagnostic information
-              associated with various handles.
-
-    This code is for internal use and as such is for MyODBC 
-    developers only. 
-*/
-
-#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}
-};
-
-
-MYODBC_DIA_HANDLE MYODBCDiaAlloc()
-{
-    MYODBC_DIA_PTR pDia = (MYODBC_DIA_PTR)MYODBCCCalloc( 1, sizeof(MYODBC_DIA) );
-
-    pDia->nTypeID                    = MYODBC_RTTI_DIA;
-    pDia->diag_cursor_row_count      = 0;
-    pDia->diag_dynamic_function      = NULL;
-    pDia->diag_dynamic_function_code = SQL_DIAG_UNKNOWN_STATEMENT;
-    pDia->diag_number                = 0;
-    pDia->diag_returncode            = SQL_SUCCESS;
-    pDia->diag_row_count             = 0;
-
-    /*!
-        \internal ODBC Rule
-
-        A string that indicates the name of the connection that the diagnostic 
-        record relates to. This field is driver-defined. For diagnostic data 
-        structures associated with the environment handle and for diagnostics 
-        that do not relate to any connection, this field is a zero-length string.
-    */    
-    pDia->diag_connection_name       = MYODBCCStrDup( "", SQL_NTS );
-    pDia->diag_server_name           = MYODBCCStrDup( "", SQL_NTS );
-
-    /* Allocate and initialize a dynamic array of records. */
-    MYODBCArrayAlloc( &pDia->hRecords );
-    MYODBCArraySetCacheStep( pDia->hRecords, 50 );
-    MYODBCArraySetFreeFunc( pDia->hRecords, MYODBCDiaRecFree );
-
-    return pDia;
-}
-
-

Deleted: MYODBCDia/MYODBCDiaLib/MYODBCDiaAppend.c
===================================================================
--- MYODBCDia/MYODBCDiaLib/MYODBCDiaAppend.c	2005-12-29 04:08:17 UTC (rev 20)
+++ MYODBCDia/MYODBCDiaLib/MYODBCDiaAppend.c	2005-12-29 09:54:08 UTC (rev 21)
@@ -1,25 +0,0 @@
-/*! 
-    \internal
-    \file     MYODBCDiaAppend.c
-    \author   Peter Harvey <pharvey@stripped>
-              Copyright MySQL AB 2004-2005 Released under GPL.
-    \version  Connector/ODBC v5
-    \date     2005          
-    \brief    This code is used to support diagnostic information
-              associated with various handles.
-
-    This code is for internal use and as such is for MyODBC 
-    developers only. 
-*/
-
-#include "MYODBCDiaInternal.h"
-
-SQLRETURN MYODBCDiaAppend( MYODBC_DIA_HANDLE    hDia, 
-                           MYODBC_DIA_ID        nState, 
-                           SQLINTEGER           diag_native, 
-                           SQLCHAR *            pszMessage )
-{
-    return MYODBCDiaAppend2( hDia, nState, diag_native, pszMessage, SQL_NO_ROW_NUMBER,
SQL_NO_COLUMN_NUMBER );
-}
-
-

Deleted: MYODBCDia/MYODBCDiaLib/MYODBCDiaAppend2.c
===================================================================
--- MYODBCDia/MYODBCDiaLib/MYODBCDiaAppend2.c	2005-12-29 04:08:17 UTC (rev 20)
+++ MYODBCDia/MYODBCDiaLib/MYODBCDiaAppend2.c	2005-12-29 09:54:08 UTC (rev 21)
@@ -1,76 +0,0 @@
-/*! 
-    \internal
-    \file     MYODBCDiaAppend2.c
-    \author   Peter Harvey <pharvey@stripped>
-              Copyright MySQL AB 2004-2005 Released under GPL.
-    \version  Connector/ODBC v5
-    \date     2005          
-    \brief    This code is used to support diagnostic information
-              associated with various handles.
-
-    This code is for internal use and as such is for MyODBC 
-    developers only. 
-*/
-
-#include "MYODBCDiaInternal.h"
-
-SQLRETURN MYODBCDiaAppend2( MYODBC_DIA_HANDLE   hDia, 
-                            MYODBC_DIA_ID       nState, 
-                            SQLINTEGER          diag_native, 
-                            SQLCHAR *           pszMessage, 
-                            SQLINTEGER          diag_row_number, 
-                            SQLINTEGER          diag_column_number )
-{
-    MYODBC_DIA_PTR      pDia        = (MYODBC_DIA_PTR)hDia;
-    MYODBC_DIA_REC_PTR  pDiaRec     = NULL;
-
-#if MYODBC_DEV > 0
-    /* sanity check on args as we are an entry point */
-    if ( !hDia )
-        MYODBCCAssert( "hDia" );
-    if ( MYODBCRttiType( hDia ) != MYODBC_RTTI_DIA )
-        MYODBCCAssert( "hDia" );
-#endif
-
-    /* \todo this probably needs to be revisited - perhaps no need to die */
-    if ( nState >= MYODBC_DIA_MAX )
-        MYODBCCAssert( "nState out of range" );
-
-/*
-    if ( !pDia )
-    {
-        MYODBCCfprintf( stderr, "[%s][%s %s] %s", MYODBC_VENDOR, MYODBC_NAME,
MYODBC_VERSION, pszMessage );
-        return MYODBCDia_pStates[nState].diag_returncode;
-    }
-*/
-
-    pDiaRec = MYODBCDiaRecAlloc( pDia, nState );
-    pDiaRec->diag_connection_name = MYODBCCStrDup( MYODBCDiaConnectionName(
pDia->diag_connection_name ), SQL_NTS);
-    pDiaRec->diag_server_name     = MYODBCCStrDup( MYODBCDiaServerName(
pDia->diag_server_name ), SQL_NTS);
-    pDiaRec->diag_column_number   = diag_column_number;
-    pDiaRec->diag_row_number      = diag_row_number;
-
-    /* 
-        \todo Create formatted message when requested? 
-    */
-    if ( diag_native )
-    {
-        /* server message */
-        if ( pszMessage )
-            sprintf( (char*)pDiaRec->diag_message_text, "[%s][%s %s][%s] %d %s",
MYODBC_VENDOR, MYODBC_NAME, MYODBC_DRIVER_VER, MYODBC_VENDOR, (int)diag_native,
pszMessage );
-        else
-            sprintf( (char*)pDiaRec->diag_message_text, "[%s][%s %s][%s] %d %s",
MYODBC_VENDOR, MYODBC_NAME, MYODBC_DRIVER_VER, MYODBC_VENDOR, (int)diag_native,
MYODBCDia_pStates[nState].diag_text );
-    }
-    else
-    {
-        /* driver message */
-        if ( pszMessage )
-            sprintf( (char*)pDiaRec->diag_message_text, "[%s][%s %s][%s] %s",
MYODBC_VENDOR, MYODBC_NAME, MYODBC_DRIVER_VER, MYODBCDia_pStates[nState].diag_sqlstate,
pszMessage );
-        else
-            sprintf( (char*)pDiaRec->diag_message_text, "[%s][%s %s][%s] %s",
MYODBC_VENDOR, MYODBC_NAME, MYODBC_DRIVER_VER, MYODBCDia_pStates[nState].diag_sqlstate,
MYODBCDia_pStates[nState].diag_text );
-    }
-
-    return MYODBCDia_pStates[nState].diag_returncode;
-}
-
-

Deleted: MYODBCDia/MYODBCDiaLib/MYODBCDiaClear.c
===================================================================
--- MYODBCDia/MYODBCDiaLib/MYODBCDiaClear.c	2005-12-29 04:08:17 UTC (rev 20)
+++ MYODBCDia/MYODBCDiaLib/MYODBCDiaClear.c	2005-12-29 09:54:08 UTC (rev 21)
@@ -1,68 +0,0 @@
-/*! 
-    \internal
-    \file     MYODBCDiaClear.c
-    \author   Peter Harvey <pharvey@stripped>
-              Copyright MySQL AB 2004-2005 Released under GPL.
-    \version  Connector/ODBC v5
-    \date     2005          
-    \brief    This code is used to support diagnostic information
-              associated with various handles.
-
-    This code is for internal use and as such is for MyODBC 
-    developers only. 
-*/
-
-#include "MYODBCDiaInternal.h"
-
-void MYODBCDiaClear( MYODBC_DIA_HANDLE hDia )
-{
-    MYODBC_DIA_PTR pDia = (MYODBC_DIA_PTR)hDia;
-
-#if MYODBC_DEV > 0
-    /* sanity check on args as we are an entry point */
-    if ( !hDia )
-        MYODBCCAssert( "hDia" );
-    if ( MYODBCRttiType( hDia ) != MYODBC_RTTI_DIA )
-        MYODBCCAssert( "hDia" );
-#endif
-
-    /* delete any records we may have (call-back will free mem for us) */
-    MYODBCArrayClear( pDia->hRecords );
-
-    /*
-        \internal ODBC Rule
-      
-        When SQLExecute, SQLExecDirect, SQLBulkOperations, SQLSetPos, or 
-        SQLMoreResults is called, the SQL_DIAG_ROW_COUNT field of the 
-        diagnostic data structure is set to the row count, and the row 
-        count is cached in an implementation-dependent way. SQLRowCount 
-        returns the cached row count value. The cached row count value is 
-        valid until the statement handle is set back to the prepared or 
-        allocated state, the statement is reexecuted, or SQLCloseCursor is 
-        called. Note that if a function has been called since the 
-        SQL_DIAG_ROW_COUNT field was set, the value returned by SQLRowCount 
-        might be different from the value in the SQL_DIAG_ROW_COUNT field 
-        because the SQL_DIAG_ROW_COUNT field is reset to 0 by any function 
-        call.
-        
-        see SQLRowCount
-    */      
-    pDia->diag_row_count = 0;
-
-    /*
-        \internal MYODBC Rule
-        
-        It is assumed, by the \internal ODBC Rule on diag_row_count that we should
-        reinit all dia fields with the exception of;
-          diag_connection_name
-          diag_server_name 
-    */      
-    pDia->diag_cursor_row_count      = 0;
-    pDia->diag_dynamic_function      = NULL;
-    pDia->diag_dynamic_function_code = SQL_DIAG_UNKNOWN_STATEMENT;
-    pDia->diag_number                = 0;           /* this should already be 0 but
just in case */
-    pDia->diag_returncode            = SQL_SUCCESS;
-}
-
-
-

Deleted: MYODBCDia/MYODBCDiaLib/MYODBCDiaDelete.c
===================================================================
--- MYODBCDia/MYODBCDiaLib/MYODBCDiaDelete.c	2005-12-29 04:08:17 UTC (rev 20)
+++ MYODBCDia/MYODBCDiaLib/MYODBCDiaDelete.c	2005-12-29 09:54:08 UTC (rev 21)
@@ -1,34 +0,0 @@
-/*! 
-    \internal
-    \file     MYODBCDiaDelete.c
-    \author   Peter Harvey <pharvey@stripped>
-              Copyright MySQL AB 2004-2005 Released under GPL.
-    \version  Connector/ODBC v5
-    \date     2005          
-    \brief    This code is used to support diagnostic information
-              associated with various handles.
-
-    This code is for internal use and as such is for MyODBC 
-    developers only. 
-*/
-
-#include "MYODBCDiaInternal.h"
-
-void MYODBCDiaDelete( MYODBC_DIA_HANDLE hDia, SQLSMALLINT nRecord )
-{
-    MYODBC_DIA_PTR pDia = (MYODBC_DIA_PTR)hDia;
-
-#if MYODBC_DEV > 0
-    /* sanity check on args as we are an entry point */
-    if ( !hDia || MYODBCRttiType( hDia ) != MYODBC_RTTI_DIA )
-        MYODBCCAssert( "hDia" );
-#endif
-
-    /* delete record (call-back will free mem for us) */
-    MYODBCArrayDeleteExt( pDia->hRecords, nRecord - 1 );
-
-    pDia->diag_number -= 1;
-}
-
-
-

Deleted: MYODBCDia/MYODBCDiaLib/MYODBCDiaDump.c
===================================================================
--- MYODBCDia/MYODBCDiaLib/MYODBCDiaDump.c	2005-12-29 04:08:17 UTC (rev 20)
+++ MYODBCDia/MYODBCDiaLib/MYODBCDiaDump.c	2005-12-29 09:54:08 UTC (rev 21)
@@ -1,66 +0,0 @@
-/*! 
-    \internal
-    \file     MYODBCDiaDump.c
-    \author   Peter Harvey <pharvey@stripped>
-              Copyright MySQL AB 2004-2005 Released under GPL.
-    \version  Connector/ODBC v5
-    \date     2005
-    \brief    This code is used to support diagnostic information
-              associated with various handles.
-*/
-
-#include "MYODBCDiaInternal.h"
-
-/* lets tap into the Array internals */
-#include "../../MYODBCArray/MYODBCArrayLib/MYODBCArrayInternal.h"
-
-SQLRETURN MYODBCDiaDump( MYODBC_DIA_HANDLE hDia )
-{
-    MYODBC_DIA_PTR pDia = (MYODBC_DIA_PTR)hDia;
-
-#if MYODBC_DEV > 0
-    if ( !hDia || MYODBCRttiType( hDia ) != MYODBC_RTTI_DIA )
-        MYODBCCAssert( "hDia" );
-#endif
-
-    printf( "[%s][%d] HEADER...\n", __FILE__, __LINE__ );
-    printf( "\tdiag_connection_name       = %s\n", pDia->diag_connection_name );
-    printf( "\tdiag_cursor_row_count      = %ld\n", pDia->diag_cursor_row_count );
-    printf( "\tdiag_dynamic_function      = %s\n", pDia->diag_dynamic_function );
-    printf( "\tdiag_dynamic_function_code = %ld\n", pDia->diag_dynamic_function_code
);
-    printf( "\tdiag_number                = %ld\n", pDia->diag_number );
-    printf( "\tdiag_returncode            = %d\n", pDia->diag_returncode );
-    printf( "\tdiag_row_count             = %ld\n", pDia->diag_row_count );
-    printf( "\tdiag_server_name           = %s\n", pDia->diag_server_name );
-    printf( "[%s][%d] RECORDS...\n", __FILE__, __LINE__ );
-
-    if ( pDia->hRecords )
-    {
-        MYODBC_ARRAY_PTR    pArray = (MYODBC_ARRAY_PTR)pDia->hRecords;
-        MYODBC_C_ULONGLONG  nItem;
-        
-        for ( nItem = 0; nItem < pArray->nItems; nItem++ )
-        {
-            MYODBC_DIA_REC_PTR pRec = (MYODBC_DIA_REC_PTR)pArray->ppItems[nItem];
-            printf( "\t%ld\n", (long)nItem );
-            printf( "\t\tdiag_class_origin      = %s\n", pRec->diag_class_origin );
-            printf( "\t\tdiag_column_number     = %ld\n", pRec->diag_column_number );
-            printf( "\t\tdiag_connection_name   = %s\n", pRec->diag_connection_name );
-            printf( "\t\tdiag_message_text      = %s\n", pRec->diag_message_text );
-            printf( "\t\tdiag_native            = %ld\n", pRec->diag_native );
-            printf( "\t\tdiag_row_number        = %ld\n", pRec->diag_row_number );
-            printf( "\t\tdiag_server_name       = %s\n", pRec->diag_server_name );
-            printf( "\t\tdiag_sqlstate          = %s\n", pRec->diag_sqlstate );
-            printf( "\t\tdiag_subclass_origin   = %s\n", pRec->diag_subclass_origin );
-        }
-        if ( !nItem )
-            printf( "\tno records in array\n" );
-    }
-    else
-        printf( "\tno valid array handle for records\n" );
-
-    return SQL_SUCCESS;
-}
-
-
-

Deleted: MYODBCDia/MYODBCDiaLib/MYODBCDiaFree.c
===================================================================
--- MYODBCDia/MYODBCDiaLib/MYODBCDiaFree.c	2005-12-29 04:08:17 UTC (rev 20)
+++ MYODBCDia/MYODBCDiaLib/MYODBCDiaFree.c	2005-12-29 09:54:08 UTC (rev 21)
@@ -1,39 +0,0 @@
-/*! 
-    \internal
-    \file     MYODBCDiaFree.c
-    \author   Peter Harvey <pharvey@stripped>
-              Copyright MySQL AB 2004-2005 Released under GPL.
-    \version  Connector/ODBC v5
-    \date     2005          
-    \brief    This code is used to support diagnostic information
-              associated with various handles.
-
-    This code is for internal use and as such is for MyODBC 
-    developers only. 
-*/
-
-#include "MYODBCDiaInternal.h"
-
-void MYODBCDiaFree( MYODBC_DIA_HANDLE hDia )
-{
-    MYODBC_DIA_PTR pDia = (MYODBC_DIA_PTR)hDia;
-
-#if MYODBC_DEV > 0
-    /* sanity check on args as we are an entry point */
-    if ( !hDia || MYODBCRttiType( hDia ) != MYODBC_RTTI_DIA )
-        MYODBCCAssert( "hDia" );
-#endif
-
-    /* delete any records */
-    MYODBCDiaClear( hDia );
-    MYODBCArrayFree( pDia->hRecords );
-
-    /* these are not cleared so do now */
-    MYODBCCFree( pDia->diag_connection_name );
-    MYODBCCFree( pDia->diag_server_name );
-
-    /* free dia itself */
-    MYODBCCFree( pDia );
-}
-
-

Deleted: MYODBCDia/MYODBCDiaLib/MYODBCDiaGet.c
===================================================================
--- MYODBCDia/MYODBCDiaLib/MYODBCDiaGet.c	2005-12-29 04:08:17 UTC (rev 20)
+++ MYODBCDia/MYODBCDiaLib/MYODBCDiaGet.c	2005-12-29 09:54:08 UTC (rev 21)
@@ -1,44 +0,0 @@
-/*! 
-    \internal
-    \file     MYODBCDiaGet.c
-    \author   Peter Harvey <pharvey@stripped>
-              Copyright     MySQL AB 2004-2005 Released under GPL.
-    \version  Connector/ODBC v5
-    \date     2005          
-    \brief    This code is used to support diagnostic information
-              associated with various handles.
-
-    This code is for internal use and as such is for MyODBC 
-    developers only. 
-*/
-
-#include "MYODBCDiaInternal.h"
-
-MYODBC_DIA_REC_HANDLE MYODBCDiaGet( MYODBC_DIA_HANDLE   hDia, 
-                                    SQLSMALLINT         nRecord /* 1 based */ )
-{
-    MYODBC_DIA_PTR              pDia    = (MYODBC_DIA_PTR)hDia;
-    MYODBC_ARRAY_ITEM_DATA_PTR  pData;
-
-#if MYODBC_DEV > 0
-    /* sanity check on args as we are an entry point */
-    if ( !hDia || MYODBCRttiType( hDia ) != MYODBC_RTTI_DIA )
-        MYODBCCAssert( "hDia" );
-#endif
-
-    /* is nRecord below the array we have     */
-    if ( nRecord < 1 )
-        return NULL;
-
-    /* is nRecord above the array we have     */
-    if ( nRecord > pDia->diag_number )
-        return NULL;
-
-    /* return the record                      */
-    nRecord--; /* make 0 based */
-    MYODBCArrayGetExt( pDia->hRecords, nRecord, &pData );
-
-    return pData;
-}
-
-

Deleted: MYODBCDia/MYODBCDiaLib/MYODBCDiaGetField.c
===================================================================
--- MYODBCDia/MYODBCDiaLib/MYODBCDiaGetField.c	2005-12-29 04:08:17 UTC (rev 20)
+++ MYODBCDia/MYODBCDiaLib/MYODBCDiaGetField.c	2005-12-29 09:54:08 UTC (rev 21)
@@ -1,198 +0,0 @@
-/*! 
-    \internal
-    \file     MYODBCDrvGetField.c
-    \author   Peter Harvey <pharvey@stripped>
-              Copyright MySQL AB 2004-2005 Released under GPL.
-    \version  Connector/ODBC v5
-    \date     2005          
-    \brief    This code is used to support diagnostic information
-              associated with various handles.
-
-    This code is for internal use and as such is for MyODBC 
-    developers only. 
-*/
-
-#include "MYODBCDiaInternal.h"
-
-SQLRETURN MYODBCDiaGetField( MYODBC_DIA_HANDLE  hDia,
-                             SQLSMALLINT        nRecord,
-                             SQLSMALLINT        nField,
-                             SQLPOINTER         pBuffer,
-                             SQLSMALLINT        nBufferLength,
-                             SQLSMALLINT *      pnStrLenPtr )
-{
-    MYODBC_DIA_PTR      pDia = (MYODBC_DIA_PTR)hDia;
-    MYODBC_DIA_REC_PTR  pDiaRec;
-    SQLSMALLINT         nStrLen;
-
-#if MYODBC_DEV > 0
-    if ( !hDia )
-        MYODBCCAssert( "hDia" );
-    if ( MYODBCRttiType( hDia ) != MYODBC_RTTI_DIA )
-        MYODBCCAssert( "hDia" );
-#endif
-
-    /* use dummy when no pnStrLenPtr */
-    if ( !pnStrLenPtr )
-        pnStrLenPtr = &nStrLen;
-
-    /* 
-        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 = pDia->diag_cursor_row_count;
-            break;
-
-        case SQL_DIAG_DYNAMIC_FUNCTION:
-            if ( !MYODBCCStrCopyOut( (SQLCHAR*)pBuffer, nBufferLength,
pDia->diag_dynamic_function, (SQLINTEGER*)pnStrLenPtr ) )
-                return SQL_SUCCESS_WITH_INFO;
-            break;
-
-        case SQL_DIAG_DYNAMIC_FUNCTION_CODE:
-            *(SQLINTEGER*)pBuffer = pDia->diag_dynamic_function_code;
-            break;
-
-        case SQL_DIAG_NUMBER:
-            *(SQLINTEGER*)pBuffer = pDia->diag_number;
-            break;
-
-        case SQL_DIAG_RETURNCODE:
-            *(SQLRETURN*)pBuffer = pDia->diag_returncode;
-            break;
-
-        case SQL_DIAG_ROW_COUNT:
-            *(SQLINTEGER*)pBuffer = pDia->diag_row_count;
-            break;
-
-            /*  GET RECORD FIELD  */
-        case SQL_DIAG_CLASS_ORIGIN:
-            if ( nBufferLength < 0 )
-                return SQL_ERROR;
-            if ( nRecord < 1 )
-                return SQL_ERROR;
-            if ( nRecord > pDia->diag_number )
-                return SQL_NO_DATA;
-
-            pDiaRec = MYODBCDiaGet( hDia, nRecord );
-            if ( !MYODBCCStrCopyOut( (SQLCHAR*)pBuffer, nBufferLength,
pDiaRec->diag_class_origin, (SQLINTEGER*)pnStrLenPtr ) )
-                return SQL_SUCCESS_WITH_INFO;
-            break;
-
-        case SQL_DIAG_COLUMN_NUMBER:
-            if ( nRecord < 1 )
-                return SQL_ERROR;
-            if ( nRecord > pDia->diag_number )
-                return SQL_NO_DATA;
-
-            pDiaRec = MYODBCDiaGet( hDia, nRecord );
-            *(SQLINTEGER*)pBuffer = pDiaRec->diag_column_number;
-            break;
-
-        case SQL_DIAG_CONNECTION_NAME:
-            if ( nBufferLength < 0 )
-                return SQL_ERROR;
-            if ( nRecord < 1 )
-                return SQL_ERROR;
-            if ( nRecord > pDia->diag_number )
-                return SQL_NO_DATA;
-
-            pDiaRec = MYODBCDiaGet( hDia, nRecord );
-            if ( !MYODBCCStrCopyOut( (SQLCHAR*)pBuffer, nBufferLength,
pDiaRec->diag_connection_name, (SQLINTEGER*)pnStrLenPtr ) )
-                return SQL_SUCCESS_WITH_INFO;
-            break;
-
-        case SQL_DIAG_MESSAGE_TEXT:
-            if ( nBufferLength < 0 )
-                return SQL_ERROR;
-            if ( nRecord < 1 )
-                return SQL_ERROR;
-            if ( nRecord > pDia->diag_number )
-                return SQL_NO_DATA;
-
-            pDiaRec = MYODBCDiaGet( hDia, nRecord );
-            if ( !MYODBCCStrCopyOut( (SQLCHAR*)pBuffer, nBufferLength,
pDiaRec->diag_message_text, (SQLINTEGER*)pnStrLenPtr ) )
-                return SQL_SUCCESS_WITH_INFO;
-            break;
-
-        case SQL_DIAG_NATIVE:
-            if ( nRecord < 1 )
-                return SQL_ERROR;
-            if ( nRecord > pDia->diag_number )
-                return SQL_NO_DATA;
-
-            pDiaRec = MYODBCDiaGet( hDia, nRecord );
-            *(SQLINTEGER*)pBuffer = pDiaRec->diag_native;
-            break;
-
-        case SQL_DIAG_ROW_NUMBER:
-            if ( nRecord < 1 )
-                return SQL_ERROR;
-            if ( nRecord > pDia->diag_number )
-                return SQL_NO_DATA;
-
-            pDiaRec = MYODBCDiaGet( hDia, nRecord );
-            *(SQLINTEGER*)pBuffer = pDiaRec->diag_row_number;
-            break;
-
-        case SQL_DIAG_SERVER_NAME:
-            if ( nBufferLength < 0 )
-                return SQL_ERROR;
-            if ( nRecord < 1 )
-                return SQL_ERROR;
-            if ( nRecord > pDia->diag_number )
-                return SQL_NO_DATA;
-
-            pDiaRec = MYODBCDiaGet( hDia, nRecord );
-            if ( !MYODBCCStrCopyOut( (SQLCHAR*)pBuffer, nBufferLength,
pDiaRec->diag_server_name, (SQLINTEGER*)pnStrLenPtr ) )
-                return SQL_SUCCESS_WITH_INFO;
-            break;
-
-        case SQL_DIAG_SQLSTATE:
-            {
-                SQLINTEGER n;
-
-                if ( nBufferLength < 0 )
-                    return SQL_ERROR;
-                if ( nRecord < 1 )
-                    return SQL_ERROR;
-                if ( nRecord > pDia->diag_number )
-                    return SQL_NO_DATA;
-
-                pDiaRec = MYODBCDiaGet( hDia, nRecord );
-                if ( !MYODBCCStrCopyOut( (SQLCHAR*)pBuffer, 
-                                         nBufferLength, 
-                                         pDiaRec->diag_sqlstate, 
-                                         &n ) )
-                {
-                    *pnStrLenPtr = (SQLSMALLINT)n;
-                    return SQL_SUCCESS_WITH_INFO;
-                }
-                *pnStrLenPtr = (SQLSMALLINT)n;
-            }
-            break;
-
-        case SQL_DIAG_SUBCLASS_ORIGIN:
-            if ( nBufferLength < 0 )
-                return SQL_ERROR;
-            if ( nRecord < 1 )
-                return SQL_ERROR;
-            if ( nRecord > pDia->diag_number )
-                return SQL_NO_DATA;
-
-            pDiaRec = MYODBCDiaGet( hDia, nRecord );
-            if ( !MYODBCCStrCopyOut( (SQLCHAR*)pBuffer, nBufferLength,
pDiaRec->diag_sqlstate, (SQLINTEGER*)pnStrLenPtr ) )
-                return SQL_SUCCESS_WITH_INFO;
-            break;
-
-        default:
-            return SQL_ERROR;
-    }
-
-    return SQL_SUCCESS;
-}
-
-

Modified: MYODBCDia/MYODBCDiaLib/MYODBCDiaInternal.h
===================================================================
--- MYODBCDia/MYODBCDiaLib/MYODBCDiaInternal.h	2005-12-29 04:08:17 UTC (rev 20)
+++ MYODBCDia/MYODBCDiaLib/MYODBCDiaInternal.h	2005-12-29 09:54:08 UTC (rev 21)
@@ -32,165 +32,8 @@
 #ifndef MYODBC_DIA_INTERNAL_H
 #define MYODBC_DIA_INTERNAL_H
 
-#include <MYODBCRtti.h>
-
 #include "../include/MYODBCDia.h"
 
-#define MYODBCDiaConnectionName( a ) (a ? a : (SQLCHAR*)"unknown")
-#define MYODBCDiaServerName( a ) (a ? a : (SQLCHAR*)"unknown")
-
-/*!
-    \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
-{
-  SQLCHAR * diag_class_origin;
-  SQLCHAR * diag_sqlstate;
-  SQLCHAR * diag_class;
-  SQLCHAR * diag_text;
-  SQLRETURN diag_returncode;
-
-} MYODBC_DIA_STATE;
-
-extern MYODBC_DIA_STATE MYODBCDia_pStates[];
-
-/*!
-    \internal
-    \brief  This is the main handle for diagnostic information.
-    
-            This contains the diagnostic header fields and 0 - n 
-            diagnostic records. Each; environment, connection, statement
-            and descriptor handle has one of these. 
-*/
-typedef struct tMYODBC_DIA
-{
-    MYODBC_RTTI_TYPE    nTypeID;                    /*!< runtime type id              
                                               */
-    SQLINTEGER          diag_cursor_row_count;      /*!< Count of rows in the cursor. 
                                               */
-    SQLCHAR *           diag_dynamic_function;      /*!< String indicating type of SQL
executed (ie "UPDATE WHERE")                   */
-    SQLINTEGER          diag_dynamic_function_code; /*!< Code indicating type of SQL
executed (ie SQL_DIAG_UPDATE_WHERE)              */
-    SQLINTEGER          diag_number;                /*!< The number of status records
in records array.                               */
-    SQLRETURN           diag_returncode;            /*!< Return code (as in SQLRETURN)
returned by the function.                      */
-    SQLINTEGER          diag_row_count;             /*!< The number of rows affected
by an insert, delete, or update.                 */
-    SQLCHAR *           diag_connection_name;       /*!< This is dbc->server.      
                                                  */
-    SQLCHAR *           diag_server_name;           /*!< This is dbc->dsn. Same as
SQL_DATA_SOURCE_NAME in SQLGetInfo().              */
-
-    MYODBC_ARRAY_HANDLE hRecords;                   /*!< An array of
MYODBC_DIA_REC_PTR.                                              */
-
-} MYODBC_DIA;
-
-/*!
-    \internal
-    \brief  Diagnostic pointer.
-
-            This is for convenience and code clarity.
-*/    
-typedef MYODBC_DIA *MYODBC_DIA_PTR;
-
-/*!
-    \internal
-    \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.
-*/    
-typedef struct tMYODBC_DIA_REC
-{
-    MYODBC_RTTI_TYPE    nTypeID;                                    /*!< runtime type
id                                                        */
-    SQLCHAR *           diag_class_origin;                          /*!< Doc that
defines the class portion of the SQLSTATE val in this rec.    */
-    SQLINTEGER          diag_column_number;                         /*!< Col num in
the result set or the param num in the set of parameters.   */
-    SQLCHAR *           diag_connection_name;                       /*!< This is
dbc->server.                                                   */
-    SQLCHAR             diag_message_text[SQL_MAX_MESSAGE_LENGTH];  /*!< A, formatted,
informational message on the error or warning.           */
-    SQLINTEGER          diag_native;                                /*!< A driver/data
source-    SQLINTEGER          diag_row_number;                            /*!< Row num in
the rowset, or the param num in the set of parameters.      */
-    SQLCHAR *           diag_server_name;                           /*!< This is
dbc->dsn. Same as SQL_DATA_SOURCE_NAME in SQLGetInfo().        */
-    SQLCHAR *           diag_sqlstate;                              /*!< A
five-character SQLSTATE diagnostic code.                             */
-    SQLCHAR *           diag_subclass_origin;                       /*!< */
-
-    MYODBC_DIA_PTR      pOwner;                                     /*!< Diagnostic
which owns us - we do not exist without it.                 */
-
-} MYODBC_DIA_REC;
-
-/*!
-    \internal
-    \brief  Diagnostic record pointer.
-
-            This is for convenience and code clarity.
-*/    
-typedef MYODBC_DIA_REC *MYODBC_DIA_REC_PTR;
-
-
-/*!
-    \internal
-    \brief  Dumps debugging info to stdout.
-
-            This function can be used when debugging this library.
-
-    \param  hDia  Diagnostic handle (must be a valid handle).
-
-    \return SQLRETURN
-
-    \retval SQL_SUCCESS
-    \retval SQL_ERROR
-*/            
-SQLRETURN MYODBCDiaDump( MYODBC_DIA_HANDLE hDia );
-
-/*!
-    \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
-*/    
-MYODBC_DIA_REC_PTR MYODBCDiaRecAlloc( MYODBC_DIA_PTR    pDiagnostic, 
-                                      MYODBC_DIA_ID     nState );
-
-/*!
-    \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
-*/    
-void MYODBCDiaRecFree( void *pDiaRec );
-
 #endif
 
 

Modified: MYODBCDia/MYODBCDiaLib/MYODBCDiaLib.pro
===================================================================
--- MYODBCDia/MYODBCDiaLib/MYODBCDiaLib.pro	2005-12-29 04:08:17 UTC (rev 20)
+++ MYODBCDia/MYODBCDiaLib/MYODBCDiaLib.pro	2005-12-29 09:54:08 UTC (rev 21)
@@ -7,10 +7,12 @@
 include( ../../common.pri )
 include( ../../config.pri )
 include( ../../defines.pri )
+include( ../../odbc.pri )
 CONFIG		+= staticlib
+CONFIG		+= console
 INCLUDEPATH	+= ../../MYODBCC/include
-INCLUDEPATH	+= ../../MYODBCRtti/include
-INCLUDEPATH	+= ../../MYODBCArray/include
+INCLUDEPATH	+= ../../MYODBCDbg/include
+INCLUDEPATH	+= ../include
 
 # #########################################################
 # UNIX
@@ -33,19 +35,10 @@
 # #########################################################
 HEADERS		= \
 		../include/MYODBCDia.h \
+		../include/MYODBCDiaRecord.h \
 		MYODBCDiaInternal.h
 
 SOURCES		= \
-		MYODBCDiaAlloc.c \
-		MYODBCDiaAppend.c \
-		MYODBCDiaAppend2.c \
-		MYODBCDiaClear.c \
-		MYODBCDiaDelete.c \
-		MYODBCDiaDump.c \
-		MYODBCDiaFree.c \
-		MYODBCDiaGet.c \
-		MYODBCDiaGetField.c \
-		MYODBCDiaRecAlloc.c \
-		MYODBCDiaRecFree.c \
-		MYODBCDiaSetField.c
+		MYODBCDia.cpp \
+		MYODBCDiaRecord.cpp
 

Modified: MYODBCDia/MYODBCDiaLib/MYODBCDiaLib.vpj
===================================================================
--- MYODBCDia/MYODBCDiaLib/MYODBCDiaLib.vpj	2005-12-29 04:08:17 UTC (rev 20)
+++ MYODBCDia/MYODBCDiaLib/MYODBCDiaLib.vpj	2005-12-29 09:54:08 UTC (rev 21)
@@ -184,18 +184,8 @@
 		<Folder
 			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="MYODBCDiaAlloc.c"/>
-			<F N="MYODBCDiaAppend.c"/>
-			<F N="MYODBCDiaAppend2.c"/>
-			<F N="MYODBCDiaClear.c"/>
-			<F N="MYODBCDiaDelete.c"/>
-			<F N="MYODBCDiaDump.c"/>
-			<F N="MYODBCDiaFree.c"/>
-			<F N="MYODBCDiaGet.c"/>
-			<F N="MYODBCDiaGetField.c"/>
-			<F N="MYODBCDiaRecAlloc.c"/>
-			<F N="MYODBCDiaRecFree.c"/>
-			<F N="MYODBCDiaSetField.c"/>
+			<F N="MYODBCDia.cpp"/>
+			<F N="MYODBCDiaRecord.cpp"/>
 		</Folder>
 		<Folder
 			Name="Header Files"

Deleted: MYODBCDia/MYODBCDiaLib/MYODBCDiaRecAlloc.c
===================================================================
--- MYODBCDia/MYODBCDiaLib/MYODBCDiaRecAlloc.c	2005-12-29 04:08:17 UTC (rev 20)
+++ MYODBCDia/MYODBCDiaLib/MYODBCDiaRecAlloc.c	2005-12-29 09:54:08 UTC (rev 21)
@@ -1,48 +0,0 @@
-/*! 
-    \internal
-    \file     MYODBCDiaRecAlloc.c
-    \author   Peter Harvey <pharvey@stripped>
-              Copyright MySQL AB 2004-2005 Released under GPL.
-    \version  Connector/ODBC v5
-    \date     2005          
-    \brief    This code is used to support diagnostic information
-              associated with various handles.
-
-    This code is for internal use and as such is for MyODBC 
-    developers only. 
-*/
-
-#include "MYODBCDiaInternal.h"
-
-MYODBC_DIA_REC_PTR MYODBCDiaRecAlloc( MYODBC_DIA_PTR pDia, MYODBC_DIA_ID nState )
-{
-    MYODBC_DIA_REC_PTR pDiaRec;
-
-#if MYODBC_DEV > 0
-    /* sanity check on args as we are an entry point */
-    if ( !pDia || MYODBCRttiType( pDia ) != MYODBC_RTTI_DIA )
-        MYODBCCAssert( "pDia" );
-#endif
-
-    pDiaRec = (MYODBC_DIA_REC_PTR)MYODBCCCalloc( 1, sizeof(MYODBC_DIA_REC) );
-
-    pDiaRec->nTypeID                  = MYODBC_RTTI_DIA_REC;
-    pDiaRec->diag_class_origin        = MYODBCDia_pStates[nState].diag_class_origin;
-    pDiaRec->diag_column_number       = SQL_NO_COLUMN_NUMBER;
-    pDiaRec->diag_connection_name     = NULL;
-    pDiaRec->diag_message_text[0]     = '\0';
-    pDiaRec->diag_native              = 0;
-    pDiaRec->diag_row_number          = SQL_NO_ROW_NUMBER;
-    pDiaRec->diag_server_name         = NULL;
-    pDiaRec->diag_sqlstate            = MYODBCDia_pStates[nState].diag_sqlstate;
-    pDiaRec->diag_subclass_origin     = MYODBCDia_pStates[nState].diag_class_origin;
-    pDiaRec->pOwner                   = pDia;
-
-    MYODBCArrayAppend( pDia->hRecords, pDiaRec );
-
-    pDia->diag_number += 1;
-
-    return pDiaRec;
-}
-
-

Deleted: MYODBCDia/MYODBCDiaLib/MYODBCDiaRecFree.c
===================================================================
--- MYODBCDia/MYODBCDiaLib/MYODBCDiaRecFree.c	2005-12-29 04:08:17 UTC (rev 20)
+++ MYODBCDia/MYODBCDiaLib/MYODBCDiaRecFree.c	2005-12-29 09:54:08 UTC (rev 21)
@@ -1,41 +0,0 @@
-/*! 
-    \internal
-    \file     MYODBCDiaRecFree.c
-    \author   Peter Harvey <pharvey@stripped>
-              Copyright MySQL AB 2004-2005 Released under GPL.
-    \version  Connector/ODBC v5
-    \date     2005          
-    \brief    This code is used to support diagnostic information
-              associated with various handles.
-
-    This code is for internal use and as such is for MyODBC 
-    developers only. 
-*/
-
-#include "MYODBCDiaInternal.h"
-
-/* call-back */
-void MYODBCDiaRecFree( void *pVoid )
-{
-    MYODBC_DIA_REC_PTR pDiaRec = (MYODBC_DIA_REC_PTR)pVoid;
-
-#if MYODBC_DEV > 0
-    /* sanity check on args as we are an entry point */
-    if ( !pDiaRec || MYODBCRttiType( pDiaRec ) != MYODBC_RTTI_DIA_REC )
-        MYODBCCAssert( "pDiaRec" );
-#endif
-
-    /* 
-        free strings 
-        Some strings in rec do not need to be freed as they reference static data.
-    */
-    MYODBCCFree( pDiaRec->diag_connection_name );
-    MYODBCCFree( pDiaRec->diag_server_name );
-
-    pDiaRec->pOwner->diag_number -= 1;
-
-    /* free rec itself */
-    MYODBCCFree( pDiaRec );
-}
-
-

Added: MYODBCDia/MYODBCDiaLib/MYODBCDiaRecord.cpp
===================================================================
--- MYODBCDia/MYODBCDiaLib/MYODBCDiaRecord.cpp	2005-12-29 04:08:17 UTC (rev 20)
+++ MYODBCDia/MYODBCDiaLib/MYODBCDiaRecord.cpp	2005-12-29 09:54:08 UTC (rev 21)
@@ -0,0 +1,340 @@
+#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;
+}
+
+SQLRETURN MYODBCDiaRecord::setField( SQLSMALLINT nField, SQLPOINTER pValue, SQLINTEGER
nStringLength )
+{
+}
+
+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 ( diag_native )
+    {
+        /* 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;
+}
+
+/*!
+    \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    : " <<
rval.MYODBCDia_pStates[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        : " <<
rval.MYODBCDia_pStates[nState].diag_sqlstate << endl;
+    stream << "SQL_DIAG_SUBCLASS_ORIGIN : " <<
rval.MYODBCDia_pStates[nState].diag_class_origin << endl;
+
+    return stream;
+}
+
+SQLRETURN MYODBCDiaRecord::getField( SQLSMALLINT nField, SQLPOINTER pBuffer, SQLSMALLINT
nBufferLength, SQLSMALLINT *pnStrLenPtr )
+{
+}
+

Deleted: MYODBCDia/MYODBCDiaLib/MYODBCDiaSetField.c
===================================================================
--- MYODBCDia/MYODBCDiaLib/MYODBCDiaSetField.c	2005-12-29 04:08:17 UTC (rev 20)
+++ MYODBCDia/MYODBCDiaLib/MYODBCDiaSetField.c	2005-12-29 09:54:08 UTC (rev 21)
@@ -1,67 +0,0 @@
-/*! 
-    \internal
-    \file     MYODBCDrvSetField.c
-    \author   Peter Harvey <pharvey@stripped>
-              Copyright MySQL AB 2004-2005 Released under GPL.
-    \version  Connector/ODBC v5
-    \date     2005          
-    \brief    This code is used to support diagnostic information
-              associated with various handles.
-
-    This code is for internal use and as such is for MyODBC 
-    developers only. 
-*/
-
-#include "MYODBCDiaInternal.h"
-
-SQLRETURN MYODBCDiaSetField( MYODBC_DIA_HANDLE  hDia,
-                             SQLSMALLINT        nRecord,
-                             SQLSMALLINT        nField,
-                             SQLPOINTER         pValue,
-                             SQLINTEGER         nStringLength )
-{
-    MYODBC_DIA_PTR pDia = (MYODBC_DIA_PTR)hDia;
-
-#if MYODBC_DEV > 0
-    if ( !hDia )
-        MYODBCCAssert( "hDia" );
-    if ( MYODBCRttiType( hDia ) != MYODBC_RTTI_DIA )
-        MYODBCCAssert( "hDia" );
-#endif
-
-    /* 
-        These are the fields we know about listed by category
-        (header/record) and in _alpha_ order.
-    */
-    switch ( nField )
-    {
-        /* HEADER FIELD  */
-        case SQL_DIAG_CURSOR_ROW_COUNT:
-        case SQL_DIAG_DYNAMIC_FUNCTION:
-        case SQL_DIAG_DYNAMIC_FUNCTION_CODE:
-        case SQL_DIAG_NUMBER:
-        case SQL_DIAG_RETURNCODE:
-            return SQL_ERROR;
-
-        case SQL_DIAG_ROW_COUNT:
-            pDia->diag_row_count = (SQLINTEGER)pValue;
-            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;
-    }
-
-    return SQL_SUCCESS;
-}
-
-

Modified: MYODBCDia/include/MYODBCDia.h
===================================================================
--- MYODBCDia/include/MYODBCDia.h	2005-12-29 04:08:17 UTC (rev 20)
+++ MYODBCDia/include/MYODBCDia.h	2005-12-29 09:54:08 UTC (rev 21)
@@ -28,327 +28,63 @@
 #ifndef MYODBC_DIA_H
 #define MYODBC_DIA_H
 
-#include <MYODBCArray.h>
+#include "MYODBCDiaRecord.h"
 
 /*!
-    \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.
+    \internal
+    \brief  This is the main handle for diagnostic information.
     
-    \sa MYODBCDia_pStates MYODBC_DIA_STATE
-*/    
-typedef enum MYODBC_DIA_ID
+            This contains the diagnostic header fields and 0 - n 
+            diagnostic records. Each; environment, connection, statement
+            and descriptor handle has one of these. 
+*/
+class MYODBCDia 
 {
-    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
+    friend class MYODBCDiaRecord;
+    friend QTextStream &operator<<( QTextStream &stream, const MYODBCDia
&rval );
+public:
+    MYODBCDia();
+    ~MYODBCDia();
 
-} MYODBC_DIA_ID;
+    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 );
 
-/*!
-    \brief  A diagnostic handle.
-*/    
-typedef void *MYODBC_DIA_HANDLE;
+    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();
+    const MYODBCDiaRecord &getRecord( SQLSMALLINT nRecord /* 1 based */ );
+    SQLRETURN getField( SQLSMALLINT nRecord /* 1 based */, SQLSMALLINT nField, SQLPOINTER
pBuffer, SQLSMALLINT nBufferLength, SQLSMALLINT *pnStrLenPtr );
 
-/*!
-    \brief  A diagnostic record handle.
-*/    
-typedef void *MYODBC_DIA_REC_HANDLE;
+    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 */ );
 
-/*!
-    \brief  Allocates a new diagnostics structure.
+protected:
+    SQLINTEGER  nCursorRowCount;        /*!< Count of rows in the cursor.             
                                   */
+/*    SQLCHAR *           diag_dynamic_function;     */
+    SQLINTEGER  nDynamicFunctionCode;   /*!< Code indicating type of SQL executed (ie
SQL_DIAG_UPDATE_WHERE)              */
+    SQLRETURN   nReturnCode;            /*!< Return code (as in SQLRETURN) returned by
the function.                      */
+    SQLINTEGER  nRowCount;              /*!< The number of rows affected by an insert,
delete, or update.                 */
 
-            Allocates and initializes a new diagnostics 
-            structure. Should be free using MYODBCDiaFree().
+    /* these values are copied by new records */
+    QString   stringConnectionName;   /*!< This is dbc->server.                    
                                    */
+    Qstring   stringServerName;       /*!< This is dbc->dsn. Same as
SQL_DATA_SOURCE_NAME in SQLGetInfo().              */
 
-    \return a viable diagnostic structure
-        
-    \sa     MYODBCDiaFree
-*/
-MYODBC_DIA_HANDLE MYODBCDiaAlloc();
+    QList<MYODBCDiaRecord*> listRecords;/*!< the records we own                 
                                          */
+};
 
-/*!
-    \brief  Appends a diagnostic record to the given handle.
-    
-            This function is called to append a diagnostic record to the
-            given diagnostic structure. This function is called often 
-            when there are errors or warnings.
 
-            Unlike MYODBCDiaAppend2, this function does not require row 
-            or col number to be passed.
-    
-            The final message stored will conform to the format specified
-            in the ODBC specification and will result in a message larger
-            than anything provided in pszMessage. The final message MUST
-            not be larger than SQL_MAX_MESSAGE_LENGTH (typically 512 bytes).
-             
-    \param  hDia        Diagnostic handle created with MYODBCDiaAlloc.
-    \param  nState      Numeric id for an SQL state.
-    \param  diag_native Native (perhaps DBMS specific) error code.
-    \param  pszMessage  Message (if any) to be associated with 
-                        diagnostic record.
-
-    \return             SQL return code corresponding to the nState.
-
-    \sa     MYODBCDiaAppend2
-*/
-SQLRETURN MYODBCDiaAppend( MYODBC_DIA_HANDLE   hDia, 
-                           MYODBC_DIA_ID       nState, 
-                           SQLINTEGER          diag_native,
-                           SQLCHAR *           pszMessage );
-
-/*!
-    \brief  Appends a diagnostic record to the given handle.
-    
-            This function is called to append a diagnostic record to the
-            given handle. This function is called when row and/or col
-            number are relevant.
-
-            The final message stored will conform to the format specified
-            in the ODBC specification and will result in a message larger
-            than anything provided in pszMessage. The final message MUST
-            not be larger than SQL_MAX_MESSAGE_LENGTH (typically 512 bytes).
-             
-    \param  hDia            Diagnostic handle created with MYODBCDiaAlloc.
-    \param  nState          numeric id for an SQL state
-    \param  diag_native     native (perhaps DBMS specific) error code
-    \param  pszMessage      message (if any) to be associated with diagnostic record
-    \param  diag_row_number the relevant row number or SQL_NO_ROW_NUMBER
-    \param  diag_col_number the relevant col number or SQL_NO_COLUMN_NUMBER
-
-    \return                 SQL return code corresponding to the nState.
-    
-    \sa     MYODBCDiaAppend
-*/
-SQLRETURN MYODBCDiaAppend2( MYODBC_DIA_HANDLE  hDia,
-                            MYODBC_DIA_ID      nState, 
-                            SQLINTEGER         diag_native, 
-                            SQLCHAR *          pszMessage, 
-                            SQLINTEGER         diag_row_number, 
-                            SQLINTEGER         diag_column_number );
-
-/*!
-    \brief  Clears the diagnostic information for the given handle.
-    
-            This function is called at most entry points to the ODBC 
-            API to clear diagnostic information from a previous call 
-            to the ODBC API.
-    
-    \param  hDia    Diagnostic handle created with MYODBCDiaAlloc.
-
-    \sa     MYODBCDiaAlloc
-            MYODBCDiaFree
-*/
-void MYODBCDiaClear( MYODBC_DIA_HANDLE hDia );
-
-/*!
-    \brief  Frees a diagnostics structure.
-
-            Frees a diagnostics structure previously allocated with
-            MYODBCDiaAlloc(). 
-    
-    \param  hDia    Diagnostic handle created with MYODBCDiaAlloc.
-                        
-    \sa     MYODBCDiaAlloc
-*/
-void MYODBCDiaFree( MYODBC_DIA_HANDLE hDia );
-
-/*!
-    \brief  Gets a diagnostic record.
-    
-            This function is called to get a diagnostic record from the given 
-            diagnostic handle.
-
-    \param  hDia        Diagnostic handle created with MYODBCDiaAlloc.
-    \param  nRecord     Diagnostic record number (1 based).
-    
-    \return             NULL or viable MYODBC_DIA_REC_HANDLE
-    
-    \sa     MYODBCDiaAppend
-*/
-MYODBC_DIA_REC_HANDLE MYODBCDiaGet( MYODBC_DIA_HANDLE   hDia, 
-                                    SQLSMALLINT         nRecord );
-
-/*!
-    \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  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   Character data was truncated.
-    \retval SQL_ERROR               General error.
-    \retval SQL_NO_DATA             No data to return (ie requested record does not
exist).
-*/
-SQLRETURN MYODBCDiaGetField( MYODBC_DIA_HANDLE  hDia,
-                             SQLSMALLINT        nRecord,
-                             SQLSMALLINT        nField,
-                             SQLPOINTER         pBuffer,
-                             SQLSMALLINT        nBufferLength,
-                             SQLSMALLINT *      pnStrLenPtr );
-
-
-/*!
-    \brief  Sets 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).
-
-    \return SQLRETURN
-
-    \retval SQL_SUCCESS             Success!
-    \retval SQL_SUCCESS_WITH_INFO   Altered value used.
-    \retval SQL_ERROR               General error.
-*/
-SQLRETURN MYODBCDiaSetField( MYODBC_DIA_HANDLE  hDia,
-                             SQLSMALLINT        nRecord,
-                             SQLSMALLINT        nField,
-                             SQLPOINTER         pValue,
-                             SQLINTEGER         nStringLength );
 #endif
 
 

Added: MYODBCDia/include/MYODBCDiaRecord.h
===================================================================
--- MYODBCDia/include/MYODBCDiaRecord.h	2005-12-29 04:08:17 UTC (rev 20)
+++ MYODBCDia/include/MYODBCDiaRecord.h	2005-12-29 09:54:08 UTC (rev 21)
@@ -0,0 +1,244 @@
+#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 );
+    SQLRETURN setField( SQLSMALLINT nField, SQLPOINTER pValue, SQLINTEGER nStringLength
);
+
+    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: r21 - MYODBCDbg/MYODBCDbgTest MYODBCDia MYODBCDia/MYODBCDiaLib MYODBCDia/includepharvey29 Dec