Modified:
trunk/MYODBCDriver/MYODBCDriverLib/SQLGetFunctions.cpp
trunk/MYSQLPlus/MYSQLPlusLib/MStatement.cpp
Log:
- starting to add support for SQLColumnPrivileges
Modified: trunk/MYODBCDriver/MYODBCDriverLib/SQLGetFunctions.cpp
===================================================================
--- trunk/MYODBCDriver/MYODBCDriverLib/SQLGetFunctions.cpp 2006-08-11 09:31:11 UTC (rev
485)
+++ trunk/MYODBCDriver/MYODBCDriverLib/SQLGetFunctions.cpp 2006-08-11 10:37:16 UTC (rev
486)
@@ -100,7 +100,7 @@
SQL_API_SQLBINDPARAMETER,
SQL_API_SQLBROWSECONNECT,
/* SQL_API_SQLCOLATTRIBUTES, Dep */
-/* SQL_API_SQLCOLUMNPRIVILEGES, */
+ SQL_API_SQLCOLUMNPRIVILEGES,
SQL_API_SQLDESCRIBEPARAM,
SQL_API_SQLDRIVERCONNECT,
/* SQL_API_SQLDRIVERS, DM */
Modified: trunk/MYSQLPlus/MYSQLPlusLib/MStatement.cpp
===================================================================
--- trunk/MYSQLPlus/MYSQLPlusLib/MStatement.cpp 2006-08-11 09:31:11 UTC (rev 485)
+++ trunk/MYSQLPlus/MYSQLPlusLib/MStatement.cpp 2006-08-11 10:37:16 UTC (rev 486)
@@ -1854,7 +1854,7 @@
MYODBCDbgReturn( nReturn );
}
-SQLRETURN MStatement::doColumnPrivileges( SQLWCHAR *psCatalogName, SQLSMALLINT
nNameLength1, SQLWCHAR *psSchemaName, SQLSMALLINT nNameLength2, SQLWCHAR *psTableName,
SQLSMALLINT nNameLength3, SQLWCHAR *psColumnName, SQLSMALLINT nNameLength4 )
+SQLRETURN MStatement::doColumnPrivileges( SQLWCHAR *psCatalog, SQLSMALLINT nLength1,
SQLWCHAR *psSchema, SQLSMALLINT nLength2, SQLWCHAR *psTable, SQLSMALLINT nLength3,
SQLWCHAR *psColumn, SQLSMALLINT nLength4 )
{
MYODBCDbgEnter();
@@ -1865,7 +1865,138 @@
*/
pDiagnostic->doClear();
- MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::DIA_HY000, 0, "Driver
Does not support this API" ) );
+ /*!
+ \internal ODBC RULE (DM)
+
+ 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()->getInfoMaxTableNameLen() )
+ 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 stringTable;
+ 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 ( psTable && nLength3 != 0 )
+ stringTable = QString::fromUtf16( psTable, ( 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->doColumnPrivileges( stringCatalog, stringSchema, stringTable,
stringColumn );
+ if ( !SQL_SUCCEEDED( nReturn ) )
+ {
+ delete pResult;
+ MYODBCDbgReturn( nReturn );
+ }
+
+ setImplicitPrepare( true );
+ setState( STATE_S5 );
+
+ MYODBCDbgReturn( nReturn );
}
SQLRETURN MStatement::doColumns( SQLWCHAR *psCatalog, SQLSMALLINT nLength1, SQLWCHAR
*psSchema, SQLSMALLINT nLength2, SQLWCHAR *psTable, SQLSMALLINT nLength3, SQLWCHAR
*psColumn, SQLSMALLINT nLength4 )
| Thread |
|---|
| • Connector/ODBC 5 commit: r486 - in trunk: MYODBCDriver/MYODBCDriverLib MYSQLPlus/MYSQLPlusLib | pharvey | 11 Aug |