List:Commits« Previous MessageNext Message »
From:pharvey Date:May 3 2006 7:07am
Subject:Connector/ODBC 5 commit: r183 - MYODBCDriver/MYODBCDriverLib MYSQLPlus/MYSQLPlusLib
View as plain text  
Modified:
   MYODBCDriver/MYODBCDriverLib/SQLBindCol.cpp
   MYODBCDriver/MYODBCDriverLib/SQLBindParameter.cpp
   MYODBCDriver/MYODBCDriverLib/SQLBrowseConnectW.cpp
   MYODBCDriver/MYODBCDriverLib/SQLBulkOperations.cpp
   MYODBCDriver/MYODBCDriverLib/SQLCancel.cpp
   MYODBCDriver/MYODBCDriverLib/SQLCloseCursor.cpp
   MYODBCDriver/MYODBCDriverLib/SQLColAttributeW.cpp
   MYODBCDriver/MYODBCDriverLib/SQLColumnPrivilegesW.cpp
   MYODBCDriver/MYODBCDriverLib/SQLColumnsW.cpp
   MYODBCDriver/MYODBCDriverLib/SQLDescribeColW.cpp
   MYODBCDriver/MYODBCDriverLib/SQLDescribeParam.cpp
   MYODBCDriver/MYODBCDriverLib/SQLDisconnect.cpp
   MYODBCDriver/MYODBCDriverLib/SQLDriverConnectW.cpp
   MYODBCDriver/MYODBCDriverLib/SQLExecDirectW.cpp
   MYODBCDriver/MYODBCDriverLib/SQLExecute.cpp
   MYODBCDriver/MYODBCDriverLib/SQLExtendedFetch.cpp
   MYODBCDriver/MYODBCDriverLib/SQLFetch.cpp
   MYODBCDriver/MYODBCDriverLib/SQLFetchScroll.cpp
   MYODBCDriver/MYODBCDriverLib/SQLForeignKeysW.cpp
   MYODBCDriver/MYODBCDriverLib/SQLFreeStmt.cpp
   MYODBCDriver/MYODBCDriverLib/SQLGetConnectAttrW.cpp
   MYODBCDriver/MYODBCDriverLib/SQLGetCursorNameW.cpp
   MYODBCDriver/MYODBCDriverLib/SQLGetData.cpp
   MYODBCDriver/MYODBCDriverLib/SQLGetDescFieldW.cpp
   MYODBCDriver/MYODBCDriverLib/SQLGetDescRecW.cpp
   MYODBCDriver/MYODBCDriverLib/SQLGetEnvAttr.cpp
   MYODBCDriver/MYODBCDriverLib/SQLGetFunctions.cpp
   MYODBCDriver/MYODBCDriverLib/SQLGetInfoW.cpp
   MYODBCDriver/MYODBCDriverLib/SQLGetStmtAttrW.cpp
   MYODBCDriver/MYODBCDriverLib/SQLGetTypeInfoW.cpp
   MYODBCDriver/MYODBCDriverLib/SQLMoreResults.cpp
   MYODBCDriver/MYODBCDriverLib/SQLNativeSqlW.cpp
   MYODBCDriver/MYODBCDriverLib/SQLNumParams.cpp
   MYODBCDriver/MYODBCDriverLib/SQLNumResultCols.cpp
   MYODBCDriver/MYODBCDriverLib/SQLParamData.cpp
   MYODBCDriver/MYODBCDriverLib/SQLPrepareW.cpp
   MYODBCDriver/MYODBCDriverLib/SQLPrimaryKeysW.cpp
   MYODBCDriver/MYODBCDriverLib/SQLProcedureColumnsW.cpp
   MYODBCDriver/MYODBCDriverLib/SQLProceduresW.cpp
   MYODBCDriver/MYODBCDriverLib/SQLPutData.cpp
   MYODBCDriver/MYODBCDriverLib/SQLRowCount.cpp
   MYODBCDriver/MYODBCDriverLib/SQLSetConnectAttrW.cpp
   MYODBCDriver/MYODBCDriverLib/SQLSetCursorNameW.cpp
   MYODBCDriver/MYODBCDriverLib/SQLSetDescFieldW.cpp
   MYODBCDriver/MYODBCDriverLib/SQLSetDescRec.cpp
   MYODBCDriver/MYODBCDriverLib/SQLSetEnvAttr.cpp
   MYODBCDriver/MYODBCDriverLib/SQLSetPos.cpp
   MYODBCDriver/MYODBCDriverLib/SQLSetStmtAttrW.cpp
   MYODBCDriver/MYODBCDriverLib/SQLSpecialColumnsW.cpp
   MYODBCDriver/MYODBCDriverLib/SQLStatisticsW.cpp
   MYODBCDriver/MYODBCDriverLib/SQLTablePrivilegesW.cpp
   MYODBCDriver/MYODBCDriverLib/SQLTablesW.cpp
   MYSQLPlus/MYSQLPlusLib/MConnection.cpp
   MYSQLPlus/MYSQLPlusLib/MEnvironment.cpp
   MYSQLPlus/MYSQLPlusLib/MStatement.cpp
Log:


Modified: MYODBCDriver/MYODBCDriverLib/SQLBindCol.cpp
===================================================================
--- MYODBCDriver/MYODBCDriverLib/SQLBindCol.cpp	2006-05-03 02:41:16 UTC (rev 182)
+++ MYODBCDriver/MYODBCDriverLib/SQLBindCol.cpp	2006-05-03 07:07:35 UTC (rev 183)
@@ -42,6 +42,10 @@
                               SQLINTEGER * pnStrLenOrInd )
 {
     MYODBCDbgEnter();
+
+    if ( !hStm )
+        MYODBCDbgReturn( SQL_INVALID_HANDLE );
+
     MYODBCDbgReturn( ((MStatement*)hStm)->doBindCol( nColumnNumber, nTargetType,
pTargetValue, nBufferLength, pnStrLenOrInd ) );
 }
 

Modified: MYODBCDriver/MYODBCDriverLib/SQLBindParameter.cpp
===================================================================
--- MYODBCDriver/MYODBCDriverLib/SQLBindParameter.cpp	2006-05-03 02:41:16 UTC (rev 182)
+++ MYODBCDriver/MYODBCDriverLib/SQLBindParameter.cpp	2006-05-03 07:07:35 UTC (rev 183)
@@ -53,6 +53,10 @@
                                     SQLINTEGER *    pnStrLenOrInd )
 {
     MYODBCDbgEnter();
+
+    if ( !hStm )
+        MYODBCDbgReturn( SQL_INVALID_HANDLE );
+
     MYODBCDbgReturn( ((MStatement*)hStm)->doBindParameter( nParameterNumber,
nInputOutputType, nValueType, nParameterType, nColumnSize, nDecimalDigits,
nParameterValue, nBufferLen, pnStrLenOrInd ) );
 }
 

Modified: MYODBCDriver/MYODBCDriverLib/SQLBrowseConnectW.cpp
===================================================================
--- MYODBCDriver/MYODBCDriverLib/SQLBrowseConnectW.cpp	2006-05-03 02:41:16 UTC (rev 182)
+++ MYODBCDriver/MYODBCDriverLib/SQLBrowseConnectW.cpp	2006-05-03 07:07:35 UTC (rev 183)
@@ -16,6 +16,10 @@
                                     SQLSMALLINT *   pnStringLength2 )
 {
     MYODBCDbgEnter();
+
+    if ( !hDbc )
+        MYODBCDbgReturn( SQL_INVALID_HANDLE );
+
     MYODBCDbgReturn( ((MConnection*)hDbc)->doBrowseConnect( psInConnectionString,
nStringLength1, psOutConnectionString, nBufferLength, pnStringLength2 ) );
 }
 

Modified: MYODBCDriver/MYODBCDriverLib/SQLBulkOperations.cpp
===================================================================
--- MYODBCDriver/MYODBCDriverLib/SQLBulkOperations.cpp	2006-05-03 02:41:16 UTC (rev 182)
+++ MYODBCDriver/MYODBCDriverLib/SQLBulkOperations.cpp	2006-05-03 07:07:35 UTC (rev 183)
@@ -36,6 +36,10 @@
                                      SQLSMALLINT    nOperation )
 {
     MYODBCDbgEnter();
+
+    if ( !hStm )
+        MYODBCDbgReturn( SQL_INVALID_HANDLE );
+
     MYODBCDbgReturn( ((MStatement*)hStm)->doBulkOperations( nOperation ) );
 }
 

Modified: MYODBCDriver/MYODBCDriverLib/SQLCancel.cpp
===================================================================
--- MYODBCDriver/MYODBCDriverLib/SQLCancel.cpp	2006-05-03 02:41:16 UTC (rev 182)
+++ MYODBCDriver/MYODBCDriverLib/SQLCancel.cpp	2006-05-03 07:07:35 UTC (rev 183)
@@ -33,6 +33,10 @@
 SQLRETURN SQL_API SQLCancel( SQLHSTMT hStm )
 {
     MYODBCDbgEnter();
+
+    if ( !hStm )
+        MYODBCDbgReturn( SQL_INVALID_HANDLE );
+
     MYODBCDbgReturn( ((MStatement*)hStm)->doCancel() );
 }
 

Modified: MYODBCDriver/MYODBCDriverLib/SQLCloseCursor.cpp
===================================================================
--- MYODBCDriver/MYODBCDriverLib/SQLCloseCursor.cpp	2006-05-03 02:41:16 UTC (rev 182)
+++ MYODBCDriver/MYODBCDriverLib/SQLCloseCursor.cpp	2006-05-03 07:07:35 UTC (rev 183)
@@ -27,6 +27,10 @@
 SQLRETURN SQL_API SQLCloseCursor( SQLHSTMT hStm )
 {
     MYODBCDbgEnter();
+
+    if ( !hStm )
+        MYODBCDbgReturn( SQL_INVALID_HANDLE );
+
     MYODBCDbgReturn( ((MStatement*)hStm)->doCloseCursor() );
 }
 

Modified: MYODBCDriver/MYODBCDriverLib/SQLColAttributeW.cpp
===================================================================
--- MYODBCDriver/MYODBCDriverLib/SQLColAttributeW.cpp	2006-05-03 02:41:16 UTC (rev 182)
+++ MYODBCDriver/MYODBCDriverLib/SQLColAttributeW.cpp	2006-05-03 07:07:35 UTC (rev 183)
@@ -27,6 +27,10 @@
 #endif
 {
     MYODBCDbgEnter();
+
+    if ( !hStm )
+        MYODBCDbgReturn( SQL_INVALID_HANDLE );
+
     MYODBCDbgReturn( ((MStatement*)hStm)->doColAttribute( nColumnNumber,
nFieldIdentifier, psCharacterAttribute, nBufferLength, pnStringLength, pnNumericAttribute
) );
 }
 

Modified: MYODBCDriver/MYODBCDriverLib/SQLColumnPrivilegesW.cpp
===================================================================
--- MYODBCDriver/MYODBCDriverLib/SQLColumnPrivilegesW.cpp	2006-05-03 02:41:16 UTC (rev
182)
+++ MYODBCDriver/MYODBCDriverLib/SQLColumnPrivilegesW.cpp	2006-05-03 07:07:35 UTC (rev
183)
@@ -48,6 +48,10 @@
                                         SQLSMALLINT  nNameLength4 )
 { 
     MYODBCDbgEnter();
+
+    if ( !hStm )
+        MYODBCDbgReturn( SQL_INVALID_HANDLE );
+
     MYODBCDbgReturn( ((MStatement*)hStm)->doColumnPrivileges( psCatalogName,
nNameLength1, psSchemaName, nNameLength2, psTableName, nNameLength3, psColumnName,
nNameLength4 ) )
 }
 

Modified: MYODBCDriver/MYODBCDriverLib/SQLColumnsW.cpp
===================================================================
--- MYODBCDriver/MYODBCDriverLib/SQLColumnsW.cpp	2006-05-03 02:41:16 UTC (rev 182)
+++ MYODBCDriver/MYODBCDriverLib/SQLColumnsW.cpp	2006-05-03 07:07:35 UTC (rev 183)
@@ -39,6 +39,10 @@
                                SQLSMALLINT  nNameLength4 )
 {
     MYODBCDbgEnter();
+
+    if ( !hStm )
+        MYODBCDbgReturn( SQL_INVALID_HANDLE );
+
     MYODBCDbgReturn( ((MStatement*)hStm)->doColumns( psCatalogName, nNameLength1,
psSchemaName, nNameLength2, psTableName, nNameLength3, psColumnName, nNameLength4 ) );
 }
 

Modified: MYODBCDriver/MYODBCDriverLib/SQLDescribeColW.cpp
===================================================================
--- MYODBCDriver/MYODBCDriverLib/SQLDescribeColW.cpp	2006-05-03 02:41:16 UTC (rev 182)
+++ MYODBCDriver/MYODBCDriverLib/SQLDescribeColW.cpp	2006-05-03 07:07:35 UTC (rev 183)
@@ -19,6 +19,10 @@
                                    SQLSMALLINT * pnNullable )
 {
     MYODBCDbgEnter();
+
+    if ( !hStm )
+        MYODBCDbgReturn( SQL_INVALID_HANDLE );
+
     MYODBCDbgReturn( ((MStatement*)hStm)->doDescribeCol( nColumnNumber, psColumnName,
nBufferLength, pnNameLength, pnDataType, pnColumnSize, pnDecimalDigits, pnNullable ) );
 }
 

Modified: MYODBCDriver/MYODBCDriverLib/SQLDescribeParam.cpp
===================================================================
--- MYODBCDriver/MYODBCDriverLib/SQLDescribeParam.cpp	2006-05-03 02:41:16 UTC (rev 182)
+++ MYODBCDriver/MYODBCDriverLib/SQLDescribeParam.cpp	2006-05-03 07:07:35 UTC (rev 183)
@@ -42,6 +42,10 @@
                                     SQLSMALLINT *   pnNullablePtr )
 {
     MYODBCDbgEnter();
+
+    if ( !hStm )
+        MYODBCDbgReturn( SQL_INVALID_HANDLE );
+
     MYODBCDbgReturn( ((MStatement*)hStm)->doDescribeParam( nParameterNumber,
pnDataType, pnParameterSize, pnDecimalDigits, pnNullablePtr ) );
 }
 

Modified: MYODBCDriver/MYODBCDriverLib/SQLDisconnect.cpp
===================================================================
--- MYODBCDriver/MYODBCDriverLib/SQLDisconnect.cpp	2006-05-03 02:41:16 UTC (rev 182)
+++ MYODBCDriver/MYODBCDriverLib/SQLDisconnect.cpp	2006-05-03 07:07:35 UTC (rev 183)
@@ -32,6 +32,10 @@
 SQLRETURN SQL_API SQLDisconnect( SQLHDBC hDbc )
 {
     MYODBCDbgEnter();
+
+    if ( !hDbc )
+        MYODBCDbgReturn( SQL_INVALID_HANDLE );
+
     MYODBCDbgReturn( ((MConnection*)hDbc)->doDisconnect() );
 }
 

Modified: MYODBCDriver/MYODBCDriverLib/SQLDriverConnectW.cpp
===================================================================
--- MYODBCDriver/MYODBCDriverLib/SQLDriverConnectW.cpp	2006-05-03 02:41:16 UTC (rev 182)
+++ MYODBCDriver/MYODBCDriverLib/SQLDriverConnectW.cpp	2006-05-03 07:07:35 UTC (rev 183)
@@ -18,6 +18,10 @@
                                      SQLUSMALLINT    nDriverCompletion )
 {
     MYODBCDbgEnter();
+
+    if ( !hDbc )
+        MYODBCDbgReturn( SQL_INVALID_HANDLE );
+
     MYODBCDbgReturn( ((MConnection*)hDbc)->doDriverConnect( hWnd,
psInConnectionString, nStringLength1, psOutConnectionString, nBufferLength,
pnStringLength2Ptr, nDriverCompletion ) );
 }
 

Modified: MYODBCDriver/MYODBCDriverLib/SQLExecDirectW.cpp
===================================================================
--- MYODBCDriver/MYODBCDriverLib/SQLExecDirectW.cpp	2006-05-03 02:41:16 UTC (rev 182)
+++ MYODBCDriver/MYODBCDriverLib/SQLExecDirectW.cpp	2006-05-03 07:07:35 UTC (rev 183)
@@ -13,6 +13,10 @@
                                   SQLINTEGER nTextLength )
 {
     MYODBCDbgEnter();
+
+    if ( !hStm )
+        MYODBCDbgReturn( SQL_INVALID_HANDLE );
+
     MYODBCDbgReturn( ((MStatement*)hStm)->doExecDirect( psStatementText, nTextLength )
);
 }
 

Modified: MYODBCDriver/MYODBCDriverLib/SQLExecute.cpp
===================================================================
--- MYODBCDriver/MYODBCDriverLib/SQLExecute.cpp	2006-05-03 02:41:16 UTC (rev 182)
+++ MYODBCDriver/MYODBCDriverLib/SQLExecute.cpp	2006-05-03 07:07:35 UTC (rev 183)
@@ -30,6 +30,10 @@
 SQLRETURN SQL_API SQLExecute( SQLHSTMT hStm )
 {
     MYODBCDbgEnter();
+
+    if ( !hStm )
+        MYODBCDbgReturn( SQL_INVALID_HANDLE );
+
     MYODBCDbgReturn( ((MStatement*)hStm)->doExecute() );
 }
 

Modified: MYODBCDriver/MYODBCDriverLib/SQLExtendedFetch.cpp
===================================================================
--- MYODBCDriver/MYODBCDriverLib/SQLExtendedFetch.cpp	2006-05-03 02:41:16 UTC (rev 182)
+++ MYODBCDriver/MYODBCDriverLib/SQLExtendedFetch.cpp	2006-05-03 07:07:35 UTC (rev 183)
@@ -45,6 +45,10 @@
                                     SQLUSMALLINT *  pnRowStatusArray )
 {
     MYODBCDbgEnter();
+
+    if ( !hStm )
+        MYODBCDbgReturn( SQL_INVALID_HANDLE );
+
     MYODBCDbgReturn( ((MStatement*)hStm)->doExtendedFetch( nFetchOrientation,
nFetchOffset, pnRowCount, pnRowStatusArray ) );
 }
 

Modified: MYODBCDriver/MYODBCDriverLib/SQLFetch.cpp
===================================================================
--- MYODBCDriver/MYODBCDriverLib/SQLFetch.cpp	2006-05-03 02:41:16 UTC (rev 182)
+++ MYODBCDriver/MYODBCDriverLib/SQLFetch.cpp	2006-05-03 07:07:35 UTC (rev 183)
@@ -26,6 +26,10 @@
 SQLRETURN SQL_API SQLFetch( SQLHSTMT hStm )
 {
     MYODBCDbgEnter();
+
+    if ( !hStm )
+        MYODBCDbgReturn( SQL_INVALID_HANDLE );
+
     MYODBCDbgReturn( ((MStatement*)hStm)->doFetch() );
 }
 

Modified: MYODBCDriver/MYODBCDriverLib/SQLFetchScroll.cpp
===================================================================
--- MYODBCDriver/MYODBCDriverLib/SQLFetchScroll.cpp	2006-05-03 02:41:16 UTC (rev 182)
+++ MYODBCDriver/MYODBCDriverLib/SQLFetchScroll.cpp	2006-05-03 07:07:35 UTC (rev 183)
@@ -33,6 +33,10 @@
                                   SQLINTEGER  nFetchOffset )
 {
     MYODBCDbgEnter();
+
+    if ( !hStm )
+        MYODBCDbgReturn( SQL_INVALID_HANDLE );
+
     MYODBCDbgReturn( ((MStatement*)hStm)->doFetchScroll( nFetchOrientation,
nFetchOffset ) );
 }
 

Modified: MYODBCDriver/MYODBCDriverLib/SQLForeignKeysW.cpp
===================================================================
--- MYODBCDriver/MYODBCDriverLib/SQLForeignKeysW.cpp	2006-05-03 02:41:16 UTC (rev 182)
+++ MYODBCDriver/MYODBCDriverLib/SQLForeignKeysW.cpp	2006-05-03 07:07:35 UTC (rev 183)
@@ -23,6 +23,10 @@
                                    SQLSMALLINT   nNameLength6 )
 {
     MYODBCDbgEnter();
+
+    if ( !hStm )
+        MYODBCDbgReturn( SQL_INVALID_HANDLE );
+
     MYODBCDbgReturn( ((MStatement*)hStm)->doForeignKeys( psPKCatalogName,
nNameLength1, psPKSchemaName, nNameLength2, psPKTableName, nNameLength3, psFKCatalogName,
nNameLength4, psFKSchemaName, nNameLength5, psFKTableName, nNameLength6 ) );
 }
 

Modified: MYODBCDriver/MYODBCDriverLib/SQLFreeStmt.cpp
===================================================================
--- MYODBCDriver/MYODBCDriverLib/SQLFreeStmt.cpp	2006-05-03 02:41:16 UTC (rev 182)
+++ MYODBCDriver/MYODBCDriverLib/SQLFreeStmt.cpp	2006-05-03 07:07:35 UTC (rev 183)
@@ -37,6 +37,9 @@
 {
     MYODBCDbgEnter();
 
+    if ( !hStm )
+        MYODBCDbgReturn( SQL_INVALID_HANDLE );
+
     MStatement *pStatement = (MStatement*)hStm;
 
     if ( nOption == SQL_DROP )

Modified: MYODBCDriver/MYODBCDriverLib/SQLGetConnectAttrW.cpp
===================================================================
--- MYODBCDriver/MYODBCDriverLib/SQLGetConnectAttrW.cpp	2006-05-03 02:41:16 UTC (rev 182)
+++ MYODBCDriver/MYODBCDriverLib/SQLGetConnectAttrW.cpp	2006-05-03 07:07:35 UTC (rev 183)
@@ -8,6 +8,30 @@
 */
 #include "MYODBCDriverInternal.h"
 
+/*!
+    \brief  <B>ODBC 3.0 API</B>
+            <BR>
+            Returns the connection attribute values.
+
+    \param  hStm                Viable statement handle.
+    \param  nAttribute          Desired attribute.
+    \param  pValuePtr           Place to store the value for nAttribute.
+    \param  nBufferLength       Size of the pValuePtr buffer.
+    \param  pnStringLengthPtr   Place to store number of bytes available for pValuePtr.
+
+    \return SQLRETURN
+
+    \retval SQL_SUCCESS             Request processed ok.
+    \retval SQL_SUCCESS_WITH_INFO   Request was probably processed ok - check diagnostic.
+    \retval SQL_ERROR               Request failed.
+    \retval SQL_NO_DATA             No data affected.
+    \retval SQL_INVALID_HANDLE      Invalid handle was provided.
+
+    \sa     SQLGetStmtAttr
+            SQLSetConnectAttr
+            SQLSetEnvAttr
+            SQLSetStmtAttr
+*/
 SQLRETURN SQL_API SQLGetConnectAttrW( SQLHDBC        hDbc, 
                                       SQLINTEGER     nAttribute, 
                                       SQLPOINTER     pValue, 
@@ -15,6 +39,19 @@
                                       SQLINTEGER *   pnStringLength )
 {
     MYODBCDbgEnter();
+
+    /*!
+        \internal MYODBC RULE
+
+        We dot not support the following ODBC RULE;
+
+            "if Attribute is SQL_ATTR_TRACE or SQL_ATTR_TRACEFILE, ConnectionHandle does
not have 
+            to be valid, and SQLGetConnectAttr will not return SQL_ERROR or
SQL_INVALID_HANDLE if 
+            ConnectionHandle is invalid."
+    */
+    if ( !hDbc )
+        MYODBCDbgReturn( SQL_INVALID_HANDLE );
+
     MYODBCDbgReturn( ((MConnection*)hDbc)->getConnectAttr( nAttribute, pValue,
nBufferLength, pnStringLength ) );
 }
 

Modified: MYODBCDriver/MYODBCDriverLib/SQLGetCursorNameW.cpp
===================================================================
--- MYODBCDriver/MYODBCDriverLib/SQLGetCursorNameW.cpp	2006-05-03 02:41:16 UTC (rev 182)
+++ MYODBCDriver/MYODBCDriverLib/SQLGetCursorNameW.cpp	2006-05-03 07:07:35 UTC (rev 183)
@@ -14,6 +14,10 @@
                                      SQLSMALLINT *   pnNameLength )
 {
     MYODBCDbgEnter();
+
+    if ( !hStm )
+        MYODBCDbgReturn( SQL_INVALID_HANDLE );
+
     MYODBCDbgReturn( ((MStatement*)hStm)->getCursorName( psCursorName, nBufferLength,
pnNameLength ) );
 }
 

Modified: MYODBCDriver/MYODBCDriverLib/SQLGetData.cpp
===================================================================
--- MYODBCDriver/MYODBCDriverLib/SQLGetData.cpp	2006-05-03 02:41:16 UTC (rev 182)
+++ MYODBCDriver/MYODBCDriverLib/SQLGetData.cpp	2006-05-03 07:07:35 UTC (rev 183)
@@ -73,6 +73,10 @@
                               SQLINTEGER * pnStrLenOrInd )
 {
     MYODBCDbgEnter();
+
+    if ( !hStm )
+        MYODBCDbgReturn( SQL_INVALID_HANDLE );
+
     MYODBCDbgReturn( ((MStatement*)hStm)->getData( nColumnNumber, nTargetType,
pTargetValue, nBufferLength, pnStrLenOrInd ) );
 }
 

Modified: MYODBCDriver/MYODBCDriverLib/SQLGetDescFieldW.cpp
===================================================================
--- MYODBCDriver/MYODBCDriverLib/SQLGetDescFieldW.cpp	2006-05-03 02:41:16 UTC (rev 182)
+++ MYODBCDriver/MYODBCDriverLib/SQLGetDescFieldW.cpp	2006-05-03 07:07:35 UTC (rev 183)
@@ -16,6 +16,10 @@
                                     SQLINTEGER * pnStringLength )
 {
     MYODBCDbgEnter();
+
+    if ( !hDes )
+        MYODBCDbgReturn( SQL_INVALID_HANDLE );
+
     MYODBCDbgReturn( ((MDescriptor*)hDes)->getDescField( nRecNumber, nFieldIdentifier,
pValue, nBufferLength, pnStringLength ) );
 }
 

Modified: MYODBCDriver/MYODBCDriverLib/SQLGetDescRecW.cpp
===================================================================
--- MYODBCDriver/MYODBCDriverLib/SQLGetDescRecW.cpp	2006-05-03 02:41:16 UTC (rev 182)
+++ MYODBCDriver/MYODBCDriverLib/SQLGetDescRecW.cpp	2006-05-03 07:07:35 UTC (rev 183)
@@ -21,6 +21,10 @@
                                   SQLSMALLINT *  pnNullable )
 {
     MYODBCDbgEnter();
+
+    if ( !hDes )
+        MYODBCDbgReturn( SQL_INVALID_HANDLE );
+
     MYODBCDbgReturn( ((MDescriptor*)hDes)->getDescRec( nRecNumber, pszName,
nBufferLength, pnStringLength, pnType, pnSubType, pnLength, pnPrecision, pnScale,
pnNullable ) );
 }
 

Modified: MYODBCDriver/MYODBCDriverLib/SQLGetEnvAttr.cpp
===================================================================
--- MYODBCDriver/MYODBCDriverLib/SQLGetEnvAttr.cpp	2006-05-03 02:41:16 UTC (rev 182)
+++ MYODBCDriver/MYODBCDriverLib/SQLGetEnvAttr.cpp	2006-05-03 07:07:35 UTC (rev 183)
@@ -40,6 +40,15 @@
                                  SQLINTEGER *   pnStringLength )
 {
     MYODBCDbgEnter();
+
+    /*!
+        \internal MYODBC RULE
+
+        We do not support process level attributes.
+    */
+    if ( !hEnv )
+        MYODBCDbgReturn( SQL_INVALID_HANDLE );
+
     MYODBCDbgReturn( ((MEnvironment*)hEnv)->getEnvAttr( nAttribute, pValue,
nBufferLength, pnStringLength ) );
 }
 

Modified: MYODBCDriver/MYODBCDriverLib/SQLGetFunctions.cpp
===================================================================
--- MYODBCDriver/MYODBCDriverLib/SQLGetFunctions.cpp	2006-05-03 02:41:16 UTC (rev 182)
+++ MYODBCDriver/MYODBCDriverLib/SQLGetFunctions.cpp	2006-05-03 07:07:35 UTC (rev 183)
@@ -122,6 +122,10 @@
                                    SQLUSMALLINT *   pnSupportedPtr )
 {
     MYODBCDbgEnter();
+
+    if ( !hDbc )
+        MYODBCDbgReturn( SQL_INVALID_HANDLE );
+
     MYODBCDbgReturn( SQL_ERROR );
 }
 

Modified: MYODBCDriver/MYODBCDriverLib/SQLGetInfoW.cpp
===================================================================
--- MYODBCDriver/MYODBCDriverLib/SQLGetInfoW.cpp	2006-05-03 02:41:16 UTC (rev 182)
+++ MYODBCDriver/MYODBCDriverLib/SQLGetInfoW.cpp	2006-05-03 07:07:35 UTC (rev 183)
@@ -15,6 +15,10 @@
                                SQLSMALLINT * pnStringLength )
 {
     MYODBCDbgEnter();
+
+    if ( !hDbc )
+        MYODBCDbgReturn( SQL_INVALID_HANDLE );
+
     MYODBCDbgReturn( ((MConnection*)hDbc)->getInfo( nInfoType, pInfoValue,
nBufferLength, pnStringLength ) );
 }
 

Modified: MYODBCDriver/MYODBCDriverLib/SQLGetStmtAttrW.cpp
===================================================================
--- MYODBCDriver/MYODBCDriverLib/SQLGetStmtAttrW.cpp	2006-05-03 02:41:16 UTC (rev 182)
+++ MYODBCDriver/MYODBCDriverLib/SQLGetStmtAttrW.cpp	2006-05-03 07:07:35 UTC (rev 183)
@@ -15,6 +15,10 @@
                                    SQLINTEGER *  pnStringLength )
 {
     MYODBCDbgEnter();
+
+    if ( !hStm )
+        MYODBCDbgReturn( SQL_INVALID_HANDLE );
+
     MYODBCDbgReturn( ((MStatement*)hStm)->getStmtAttr( nAttribute, pValue,
nBufferLength, pnStringLength ) );
 }
 

Modified: MYODBCDriver/MYODBCDriverLib/SQLGetTypeInfoW.cpp
===================================================================
--- MYODBCDriver/MYODBCDriverLib/SQLGetTypeInfoW.cpp	2006-05-03 02:41:16 UTC (rev 182)
+++ MYODBCDriver/MYODBCDriverLib/SQLGetTypeInfoW.cpp	2006-05-03 07:07:35 UTC (rev 183)
@@ -12,6 +12,10 @@
                                    SQLSMALLINT   nDataType )
 {
     MYODBCDbgEnter();
+
+    if ( !hStm )
+        MYODBCDbgReturn( SQL_INVALID_HANDLE );
+
     MYODBCDbgReturn( ((MStatement*)hStm)->getTypeInfo( nDataType ) );
 }
 

Modified: MYODBCDriver/MYODBCDriverLib/SQLMoreResults.cpp
===================================================================
--- MYODBCDriver/MYODBCDriverLib/SQLMoreResults.cpp	2006-05-03 02:41:16 UTC (rev 182)
+++ MYODBCDriver/MYODBCDriverLib/SQLMoreResults.cpp	2006-05-03 07:07:35 UTC (rev 183)
@@ -29,6 +29,10 @@
 SQLRETURN SQL_API SQLMoreResults( SQLHSTMT hStm )
 {
     MYODBCDbgEnter();
+
+    if ( !hStm )
+        MYODBCDbgReturn( SQL_INVALID_HANDLE );
+
     MYODBCDbgReturn( ((MStatement*)hStm)->doMoreResults() );
 }
 

Modified: MYODBCDriver/MYODBCDriverLib/SQLNativeSqlW.cpp
===================================================================
--- MYODBCDriver/MYODBCDriverLib/SQLNativeSqlW.cpp	2006-05-03 02:41:16 UTC (rev 182)
+++ MYODBCDriver/MYODBCDriverLib/SQLNativeSqlW.cpp	2006-05-03 07:07:35 UTC (rev 183)
@@ -17,8 +17,9 @@
 {
     MYODBCDbgEnter();
 
-    SQLRETURN nReturn = ((MConnection*)hDbc)->doNativeSql( psInStatementText,
nTextLength1, psOutStatementText, nBufferLength, pnTextLength2 );
+    if ( !hDbc )
+        MYODBCDbgReturn( SQL_INVALID_HANDLE );
 
-    MYODBCDbgReturn( nReturn );
+    MYODBCDbgReturn( ((MConnection*)hDbc)->doNativeSql( psInStatementText,
nTextLength1, psOutStatementText, nBufferLength, pnTextLength2 ) );
 }
 

Modified: MYODBCDriver/MYODBCDriverLib/SQLNumParams.cpp
===================================================================
--- MYODBCDriver/MYODBCDriverLib/SQLNumParams.cpp	2006-05-03 02:41:16 UTC (rev 182)
+++ MYODBCDriver/MYODBCDriverLib/SQLNumParams.cpp	2006-05-03 07:07:35 UTC (rev 183)
@@ -29,6 +29,10 @@
                                 SQLSMALLINT *   pnParameterCount )
 {
     MYODBCDbgEnter();
+
+    if ( !hStm )
+        MYODBCDbgReturn( SQL_INVALID_HANDLE );
+
     MYODBCDbgReturn( ((MStatement*)hStm)->doNumParams( pnParameterCount ) );
 }
 

Modified: MYODBCDriver/MYODBCDriverLib/SQLNumResultCols.cpp
===================================================================
--- MYODBCDriver/MYODBCDriverLib/SQLNumResultCols.cpp	2006-05-03 02:41:16 UTC (rev 182)
+++ MYODBCDriver/MYODBCDriverLib/SQLNumResultCols.cpp	2006-05-03 07:07:35 UTC (rev 183)
@@ -29,6 +29,10 @@
                                     SQLSMALLINT *   pnColumnCountPtr )
 {
     MYODBCDbgEnter();
+
+    if ( !hStm )
+        MYODBCDbgReturn( SQL_INVALID_HANDLE );
+
     MYODBCDbgReturn( ((MStatement*)hStm)->doNumResultCols( pnColumnCountPtr ) );
 }
 

Modified: MYODBCDriver/MYODBCDriverLib/SQLParamData.cpp
===================================================================
--- MYODBCDriver/MYODBCDriverLib/SQLParamData.cpp	2006-05-03 02:41:16 UTC (rev 182)
+++ MYODBCDriver/MYODBCDriverLib/SQLParamData.cpp	2006-05-03 07:07:35 UTC (rev 183)
@@ -31,6 +31,10 @@
                                 SQLPOINTER *ppValue )
 {
     MYODBCDbgEnter();
+
+    if ( !hStm )
+        MYODBCDbgReturn( SQL_INVALID_HANDLE );
+
     MYODBCDbgReturn( ((MStatement*)hStm)->doParamData( ppValue ) );
 }
 

Modified: MYODBCDriver/MYODBCDriverLib/SQLPrepareW.cpp
===================================================================
--- MYODBCDriver/MYODBCDriverLib/SQLPrepareW.cpp	2006-05-03 02:41:16 UTC (rev 182)
+++ MYODBCDriver/MYODBCDriverLib/SQLPrepareW.cpp	2006-05-03 07:07:35 UTC (rev 183)
@@ -13,6 +13,10 @@
                                SQLINTEGER    nLength1 )
 {
     MYODBCDbgEnter();
+
+    if ( !hStm )
+        MYODBCDbgReturn( SQL_INVALID_HANDLE );
+
     MYODBCDbgReturn( ((MStatement*)hStm)->doPrepare( psStatementText, nLength1 ) );
 }
 

Modified: MYODBCDriver/MYODBCDriverLib/SQLPrimaryKeysW.cpp
===================================================================
--- MYODBCDriver/MYODBCDriverLib/SQLPrimaryKeysW.cpp	2006-05-03 02:41:16 UTC (rev 182)
+++ MYODBCDriver/MYODBCDriverLib/SQLPrimaryKeysW.cpp	2006-05-03 07:07:35 UTC (rev 183)
@@ -37,6 +37,10 @@
                                    SQLSMALLINT   nNameLength3 )
 {
     MYODBCDbgEnter();
+
+    if ( !hStm )
+        MYODBCDbgReturn( SQL_INVALID_HANDLE );
+
     MYODBCDbgReturn( ((MStatement*)hStm)->doPrimaryKeys( psCatalogName, nNameLength1,
psSchemaName, nNameLength2, psTableName, nNameLength3 ) );
 }
 

Modified: MYODBCDriver/MYODBCDriverLib/SQLProcedureColumnsW.cpp
===================================================================
--- MYODBCDriver/MYODBCDriverLib/SQLProcedureColumnsW.cpp	2006-05-03 02:41:16 UTC (rev
182)
+++ MYODBCDriver/MYODBCDriverLib/SQLProcedureColumnsW.cpp	2006-05-03 07:07:35 UTC (rev
183)
@@ -19,6 +19,10 @@
                                         SQLSMALLINT  nNameLength4 )
 {
     MYODBCDbgEnter();
+
+    if ( !hStm )
+        MYODBCDbgReturn( SQL_INVALID_HANDLE );
+
     MYODBCDbgReturn( ((MStatement*)hStm)->doProcedureColumns( psCatalogName,
nNameLength1, psSchemaName, nNameLength2, psProcName, nNameLength3, psColumnName,
nNameLength4 ) );
 }
 

Modified: MYODBCDriver/MYODBCDriverLib/SQLProceduresW.cpp
===================================================================
--- MYODBCDriver/MYODBCDriverLib/SQLProceduresW.cpp	2006-05-03 02:41:16 UTC (rev 182)
+++ MYODBCDriver/MYODBCDriverLib/SQLProceduresW.cpp	2006-05-03 07:07:35 UTC (rev 183)
@@ -17,6 +17,10 @@
                                   SQLSMALLINT    nNameLength3 )
 {
     MYODBCDbgEnter();
+
+    if ( !hStm )
+        MYODBCDbgReturn( SQL_INVALID_HANDLE );
+
     MYODBCDbgReturn( ((MStatement*)hStm)->doProcedures( psCatalogName, nNameLength1,
psSchemaName, nNameLength2, psProcName, nNameLength3 ) );
 }
 

Modified: MYODBCDriver/MYODBCDriverLib/SQLPutData.cpp
===================================================================
--- MYODBCDriver/MYODBCDriverLib/SQLPutData.cpp	2006-05-03 02:41:16 UTC (rev 182)
+++ MYODBCDriver/MYODBCDriverLib/SQLPutData.cpp	2006-05-03 07:07:35 UTC (rev 183)
@@ -31,6 +31,10 @@
                               SQLINTEGER    nStrLenOrInd )
 {
     MYODBCDbgEnter();
+
+    if ( !hStm )
+        MYODBCDbgReturn( SQL_INVALID_HANDLE );
+
     MYODBCDbgReturn( ((MStatement*)hStm)->doPutData( pValue, nStrLenOrInd ) );
 }
 

Modified: MYODBCDriver/MYODBCDriverLib/SQLRowCount.cpp
===================================================================
--- MYODBCDriver/MYODBCDriverLib/SQLRowCount.cpp	2006-05-03 02:41:16 UTC (rev 182)
+++ MYODBCDriver/MYODBCDriverLib/SQLRowCount.cpp	2006-05-03 07:07:35 UTC (rev 183)
@@ -28,6 +28,10 @@
                                SQLINTEGER * pnRowCountPtr )
 {
     MYODBCDbgEnter();
+
+    if ( !hStm )
+        MYODBCDbgReturn( SQL_INVALID_HANDLE );
+
     MYODBCDbgReturn( ((MStatement*)hStm)->doRowCount( pnRowCountPtr ) );
 }
 

Modified: MYODBCDriver/MYODBCDriverLib/SQLSetConnectAttrW.cpp
===================================================================
--- MYODBCDriver/MYODBCDriverLib/SQLSetConnectAttrW.cpp	2006-05-03 02:41:16 UTC (rev 182)
+++ MYODBCDriver/MYODBCDriverLib/SQLSetConnectAttrW.cpp	2006-05-03 07:07:35 UTC (rev 183)
@@ -14,6 +14,19 @@
                                       SQLINTEGER nStringLength )
 {
     MYODBCDbgEnter();
+
+    /*!
+        \internal MYODBC RULE
+
+        We do not support the following ODBC RULE;
+
+            "Calling SQLSetConnectAttr with an Attribute of SQL_ATTR_ TRACEFILE 
+            does not require the ConnectionHandle argument to be valid and will 
+            not return SQL_ERROR if ConnectionHandle is invalid."
+    */
+    if ( !hDbc )
+        MYODBCDbgReturn( SQL_INVALID_HANDLE );
+
     MYODBCDbgReturn( ((MConnection*)hDbc)->setConnectAttr( nAttribute, pValuePtr,
nStringLength ) );
 }
 

Modified: MYODBCDriver/MYODBCDriverLib/SQLSetCursorNameW.cpp
===================================================================
--- MYODBCDriver/MYODBCDriverLib/SQLSetCursorNameW.cpp	2006-05-03 02:41:16 UTC (rev 182)
+++ MYODBCDriver/MYODBCDriverLib/SQLSetCursorNameW.cpp	2006-05-03 07:07:35 UTC (rev 183)
@@ -13,6 +13,10 @@
                                      SQLSMALLINT nNameLength )
 {
     MYODBCDbgEnter();
+
+    if ( !hStm )
+        MYODBCDbgReturn( SQL_INVALID_HANDLE );
+
     MYODBCDbgReturn( ((MStatement*)hStm)->setCursorName( psCursorName, nNameLength )
);
 }
 

Modified: MYODBCDriver/MYODBCDriverLib/SQLSetDescFieldW.cpp
===================================================================
--- MYODBCDriver/MYODBCDriverLib/SQLSetDescFieldW.cpp	2006-05-03 02:41:16 UTC (rev 182)
+++ MYODBCDriver/MYODBCDriverLib/SQLSetDescFieldW.cpp	2006-05-03 07:07:35 UTC (rev 183)
@@ -15,5 +15,9 @@
                                     SQLINTEGER   nBufferLength )
 {
     MYODBCDbgEnter();
+
+    if ( !hDes )
+        MYODBCDbgReturn( SQL_INVALID_HANDLE );
+
     MYODBCDbgReturn( ((MDescriptor*)hDes)->setDescField( nRecNumber, nFieldIdentifier,
pValuePtr, nBufferLength ) );
 }

Modified: MYODBCDriver/MYODBCDriverLib/SQLSetDescRec.cpp
===================================================================
--- MYODBCDriver/MYODBCDriverLib/SQLSetDescRec.cpp	2006-05-03 02:41:16 UTC (rev 182)
+++ MYODBCDriver/MYODBCDriverLib/SQLSetDescRec.cpp	2006-05-03 07:07:35 UTC (rev 183)
@@ -34,6 +34,10 @@
                                  SQLLEN *       pnIndicator )
 {
     MYODBCDbgEnter();
+
+    if ( !hDes )
+        MYODBCDbgReturn( SQL_INVALID_HANDLE );
+
     MYODBCDbgReturn( ((MDescriptor*)hDes)->setDescRec( nRecNumber, nType, nSubType,
nLength, nPrecision, nScale, pData, pnStringLength, pnIndicator ) );
 }
 

Modified: MYODBCDriver/MYODBCDriverLib/SQLSetEnvAttr.cpp
===================================================================
--- MYODBCDriver/MYODBCDriverLib/SQLSetEnvAttr.cpp	2006-05-03 02:41:16 UTC (rev 182)
+++ MYODBCDriver/MYODBCDriverLib/SQLSetEnvAttr.cpp	2006-05-03 07:07:35 UTC (rev 183)
@@ -39,7 +39,7 @@
         We do not support process level attributes.
     */
     if ( !hEnv )
-        MYODBCDbgReturn( SQL_ERROR );
+        MYODBCDbgReturn( SQL_INVALID_HANDLE );
 
     MYODBCDbgReturn( ((MEnvironment*)hEnv)->setEnvAttr( nAttribute, pValue,
nStringLength ) );
 }

Modified: MYODBCDriver/MYODBCDriverLib/SQLSetPos.cpp
===================================================================
--- MYODBCDriver/MYODBCDriverLib/SQLSetPos.cpp	2006-05-03 02:41:16 UTC (rev 182)
+++ MYODBCDriver/MYODBCDriverLib/SQLSetPos.cpp	2006-05-03 07:07:35 UTC (rev 183)
@@ -35,6 +35,10 @@
                              SQLUSMALLINT   nLockType )
 {
     MYODBCDbgEnter();
+
+    if ( !hStm )
+        MYODBCDbgReturn( SQL_INVALID_HANDLE );
+
     MYODBCDbgReturn( ((MStatement*)hStm)->setPos( nRowNumber, nOperation, nLockType )
);
 }
 

Modified: MYODBCDriver/MYODBCDriverLib/SQLSetStmtAttrW.cpp
===================================================================
--- MYODBCDriver/MYODBCDriverLib/SQLSetStmtAttrW.cpp	2006-05-03 02:41:16 UTC (rev 182)
+++ MYODBCDriver/MYODBCDriverLib/SQLSetStmtAttrW.cpp	2006-05-03 07:07:35 UTC (rev 183)
@@ -14,6 +14,10 @@
                                    SQLINTEGER    nStringLength )
 {
     MYODBCDbgEnter();
+
+    if ( !hStm )
+        MYODBCDbgReturn( SQL_INVALID_HANDLE );
+
     MYODBCDbgReturn( ((MStatement*)hStm)->setStmtAttr( nAttribute, pValue,
nStringLength ) );
 }
 

Modified: MYODBCDriver/MYODBCDriverLib/SQLSpecialColumnsW.cpp
===================================================================
--- MYODBCDriver/MYODBCDriverLib/SQLSpecialColumnsW.cpp	2006-05-03 02:41:16 UTC (rev 182)
+++ MYODBCDriver/MYODBCDriverLib/SQLSpecialColumnsW.cpp	2006-05-03 07:07:35 UTC (rev 183)
@@ -20,6 +20,10 @@
                                       SQLSMALLINT   nNullable )
 {  
     MYODBCDbgEnter();
+
+    if ( !hStm )
+        MYODBCDbgReturn( SQL_INVALID_HANDLE );
+
     MYODBCDbgReturn( ((MStatement*)hStm)->doSpecialColumns( nIdentifierType,
psCatalogName, nNameLength1, psSchemaName, nNameLength2, psTableName, nNameLength3,
nScope, nNullable ) );
 }
 

Modified: MYODBCDriver/MYODBCDriverLib/SQLStatisticsW.cpp
===================================================================
--- MYODBCDriver/MYODBCDriverLib/SQLStatisticsW.cpp	2006-05-03 02:41:16 UTC (rev 182)
+++ MYODBCDriver/MYODBCDriverLib/SQLStatisticsW.cpp	2006-05-03 07:07:35 UTC (rev 183)
@@ -39,6 +39,10 @@
                                   SQLUSMALLINT   nAccuracy )
 {
     MYODBCDbgEnter();
+
+    if ( !hStm )
+        MYODBCDbgReturn( SQL_INVALID_HANDLE );
+
     MYODBCDbgReturn( ((MStatement*)hStm)->doStatistics( psCatalogName, nNameLength1,
psSchemaName, nNameLength2, psTableName, nNameLength3, nUnique, nAccuracy )  );
 }
 

Modified: MYODBCDriver/MYODBCDriverLib/SQLTablePrivilegesW.cpp
===================================================================
--- MYODBCDriver/MYODBCDriverLib/SQLTablePrivilegesW.cpp	2006-05-03 02:41:16 UTC (rev 182)
+++ MYODBCDriver/MYODBCDriverLib/SQLTablePrivilegesW.cpp	2006-05-03 07:07:35 UTC (rev 183)
@@ -17,6 +17,10 @@
                                        SQLSMALLINT  nTableName )
 {
     MYODBCDbgEnter();
+
+    if ( !hStm )
+        MYODBCDbgReturn( SQL_INVALID_HANDLE );
+
     MYODBCDbgReturn( ((MStatement*)hStm)->doTablePrivileges( psCatalogName,
nCatalogName, psSchemaName, nSchemaName, psTableName, nTableName ) );
 }
 

Modified: MYODBCDriver/MYODBCDriverLib/SQLTablesW.cpp
===================================================================
--- MYODBCDriver/MYODBCDriverLib/SQLTablesW.cpp	2006-05-03 02:41:16 UTC (rev 182)
+++ MYODBCDriver/MYODBCDriverLib/SQLTablesW.cpp	2006-05-03 07:07:35 UTC (rev 183)
@@ -40,6 +40,10 @@
                               SQLSMALLINT    nNameLength4 )
 {
     MYODBCDbgEnter();
+
+    if ( !hStm )
+        MYODBCDbgReturn( SQL_INVALID_HANDLE );
+
     MYODBCDbgReturn( ((MStatement*)hStm)->doTables( psCatalogName, nNameLength1,
psSchemaName, nNameLength2, psTableName, nNameLength3, psTableType, nNameLength4 ) );
 }
 

Modified: MYSQLPlus/MYSQLPlusLib/MConnection.cpp
===================================================================
--- MYSQLPlus/MYSQLPlusLib/MConnection.cpp	2006-05-03 02:41:16 UTC (rev 182)
+++ MYSQLPlus/MYSQLPlusLib/MConnection.cpp	2006-05-03 07:07:35 UTC (rev 183)
@@ -14,6 +14,39 @@
     nStatementType  = STATEMENT_DYNAMIC;
     pMySQL          = NULL;
 
+    /*!
+        \internal ODBC RULE
+
+        SQL_ATTR_TXN_ISOLATION/nTxnIsolation should default to same value as returned
from
+        SQLGetInfo with SQL_DEFAULT_TXN_ISOLATION.
+    */
+
+    /*!
+        \internal MYODBC RULE
+
+        We dot not support the following ODBC RULE (we have defaults for all attributes);
+
+            "if SQLGetConnectAttr is called and the specified attribute does not have a 
+            default and has not been set by a prior call to SQLSetConnectAttr, 
+            SQLGetConnectAttr will return SQL_NO_DATA."
+    */
+
+    nAccessMode             = SQL_MODE_READ_WRITE;
+    nAsyncEnable            = SQL_ASYNC_ENABLE_OFF;
+    nAutocommit             = SQL_AUTOCOMMIT_ON;
+    nConnectionTimeout      = 0;
+    stringCurrentCatalog    = QString::null;
+    nLoginTimeout           = 0;
+    nMetadataID             = SQL_FALSE;
+    nODBCCursors            = SQL_CUR_USE_DRIVER;
+    nPacketSize             = 16 * 1,024,000;        /*! \internal \todo Client and
server have independent value. Default on client is 16M but try to be smarter by getting
real value. */
+    hQuietMode              = 0;
+    nTrace                  = SQL_OPT_TRACE_OFF;
+    stringTracefile         = QString::null;
+    stringTranslateLib      = QString::null;
+    nTranslateOption        = 0;
+    nTxnIsolation           = 0;
+
     MYODBCDbgReturn2();
 }
 
@@ -26,12 +59,26 @@
     MYODBCDbgReturn2();
 }
 
-SQLRETURN MConnection::setConnectAttr( SQLINTEGER nAttribute, SQLPOINTER pValuePtr,
SQLINTEGER nStringLength )
+SQLRETURN MConnection::setConnectAttr( SQLINTEGER nAttribute, SQLPOINTER pValue,
SQLINTEGER nStringLength )
 {
     MYODBCDbgEnter();
 
+    /*!
+        \internal ODBC RULE
+
+        We clear diagnostic each time an ODBC API call is made (with exceptions).
+    */
     pDiagnostic->doClear();
 
+    /*!
+        \internal ODBC RULE (DM)
+
+        (DM) *ValuePtr is a character string, and BufferLength was less than zero 
+        but not equal to SQL_NTS.
+    */
+    if ( nBufferLength < 0 && nBufferLength != SQL_NTS )
+        MYODBCDbgReturn( pDiagnostic->doAppend( MDiagnostic::DIA_HY090 ) );
+
     MYODBCDbgReturn( SQL_ERROR );
 }
 
@@ -44,13 +91,156 @@
     MYODBCDbgReturn( SQL_SUCCESS );
 }
 
-SQLRETURN MConnection::getConnectAttr( SQLINTEGER nAttribute, SQLPOINTER pValuePtr,
SQLINTEGER nBufferLength, SQLINTEGER *pnStringLengthPtr )
+SQLRETURN MConnection::getConnectAttr( SQLINTEGER nAttribute, SQLPOINTER pValue,
SQLINTEGER nBufferLength, SQLINTEGER *pnStringLength )
 {
     MYODBCDbgEnter();
 
+    /* handle case where we are not provided viable pnStringLength */
+    SQLINTEGER      nLen        = 0;
+    SQLINTEGER *    pnLen;
+    if ( pnStringLength )
+        pnLen = pnStringLength;
+    else
+        pnLen = &nLen;
+
+    /*!
+        \internal ODBC RULE
+
+        We clear diagnostic each time an ODBC API call is made (with exceptions).
+    */
     pDiagnostic->doClear();
 
-    MYODBCDbgReturn( SQL_ERROR );
+    /*!
+        \internal ODBC Rule
+
+        (DM) SQLBrowseConnect was called for the ConnectionHandle and returned 
+        SQL_NEED_DATA. This function was called before SQLBrowseConnect 
+        returned SQL_SUCCESS_WITH_INFO or SQL_SUCCESS.
+    */      
+    if ( pDbc->nState == MYODBC_DRV_STATE_C3 )
+        MYODBCDbgReturn( pDiagnostic->doAppend( MDiagnostic::DIA_HY010 ) );
+
+    switch ( nAttribute )
+    {
+        case SQL_ATTR_ACCESS_MODE:
+            if ( pValue )
+                *((SQLUINTEGER*)pValue) = getAccessMode();
+            *pnLen = SQL_IS_UINTEGER ;
+            break;
+
+        case SQL_ATTR_ASYNC_ENABLE:
+            if ( pValue )
+                *((SQLUINTEGER*)pValue) = getAsyncEnable();
+            *pnLen = SQL_IS_UINTEGER ;
+            break;
+
+        case SQL_ATTR_AUTO_IPD:
+            if ( pValue )
+                *((SQLUINTEGER*)pValue) = getAutoIPD();
+            *pnLen = SQL_IS_UINTEGER ;
+            break;
+
+        case SQL_ATTR_AUTOCOMMIT:
+            if ( pValue )
+                *((SQLUINTEGER*)pValue) = getAutocommit();
+            *pnLen = SQL_IS_UINTEGER ;
+            break;
+
+        case SQL_ATTR_CONNECTION_DEAD:
+            if ( pValue )
+                *((SQLUINTEGER*)pValue) = getConnectionDead();
+            *pnLen = SQL_IS_UINTEGER ;
+            break;
+
+        case SQL_ATTR_CONNECTION_TIMEOUT:
+            if ( pValue )
+                *((SQLUINTEGER*)pValue) = getConnectionTimeout();
+            *pnLen = SQL_IS_UINTEGER ;
+            break;
+
+        case SQL_ATTR_CURRENT_CATALOG:
+            if ( pValue )
+                MYODBCCStrCopyOut( pszChar, nBufferLength, pDbc->attr_current_catalog,
pnLen );
+            break;
+
+        case SQL_ATTR_LOGIN_TIMEOUT:
+            if ( pValue )
+                *((SQLUINTEGER*)pValue) = getLoginTimeout();
+            *pnLen = SQL_IS_UINTEGER ;
+            break;
+
+        case SQL_ATTR_METADATA_ID:
+            if ( pValue )
+                *((SQLUINTEGER*)pValue) = getMetadataID();
+            *pnLen = SQL_IS_UINTEGER ;
+            break;
+
+        case SQL_ATTR_ODBC_CURSORS:
+            if ( pValue )
+                *((SQLUINTEGER*)pValue) = getODBCCursors();
+            *pnLen = SQL_IS_UINTEGER ;
+            break;
+
+        case SQL_ATTR_PACKET_SIZE:
+            if ( pValue )
+                *((SQLUINTEGER*)pValue) = getPacketSize();
+            *pnLen = SQL_IS_UINTEGER ;
+            break;
+
+        case SQL_ATTR_QUIET_MODE:
+            if ( pValue )
+                *((SQLINTEGER*)pValue) = (SQLINTEGER)getQuietMode();
+            *pnLen = SQL_IS_INTEGER ;
+            break;
+
+        case SQL_ATTR_TRACE:
+            if ( pValue )
+                *((SQLUINTEGER*)pValue) = getTrace();
+            *pnLen = SQL_IS_UINTEGER ;
+            break;
+
+        case SQL_ATTR_TRACEFILE:
+            if ( nBufferLength < 1 )
+                MYODBCDbgReturn( pDiagnostic->doAppend( MDiagnostic::DIA_HY090 ) );
+
+            if ( pValue )
+            {
+                errno_t nError;
+
+                if ( getTracefile().isNull() )
+                {
+                    MYODBCDbgReturn( SQL_NO_DATA );
+                    *pnLen = 0;
+                }
+                else if ( nError = MYODBCC::doStrNCpy( (SQLWCHAR*)pValue, nBufferLength /
sizeof(SQLWCHAR), getTracefile().utf16() ) )
+                    MYODBCDbgReturn( pDiagnostic->doAppend( MDiagnostic::DIA_HY000,
nError, tr("doStrNCpy() failed.") ) );
+            }
+            *pnLen = getTracefile().length() * sizeof(SQLWCHAR);
+            if ( *pnLen > nBufferLength )
+                MYODBCDbgReturn( SQL_SUCCESS_WITH_INFO );
+            break;
+
+        case SQL_ATTR_TRANSLATE_LIB:
+            if ( pValue )
+                MYODBCCStrCopyOut( pszChar, nBufferLength, pDbc->attr_translate_lib,
pnLen );
+            break;
+
+        case SQL_ATTR_TRANSLATE_OPTION:
+            if ( pValue )
+                *((SQLINTEGER*)pValue) = (SQLINTEGER)getTranslateOption();
+            *pnLen = SQL_IS_INTEGER ;
+            break;
+        case SQL_ATTR_TXN_ISOLATION:
+            if ( pValue )
+                *((SQLINTEGER*)pValue) = (SQLINTEGER)getTxnIsolation();
+            *pnLen = SQL_IS_INTEGER ;
+            break;
+
+        default:
+            MYODBCDbgReturn( pDiagnostic->doAppend( MDiagnostic::DIA_HY092 ) );
+    }
+
+    MYODBCDbgReturn( SQL_SUCCESS );
 }
 
 SQLRETURN MConnection::getDiagField( SQLSMALLINT nRecNumber, SQLSMALLINT nDiagIdentifier,
SQLPOINTER pDiagInfoPtr, SQLSMALLINT nBufferLength, SQLSMALLINT *pnStringLengthPtr )
@@ -335,6 +525,337 @@
     MYODBCDbgReturn( SQL_ERROR );
 }
 
+SQLRETURN MConnection::setAccessMode( SQLUINTEGER nAccessMode )
+{
+    MYODBCDbgEnter();
+
+    switch ( nAccessMode )
+    {
+        case SQL_MODE_READ_ONLY:
+        case SQL_MODE_READ_WRITE:
+            break;
+        default:
+            MYODBCDbgReturn( pDiagnostic->doAppend( MDiagnostic::DIA_HY092 ) );
+    }
+
+    this->nAccessMode = nAccessMode;
+
+    MYODBCDbgReturn( SQL_SUCCESS );
+}
+
+SQLRETURN MConnection::setAsyncEnable( SQLUINTEGER nAsyncEnable )
+{
+    MYODBCDbgEnter();
+
+    /*!
+        \internal ODBC RULE
+
+        Drivers that operate only on multithread operating systems do not need 
+        to support asynchronous execution.
+    */
+    /*!
+        \internal MYODBC RULE
+
+        We dot not support asynch.
+    */
+    switch ( nAsyncEnable )
+    {
+        case SQL_ASYNC_ENABLE_OFF:
+            break;
+        case SQL_ASYNC_ENABLE_ON:
+            MYODBCDbgReturn( pDiagnostic->doAppend( MDiagnostic::DIA_HYC00 ) );
+        default:
+            MYODBCDbgReturn( pDiagnostic->doAppend( MDiagnostic::DIA_HY092 ) );
+    }
+
+    this->nAsyncEnable = nAsyncEnable;
+
+    MYODBCDbgReturn( SQL_SUCCESS );
+}
+
+SQLRETURN MConnection::setAutocommit( SQLUINTEGER nAutocommit )
+{
+    MYODBCDbgEnter();
+
+    /*!
+        \internal 
+        \todo       Enable transaction support.
+    */
+    switch ( nAutocommit )
+    {
+        case SQL_AUTOCOMMIT_OFF:
+            MYODBCDbgReturn( pDiagnostic->doAppend( MDiagnostic::DIA_HYC00 ) );
+        case SQL_AUTOCOMMIT_ON:
+            break;
+        default:
+            MYODBCDbgReturn( pDiagnostic->doAppend( MDiagnostic::DIA_HY092 ) );
+    }
+
+    this->nAutocommit = nAutocommit;
+
+    MYODBCDbgReturn( SQL_SUCCESS );
+}
+
+SQLRETURN MConnection::setConnectionTimeout( SQLUINTEGER nConnectionTimeout )
+{
+    MYODBCDbgEnter();
+
+    this->nConnectionTimeout = nConnectionTimeout;
+
+    MYODBCDbgReturn( SQL_SUCCESS );
+}
+
+SQLRETURN MConnection::setCurrentCatalog( QString stringCurrentCatalog )
+{
+    MYODBCDbgEnter();
+
+    /*!
+        \internal
+        \note       This will get used during a connect - it is not applied now. It
+                    will be ignored if isEmpty().
+
+                    This may get set with DATABASE connect attribute during a
+                    connect depending upon circumstances. See connect methods.
+    */
+    this->stringCurrentCatalog = stringCurrentCatalog;
+
+    MYODBCDbgReturn( SQL_SUCCESS );
+}
+
+SQLRETURN MConnection::setLoginTimeout( SQLUINTEGER nLoginTimeout )
+{
+    MYODBCDbgEnter();
+
+    /*!
+        \internal
+        \note       This will get used during a connect - it is not applied now. 
+    */
+    this->nLoginTimeout = nLoginTimeout;
+
+    MYODBCDbgReturn( SQL_SUCCESS );
+}
+
+SQLRETURN MConnection::setMetadataID( SQLUINTEGER nMetadataID )
+{
+    MYODBCDbgEnter();
+
+    switch ( nMetadataID )
+    {
+        case SQL_TRUE:
+        case SQL_FALSE:
+            break;
+        default:
+            MYODBCDbgReturn( pDiagnostic->doAppend( MDiagnostic::DIA_HY092 ) );
+    }
+
+    this->nMetadataID = nMetadataID;
+
+    MYODBCDbgReturn( SQL_SUCCESS );
+}
+
+SQLRETURN MConnection::setODBCCursors( SQLUINTEGER nODBCCursors )
+{
+    MYODBCDbgEnter();
+
+    /*!
+        \internal MYODBC RULE
+
+        Try to support DM attributes in case app is linked directly to us.
+    */
+    switch ( nODBCCursors )
+    {
+        case SQL_CUR_USE_IF_NEEDED:
+        case SQL_CUR_USE_ODBC:
+            MYODBCDbgReturn( pDiagnostic->doAppend( MDiagnostic::DIA_HYC00 ) );
+        case SQL_CUR_USE_DRIVER:
+            break;
+        default:
+            MYODBCDbgReturn( pDiagnostic->doAppend( MDiagnostic::DIA_HY092 ) );
+    }
+
+    this->nODBCCursors = nODBCCursors;
+
+    MYODBCDbgReturn( SQL_SUCCESS );
+}
+
+SQLRETURN MConnection::setPacketSize( SQLUINTEGER nPacketSize )
+{
+    MYODBCDbgEnter();
+
+    /*!
+        \internal ODBC RULE
+
+        If the application sets packet size after a connection has already been 
+        made, the driver will return SQLSTATE HY011 (Attribute cannot be set now).
+    */
+    if ( getState() > STATE_C3 )
+        MYODBCDbgReturn( pDiagnostic->doAppend( MDiagnostic::DIA_HY011 ) );
+
+    /*!
+        \internal
+        \todo       We can probably make use of this.
+    */
+    MYODBCDbgReturn( pDiagnostic->doAppend( MDiagnostic::DIA_HYC00 ) );
+
+    this->nPacketSize = nPacketSize;
+
+    MYODBCDbgReturn( SQL_SUCCESS );
+}
+
+SQLRETURN MConnection::setQuietMode( HWND_32 hQuietMode )
+{
+    MYODBCDbgEnter();
+
+    /*!
+        \internal 
+        \note       We do not use this.
+    */
+    this->hQuietMode = hQuietMode;
+
+    MYODBCDbgReturn( SQL_SUCCESS );
+}
+
+SQLRETURN MConnection::setTrace( SQLUINTEGER nTrace )
+{
+    MYODBCDbgEnter();
+
+    /*!
+        \internal MYODBC RULE
+
+        Try to support DM attributes in case app is linked directly to us.
+    */
+
+    /*!
+        \internal 
+        \todo make use of this
+    */
+
+    switch ( nTrace )
+    {
+        case SQL_OPT_TRACE_OFF:
+            break;
+        case SQL_OPT_TRACE_ON:
+            MYODBCDbgReturn( pDiagnostic->doAppend( MDiagnostic::DIA_HYC00 ) );
+        default:
+            MYODBCDbgReturn( pDiagnostic->doAppend( MDiagnostic::DIA_HY092 ) );
+    }
+
+    this->nTrace = nTrace;
+
+    MYODBCDbgReturn( SQL_SUCCESS );
+}
+
+SQLRETURN MConnection::setTracefile( QString stringTracefile )
+{
+    MYODBCDbgEnter();
+
+    /*!
+        \internal MYODBC RULE
+
+        Try to support DM attributes in case app is linked directly to us.
+    */
+
+    /*!
+        \internal 
+        \todo make use of this
+    */
+    this->stringTracefile = stringTracefile;
+
+    MYODBCDbgReturn( SQL_SUCCESS );
+}
+
+SQLRETURN MConnection::setTranslateLib( QString stringTranslateLib )
+{
+    MYODBCDbgEnter();
+
+    /*!
+        \internal MYODBC RULE
+
+        We dot not support the following ODBC RULE;
+
+            "The setting of this attribute will persist across connections."
+    */
+
+    /*!
+        \internal ODBC RULE 
+
+        This attribute can be specified only if the driver has connected 
+        to the data source.
+    */
+    if ( getState() < STATE_C4 )
+        MYODBCDbgReturn( pDiagnostic->doAppend( MDiagnostic::DIA_HY011 ) );
+
+    /*!
+        \internal 
+        \todo support translation library 
+    */
+    this->stringTranslateLib = stringTranslateLib;
+
+    MYODBCDbgReturn( SQL_SUCCESS );
+}
+
+SQLRETURN MConnection::setTranslateOption( qint32 nTranslateOption )
+{
+    MYODBCDbgEnter();
+
+    /*!
+        \internal ODBC RULE 
+
+        This attribute can be specified only if the driver has connected 
+        to the data source.
+    */
+    if ( getState() < STATE_C4 )
+        MYODBCDbgReturn( pDiagnostic->doAppend( MDiagnostic::DIA_HY011 ) );
+
+    /*!
+        \internal 
+        \todo support translation library 
+    */
+    this->nTranslateOption = nTranslateOption;
+
+    MYODBCDbgReturn( SQL_SUCCESS );
+}
+
+SQLRETURN MConnection::setTxnIsolation( qint32 nTxnIsolation )
+{
+    MYODBCDbgEnter();
+
+    /*!
+        \internal ODBC RULE
+
+        An application must call SQLEndTran to commit or roll back all open 
+        transactions on a connection, before calling SQLSetConnectAttr with 
+        this option.
+    */
+    if ( getState() == STATE_C6 )
+        MYODBCDbgReturn( pDiagnostic->doAppend( MDiagnostic::DIA_HY011 ) );
+
+    /*!
+        \internal 
+        \todo enable transaction support
+    */
+    /*!
+        \internal 
+        \todo treat as bitmask
+    */
+    switch ( nTxnIsolation )
+    {
+        case 0: /* no transactions */
+            break;
+        case SQL_TXN_READ_UNCOMMITTED:
+        case SQL_TXN_READ_COMMITTED:
+        case SQL_TXN_REPEATABLE_READ:
+        case SQL_TXN_SERIALIZABLE:
+            MYODBCDbgReturn( pDiagnostic->doAppend( MDiagnostic::DIA_HYC00 ) );
+        default:
+            MYODBCDbgReturn( pDiagnostic->doAppend( MDiagnostic::DIA_HY092 ) );
+    }
+
+    this->nTxnIsolation = nTxnIsolation;
+
+    MYODBCDbgReturn( SQL_SUCCESS );
+}
+
 MDiagnostic *MConnection::getDiagnostic()
 {
     MYODBCDbgEnter();
@@ -347,14 +868,14 @@
 {
     MYODBCDbgEnter();
 
-    MYODBCDbgReturn3( "%d", zz );
+    MYODBCDbgReturn3( "%d", nAccessMode );
 }
 
 SQLUINTEGER MConnection::getAsyncEnable()
 {
     MYODBCDbgEnter();
 
-    MYODBCDbgReturn3( "%d", zz );
+    MYODBCDbgReturn3( "%d", nAsyncEnable );
 }
 
 SQLUINTEGER MConnection::getAutoIPD()
@@ -375,11 +896,31 @@
 {
     MYODBCDbgEnter();
 
-    SQLUINTEGER nConnectionDead = SQL_CD_FALSE;
+    SQLUINTEGER nConnectionDead = SQL_CD_TRUE;
 
-    if ( getState() == STATE_C4 )
+    if ( getState() >= STATE_C4 )
     {
-        mysql_ping( pMySQL );
+        int nReturn = mysql_ping( pMySQL );
+        switch ( nReturn )
+        {
+            case 0:
+                nConnectionDead = SQL_CD_FALSE;
+                break;
+            case CR_COMMANDS_OUT_OF_SYNC:
+                pDiagnostic->doAppend( MDiagnostic::DIA_01000, nReturn,
"CR_COMMANDS_OUT_OF_SYNC" );
+                break;
+            case CR_SERVER_GONE_ERROR:
+                pDiagnostic->doAppend( MDiagnostic::DIA_01000, nReturn,
"CR_SERVER_GONE_ERROR" );
+                break;
+            case CR_UNKNOWN_ERROR:
+                pDiagnostic->doAppend( MDiagnostic::DIA_01000, nReturn,
"CR_UNKNOWN_ERROR" );
+                break;
+            case CR_SERVER_LOST: /* tbis is undocumented but as I recall it happens - PAH
*/
+                pDiagnostic->doAppend( MDiagnostic::DIA_01000, nReturn,
"CR_SERVER_LOST" );
+                break;
+            default:
+                MYODBCDbgReturn( pDiagnostic->doAppend( MDiagnostic::DIA_HY000,
nReturn, tr("Unhandled return code from mysql_ping()") ) );
+        }
     }
 
     MYODBCDbgReturn3( "%d", nConnectionDead );
@@ -496,7 +1037,6 @@
         mysql_options( pMySQL, MYSQL_INIT_COMMAND, stringInitialStatement.toUtf8().data()
);
     if ( nConnectTimeout )
         mysql_options( pMySQL, MYSQL_OPT_CONNECT_TIMEOUT, (char*)&nConnectTimeout );
-getl
 
     return nClientFlag;
 }

Modified: MYSQLPlus/MYSQLPlusLib/MEnvironment.cpp
===================================================================
--- MYSQLPlus/MYSQLPlusLib/MEnvironment.cpp	2006-05-03 02:41:16 UTC (rev 182)
+++ MYSQLPlus/MYSQLPlusLib/MEnvironment.cpp	2006-05-03 07:07:35 UTC (rev 183)
@@ -85,30 +85,6 @@
     MYODBCDbgReturn( pDiagnostic->getDiagRec( nRecNumber, psSQLState,
pnNativeErrorPtr, psMessageText, nBufferLength, pnTextLengthPtr ) );
 }
 
-/*!
-    \brief  <B>ODBC 3.0 API</B>
-            <BR>
-            Returns the environment attributes.
-
-    \param  nAttribute          Attribute to retrieve.
-    \param  pValuePtr           Pointer to a buffer in which to return the attribute
value.
-    \param  nBufferLength       Size of pValuePtr buffer.
-    \param  pnStringLengthPtr   Number of bytes available for pValuePtr.
-    
-    \return SQLRETURN
-
-    \retval SQL_SUCCESS             Request processed ok.
-    \retval SQL_SUCCESS_WITH_INFO   Request was probably processed ok - check diagnostic.
-    \retval SQL_ERROR               Request failed.
-    \retval SQL_NO_DATA             No data.
-    \retval SQL_INVALID_HANDLE      Invalid handle was provided.
-
-    \sa     SQLGetConnectAttr
-            SQLGetStmtAttr
-            SQLSetConnectAttr
-            SQLSetEnvAttr
-            SQLSetStmtAttr
-*/
 SQLRETURN MEnvironment::getEnvAttr( SQLINTEGER nAttribute, SQLPOINTER pValue, SQLINTEGER
nBufferLength, SQLINTEGER *pnStringLength )
 {
     MYODBCDbgEnter();
@@ -120,23 +96,24 @@
     */
     pDiagnostic->doClear();
 
-    if ( !pValue )
-        MYODBCDbgReturn( pDiagnostic->doAppend( MDiagnostic::DIA_HY000 ) );
-
     /* do it  */
     switch ( nAttribute )
     {
         case SQL_ATTR_CONNECTION_POOLING:
-            *((SQLUINTEGER*)pValue) = getConnectionPooling();
+            if ( pValue )
+                *((SQLUINTEGER*)pValue) = getConnectionPooling();
             break;
         case SQL_ATTR_CP_MATCH:
-            *((SQLUINTEGER*)pValue) = getCPMatch();
+            if ( pValue )
+                *((SQLUINTEGER*)pValue) = getCPMatch();
             break;
         case SQL_ATTR_ODBC_VERSION:
-            *((SQLINTEGER*)pValue) = getODBCVersion();
+            if ( pValue )
+                *((SQLINTEGER*)pValue) = getODBCVersion();
             break;
         case SQL_ATTR_OUTPUT_NTS:
-            *((SQLINTEGER*)pValue) = getOutputNTS();
+            if ( pValue )
+                *((SQLINTEGER*)pValue) = getOutputNTS();
             break;
         default:
             MYODBCDbgReturn( pDiagnostic->doAppend( MDiagnostic::DIA_HY092 ) );

Modified: MYSQLPlus/MYSQLPlusLib/MStatement.cpp
===================================================================
--- MYSQLPlus/MYSQLPlusLib/MStatement.cpp	2006-05-03 02:41:16 UTC (rev 182)
+++ MYSQLPlus/MYSQLPlusLib/MStatement.cpp	2006-05-03 07:07:35 UTC (rev 183)
@@ -25,7 +25,7 @@
     nKeysetSize         = 0;
     nMaxLength          = 0;
     nMaxRows            = 0;
-    nMetadataID         = SQL_FALSE;
+    nMetadataID         = pConnection->getMetadataID();
     nNoscan             = SQL_NOSCAN_OFF;
     nQueryTimeout       = 0;
     nRetrieveData       = SQL_RD_ON;

Thread
Connector/ODBC 5 commit: r183 - MYODBCDriver/MYODBCDriverLib MYSQLPlus/MYSQLPlusLibpharvey3 May