List:Commits« Previous MessageNext Message »
From:pharvey Date:June 30 2006 6:10pm
Subject:Connector/ODBC 5 commit: r419 - trunk/MYSQLPlus/MYSQLPlusLib
View as plain text  
Modified:
   trunk/MYSQLPlus/MYSQLPlusLib/MResultPlus.cpp
Log:
clean compiles

Modified: trunk/MYSQLPlus/MYSQLPlusLib/MResultPlus.cpp
===================================================================
--- trunk/MYSQLPlus/MYSQLPlusLib/MResultPlus.cpp	2006-06-29 05:13:32 UTC (rev 418)
+++ trunk/MYSQLPlus/MYSQLPlusLib/MResultPlus.cpp	2006-06-30 18:10:32 UTC (rev 419)
@@ -867,7 +867,7 @@
 
         stringStatement = "SELECT * "
                           "FROM   INFORMATION_SCHEMA.STATISTICS "
-                          "WHERE  TABLE_SCHEMA='" + stringCatalog + "' AND TABLE_NAME='"
+ stringTable + "' "
+                          "WHERE  TABLE_SCHEMA='" + stringCatalog + "' AND TABLE_NAME='"
+ stringTable + "' " + ( nUnique == SQL_INDEX_UNIQUE ? " AND NON_UNIQUE=0 " : " " );
                           "ORDER BY NON_UNIQUE, TYPE, INDEX_QUALIFIER, INDEX_NAME, and
ORDINAL_POSITION ";
 
         if ( mysql_query( getMySQL(), stringStatement.toUtf8().data() ) )
@@ -879,11 +879,31 @@
 
         while ( pRow = mysql_fetch_row( pResult ) )
         {
+            SQLSMALLINT nType;
+            QString stringType( pRow[13] );
+
+            if ( stringType == "BTREE" )
+#ifdef SQL_INDEX_BTREE
+                nType = SQL_INDEX_BTREE;
+#else
+                nType = SQL_INDEX_OTHER;
+#endif
+            else if ( stringType == "HASH" )
+                nType = SQL_INDEX_HASHED;
+            else if ( stringType == "CLUSTERED" ) // in case we return this at some point
in the future
+                nType = SQL_INDEX_CLUSTERED;
+            else
+            {
+                getDiagnostic()->doAppend( MDiagnostic::DIA_01000, 0,  QString(
"Unhandled index type (%1)" ).arg( stringType ) );
+                nType = SQL_INDEX_OTHER;
+            }
+
+            /*! \note as i recall we can get FILTER_CONDITION from COMMENT - but not 100%
of the time so perhaps forget it or perhaps try to be smart? */
             doAppendStatistics( pRow[4],    // catalog - we put MySQL schema in here
                                 pRow[2],    // table 
                                 pRow[3],    // unique
                                 pRow[5],    // column
-                                MYODBCC::getIndexType( pRow[13] ),   // type (char to
smallint for example "BTREE" = SQL_INDEX_BTREE
+                                nType,      // type
                                 pRow[6],    // ordinal
                                 pRow[7],    // column
                                 pRow[9],    // AscDesc,

Thread
Connector/ODBC 5 commit: r419 - trunk/MYSQLPlus/MYSQLPlusLibpharvey30 Jun