List:Commits« Previous MessageNext Message »
From:pharvey Date:June 27 2006 8:55am
Subject:Connector/ODBC 5 commit: r404 - in trunk/MYSQLPlus: MYSQLPlusLib include
View as plain text  
Modified:
   trunk/MYSQLPlus/MYSQLPlusLib/MConnection.cpp
   trunk/MYSQLPlus/include/MConnection.h
Log:
more work on getInfo*() methods

Modified: trunk/MYSQLPlus/MYSQLPlusLib/MConnection.cpp
===================================================================
--- trunk/MYSQLPlus/MYSQLPlusLib/MConnection.cpp	2006-06-27 05:59:14 UTC (rev 403)
+++ trunk/MYSQLPlus/MYSQLPlusLib/MConnection.cpp	2006-06-27 06:55:45 UTC (rev 404)
@@ -469,16 +469,6 @@
     BOOLEAN             bCopyOk;
 
     /*!
-        \internal
-        \todo
-
-        Need to go through each support method to ensure that;
-
-        - values which are based upon server version etc are actually based upon that
underlying dependency
-        - values which are literal in fact reflect reality for example;
getInfoMaxColumnsInTable - is it really infinite
-    */
-
-    /*!
         \internal ODBC RULE
 
         We clear diagnostic each time an ODBC API call is made (with exceptions).
@@ -540,6 +530,7 @@
         MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::DIA_08003 ) );
 
     /*!
+        \internal
         \todo
 
         Much the values returned here are copied from the 3.51 driver with only a quick
check to
@@ -548,12 +539,14 @@
         be done in more than one pass/effort.
     */
     /*!
+        \internal
         \todo
 
         Some of the values in here are dependent upon the version of the server we are
using
         and possibly the client library. This needs to be handled.
     */
     /*!
+        \internal
         \todo
 
         Some of the values in here are conservative in the exposure of features in the
driver as
@@ -564,15 +557,22 @@
     switch ( nInfoType )
     {
         case 30002:
+            /*!
+                \internal
+                \note
+
+                This seems to come in despite it being an unknown value!? Sending back an
error seems to
+                be worse than ignoring. 
+            */
             break;
         case SQL_ACCESSIBLE_PROCEDURES:
-            bCopyOk = MYODBCC::doStringCopyOut( pszSQLWCHAR, nBufferLength /
sizeof(SQLWCHAR), L"Y", &nStringLengthChars );
+            bCopyOk = MYODBCC::doStringCopyOut( pszSQLWCHAR, nBufferLength /
sizeof(SQLWCHAR), (SQLWCHAR*)getInfoAccessibleProcedures().utf16(),
&nStringLengthChars );
             *pnStringLengthBytes = nStringLengthChars * sizeof(SQLWCHAR);
             if ( !bCopyOk )
                 MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::DIA_01004 )
);
             break;
         case SQL_ACCESSIBLE_TABLES:
-            bCopyOk = MYODBCC::doStringCopyOut( pszSQLWCHAR, nBufferLength /
sizeof(SQLWCHAR), L"Y", &nStringLengthChars );
+            bCopyOk = MYODBCC::doStringCopyOut( pszSQLWCHAR, nBufferLength /
sizeof(SQLWCHAR), (SQLWCHAR*)getInfoAccessibleTables().utf16(), &nStringLengthChars
);
             *pnStringLengthBytes = nStringLengthChars * sizeof(SQLWCHAR);
             if ( !bCopyOk )
                 MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::DIA_01004 )
);
@@ -605,19 +605,19 @@
             *pnSQLUSMALLINT = getInfoCatalogLocation();
             break;
         case SQL_CATALOG_NAME:
-            bCopyOk = MYODBCC::doStringCopyOut( pszSQLWCHAR, nBufferLength /
sizeof(SQLWCHAR), L"Y", &nStringLengthChars );
+            bCopyOk = MYODBCC::doStringCopyOut( pszSQLWCHAR, nBufferLength /
sizeof(SQLWCHAR), (SQLWCHAR*)getInfoCatalogName().utf16(), &nStringLengthChars );
             *pnStringLengthBytes = nStringLengthChars * sizeof(SQLWCHAR);
             if ( !bCopyOk )
                 MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::DIA_01004 )
);
             break;
         case SQL_CATALOG_NAME_SEPARATOR:
-            bCopyOk = MYODBCC::doStringCopyOut( pszSQLWCHAR, nBufferLength /
sizeof(SQLWCHAR), L".", &nStringLengthChars );
+            bCopyOk = MYODBCC::doStringCopyOut( pszSQLWCHAR, nBufferLength /
sizeof(SQLWCHAR), (SQLWCHAR*)getInfoCatalogNameSeparator().utf16(),
&nStringLengthChars );
             *pnStringLengthBytes = nStringLengthChars * sizeof(SQLWCHAR);
             if ( !bCopyOk )
                 MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::DIA_01004 )
);
             break;
         case SQL_CATALOG_TERM:
-            bCopyOk = MYODBCC::doStringCopyOut( pszSQLWCHAR, nBufferLength /
sizeof(SQLWCHAR), L"database", &nStringLengthChars );
+            bCopyOk = MYODBCC::doStringCopyOut( pszSQLWCHAR, nBufferLength /
sizeof(SQLWCHAR), (SQLWCHAR*)getInfoCatalogTerm().utf16(), &nStringLengthChars );
             *pnStringLengthBytes = nStringLengthChars * sizeof(SQLWCHAR);
             if ( !bCopyOk )
                 MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::DIA_01004 )
);
@@ -626,13 +626,13 @@
             *pnSQLUINTEGER  = getInfoCatalogUsage();
             break;
         case SQL_COLLATION_SEQ:
-            bCopyOk = MYODBCC::doStringCopyOut( pszSQLWCHAR, nBufferLength /
sizeof(SQLWCHAR), L"", &nStringLengthChars );
+            bCopyOk = MYODBCC::doStringCopyOut( pszSQLWCHAR, nBufferLength /
sizeof(SQLWCHAR), (SQLWCHAR*)getInfoCollationSeq().utf16(), &nStringLengthChars );
             *pnStringLengthBytes = nStringLengthChars * sizeof(SQLWCHAR);
             if ( !bCopyOk )
                 MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::DIA_01004 )
);
             break;
         case SQL_COLUMN_ALIAS:
-            bCopyOk = MYODBCC::doStringCopyOut( pszSQLWCHAR, nBufferLength /
sizeof(SQLWCHAR), L"Y", &nStringLengthChars );
+            bCopyOk = MYODBCC::doStringCopyOut( pszSQLWCHAR, nBufferLength /
sizeof(SQLWCHAR), (SQLWCHAR*)getInfoColumnAlias().utf16(), &nStringLengthChars );
             *pnStringLengthBytes = nStringLengthChars * sizeof(SQLWCHAR);
             if ( !bCopyOk )
                 MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::DIA_01004 )
);
@@ -748,79 +748,37 @@
             *pnSQLUINTEGER = getInfoCursorSensitivity();
             break;
         case SQL_DATA_SOURCE_NAME:
-            if ( getDataSourceName().isEmpty() )
-            {
-                bCopyOk = MYODBCC::doStringCopyOut( pszSQLWCHAR, nBufferLength /
sizeof(SQLWCHAR), L"", &nStringLengthChars );
-                *pnStringLengthBytes = nStringLengthChars * sizeof(SQLWCHAR);
-                if ( !bCopyOk )
-                    MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::DIA_01004
) );
-            }
-            else
-            {
-                bCopyOk = MYODBCC::doStringCopyOut( pszSQLWCHAR, nBufferLength /
sizeof(SQLWCHAR), (SQLWCHAR*)getDataSourceName().utf16(), &nStringLengthChars );
-                *pnStringLengthBytes = nStringLengthChars * sizeof(SQLWCHAR);
-                if ( !bCopyOk )
-                    MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::DIA_01004
) );
-            }
+            bCopyOk = MYODBCC::doStringCopyOut( pszSQLWCHAR, nBufferLength /
sizeof(SQLWCHAR), (SQLWCHAR*)getInfoDataSourceName().utf16(), &nStringLengthChars );
+            *pnStringLengthBytes = nStringLengthChars * sizeof(SQLWCHAR);
+            if ( !bCopyOk )
+                MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::DIA_01004 )
);
             break;
         case SQL_DATA_SOURCE_READ_ONLY:
-            bCopyOk = MYODBCC::doStringCopyOut( pszSQLWCHAR, nBufferLength /
sizeof(SQLWCHAR), L"N", &nStringLengthChars );
+            bCopyOk = MYODBCC::doStringCopyOut( pszSQLWCHAR, nBufferLength /
sizeof(SQLWCHAR), (SQLWCHAR*)getInfoDataSourceReadOnly().utf16(), &nStringLengthChars
);
             *pnStringLengthBytes = nStringLengthChars * sizeof(SQLWCHAR);
             if ( !bCopyOk )
                 MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::DIA_01004 )
);
             break;
         case SQL_DATABASE_NAME:
-            {
-                /*!
-                    \internal ODBC Rule
-
-                    A character string with the name of the current database in use, if
the data source defines 
-                    a named object called "database".
-                    ... also SQL_ATTR_CURRENT_CATALOG.
-                */
-                /*!
-                    \internal MYODBC Rule
-
-                    We account for the fact that SQL_ATTR_CURRENT_CATALOG may be
inaccurate due
-                    to the possible use of "USE DATABASE". So this may not be the value
of 'database' from
-                    a DSN.
-                */
-                QString stringDatabaseName = getCurrentCatalog();
-
-                if ( stringDatabaseName.isEmpty() )
-                {
-                    bCopyOk = MYODBCC::doStringCopyOut( pszSQLWCHAR, nBufferLength /
sizeof(SQLWCHAR), L"", &nStringLengthChars );
-                    *pnStringLengthBytes = nStringLengthChars * sizeof(SQLWCHAR);
-                    if ( !bCopyOk )
-                        MYODBCDbgReturn( getDiagnostic()->doAppend(
MDiagnostic::DIA_01004 ) );
-                }
-                else
-                {
-                    bCopyOk = MYODBCC::doStringCopyOut( pszSQLWCHAR, nBufferLength /
sizeof(SQLWCHAR), (SQLWCHAR*)stringDatabaseName.utf16(), &nStringLengthChars );
-                    *pnStringLengthBytes = nStringLengthChars * sizeof(SQLWCHAR);
-                    if ( !bCopyOk )
-                        MYODBCDbgReturn( getDiagnostic()->doAppend(
MDiagnostic::DIA_01004 ) );
-                }
-            }
+            bCopyOk = MYODBCC::doStringCopyOut( pszSQLWCHAR, nBufferLength /
sizeof(SQLWCHAR), (SQLWCHAR*)getInfoDatabaseName().utf16(), &nStringLengthChars );
+            *pnStringLengthBytes = nStringLengthChars * sizeof(SQLWCHAR);
+            if ( !bCopyOk )
+                MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::DIA_01004 )
);
             break;
         case SQL_DATETIME_LITERALS:
             *pnSQLUINTEGER = getInfoDatetimeLiterals();
             break;
         case SQL_DBMS_NAME:
-            bCopyOk = MYODBCC::doStringCopyOut( pszSQLWCHAR, nBufferLength /
sizeof(SQLWCHAR), L"MySQL", &nStringLengthChars );
+            bCopyOk = MYODBCC::doStringCopyOut( pszSQLWCHAR, nBufferLength /
sizeof(SQLWCHAR), (SQLWCHAR*)getInfoDbmsName().utf16(), &nStringLengthChars );
             *pnStringLengthBytes = nStringLengthChars * sizeof(SQLWCHAR);
             if ( !bCopyOk )
                 MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::DIA_01004 )
);
             break;
         case SQL_DBMS_VER: 
-            {
-                QString stringServerVersion( ((MYSQL*)getMySQL())->server_version );
-
-                bCopyOk = MYODBCC::doStringCopyOut( pszSQLWCHAR, nBufferLength /
sizeof(SQLWCHAR), (SQLWCHAR*)stringServerVersion.utf16(), &nStringLengthChars );
-                *pnStringLengthBytes = nStringLengthChars * sizeof(SQLWCHAR);
-                if ( !bCopyOk )
-                    MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::DIA_01004
) );
-            }
+            bCopyOk = MYODBCC::doStringCopyOut( pszSQLWCHAR, nBufferLength /
sizeof(SQLWCHAR), (SQLWCHAR*)getInfoDbmsVer().utf16(), &nStringLengthChars );
+            *pnStringLengthBytes = nStringLengthChars * sizeof(SQLWCHAR);
+            if ( !bCopyOk )
+                MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::DIA_01004 )
);
             break;
         case SQL_DDL_INDEX:
             *pnSQLUINTEGER = getInfoDdlIndex();
@@ -829,55 +787,25 @@
             *pnSQLUINTEGER = getInfoDefaultTxnIsolation();
             break;
         case SQL_DESCRIBE_PARAMETER:
-            bCopyOk = MYODBCC::doStringCopyOut( pszSQLWCHAR, nBufferLength /
sizeof(SQLWCHAR), L"N", &nStringLengthChars );
+            bCopyOk = MYODBCC::doStringCopyOut( pszSQLWCHAR, nBufferLength /
sizeof(SQLWCHAR), (SQLWCHAR*)getInfoDescribeParameter().utf16(), &nStringLengthChars
);
             *pnStringLengthBytes = nStringLengthChars * sizeof(SQLWCHAR);
             if ( !bCopyOk )
                 MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::DIA_01004 )
);
             break;
         case SQL_DM_VER:
-            {
-                /*!
-                    \internal MYODBC RULE
-
-                    We are not, of course, a Driver Manager. However; applications may
link to
-                    us directly. I suppose that someone could even use us as a
replacement for 
-                    a DM (say on a lean machine). So lets fake it. Applications mileage
may vary.
-                */
-                QString stringVersion( (SQL_SPEC_STRING ".0000.0000") );
-
-                bCopyOk = MYODBCC::doStringCopyOut( pszSQLWCHAR, nBufferLength /
sizeof(SQLWCHAR), (SQLWCHAR*)stringVersion.utf16(), &nStringLengthChars );
-                *pnStringLengthBytes = nStringLengthChars * sizeof(SQLWCHAR);
-                if ( !bCopyOk )
-                    MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::DIA_01004
) );
-            }
+            bCopyOk = MYODBCC::doStringCopyOut( pszSQLWCHAR, nBufferLength /
sizeof(SQLWCHAR), (SQLWCHAR*)getInfoDmVer().utf16(), &nStringLengthChars );
+            *pnStringLengthBytes = nStringLengthChars * sizeof(SQLWCHAR);
+            if ( !bCopyOk )
+                MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::DIA_01004 )
);
             break;
         case SQL_DRIVER_HDBC:
             if ( !pInfoValue )
                 MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::DIA_HY024 )
);
-            /*!
-                \internal
-                \note
-
-                The request is to get the *drivers* connection handle.
-
-                The only way we would get this request is if the app linked directly to
the driver - if there
-                is no driver manager in the equation. So we just return "this" as we are
the handle the caller is
-                looking for.
-            */
             *pnSQLUINTEGER = getInfoDriverHdbc();
             break;
         case SQL_DRIVER_HENV:
             if ( !pInfoValue )
                 MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::DIA_HY024 )
);
-            /*!
-                \internal
-                \note
-
-                The request is to get the *drivers* environment handle for this
connection.
-
-                The only way we would get this request is if the app linked directly to
the driver - if there
-                is no driver manager in the equation. 
-            */
             *pnSQLUINTEGER = getInfoDriverHenv();
             break;
         case SQL_DRIVER_HDESC:
@@ -947,46 +875,22 @@
             */
             break;
         case SQL_DRIVER_NAME:
-            {
-                QString stringDriverName( MYODBC_DRIVER_NAME );
-
-                bCopyOk = MYODBCC::doStringCopyOut( (SQLWCHAR*)pInfoValue, nBufferLength,
(SQLWCHAR*)stringDriverName.utf16(), &nStringLengthChars );
-                *pnStringLengthBytes = nStringLengthChars * sizeof(SQLWCHAR);
-                if ( !bCopyOk )
-                    MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::DIA_01004
) );
-            }
+            bCopyOk = MYODBCC::doStringCopyOut( (SQLWCHAR*)pInfoValue, nBufferLength,
(SQLWCHAR*)getInfoDriverName().utf16(), &nStringLengthChars );
+            *pnStringLengthBytes = nStringLengthChars * sizeof(SQLWCHAR);
+            if ( !bCopyOk )
+                MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::DIA_01004 )
);
             break;
         case SQL_DRIVER_ODBC_VER:
-            {
-                /*!
-                    \internal ODBC RULE
-
-                    A character string with the version of ODBC that the driver supports.
The version is of the form ##.##, 
-                    where the first two digits are the major version and the next two
digits are the minor version.                 
-
-                    \note
-
-                    We report what we want to support (latest) - not what we actually
support. In this way we hope to get feedback
-                    about features missing and implement them in the order which best
reflects the needs of the 
-                    community.
-                */
-                QString stringVersion( SQL_SPEC_STRING );
-
-                bCopyOk = MYODBCC::doStringCopyOut( pszSQLWCHAR, nBufferLength /
sizeof(SQLWCHAR), (SQLWCHAR*)stringVersion.utf16(), &nStringLengthChars );
-                *pnStringLengthBytes = nStringLengthChars * sizeof(SQLWCHAR);
-                if ( !bCopyOk )
-                    MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::DIA_01004
) );
-            }
+            bCopyOk = MYODBCC::doStringCopyOut( pszSQLWCHAR, nBufferLength /
sizeof(SQLWCHAR), (SQLWCHAR*)getInfoDriverOdbcVer().utf16(), &nStringLengthChars );
+            *pnStringLengthBytes = nStringLengthChars * sizeof(SQLWCHAR);
+            if ( !bCopyOk )
+                MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::DIA_01004 )
);
             break;
         case SQL_DRIVER_VER:
-            {
-                QString stringVersion( MYODBC_VERSION );
-
-                bCopyOk = MYODBCC::doStringCopyOut( (SQLWCHAR*)pInfoValue, nBufferLength,
(SQLWCHAR*)stringVersion.utf16(), &nStringLengthChars );
-                *pnStringLengthBytes = nStringLengthChars * sizeof(SQLWCHAR);
-                if ( !bCopyOk )
-                    MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::DIA_01004
) );
-            }
+            bCopyOk = MYODBCC::doStringCopyOut( (SQLWCHAR*)pInfoValue, nBufferLength,
(SQLWCHAR*)getInfoDriverVer().utf16(), &nStringLengthChars );
+            *pnStringLengthBytes = nStringLengthChars * sizeof(SQLWCHAR);
+            if ( !bCopyOk )
+                MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::DIA_01004 )
);
             break;
         case SQL_DROP_ASSERTION:
             *pnSQLUINTEGER = getInfoDropAssertion();
@@ -1019,7 +923,7 @@
             *pnSQLUINTEGER = getInfoDynamicCursorAttributes2();
             break;
         case SQL_EXPRESSIONS_IN_ORDERBY:
-            bCopyOk = MYODBCC::doStringCopyOut( (SQLWCHAR*)pInfoValue, nBufferLength,
L"Y", &nStringLengthChars );
+            bCopyOk = MYODBCC::doStringCopyOut( (SQLWCHAR*)pInfoValue, nBufferLength,
(SQLWCHAR*)getInfoExpressionsInOrderby().utf16(), &nStringLengthChars );
             *pnStringLengthBytes = nStringLengthChars * sizeof(SQLWCHAR);
             if ( !bCopyOk )
                 MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::DIA_01004 )
);
@@ -1046,7 +950,7 @@
             *pnSQLUSMALLINT = getInfoIdentifierCase();
             break;
         case SQL_IDENTIFIER_QUOTE_CHAR:
-            bCopyOk = MYODBCC::doStringCopyOut( (SQLWCHAR*)pInfoValue, nBufferLength,
L"`", &nStringLengthChars );
+            bCopyOk = MYODBCC::doStringCopyOut( (SQLWCHAR*)pInfoValue, nBufferLength,
(SQLWCHAR*)getInfoIdentifierQuoteChar().utf16(), &nStringLengthChars );
             *pnStringLengthBytes = nStringLengthChars * sizeof(SQLWCHAR);
             if ( !bCopyOk )
                 MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::DIA_01004 )
);
@@ -1061,7 +965,7 @@
             *pnSQLUINTEGER = getInfoInsertStatement();
             break;
         case SQL_INTEGRITY:
-            bCopyOk = MYODBCC::doStringCopyOut( (SQLWCHAR*)pInfoValue, nBufferLength,
L"N", &nStringLengthChars );
+            bCopyOk = MYODBCC::doStringCopyOut( (SQLWCHAR*)pInfoValue, nBufferLength,
(SQLWCHAR*)getInfoIntegrity().utf16(), &nStringLengthChars );
             *pnStringLengthBytes = nStringLengthChars * sizeof(SQLWCHAR);
             if ( !bCopyOk )
                 MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::DIA_01004 )
);
@@ -1073,13 +977,13 @@
             *pnSQLUINTEGER = getInfoKeysetCursorAttributes2();
             break;
         case SQL_KEYWORDS:
-            bCopyOk = MYODBCC::doStringCopyOut( (SQLWCHAR*)pInfoValue, nBufferLength,
L"UNIQUE,ZEROFILL,UNSIGNED,BIGINT,BLOB,TINYBLOB,MEDIMUMBLOB,LONGBLOB,MEDIUMINT,PROCEDURE,SHOW,LIMIT,DEFAULT,TABLES,REGEXP,RLIKE,KEYS,TINYTEXT,MEDIUMTEXT",
&nStringLengthChars );
+            bCopyOk = MYODBCC::doStringCopyOut( (SQLWCHAR*)pInfoValue, nBufferLength,
(SQLWCHAR*)getInfoKeywords().utf16(), &nStringLengthChars );
             *pnStringLengthBytes = nStringLengthChars * sizeof(SQLWCHAR);
             if ( !bCopyOk )
                 MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::DIA_01004 )
);
             break;
         case SQL_LIKE_ESCAPE_CLAUSE:
-            bCopyOk = MYODBCC::doStringCopyOut( (SQLWCHAR*)pInfoValue, nBufferLength,
L"Y", &nStringLengthChars );
+            bCopyOk = MYODBCC::doStringCopyOut( (SQLWCHAR*)pInfoValue, nBufferLength,
(SQLWCHAR*)getInfoLikeEscapeClause().utf16(), &nStringLengthChars );
             *pnStringLengthBytes = nStringLengthChars * sizeof(SQLWCHAR);
             if ( !bCopyOk )
                 MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::DIA_01004 )
);
@@ -1139,7 +1043,7 @@
             *pnSQLUINTEGER = getInfoMaxRowSize();
             break;
         case SQL_MAX_ROW_SIZE_INCLUDES_LONG:
-            bCopyOk = MYODBCC::doStringCopyOut( (SQLWCHAR*)pInfoValue, nBufferLength,
L"Y", &nStringLengthChars );
+            bCopyOk = MYODBCC::doStringCopyOut( (SQLWCHAR*)pInfoValue, nBufferLength,
(SQLWCHAR*)getInfoMaxRowSizeIncludesLong().utf16(), &nStringLengthChars );
             *pnStringLengthBytes = nStringLengthChars * sizeof(SQLWCHAR);
             if ( !bCopyOk )
                 MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::DIA_01004 )
);
@@ -1160,14 +1064,19 @@
             *pnSQLUSMALLINT = getInfoMaxUserNameLen();
             break;
         case SQL_MULT_RESULT_SETS:
+            bCopyOk = MYODBCC::doStringCopyOut( (SQLWCHAR*)pInfoValue, nBufferLength,
(SQLWCHAR*)getInfoMultiResultSets().utf16(), &nStringLengthChars );
+            *pnStringLengthBytes = nStringLengthChars * sizeof(SQLWCHAR);
+            if ( !bCopyOk )
+                MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::DIA_01004 )
);
+            break;
         case SQL_MULTIPLE_ACTIVE_TXN:
-            bCopyOk = MYODBCC::doStringCopyOut( (SQLWCHAR*)pInfoValue, nBufferLength,
L"Y", &nStringLengthChars );
+            bCopyOk = MYODBCC::doStringCopyOut( (SQLWCHAR*)pInfoValue, nBufferLength,
(SQLWCHAR*)getInfoMultipleActiveTxn().utf16(), &nStringLengthChars );
             *pnStringLengthBytes = nStringLengthChars * sizeof(SQLWCHAR);
             if ( !bCopyOk )
                 MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::DIA_01004 )
);
             break;
         case SQL_NEED_LONG_DATA_LEN:
-            bCopyOk = MYODBCC::doStringCopyOut( (SQLWCHAR*)pInfoValue, nBufferLength,
L"N", &nStringLengthChars );
+            bCopyOk = MYODBCC::doStringCopyOut( (SQLWCHAR*)pInfoValue, nBufferLength,
(SQLWCHAR*)getInfoNeedLongDataLen().utf16(), &nStringLengthChars );
             *pnStringLengthBytes = nStringLengthChars * sizeof(SQLWCHAR);
             if ( !bCopyOk )
                 MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::DIA_01004 )
);
@@ -1191,21 +1100,7 @@
             *pnSQLSMALLINT = getInfoOdbcSqlConformance();
             break;
         case SQL_ODBC_VER:
-            /*!
-                \internal MYODBC RULE
-
-                We are not, of course, a Driver Manager. However; applications may link
to
-                us directly so lets handle this.
-            */
-            /*!
-                \internal ODBC RULE
-
-                A character string with the version of ODBC to which the Driver Manager 
-                conforms. The version is of the form ##.##.0000, where the first two
digits 
-                are the major version and the next two digits are the minor version. This

-                is implemented solely in the Driver Manager.            
-            */
-            bCopyOk = MYODBCC::doStringCopyOut( pszSQLWCHAR, nBufferLength /
sizeof(SQLWCHAR), (SQLWCHAR*)QString::fromAscii( SQL_SPEC_STRING ".0000" ).utf16(),
&nStringLengthChars );
+            bCopyOk = MYODBCC::doStringCopyOut( pszSQLWCHAR, nBufferLength /
sizeof(SQLWCHAR), (SQLWCHAR*)getInfoOdbcVer().utf16(), &nStringLengthChars );
             *pnStringLengthBytes = nStringLengthChars * sizeof(SQLWCHAR);
             if ( !bCopyOk )
                 MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::DIA_01004 )
);
@@ -1214,7 +1109,7 @@
             *pnSQLUINTEGER = getInfoOjCapabilities();
             break;
         case SQL_ORDER_BY_COLUMNS_IN_SELECT:
-            bCopyOk = MYODBCC::doStringCopyOut( pszSQLWCHAR, nBufferLength /
sizeof(SQLWCHAR), L"Y", &nStringLengthChars );
+            bCopyOk = MYODBCC::doStringCopyOut( pszSQLWCHAR, nBufferLength /
sizeof(SQLWCHAR), (SQLWCHAR*)getInfoOrderByColumnsInSelect().utf16(),
&nStringLengthChars );
             *pnStringLengthBytes = nStringLengthChars * sizeof(SQLWCHAR);
             if ( !bCopyOk )
                 MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::DIA_01004 )
);
@@ -2937,21 +2832,21 @@
 {
     MYODBCDbgEnter();
 
-    MYODBCDbgReturn1( sssss );
+    MYODBCDbgReturn1( "Y" );
 }
 
 QString MConnection::getInfoCatalogNameSeparator()
 {
     MYODBCDbgEnter();
 
-    MYODBCDbgReturn1( sssss );
+    MYODBCDbgReturn1( "." );
 }
 
 QString MConnection::getInfoCatalogTerm()
 {
     MYODBCDbgEnter();
 
-    MYODBCDbgReturn1( sssss );
+    MYODBCDbgReturn1( "database" );
 }
 
 SQLUINTEGER  MConnection::getInfoCatalogUsage()
@@ -2969,14 +2864,14 @@
 {
     MYODBCDbgEnter();
 
-    MYODBCDbgReturn1( sssss );
+    MYODBCDbgReturn1( "" );
 }
 
 QString MConnection::getInfoColumnAlias()
 {
     MYODBCDbgEnter();
 
-    MYODBCDbgReturn1( sssss );
+    MYODBCDbgReturn1( "Y" );
 }
 
 SQLUSMALLINT MConnection::getInfoConcatNullBehavior()
@@ -3012,7 +2907,7 @@
 {
     MYODBCDbgEnter();
 
-    MYODBCDbgReturn3( "%d", 0 );
+    MYODBCDbgReturn3( "%d", 0L );
 }
 
 SQLUINTEGER  MConnection::getInfoConvertBit()
@@ -3063,7 +2958,7 @@
 {
     MYODBCDbgEnter();
 
-    MYODBCDbgReturn3( "%d", 0 );
+    MYODBCDbgReturn3( "%d", 0L );
 }
 
 SQLUINTEGER  MConnection::getInfoConvertDate()
@@ -3482,7 +3377,10 @@
 {
     MYODBCDbgEnter();
 
-    MYODBCDbgReturn1( sssss );
+    if ( getInfoDataSourceName().isNull() )
+        MYODBCDbgReturn1( "" );
+
+    MYODBCDbgReturn1( getDataSourceName() );
 }
 
 QString MConnection::getInfoDataSourceReadOnly()
@@ -3496,7 +3394,26 @@
 {
     MYODBCDbgEnter();
 
-    MYODBCDbgReturn1( sssss );
+    /*!
+        \internal ODBC Rule
+
+        A character string with the name of the current database in use, if the data
source defines 
+        a named object called "database".
+        ... also SQL_ATTR_CURRENT_CATALOG.
+    */
+    /*!
+        \internal MYODBC Rule
+
+        We account for the fact that SQL_ATTR_CURRENT_CATALOG may be inaccurate due
+        to the possible use of "USE DATABASE". So this may not be the value of 'database'
from
+        a DSN.
+    */
+    QString stringDatabaseName = getCurrentCatalog();
+
+    if ( stringDatabaseName.isNull() )
+        MYODBCDbgReturn1( "" );
+
+    MYODBCDbgReturn1( stringDatabaseName );
 }
 
 SQLUINTEGER  MConnection::getInfoDatetimeLiterals()
@@ -3512,14 +3429,17 @@
 {
     MYODBCDbgEnter();
 
-    MYODBCDbgReturn1( sssss );
+    MYODBCDbgReturn1( "MySQL" );
 }
 
 QString MConnection::getInfoDbmsVer() 
 {
     MYODBCDbgEnter();
 
-    MYODBCDbgReturn1( sssss );
+    if ( getMySQL() )
+        MYODBCDbgReturn1( ((MYSQL*)getMySQL())->server_version );
+
+    MYODBCDbgReturn1( "" );
 }
 
 SQLUINTEGER  MConnection::getInfoDdlIndex()
@@ -3541,20 +3461,37 @@
 {
     MYODBCDbgEnter();
 
-    MYODBCDbgReturn1( sssss );
+    MYODBCDbgReturn1( "N" );
 }
 
 QString MConnection::getInfoDmVer()
 {
     MYODBCDbgEnter();
 
-    MYODBCDbgReturn1( sssss );
+    /*!
+        \internal MYODBC RULE
+
+        We are not, of course, a Driver Manager. However; applications may link to
+        us directly. I suppose that someone could even use us as a replacement for 
+        a DM (say on a lean machine). So lets fake it. Applications mileage may vary.
+    */
+    MYODBCDbgReturn1( (SQL_SPEC_STRING ".0000.0000") );
 }
 
 SQLUINTEGER  MConnection::getInfoDriverHdbc()
 {
     MYODBCDbgEnter();
 
+    /*!
+        \internal
+        \note
+
+        The request is to get the *drivers* connection handle.
+
+        The only way we would get this request is if the app linked directly to the
driver - if there
+        is no driver manager in the equation. So we just return "this" as we are the
handle the caller is
+        looking for.
+    */
     MYODBCDbgReturn3( "%d", (SQLUINTEGER)this );
 }
 
@@ -3562,6 +3499,15 @@
 {
     MYODBCDbgEnter();
 
+    /*!
+        \internal
+        \note
+
+        The request is to get the *drivers* environment handle for this connection.
+
+        The only way we would get this request is if the app linked directly to the
driver - if there
+        is no driver manager in the equation. 
+    */
     MYODBCDbgReturn3( "%d", (SQLUINTEGER)getEnvironment() );
 }
 
@@ -3569,21 +3515,33 @@
 {
     MYODBCDbgEnter();
 
-    MYODBCDbgReturn1( sssss );
+    MYODBCDbgReturn1( MYODBC_DRIVER_NAME );
 }
 
 QString MConnection::getInfoDriverOdbcVer()
 {
     MYODBCDbgEnter();
 
-    MYODBCDbgReturn1( sssss );
+    /*!
+        \internal ODBC RULE
+
+        A character string with the version of ODBC that the driver supports. The version
is of the form ##.##, 
+        where the first two digits are the major version and the next two digits are the
minor version.                 
+
+        \note
+
+        We report what we want to support (latest) - not what we actually support. In
this way we hope to get feedback
+        about features missing and implement them in the order which best reflects the
needs of the 
+        community.
+    */
+    MYODBCDbgReturn1( SQL_SPEC_STRING );
 }
 
 QString MConnection::getInfoDriverVer()
 {
     MYODBCDbgEnter();
 
-    MYODBCDbgReturn1( sssss );
+    MYODBCDbgReturn1( MYODBC_VERSION );
 }
 
 SQLUINTEGER  MConnection::getInfoDropAssertion()
@@ -3680,7 +3638,7 @@
 {
     MYODBCDbgEnter();
 
-    MYODBCDbgReturn1( sssss );
+    MYODBCDbgReturn1( "Y" );
 }
 
 SQLUINTEGER  MConnection::getInfoFetchDirection() 
@@ -3757,7 +3715,7 @@
 {
     MYODBCDbgEnter();
 
-    MYODBCDbgReturn1( sssss );
+    MYODBCDbgReturn1( "`" );
 }
 
 SQLUINTEGER  MConnection::getInfoIndexKeywords()
@@ -3787,7 +3745,7 @@
 {
     MYODBCDbgEnter();
 
-    MYODBCDbgReturn1( sssss );
+    MYODBCDbgReturn1( "N" );
 }
 
 SQLUINTEGER  MConnection::getInfoKeysetCursorAttributes1()
@@ -3808,14 +3766,14 @@
 {
     MYODBCDbgEnter();
 
-    MYODBCDbgReturn1( sssss );
+    MYODBCDbgReturn1(
"UNIQUE,ZEROFILL,UNSIGNED,BIGINT,BLOB,TINYBLOB,MEDIMUMBLOB,LONGBLOB,MEDIUMINT,PROCEDURE,SHOW,LIMIT,DEFAULT,TABLES,REGEXP,RLIKE,KEYS,TINYTEXT,MEDIUMTEXT"
);
 }
 
 QString MConnection::getInfoLikeEscapeClause()
 {
     MYODBCDbgEnter();
 
-    MYODBCDbgReturn1( sssss );
+    MYODBCDbgReturn1( "Y" );
 }
 
 SQLUINTEGER  MConnection::getInfoLockTypes()
@@ -3972,7 +3930,7 @@
 {
     MYODBCDbgEnter();
 
-    MYODBCDbgReturn1( sssss );
+    MYODBCDbgReturn1( "Y" );
 }
 
 SQLUSMALLINT MConnection::getInfoMaxSchemaNameLen()
@@ -4026,21 +3984,21 @@
 {
     MYODBCDbgEnter();
 
-    MYODBCDbgReturn1( sssss );
+    MYODBCDbgReturn1( "Y" );
 }
 
 QString MConnection::getInfoMultipleActiveTxn()
 {
     MYODBCDbgEnter();
 
-    MYODBCDbgReturn1( sssss );
+    MYODBCDbgReturn1( "Y" );
 }
 
 QString MConnection::getInfoNeedLongDataLen()
 {
     MYODBCDbgEnter();
 
-    MYODBCDbgReturn1( sssss );
+    MYODBCDbgReturn1( "N" );
 }
 
 SQLUSMALLINT MConnection::getInfoNonNullableColumns()
@@ -4112,7 +4070,21 @@
 {
     MYODBCDbgEnter();
 
-    MYODBCDbgReturn1( sssss );
+    /*!
+        \internal MYODBC RULE
+
+        We are not, of course, a Driver Manager. However; applications may link to
+        us directly so lets handle this.
+    */
+    /*!
+        \internal ODBC RULE
+
+        A character string with the version of ODBC to which the Driver Manager 
+        conforms. The version is of the form ##.##.0000, where the first two digits 
+        are the major version and the next two digits are the minor version. This 
+        is implemented solely in the Driver Manager.            
+    */
+    MYODBCDbgReturn1( SQL_SPEC_STRING ".0000" );
 }
 
 SQLUINTEGER  MConnection::getInfoOjCapabilities()
@@ -4131,7 +4103,7 @@
 {
     MYODBCDbgEnter();
 
-    MYODBCDbgReturn1( sssss );
+    MYODBCDbgReturn1( "Y" );
 }
 
 SQLUINTEGER  MConnection::getInfoParamArrayRowCounts()

Modified: trunk/MYSQLPlus/include/MConnection.h
===================================================================
--- trunk/MYSQLPlus/include/MConnection.h	2006-06-27 05:59:14 UTC (rev 403)
+++ trunk/MYSQLPlus/include/MConnection.h	2006-06-27 06:55:45 UTC (rev 404)
@@ -166,6 +166,8 @@
                 less efficient than using these.
 
                 We do this for all info types for completeness (we ignore the fact that
many are likely to be constant over time).
+
+        \note   We have the luxury of doing this as getInfo() is not called often.
     */
     /*@{*/
     QString         getInfoAccessibleProcedures();

Thread
Connector/ODBC 5 commit: r404 - in trunk/MYSQLPlus: MYSQLPlusLib includepharvey27 Jun