List:Commits« Previous MessageNext Message »
From:pharvey Date:August 11 2006 10:57am
Subject:Connector/ODBC 5 commit: r488 - in trunk: MYODBCDriver/MYODBCDriverLib MYSQLPlus/MYSQLPlusLib
View as plain text  
Modified:
   trunk/MYODBCDriver/MYODBCDriverLib/SQLGetFunctions.cpp
   trunk/MYSQLPlus/MYSQLPlusLib/MStatement.cpp
Log:
- started adding support for SQLProcedureColumns

Modified: trunk/MYODBCDriver/MYODBCDriverLib/SQLGetFunctions.cpp
===================================================================
--- trunk/MYODBCDriver/MYODBCDriverLib/SQLGetFunctions.cpp	2006-08-11 10:46:58 UTC (rev
487)
+++ trunk/MYODBCDriver/MYODBCDriverLib/SQLGetFunctions.cpp	2006-08-11 10:57:25 UTC (rev
488)
@@ -111,7 +111,7 @@
     SQL_API_SQLNUMPARAMS,
 /*  SQL_API_SQLPARAMOPTIONS,        Dep */
     SQL_API_SQLPRIMARYKEYS,
-/*  SQL_API_SQLPROCEDURECOLUMNS,        */
+    SQL_API_SQLPROCEDURECOLUMNS,
     SQL_API_SQLPROCEDURES,
 /*  SQL_API_SQLSETPOS,                  */
 /*  SQL_API_SQLSETSCROLLOPTIONS,    Dep */

Modified: trunk/MYSQLPlus/MYSQLPlusLib/MStatement.cpp
===================================================================
--- trunk/MYSQLPlus/MYSQLPlusLib/MStatement.cpp	2006-08-11 10:46:58 UTC (rev 487)
+++ trunk/MYSQLPlus/MYSQLPlusLib/MStatement.cpp	2006-08-11 10:57:25 UTC (rev 488)
@@ -3632,7 +3632,7 @@
     MYODBCDbgReturn( nReturn );
 }
 
-SQLRETURN MStatement::doProcedureColumns( SQLWCHAR *psCatalogName, SQLSMALLINT
nNameLength1, SQLWCHAR *psSchemaName, SQLSMALLINT nNameLength2, SQLWCHAR *psProcName,
SQLSMALLINT nNameLength3, SQLWCHAR *psColumnName, SQLSMALLINT nNameLength4 )
+SQLRETURN MStatement::doProcedureColumns( SQLWCHAR *psCatalog, SQLSMALLINT nLength1,
SQLWCHAR *psSchema, SQLSMALLINT nLength2, SQLWCHAR *psProcedure, SQLSMALLINT nLength3,
SQLWCHAR *psColumn, SQLSMALLINT nLength4 )
 {
     MYODBCDbgEnter();
 
@@ -3643,8 +3643,138 @@
     */
     pDiagnostic->doClear();
 
+    /*!
+        \internal ODBC RULE (DM)
 
-    MYODBCDbgReturn( SQL_ERROR );
+        A cursor was open on the StatementHandle, and SQLFetch or 
+        SQLFetchScroll had been called.
+    */
+    if ( getState() == STATE_S6 )
+        MYODBCDbgReturn( getDiagnostic()->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( getDiagnostic()->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( getDiagnostic()->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( getDiagnostic()->doAppend( MDiagnostic::DIA_HY010 ) );
+
+    /*!
+        \internal ODBC RULE (DM)
+
+        The value of one of the length arguments was less than 0 but 
+        not equal to SQL_NTS.
+    */
+    if ( nLength1 < 0 && nLength1 != SQL_NTS )
+        MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::DIA_HY090 ) );
+    if ( nLength2 < 0 && nLength2 != SQL_NTS )
+        MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::DIA_HY090 ) );
+    if ( nLength3 < 0 && nLength3 != SQL_NTS )
+        MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::DIA_HY090 ) );
+    if ( nLength4 < 0 && nLength4 != SQL_NTS )
+        MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::DIA_HY090 ) );
+
+    /*!
+        \internal ODBC RULE (DM)
+
+        The value of one of the name length arguments exceeded the maximum length 
+        value for the corresponding name.
+    */
+    if ( nLength1 > getConnection()->getInfoMaxCatalogNameLen() )
+        MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::DIA_HY090 ) );
+    if ( nLength2 > getConnection()->getInfoMaxSchemaNameLen() )
+        MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::DIA_HY090 ) );
+    if ( nLength3 > getConnection()->getInfoMaxProcedureNameLen() )
+        MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::DIA_HY090 ) );
+    if ( nLength4 > getConnection()->getInfoMaxColumnNameLen() )
+        MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::DIA_HY090 ) );
+
+    /* get our strings into a QString */
+    QString stringCatalog;
+    QString stringSchema;
+    QString stringProcedure;
+    QString stringColumn;
+
+    if ( psCatalog && nLength1 != 0 )
+        stringCatalog = QString::fromUtf16( psCatalog, ( nLength1 == SQL_NTS ? -1 :
nLength1 ) );
+    if ( psSchema && nLength2 != 0  )
+        stringSchema = QString::fromUtf16( psSchema, ( nLength2 == SQL_NTS ? -1 :
nLength2 ) );
+    if ( psProcedure && nLength3 != 0  )
+        stringProcedure = QString::fromUtf16( psProcedure, ( nLength3 == SQL_NTS ? -1 :
nLength3 ) );
+    if ( psColumn && nLength4 != 0  )
+        stringColumn = QString::fromUtf16( psColumn, ( nLength4 == SQL_NTS ? -1 :
nLength4 ) );
+
+    /*!
+        \internal ODBC RULE
+
+        A catalog was specified, and the driver or data source does not support catalogs.
+    */
+    if ( stringCatalog.isNull() )
+        stringCatalog = "";
+    if ( getConnection()->getInfoCatalogUsage() == 0 &&
!stringCatalog.isEmpty() )
+        MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::DIA_HYC00 ) );
+
+    /*!
+        \internal ODBC RULE
+
+        A schema was specified, and the driver or data source does not support schema.
+    */
+    if ( stringSchema.isNull() )
+        stringSchema = "";
+    if ( getConnection()->getInfoSchemaUsage() == 0 && !stringSchema.isEmpty()
&& stringSchema != SQL_ALL_SCHEMAS )
+        MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::DIA_HYC00 ) );
+
+    /* silently roll-back state as needed */
+    SQLRETURN nReturn;
+    if ( isPrepared() )
+    {
+        nReturn = doStateRollBack( STATE_S1 );
+        if ( !SQL_SUCCEEDED( nReturn ) )
+            MYODBCDbgReturn( nReturn );
+    }
+
+    /* generate result */
+    MResultPlus *pResult = new MResultPlus( this );
+
+    nReturn = pResult->doProcedureColumns( stringCatalog, stringSchema,
stringProcedure, stringColumn );
+    if ( !SQL_SUCCEEDED( nReturn ) )
+    {
+        delete pResult;
+        MYODBCDbgReturn( nReturn );
+    }
+
+    setImplicitPrepare( true );
+    setState( STATE_S5 );
+
+    MYODBCDbgReturn( nReturn );
 }
 
 SQLRETURN MStatement::doProcedures( SQLWCHAR *psCatalog, SQLSMALLINT nLength1, SQLWCHAR
*psSchema, SQLSMALLINT nLength2, SQLWCHAR *psProcedure, SQLSMALLINT nLength3 )

Thread
Connector/ODBC 5 commit: r488 - in trunk: MYODBCDriver/MYODBCDriverLib MYSQLPlus/MYSQLPlusLibpharvey11 Aug