List:Commits« Previous MessageNext Message »
From:pharvey Date:May 31 2006 8:39pm
Subject:Connector/ODBC 5 commit: r295 - / MYODBCDriver/MYODBCDriverLib MYODBCTst/MYODBCTstLib MYSQLPlus/MYSQLPlusLib MYSQLPlus/MYSQLPlusTest
View as plain text  
Modified:
   MYODBCDriver/MYODBCDriverLib/SQLGetDiagRecW.cpp
   MYODBCDriver/MYODBCDriverLib/SQLTablesW.cpp
   MYODBCTst/MYODBCTstLib/MYODBCTstNumResultCols.c
   MYODBCTst/MYODBCTstLib/MYODBCTstPrintDiagnostics.c
   MYSQLPlus/MYSQLPlusLib/MResultPlus.cpp
   MYSQLPlus/MYSQLPlusLib/MResultPlus.h
   MYSQLPlus/MYSQLPlusLib/MStatement.cpp
   MYSQLPlus/MYSQLPlusTest/MYSQLPlusTest.cpp
   connector-odbc.vpw
Log:


Modified: MYODBCDriver/MYODBCDriverLib/SQLGetDiagRecW.cpp
===================================================================
--- MYODBCDriver/MYODBCDriverLib/SQLGetDiagRecW.cpp	2006-05-30 23:21:07 UTC (rev 294)
+++ MYODBCDriver/MYODBCDriverLib/SQLGetDiagRecW.cpp	2006-05-31 20:39:30 UTC (rev 295)
@@ -19,18 +19,23 @@
 {
     MYODBCDbgEnter();
 
+printf( "[PAH][%s][%d]\n", __FILE__, __LINE__ );
     if ( !hHandle )
         MYODBCDbgReturn( SQL_INVALID_HANDLE );
 
     switch ( nHandleType )
     {
         case SQL_HANDLE_ENV:
+printf( "[PAH][%s][%d]\n", __FILE__, __LINE__ );
             MYODBCDbgReturn( ((MEnvironment*)hHandle)->getDiagRec( nRecNumber,
psSQLState, pnNativeError, psMessageText, nBufferLength, pnTextLength ) );
         case SQL_HANDLE_DBC:
+printf( "[PAH][%s][%d]\n", __FILE__, __LINE__ );
             MYODBCDbgReturn( ((MConnection*)hHandle)->getDiagRec( nRecNumber,
psSQLState, pnNativeError, psMessageText, nBufferLength, pnTextLength ) );
         case SQL_HANDLE_STMT:
+printf( "[PAH][%s][%d]\n", __FILE__, __LINE__ );
             MYODBCDbgReturn( ((MStatement*)hHandle)->getDiagRec( nRecNumber,
psSQLState, pnNativeError, psMessageText, nBufferLength, pnTextLength ) );
         case SQL_HANDLE_DESC:
+printf( "[PAH][%s][%d]\n", __FILE__, __LINE__ );
             MYODBCDbgReturn( ((MDescriptor*)hHandle)->getDiagRec( nRecNumber,
psSQLState, pnNativeError, psMessageText, nBufferLength, pnTextLength ) );
     }
 

Modified: MYODBCDriver/MYODBCDriverLib/SQLTablesW.cpp
===================================================================
--- MYODBCDriver/MYODBCDriverLib/SQLTablesW.cpp	2006-05-30 23:21:07 UTC (rev 294)
+++ MYODBCDriver/MYODBCDriverLib/SQLTablesW.cpp	2006-05-31 20:39:30 UTC (rev 295)
@@ -29,6 +29,94 @@
 
 #include "MYODBCDriverInternal.h"
 
+/*! 
+    \brief  <B>ODBC 1.0 API</B>
+            <BR>
+            SQLTables returns the list of table, catalog/schema/database names, 
+            and table types, stored in a specific data source. The driver 
+            returns the information as a result set.
+
+            Passing a null pointer to a search pattern argument does not constrain the 
+            search for that argument; that is, a null pointer and the search pattern % 
+            (any characters) are equivalent. However, a zero-length search pattern+            is, a valid pointer to a string of length zero+            string ("").
+
+            Extended Rules            
+
+            1) If CatalogName is SQL_ALL_CATALOGS and SchemaName and TableName are empty 
+            strings, the result set contains a list of valid catalogs for the data 
+            source. (All columns except the TABLE_CAT column contain NULLs.) 
+    \code
+SQLTables( hStm, SQL_ALL_CATALOGS, SQL_NTS, "", SQL_NTS, "", SQL_NTS, "", SQL_NTS );
+    \endcode
+
+            2) If SchemaName is SQL_ALL_SCHEMAS and CatalogName and TableName are empty 
+            strings, the result set contains a list of valid schemas for the data 
+            source. (All columns except the TABLE_SCHEM column contain NULLs.) 
+    \code
+SQLTables( hStm, "", SQL_NTS, SQL_ALL_SCHEMAS, SQL_NTS, "", SQL_NTS, "", SQL_NTS );
+    \endcode
+
+            3) If TableType is SQL_ALL_TABLE_TYPES and CatalogName, SchemaName, and 
+            TableName are empty strings, the result set contains a list of valid table 
+            types for the data source. (All columns except the TABLE_TYPE column contain
NULLs.) 
+    \code
+SQLTables( hStm, "", SQL_NTS, "", SQL_NTS, "", SQL_NTS, SQL_ALL_TABLE_TYPES, SQL_NTS );
+    \endcode
+
+    \param  hStm            Viable statement handle.
+    \param  pszCatalogName  Catalog name.
+    \param  nNameLength1    Length of pszCatalogName or SQL_NTS.
+    \param  pszSchemaName   String search pattern for schema names.
+    \param  nNameLength2    Length of pszSchemaName or SQL_NTS.
+    \param  pszTableName    String search pattern for table names.
+    \param  nNameLength3    Length of pszTableName or SQL_NTS.
+    \param  pszTableType    List of table types to match. Comma delimited.
+    \param  nNameLength4    Length of pszTableType.
+    
+    \return SQLRETURN
+
+    \retval SQL_SUCCESS             Request processed ok.
+    \retval SQL_SUCCESS_WITH_INFO   Request was probably processed ok - check diagnostic.
+    \retval SQL_STILL_EXECUTING     Still executing from a previous call.     
+    \retval SQL_ERROR               Request failed.
+    \retval SQL_INVALID_HANDLE      Invalid handle was provided.
+    
+    \note       The resultset is in the following form;
+    
+                <TABLE>
+                  <TR>
+                    <TD>Column name</TD><TD>Column
number</TD><TD>Data type</TD><TD>Comments</TD>
+                  </TR>
+                  <TR>
+                   
<TD>TABLE_CAT</TD><TD>1</TD><TD>Varchar</TD><TD>Catalog
name; NULL if not applicable to the data source. If a driver supports catalogs for some
tables but not for others, such as when the driver retrieves data from different DBMSs,
it returns an empty string ("") for those tables that do not have catalogs.</TD>
+                  </TR>
+                  <TR>
+                   
<TD>TABLE_SCHEM</TD><TD>2</TD><TD>Varchar</TD><TD>Schema
name; NULL if not applicable to the data source. If a driver supports schemas for some
tables but not for others, such as when the driver retrieves data from different DBMSs,
it returns an empty string ("") for those tables that do not have schemas.</TD>
+                  </TR>
+                  <TR>
+                   
<TD>TABLE_NAME</TD><TD>3</TD><TD>Varchar</TD><TD>Table
name.</TD>
+                  </TR>
+                  <TR>
+                   
<TD>TABLE_TYPE</TD><TD>4</TD><TD>Varchar</TD><TD>Table
type name; one of the following: "TABLE", "VIEW", "SYSTEM TABLE", "GLOBAL TEMPORARY",
"LOCAL TEMPORARY", "ALIAS", "SYNONYM", or a data source specific type name.The meanings
of "ALIAS" and "SYNONYM" are driver-specific.</TD>
+                  </TR>
+                  <TR>
+                   
<TD>REMARKS</TD><TD>5</TD><TD>Varchar</TD><TD>A
description of the table.</TD>
+                  </TR>
+                </TABLE>
+                                                            
+    \sa         SQLColumnPrivileges
+                SQLColumns
+                SQLForeignKeys
+                SQLPrimaryKeys
+                SQLProcedureColumns
+                SQLProcedures
+                SQLSpecialColumns
+                SQLStatistics
+                SQLTablePrivileges
+                SQLTables
+*/
 SQLRETURN SQL_API SQLTablesW( SQLHSTMT       hStm,
                               SQLWCHAR *     psCatalogName,
                               SQLSMALLINT    nNameLength1,

Modified: MYODBCTst/MYODBCTstLib/MYODBCTstNumResultCols.c
===================================================================
--- MYODBCTst/MYODBCTstLib/MYODBCTstNumResultCols.c	2006-05-30 23:21:07 UTC (rev 294)
+++ MYODBCTst/MYODBCTstLib/MYODBCTstNumResultCols.c	2006-05-31 20:39:30 UTC (rev 295)
@@ -41,6 +41,7 @@
 
         case SQL_SUCCESS_WITH_INFO:
         case SQL_ERROR:
+printf( "[PAH][%s][%d]\n", __FILE__, __LINE__ );
             MYODBCTstPrintDiagnostics( SQL_HANDLE_STMT, hStm );
             break;
 

Modified: MYODBCTst/MYODBCTstLib/MYODBCTstPrintDiagnostics.c
===================================================================
--- MYODBCTst/MYODBCTstLib/MYODBCTstPrintDiagnostics.c	2006-05-30 23:21:07 UTC (rev 294)
+++ MYODBCTst/MYODBCTstLib/MYODBCTstPrintDiagnostics.c	2006-05-31 20:39:30 UTC (rev 295)
@@ -39,6 +39,7 @@
     SQLSMALLINT nTextLength;
     SQLRETURN   nReturn;
 
+printf( "[PAH][%s][%d]\n", __FILE__, __LINE__ );
     while ( SQL_SUCCEEDED( ( nReturn = SQLGetDiagRec( nHandleType,
                                                       hHandle,
                                                       nRecNumber,
@@ -48,6 +49,7 @@
                                                       nBufferLength,
                                                       &nTextLength ) ) ) )
     {
+printf( "[PAH][%s][%d] (%d) (%s)\n", __FILE__, __LINE__, nReturn, szMessageText );
         szSqlState[5] = '\0';
         MYODBCTstFilePrint( stderr, _T("[%s] (%d) %s\n"), szSqlState, nNativeError,
szMessageText ); 
         nRecNumber++;

Modified: MYSQLPlus/MYSQLPlusLib/MResultPlus.cpp
===================================================================
--- MYSQLPlus/MYSQLPlusLib/MResultPlus.cpp	2006-05-30 23:21:07 UTC (rev 294)
+++ MYSQLPlus/MYSQLPlusLib/MResultPlus.cpp	2006-05-31 20:39:30 UTC (rev 295)
@@ -358,7 +358,7 @@
     MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::DIA_HY010, 0,
tr("Resultset is read-only.") ) );
 }
 
-SQLRETURN MResultPlus::doGetTypeInfo( SQLSMALLINT nDataType )
+SQLRETURN MResultPlus::getTypeInfo( SQLSMALLINT nDataType )
 {
     MYODBCDbgEnter();
 

Modified: MYSQLPlus/MYSQLPlusLib/MResultPlus.h
===================================================================
--- MYSQLPlus/MYSQLPlusLib/MResultPlus.h	2006-05-30 23:21:07 UTC (rev 294)
+++ MYSQLPlus/MYSQLPlusLib/MResultPlus.h	2006-05-31 20:39:30 UTC (rev 295)
@@ -68,7 +68,7 @@
     SQLRETURN doSkip( qlonglong nRows );
     SQLRETURN doCommit();
 
-    SQLRETURN doGetTypeInfo( SQLSMALLINT nDataType );   /*<! \sa SQLGetTypeInfo */
+    SQLRETURN getTypeInfo( SQLSMALLINT nDataType );   /*<! \sa SQLGetTypeInfo */
 
     /* isers */
     BOOLEAN isValidRow();

Modified: MYSQLPlus/MYSQLPlusLib/MStatement.cpp
===================================================================
--- MYSQLPlus/MYSQLPlusLib/MStatement.cpp	2006-05-30 23:21:07 UTC (rev 294)
+++ MYSQLPlus/MYSQLPlusLib/MStatement.cpp	2006-05-31 20:39:30 UTC (rev 295)
@@ -690,7 +690,64 @@
     */
     pDiagnostic->doClear();
 
-    MYODBCDbgReturn( SQL_ERROR );
+    /*!
+        \internal ODBC RULE (DM)
+
+        A cursor was open on the StatementHandle, and SQLFetch or 
+        SQLFetchScroll had been called.
+    */
+    if ( getState() == STATE_S6 )
+        MYODBCDbgReturn( pDiagnostic->doAppend( MDiagnostic::DIA_24000 ) );
+
+    /*!
+        \internal ODBC RULE (DM)
+
+        A cursor was open on the StatementHandle, but SQLFetch or SQLFetchScroll 
+        had not been called.
+    */
+    if ( getState() == STATE_S5 )
+        MYODBCDbgReturn( pDiagnostic->doAppend( MDiagnostic::DIA_24000 ) );
+
+    /*!
+        \internal ODBC RULE (DM)
+
+        An asynchronously executing function was called for the 
+        StatementHandle and was still executing when this function 
+        was called.
+
+        \note
+
+        DM should handle this but check here in case where app is linked
+        directly to driver.
+    */
+    if ( isAsyncInProgress() )
+        MYODBCDbgReturn( pDiagnostic->doAppend( MDiagnostic::DIA_HY010 ) );
+
+    /*!
+        \internal ODBC RULE (DM)
+
+        SQLExecute, SQLExecDirect, SQLBulkOperations, or SQLSetPos was 
+        called for the StatementHandle and returned SQL_NEED_DATA. 
+        This function was called before data was sent for all 
+        data-at-execution parameters or columns.
+    */
+    if ( isDataNeeded() )
+        MYODBCDbgReturn( pDiagnostic->doAppend( MDiagnostic::DIA_HY010 ) );
+
+    /* generate result */
+    MResultPlus *pResult = new MResultPlus( this );
+
+    SQLRETURN nReturn = pResult->getTypeInfo( nDataType );
+    if ( !SQL_SUCCEEDED( nReturn ) )
+    {
+        delete pResult;
+        MYODBCDbgReturn( nReturn );
+    }
+
+    this->pResult = pResult;
+    setState( STATE_S3 );
+
+    MYODBCDbgReturn( nReturn );
 }
 
 SQLRETURN MStatement::doBindCol( SQLUSMALLINT nColumnNumber, SQLSMALLINT nTargetType,
SQLPOINTER pTargetValue, SQLINTEGER nBufferLength, SQLLEN *pnStrLenOrInd )

Modified: MYSQLPlus/MYSQLPlusTest/MYSQLPlusTest.cpp
===================================================================
--- MYSQLPlus/MYSQLPlusTest/MYSQLPlusTest.cpp	2006-05-30 23:21:07 UTC (rev 294)
+++ MYSQLPlus/MYSQLPlusTest/MYSQLPlusTest.cpp	2006-05-31 20:39:30 UTC (rev 295)
@@ -140,6 +140,12 @@
     SQLWCHAR    pszNameWide[100];
     SQLINTEGER  nStrLenOrInd;
 
+    /* this should error out */
+    nReturn = statement.doNumResultCols( &nCols );
+    if ( nReturn != SQL_SUCCESS )
+        std::cout << endl << endl << statement.getDiagnostics().at( 0
).toAscii().data() << endl << endl;
+    QCOMPARE( nReturn, (SQLRETURN)SQL_ERROR );
+
     nReturn = statement.doExecDirect( TEXT("SELECT * FROM tbMyODBCTest"), SQL_NTS );
     if ( nReturn != SQL_SUCCESS )
         std::cout << endl << endl << statement.getDiagnostics().join(
"\n" ).toAscii().data() << endl << endl;

Modified: connector-odbc.vpw
===================================================================
--- connector-odbc.vpw	2006-05-30 23:21:07 UTC (rev 294)
+++ connector-odbc.vpw	2006-05-31 20:39:30 UTC (rev 295)
@@ -22,7 +22,6 @@
 		<Project File="MYODBCTst/MYODBCTst.vpj" />
 		<Project File="MYODBCTst/MYODBCTstLib/MYODBCTstLib.vpj" />
 		<Project File="../mysql-include.vpj" />
-		<Project File="../mysql.vpj" />
 		<Project File="MYSQLPlus/MYSQLPlus.vpj" />
 		<Project File="MYSQLPlus/MYSQLPlusLib/MYSQLPlusLib.vpj" />
 		<Project File="MYSQLPlus/MYSQLPlusTest/MYSQLPlusTest.vpj" />

Thread
Connector/ODBC 5 commit: r295 - / MYODBCDriver/MYODBCDriverLib MYODBCTst/MYODBCTstLib MYSQLPlus/MYSQLPlusLib MYSQLPlus/MYSQLPlusTestpharvey31 May