Added:
trunk/Driver/Driver/Library/SQLGetStmtOption.cpp
trunk/Driver/Driver/Library/SQLSetConnectOptionW.cpp
trunk/Driver/Driver/Library/SQLSetStmtOption.cpp
Modified:
trunk/Driver/Driver/Library/DriverLibrary.vpj
trunk/Driver/Driver/Library/Library.pro
trunk/Driver/Driver/Library/MYODBCDriverExports.def
trunk/Driver/Driver/Library/SQLBindParameter.cpp
trunk/Driver/Driver/Library/SQLCloseCursor.cpp
trunk/Driver/Driver/Library/SQLColAttributeW.cpp
trunk/Driver/Driver/Library/SQLCopyDesc.cpp
trunk/Driver/Driver/Library/SQLDisconnect.cpp
trunk/Driver/Driver/Library/SQLDriverConnectW.cpp
trunk/Driver/Driver/Library/SQLFreeHandle.cpp
trunk/Driver/Driver/Library/SQLFreeStmt.cpp
trunk/Driver/Driver/Library/SQLGetConnectAttrW.cpp
trunk/Driver/Driver/Library/SQLGetData.cpp
trunk/Driver/Driver/Library/SQLGetDescFieldW.cpp
trunk/Driver/Driver/Library/SQLGetDiagFieldW.cpp
trunk/Driver/Driver/Library/SQLGetDiagRecW.cpp
trunk/Driver/Driver/Library/SQLGetFunctions.cpp
trunk/Driver/Driver/Library/SQLGetStmtAttrW.cpp
trunk/Driver/Driver/Library/SQLPrepareW.cpp
trunk/Driver/Driver/Library/SQLSetConnectAttrW.cpp
trunk/Driver/Driver/Library/SQLSetDescFieldW.cpp
trunk/Driver/Driver/Library/SQLSetDescRec.cpp
trunk/Driver/Driver/Library/SQLSetPos.cpp
trunk/Driver/Driver/Library/SQLSetStmtAttrW.cpp
trunk/SDK/MYSQLPlus/Library/MConnection.cpp
trunk/SDK/MYSQLPlus/Library/MStatement.cpp
trunk/SDK/MYSQLPlus/include/MConnection.h
trunk/SDK/MYSQLPlus/include/MStatement.h
Log:
ENH: Add some ODBC v2 support. The support added in this commit should be enough to get DM
(while using MS Access) to make calls much more like c/odbc v3.
Modified: trunk/Driver/Driver/Library/DriverLibrary.vpj
===================================================================
--- trunk/Driver/Driver/Library/DriverLibrary.vpj 2006-10-08 00:38:08 UTC (rev 580)
+++ trunk/Driver/Driver/Library/DriverLibrary.vpj 2006-10-09 05:12:18 UTC (rev 581)
@@ -89,6 +89,7 @@
<F N="SQLGetFunctions.cpp"/>
<F N="SQLGetInfoW.cpp"/>
<F N="SQLGetStmtAttrW.cpp"/>
+ <F N="SQLGetStmtOption.cpp"/>
<F N="SQLGetTypeInfoW.cpp"/>
<F N="SQLMoreResults.cpp"/>
<F N="SQLNativeSqlW.cpp"/>
@@ -102,12 +103,14 @@
<F N="SQLPutData.cpp"/>
<F N="SQLRowCount.cpp"/>
<F N="SQLSetConnectAttrW.cpp"/>
+ <F N="SQLSetConnectOptionW.cpp"/>
<F N="SQLSetCursorNameW.cpp"/>
<F N="SQLSetDescFieldW.cpp"/>
<F N="SQLSetDescRec.cpp"/>
<F N="SQLSetEnvAttr.cpp"/>
<F N="SQLSetPos.cpp"/>
<F N="SQLSetStmtAttrW.cpp"/>
+ <F N="SQLSetStmtOption.cpp"/>
<F N="SQLSpecialColumnsW.cpp"/>
<F N="SQLStatisticsW.cpp"/>
<F N="SQLTablePrivilegesW.cpp"/>
Modified: trunk/Driver/Driver/Library/Library.pro
===================================================================
--- trunk/Driver/Driver/Library/Library.pro 2006-10-08 00:38:08 UTC (rev 580)
+++ trunk/Driver/Driver/Library/Library.pro 2006-10-09 05:12:18 UTC (rev 581)
@@ -99,6 +99,7 @@
SQLGetFunctions.cpp \
SQLGetInfoW.cpp \
SQLGetStmtAttrW.cpp \
+ SQLGetStmtOption.cpp \
SQLGetTypeInfoW.cpp \
SQLMoreResults.cpp \
SQLNativeSqlW.cpp \
@@ -112,12 +113,14 @@
SQLPutData.cpp \
SQLRowCount.cpp \
SQLSetConnectAttrW.cpp \
+ SQLSetConnectOptionW.cpp \
SQLSetCursorNameW.cpp \
SQLSetDescFieldW.cpp \
SQLSetDescRec.cpp \
SQLSetEnvAttr.cpp \
SQLSetPos.cpp \
SQLSetStmtAttrW.cpp \
+ SQLSetStmtOption.cpp \
SQLSpecialColumnsW.cpp \
SQLStatisticsW.cpp \
SQLTablePrivilegesW.cpp \
Modified: trunk/Driver/Driver/Library/MYODBCDriverExports.def
===================================================================
--- trunk/Driver/Driver/Library/MYODBCDriverExports.def 2006-10-08 00:38:08 UTC (rev 580)
+++ trunk/Driver/Driver/Library/MYODBCDriverExports.def 2006-10-09 05:12:18 UTC (rev 581)
@@ -49,6 +49,7 @@
SQLGetFunctions
SQLGetInfoW
SQLGetStmtAttrW
+SQLGetStmtOption
SQLGetTypeInfoW
SQLMoreResults
SQLNativeSqlW
@@ -62,12 +63,14 @@
SQLPutData
SQLRowCount
SQLSetConnectAttrW
+SQLSetConnectOptionW
SQLSetCursorNameW
SQLSetDescFieldW
SQLSetDescRec
SQLSetEnvAttr
SQLSetPos
SQLSetStmtAttrW
+SQLSetStmtOption
SQLSpecialColumnsW
SQLStatisticsW
SQLTablePrivilegesW
Modified: trunk/Driver/Driver/Library/SQLBindParameter.cpp
===================================================================
--- trunk/Driver/Driver/Library/SQLBindParameter.cpp 2006-10-08 00:38:08 UTC (rev 580)
+++ trunk/Driver/Driver/Library/SQLBindParameter.cpp 2006-10-09 05:12:18 UTC (rev 581)
@@ -4,7 +4,7 @@
Copyright MySQL AB 2004-2006 Released under GPL.
\version Connector/ODBC v5
\date 2006
- \brief Contains the SQLBindParamter entry point and shadow function.
+ \brief Contains the SQLBindParamter entry point.
*/
#include "MYODBCDriverInternal.h"
Modified: trunk/Driver/Driver/Library/SQLCloseCursor.cpp
===================================================================
--- trunk/Driver/Driver/Library/SQLCloseCursor.cpp 2006-10-08 00:38:08 UTC (rev 580)
+++ trunk/Driver/Driver/Library/SQLCloseCursor.cpp 2006-10-09 05:12:18 UTC (rev 581)
@@ -4,7 +4,7 @@
Copyright MySQL AB 2004-2006 Released under GPL.
\version Connector/ODBC v5
\date 2006
- \brief Contains the SQLCloseCursor entry point and shadow function.
+ \brief Contains the SQLCloseCursor entry point.
*/
#include "MYODBCDriverInternal.h"
Modified: trunk/Driver/Driver/Library/SQLColAttributeW.cpp
===================================================================
--- trunk/Driver/Driver/Library/SQLColAttributeW.cpp 2006-10-08 00:38:08 UTC (rev 580)
+++ trunk/Driver/Driver/Library/SQLColAttributeW.cpp 2006-10-09 05:12:18 UTC (rev 581)
@@ -4,7 +4,7 @@
Copyright MySQL AB 2004-2006 Released under GPL.
\version Connector/ODBC v5
\date 2006
- \brief Contains the SQLColAttributeW entry point and shadow function.
+ \brief Contains the SQLColAttributeW entry point.
*/
#include "MYODBCDriverInternal.h"
Modified: trunk/Driver/Driver/Library/SQLCopyDesc.cpp
===================================================================
--- trunk/Driver/Driver/Library/SQLCopyDesc.cpp 2006-10-08 00:38:08 UTC (rev 580)
+++ trunk/Driver/Driver/Library/SQLCopyDesc.cpp 2006-10-09 05:12:18 UTC (rev 581)
@@ -4,7 +4,7 @@
Copyright MySQL AB 2004-2006 Released under GPL.
\version Connector/ODBC v5
\date 2006
- \brief Contains the SQLCopyDesc entry point and shadow function.
+ \brief Contains the SQLCopyDesc entry point.
*/
#include "MYODBCDriverInternal.h"
Modified: trunk/Driver/Driver/Library/SQLDisconnect.cpp
===================================================================
--- trunk/Driver/Driver/Library/SQLDisconnect.cpp 2006-10-08 00:38:08 UTC (rev 580)
+++ trunk/Driver/Driver/Library/SQLDisconnect.cpp 2006-10-09 05:12:18 UTC (rev 581)
@@ -4,7 +4,7 @@
Copyright MySQL AB 2004-2006 Released under GPL.
\version Connector/ODBC v5
\date 2006
- \brief Contains the SQLDisconnect entry point and shadow function.
+ \brief Contains the SQLDisconnect entry point.
*/
#include "MYODBCDriverInternal.h"
Modified: trunk/Driver/Driver/Library/SQLDriverConnectW.cpp
===================================================================
--- trunk/Driver/Driver/Library/SQLDriverConnectW.cpp 2006-10-08 00:38:08 UTC (rev 580)
+++ trunk/Driver/Driver/Library/SQLDriverConnectW.cpp 2006-10-09 05:12:18 UTC (rev 581)
@@ -4,7 +4,7 @@
Copyright MySQL AB 2004-2006 Released under GPL.
\version Connector/ODBC v5
\date 2006
- \brief Contains the SQLDriverConnectW entry point and shadow function.
+ \brief Contains the SQLDriverConnectW entry point.
*/
#include "MYODBCDriverInternal.h"
Modified: trunk/Driver/Driver/Library/SQLFreeHandle.cpp
===================================================================
--- trunk/Driver/Driver/Library/SQLFreeHandle.cpp 2006-10-08 00:38:08 UTC (rev 580)
+++ trunk/Driver/Driver/Library/SQLFreeHandle.cpp 2006-10-09 05:12:18 UTC (rev 581)
@@ -4,7 +4,7 @@
Copyright MySQL AB 2004-2006 Released under GPL.
\version Connector/ODBC v5
\date 2006
- \brief Contains the SQLFreeHandle entry point and shadow function.
+ \brief Contains the SQLFreeHandle entry point.
*/
#include "MYODBCDriverInternal.h"
Modified: trunk/Driver/Driver/Library/SQLFreeStmt.cpp
===================================================================
--- trunk/Driver/Driver/Library/SQLFreeStmt.cpp 2006-10-08 00:38:08 UTC (rev 580)
+++ trunk/Driver/Driver/Library/SQLFreeStmt.cpp 2006-10-09 05:12:18 UTC (rev 581)
@@ -4,7 +4,7 @@
Copyright MySQL AB 2004-2006 Released under GPL.
\version Connector/ODBC v5
\date 2006
- \brief Contains the SQLFreeStmt entry point and shadow function.
+ \brief Contains the SQLFreeStmt entry point.
*/
#include "MYODBCDriverInternal.h"
Modified: trunk/Driver/Driver/Library/SQLGetConnectAttrW.cpp
===================================================================
--- trunk/Driver/Driver/Library/SQLGetConnectAttrW.cpp 2006-10-08 00:38:08 UTC (rev 580)
+++ trunk/Driver/Driver/Library/SQLGetConnectAttrW.cpp 2006-10-09 05:12:18 UTC (rev 581)
@@ -4,7 +4,7 @@
Copyright MySQL AB 2004-2006 Released under GPL.
\version Connector/ODBC v5
\date 2006
- \brief Contains the SQLGetConnectAttrW entry point and shadow function.
+ \brief Contains the SQLGetConnectAttrW entry point.
*/
#include "MYODBCDriverInternal.h"
Modified: trunk/Driver/Driver/Library/SQLGetData.cpp
===================================================================
--- trunk/Driver/Driver/Library/SQLGetData.cpp 2006-10-08 00:38:08 UTC (rev 580)
+++ trunk/Driver/Driver/Library/SQLGetData.cpp 2006-10-09 05:12:18 UTC (rev 581)
@@ -4,7 +4,7 @@
Copyright MySQL AB 2004-2006 Released under GPL.
\version Connector/ODBC v5
\date 2006
- \brief Contains the SQLGetData entry point and shadow function.
+ \brief Contains the SQLGetData entry point.
*/
#include "MYODBCDriverInternal.h"
Modified: trunk/Driver/Driver/Library/SQLGetDescFieldW.cpp
===================================================================
--- trunk/Driver/Driver/Library/SQLGetDescFieldW.cpp 2006-10-08 00:38:08 UTC (rev 580)
+++ trunk/Driver/Driver/Library/SQLGetDescFieldW.cpp 2006-10-09 05:12:18 UTC (rev 581)
@@ -4,7 +4,7 @@
Copyright MySQL AB 2004-2006 Released under GPL.
\version Connector/ODBC v5
\date 2006
- \brief Contains the SQLGetDescFieldW entry point and shadow function.
+ \brief Contains the SQLGetDescFieldW entry point.
*/
#include "MYODBCDriverInternal.h"
Modified: trunk/Driver/Driver/Library/SQLGetDiagFieldW.cpp
===================================================================
--- trunk/Driver/Driver/Library/SQLGetDiagFieldW.cpp 2006-10-08 00:38:08 UTC (rev 580)
+++ trunk/Driver/Driver/Library/SQLGetDiagFieldW.cpp 2006-10-09 05:12:18 UTC (rev 581)
@@ -4,7 +4,7 @@
Copyright MySQL AB 2004-2006 Released under GPL.
\version Connector/ODBC v5
\date 2006
- \brief Contains the SQLGetDiagFieldW entry point and shadow function.
+ \brief Contains the SQLGetDiagFieldW entry point.
*/
#include "MYODBCDriverInternal.h"
Modified: trunk/Driver/Driver/Library/SQLGetDiagRecW.cpp
===================================================================
--- trunk/Driver/Driver/Library/SQLGetDiagRecW.cpp 2006-10-08 00:38:08 UTC (rev 580)
+++ trunk/Driver/Driver/Library/SQLGetDiagRecW.cpp 2006-10-09 05:12:18 UTC (rev 581)
@@ -4,7 +4,7 @@
Copyright MySQL AB 2004-2006 Released under GPL.
\version Connector/ODBC v5
\date 2006
- \brief Contains the SQLGetDiagRecW entry point and shadow function.
+ \brief Contains the SQLGetDiagRecW entry point.
*/
#include "MYODBCDriverInternal.h"
Modified: trunk/Driver/Driver/Library/SQLGetFunctions.cpp
===================================================================
--- trunk/Driver/Driver/Library/SQLGetFunctions.cpp 2006-10-08 00:38:08 UTC (rev 580)
+++ trunk/Driver/Driver/Library/SQLGetFunctions.cpp 2006-10-09 05:12:18 UTC (rev 581)
@@ -76,7 +76,7 @@
SQL_API_SQLGETFUNCTIONS,
SQL_API_SQLGETINFO,
SQL_API_SQLGETSTMTATTR,
-/* SQL_API_SQLGETSTMTOPTION, Dep */
+ SQL_API_SQLGETSTMTOPTION, /* Dep */
SQL_API_SQLGETTYPEINFO,
SQL_API_SQLNUMRESULTCOLS,
/* SQL_API_SQLPARAMDATA, */
@@ -84,14 +84,14 @@
/* SQL_API_SQLPUTDATA, */
SQL_API_SQLROWCOUNT,
SQL_API_SQLSETCONNECTATTR,
-/* SQL_API_SQLSETCONNECTOPTION, Dep */
+ SQL_API_SQLSETCONNECTOPTION, /* Dep */
SQL_API_SQLSETCURSORNAME,
SQL_API_SQLSETDESCFIELD,
SQL_API_SQLSETDESCREC,
SQL_API_SQLSETENVATTR,
/* SQL_API_SQLSETPARAM, Dep */
SQL_API_SQLSETSTMTATTR,
-/* SQL_API_SQLSETSTMTOPTION, Dep */
+ SQL_API_SQLSETSTMTOPTION, /* Dep */
SQL_API_SQLSPECIALCOLUMNS,
SQL_API_SQLSTATISTICS,
SQL_API_SQLTABLES,
Modified: trunk/Driver/Driver/Library/SQLGetStmtAttrW.cpp
===================================================================
--- trunk/Driver/Driver/Library/SQLGetStmtAttrW.cpp 2006-10-08 00:38:08 UTC (rev 580)
+++ trunk/Driver/Driver/Library/SQLGetStmtAttrW.cpp 2006-10-09 05:12:18 UTC (rev 581)
@@ -4,7 +4,7 @@
Copyright MySQL AB 2004-2006 Released under GPL.
\version Connector/ODBC v5
\date 2006
- \brief Contains the SQLGetStmtAttrW entry point and shadow function.
+ \brief Contains the SQLGetStmtAttrW entry point.
*/
#include "MYODBCDriverInternal.h"
Added: trunk/Driver/Driver/Library/SQLGetStmtOption.cpp
===================================================================
--- trunk/Driver/Driver/Library/SQLGetStmtOption.cpp 2006-10-08 00:38:08 UTC (rev 580)
+++ trunk/Driver/Driver/Library/SQLGetStmtOption.cpp 2006-10-09 05:12:18 UTC (rev 581)
@@ -0,0 +1,90 @@
+/*!
+ \file SQLGetStmtOption.c
+ \author Peter Harvey <pharvey@stripped>
+ Copyright MySQL AB 2004-2006 Released under GPL.
+ \version Connector/ODBC v5
+ \date 2006
+ \brief Contains the SQLGetStmtOptionW entry point.
+*/
+#include "MYODBCDriverInternal.h"
+
+SQLRETURN SQL_API SQLGetStmtOption( SQLHSTMT hStm,
+ SQLUSMALLINT Option,
+ SQLPOINTER Value )
+{
+ MYODBCDbgEnter();
+
+#if MYODBC_DBG > 1
+ MYODBCDbgInfo( QString( "hStm=%1" ).arg( (qulonglong)hStm ) );
+#endif
+
+#if MYODBC_DEV > 0
+ if ( !hStm )
+ MYODBCDbgReturn( SQL_INVALID_HANDLE );
+#endif
+
+ /*!
+ \internal ODBC RULE
+
+ For an ODBC 3.x driver, the Driver Manager no longer checks to see whether Option
is in between
+ SQL_STMT_OPT_MIN and SQL_STMT_OPT_MAX, or is greater than
SQL_CONNECT_OPT_DRVR_START. The driver
+ must check this.
+ */
+
+ /*!
+ \internal ODBC RULE (DM v2 -> v3 mapping)
+
+ If fOption indicates an ODBC-defined statement option that returns a string, the
Driver Manager calls...
+
+ SQLGetStmtAttr(StatementHandle, Attribute, ValuePtr,
SQL_MAX_OPTION_STRING_LENGTH, NULL)
+ */
+
+ /* all attributes are 32-bit integer */
+
+ /*!
+ \internal ODBC RULE (DM v2 -> v3 mapping)
+
+ If fOption indicates an ODBC-defined statement option that returns a 32-bit
integer value, the Driver
+ Manager calls...
+
+ SQLGetStmtAttr(StatementHandle, Attribute, ValuePtr, 0, NULL)
+ */
+ switch ( Option )
+ {
+ case SQL_ASYNC_ENABLE:
+ case SQL_BIND_TYPE:
+ case SQL_CONCURRENCY:
+ case SQL_CURSOR_TYPE:
+ case SQL_GET_BOOKMARK:
+ case SQL_KEYSET_SIZE:
+ case SQL_MAX_LENGTH:
+ case SQL_MAX_ROWS:
+ case SQL_NOSCAN:
+ case SQL_QUERY_TIMEOUT:
+ case SQL_RETRIEVE_DATA:
+ case SQL_ROW_NUMBER:
+ case SQL_ROWSET_SIZE:
+ case SQL_SIMULATE_CURSOR:
+ case SQL_USE_BOOKMARKS:
+ MYODBCDbgReturn( ((MStatement*)hStm)->getStmtAttr( Option, Value, 0, NULL
) );
+ }
+
+ /*!
+ \internal ODBC RULE (DM v2 -> v3 mapping)
+
+ If fOption indicates a driver-defined statement option, the Driver Manager
calls...
+
+ SQLGetStmtAttr(StatementHandle, Attribute, ValuePtr, BufferLength, NULL)
+ */
+
+ /* we do not have any driver specific attributes */
+
+ /*!
+ \internal
+ \note
+
+ ODBC v2 spec. does not state an error for this so we simply return SQL_SUCCESS.
+ */
+ MYODBCDbgReturn( SQL_SUCCESS );
+}
+
Modified: trunk/Driver/Driver/Library/SQLPrepareW.cpp
===================================================================
--- trunk/Driver/Driver/Library/SQLPrepareW.cpp 2006-10-08 00:38:08 UTC (rev 580)
+++ trunk/Driver/Driver/Library/SQLPrepareW.cpp 2006-10-09 05:12:18 UTC (rev 581)
@@ -4,7 +4,7 @@
Copyright MySQL AB 2004-2006 Released under GPL.
\version Connector/ODBC v5
\date 2006
- \brief Contains the SQLPrepareW entry point and shadow function.
+ \brief Contains the SQLPrepareW entry point.
*/
#include "MYODBCDriverInternal.h"
Modified: trunk/Driver/Driver/Library/SQLSetConnectAttrW.cpp
===================================================================
--- trunk/Driver/Driver/Library/SQLSetConnectAttrW.cpp 2006-10-08 00:38:08 UTC (rev 580)
+++ trunk/Driver/Driver/Library/SQLSetConnectAttrW.cpp 2006-10-09 05:12:18 UTC (rev 581)
@@ -4,7 +4,7 @@
Copyright MySQL AB 2004-2006 Released under GPL.
\version Connector/ODBC v5
\date 2006
- \brief Contains the SQLSetConnectAttrW entry point and shadow function.
+ \brief Contains the SQLSetConnectAttrW entry point.
*/
#include "MYODBCDriverInternal.h"
Added: trunk/Driver/Driver/Library/SQLSetConnectOptionW.cpp
===================================================================
--- trunk/Driver/Driver/Library/SQLSetConnectOptionW.cpp 2006-10-08 00:38:08 UTC (rev 580)
+++ trunk/Driver/Driver/Library/SQLSetConnectOptionW.cpp 2006-10-09 05:12:18 UTC (rev 581)
@@ -0,0 +1,91 @@
+/*!
+ \file SQLSetConnectOptionW.c
+ \author Peter Harvey <pharvey@stripped>
+ Copyright MySQL AB 2004-2006 Released under GPL.
+ \version Connector/ODBC v5
+ \date 2006
+ \brief Contains the SQLSetConnectOptionW entry point.
+*/
+#include "MYODBCDriverInternal.h"
+
+SQLRETURN SQL_API SQLSetConnectOptionW( SQLHDBC hDbc,
+ SQLUSMALLINT fOption,
+ SQLULEN vParam )
+{
+ MYODBCDbgEnter();
+
+#if MYODBC_DBG > 1
+ MYODBCDbgInfo( QString( "hDbc=%1" ).arg( (qulonglong)hDbc ) );
+#endif
+
+#if MYODBC_DEV > 0
+ if ( !hDbc )
+ MYODBCDbgReturn( SQL_INVALID_HANDLE );
+#endif
+
+ SQLPOINTER p = (SQLPOINTER)vParam;
+
+ /*!
+ \internal ODBC RULE
+
+ fOption should be >= SQL_CONN_OPT_MIN and <= SQL_CONN_OPT_MAX. However; any
driver specific
+ options are found >= SQL_CONNECT_OPT_DRVR_START.
+ */
+
+ /*!
+ \internal ODBC RULE (v2 -> v3 mapping)
+
+ If fOption indicates an ODBC-defined connection attribute that requires a string,
the Driver
+ Manager calls...
+
+ SQLSetConnectAttr(ConnectionHandle, Attribute, ValuePtr, SQL_NTS)
+ */
+ switch ( fOption )
+ {
+ case SQL_CURRENT_QUALIFIER:
+ case SQL_OPT_TRACEFILE:
+ case SQL_TRANSLATE_DLL:
+ MYODBCDbgReturn( ((MConnection*)hDbc)->setConnectAttr( fOption, p, SQL_NTS
) );
+ }
+
+ /*!
+ \internal ODBC RULE (v2 -> v3 mapping)
+
+ If fOption indicates an ODBC-defined connection attribute that returns a 32-bit
integer value,
+ the Driver Manager calls...
+
+ SQLSetConnectAttr(ConnectionHandle, Attribute, ValuePtr, 0)
+ */
+ switch ( fOption )
+ {
+ case SQL_ACCESS_MODE:
+ case SQL_AUTOCOMMIT:
+ case SQL_LOGIN_TIMEOUT:
+ case SQL_ODBC_CURSORS:
+ case SQL_OPT_TRACE:
+ case SQL_PACKET_SIZE:
+ case SQL_QUIET_MODE:
+ case SQL_TRANSLATE_OPTION:
+ case SQL_TXN_ISOLATION:
+ MYODBCDbgReturn( ((MConnection*)hDbc)->setConnectAttr( fOption, p, 0 ) );
+ }
+
+ /*!
+ \internal ODBC RULE (v2 -> v3 mapping)
+
+ If fOption indicates a driver-defined connection attribute, the Driver Manager
calls...
+
+ SQLSetConnectAttr(ConnectionHandle, Attribute, ValuePtr, BufferLength)
+ */
+
+ /* we do not have any driver specific attributes */
+
+ /*!
+ \internal MYODBC RULE
+
+ Spec. does not indicate a SQL STATE for fOption being out of range (completely
invalid). Some
+ other drivers seem to opt to ignore (silently succeed) in this case.
+ */
+ MYODBCDbgReturn( SQL_SUCCESS );
+}
+
Modified: trunk/Driver/Driver/Library/SQLSetDescFieldW.cpp
===================================================================
--- trunk/Driver/Driver/Library/SQLSetDescFieldW.cpp 2006-10-08 00:38:08 UTC (rev 580)
+++ trunk/Driver/Driver/Library/SQLSetDescFieldW.cpp 2006-10-09 05:12:18 UTC (rev 581)
@@ -4,7 +4,7 @@
Copyright MySQL AB 2004-2006 Released under GPL.
\version Connector/ODBC v5
\date 2006
- \brief Contains the SQLSetDescFieldW entry point and shadow function.
+ \brief Contains the SQLSetDescFieldW entry point.
*/
#include "MYODBCDriverInternal.h"
Modified: trunk/Driver/Driver/Library/SQLSetDescRec.cpp
===================================================================
--- trunk/Driver/Driver/Library/SQLSetDescRec.cpp 2006-10-08 00:38:08 UTC (rev 580)
+++ trunk/Driver/Driver/Library/SQLSetDescRec.cpp 2006-10-09 05:12:18 UTC (rev 581)
@@ -4,7 +4,7 @@
Copyright MySQL AB 2004-2006 Released under GPL.
\version Connector/ODBC v5
\date 2006
- \brief Contains the SQLSetDescRec entry point and shadow function.
+ \brief Contains the SQLSetDescRec entry point.
*/
#include "MYODBCDriverInternal.h"
Modified: trunk/Driver/Driver/Library/SQLSetPos.cpp
===================================================================
--- trunk/Driver/Driver/Library/SQLSetPos.cpp 2006-10-08 00:38:08 UTC (rev 580)
+++ trunk/Driver/Driver/Library/SQLSetPos.cpp 2006-10-09 05:12:18 UTC (rev 581)
@@ -4,7 +4,7 @@
Copyright MySQL AB 2004-2006 Released under GPL.
\version Connector/ODBC v5
\date 2006
- \brief Contains the SQLSetPos entry point and shadow function.
+ \brief Contains the SQLSetPos entry point.
*/
#include "MYODBCDriverInternal.h"
Modified: trunk/Driver/Driver/Library/SQLSetStmtAttrW.cpp
===================================================================
--- trunk/Driver/Driver/Library/SQLSetStmtAttrW.cpp 2006-10-08 00:38:08 UTC (rev 580)
+++ trunk/Driver/Driver/Library/SQLSetStmtAttrW.cpp 2006-10-09 05:12:18 UTC (rev 581)
@@ -4,7 +4,7 @@
Copyright MySQL AB 2004-2006 Released under GPL.
\version Connector/ODBC v5
\date 2006
- \brief Contains the SQLSetStmtAttrW entry point and shadow function.
+ \brief Contains the SQLSetStmtAttrW entry point.
*/
#include "MYODBCDriverInternal.h"
Added: trunk/Driver/Driver/Library/SQLSetStmtOption.cpp
===================================================================
--- trunk/Driver/Driver/Library/SQLSetStmtOption.cpp 2006-10-08 00:38:08 UTC (rev 580)
+++ trunk/Driver/Driver/Library/SQLSetStmtOption.cpp 2006-10-09 05:12:18 UTC (rev 581)
@@ -0,0 +1,80 @@
+/*!
+ \file SQLSetStmtOption.c
+ \author Peter Harvey <pharvey@stripped>
+ Copyright MySQL AB 2004-2006 Released under GPL.
+ \version Connector/ODBC v5
+ \date 2006
+ \brief Contains the SQLSetStmtOption entry point.
+*/
+#include "MYODBCDriverInternal.h"
+
+SQLRETURN SQL_API SQLSetStmtOption( SQLHSTMT hStm,
+ SQLUSMALLINT Option,
+ SQLULEN Value )
+{
+ MYODBCDbgEnter();
+
+#if MYODBC_DBG > 1
+ MYODBCDbgInfo( QString( "hStm=%1" ).arg( (qulonglong)hStm ) );
+#endif
+
+#if MYODBC_DEV > 0
+ if ( !hStm )
+ MYODBCDbgReturn( SQL_INVALID_HANDLE );
+#endif
+
+ SQLPOINTER p = (SQLPOINTER)Value;
+
+ /*!
+ \internal ODBC RULE (v3 -> v2 mapping)
+
+ If fOption indicates an ODBC-defined statement attribute that is a string,
+ the Driver Manager calls...
+
+ SQLSetStmtAttr(StatementHandle, fOption, ValuePtr, SQL_NTS)
+ */
+
+ /* all attributes are 32-bit integer */
+
+ /*!
+ \internal ODBC RULE (v3 -> v2 mapping)
+
+ If fOption indicates an ODBC-defined statement attribute that returns a 32-bit
+ integer value, the Driver Manager calls...
+
+ SQLSetStmtAttr(StatementHandle, fOption, ValuePtr, 0)
+ */
+ switch ( Option )
+ {
+ case SQL_ASYNC_ENABLE:
+ case SQL_BIND_TYPE:
+ case SQL_CONCURRENCY:
+ case SQL_CURSOR_TYPE:
+ /* case SQL_GET_BOOKMARK: */ /* read-only */
+ case SQL_KEYSET_SIZE:
+ case SQL_MAX_LENGTH:
+ case SQL_MAX_ROWS:
+ case SQL_NOSCAN:
+ case SQL_QUERY_TIMEOUT:
+ case SQL_RETRIEVE_DATA:
+ /* case SQL_ROW_NUMBER: */ /* read-only */
+ case SQL_ROWSET_SIZE:
+ case SQL_SIMULATE_CURSOR:
+ case SQL_USE_BOOKMARKS:
+ MYODBCDbgReturn( ((MStatement*)hStm)->setStmtAttr( Option, p, 0 ) );
+ }
+
+ /*!
+ \internal ODBC RULE (v3 -> v2 mapping)
+
+ If fOption indicates a driver-defined statement attribute, the Driver Manager
+ calls...
+
+ SQLSetStmtAttr(StatementHandle, fOption, ValuePtr, BufferLength)
+ */
+
+ /* we do not have any driver specific attributes */
+
+ MYODBCDbgReturn( SQL_SUCCESS );
+}
+
Modified: trunk/SDK/MYSQLPlus/Library/MConnection.cpp
===================================================================
--- trunk/SDK/MYSQLPlus/Library/MConnection.cpp 2006-10-08 00:38:08 UTC (rev 580)
+++ trunk/SDK/MYSQLPlus/Library/MConnection.cpp 2006-10-09 05:12:18 UTC (rev 581)
@@ -65,7 +65,7 @@
nConnectionTimeout = 0;
stringCurrentCatalog = QString::null;
nLoginTimeout = SQL_LOGIN_TIMEOUT_DEFAULT;
- nMetadataID = SQL_FALSE;
+ nMetadataID = SQL_FALSE;
nODBCCursors = SQL_CUR_DEFAULT;
nPacketSize = 16 * 1,024,000; /*! \internal \todo Client and
server have independent value. Default on client is 16M but try to be smarter by getting
real value. */
hQuietMode = 0;
@@ -75,6 +75,21 @@
nTranslateOption = 0;
nTxnIsolation = 0;
+ /* statement attributes which can be set on a connection (ODBC v2 spec. compat.) */
+ /* nAsyncEnable = SQL_ASYNC_ENABLE_DEFAULT; */
+ nBindType = SQL_BIND_BY_COLUMN;
+ nConcurrency = SQL_CONCUR_DEFAULT;
+ nCursorType = SQL_CURSOR_TYPE_DEFAULT;
+ nKeysetSize = SQL_KEYSET_SIZE_DEFAULT;
+ nMaxLength = SQL_MAX_LENGTH_DEFAULT;
+ nMaxRows = SQL_MAX_ROWS_DEFAULT;
+ nNoscan = SQL_NOSCAN_DEFAULT;
+ nQueryTimeout = SQL_QUERY_TIMEOUT_DEFAULT;
+ nRetrieveData = SQL_RD_DEFAULT;
+ nRowsetSize = SQL_ROWSET_SIZE_DEFAULT;
+ nSimulateCursor = SQL_SC_TRY_UNIQUE;
+ nUseBookmarks = SQL_UB_DEFAULT;
+
MYODBCDbgReturn2();
}
@@ -265,17 +280,38 @@
case SQL_ATTR_TXN_ISOLATION:
MYODBCDbgReturn( setTxnIsolation( (qint32)pValue ) );
- case 30002:
- /*!
- \internal MYODBC RULE
+ default:
+ {
+ /*!
+ \internal ODBC RULE (ODBC v2)
- MS Access tries to get/set this unknown attribute. Most drivers,
including C/ODBC v3
- ignore it and return SQL_SUCCESS.
- */
- break;
+ An application can call SQLSetConnectOption (which may be mapped to
here) and
+ include a statement option. The driver sets the statement option for
any hstmts
+ associated with the specified hdbc and establishes the statement
option as a
+ default for any hstmts later allocated for that hdbc.
+ */
+ /*!
+ \internal ODBC RULE
- default:
- MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_HY092B ) );
+ SQL_ATTR_METADATA_ID can also be set on the connection level. (It and
+ SQL_ATTR_ASYNC_ENABLE are the only statement attributes that are also
connection
+ attributes.)
+ */
+ /*!
+ \internal
+ \note
+
+ SQL_ATTR_ASYNC_ENABLE seems to be the only attribute which exists for
SQLSetStmtOption()
+ and SQLSetConnectAttr(). This would change our implementation
supporting
+ SQLSetConnectOption() but - we never support async so we ignore this
complication.
+ */
+ if ( getEnvironment()->getODBCVersion() == SQL_OV_ODBC2 )
+ {
+ MYODBCDbgReturn( setStmtOption( nAttribute, pValue, nStringLength )
);
+ }
+ else
+ MYODBCDbgReturn( getDiagnostic()->doAppend(
MDiagnostic::STATE_HY092B ) );
+ }
}
MYODBCDbgReturn( SQL_SUCCESS );
@@ -2553,6 +2589,111 @@
MYODBCDbgReturn( SQL_SUCCESS );
}
+SQLRETURN MConnection::setStmtOption( SQLINTEGER nAttribute, SQLPOINTER pValue,
SQLINTEGER nStringLength )
+{
+ MYODBCDbgEnter();
+
+ BOOLEAN bWarning = false;
+ SQLRETURN nReturn = SQL_SUCCESS;
+
+ /* try to adopt the value for future statements */
+ switch ( nAttribute )
+ {
+ case SQL_ASYNC_ENABLE:
+ nReturn = setAsyncEnable( (SQLUINTEGER)pValue );
+ break;
+
+ case SQL_BIND_TYPE:
+ nReturn = setBindType( (SQLUINTEGER)pValue );
+ break;
+
+ case SQL_CONCURRENCY:
+ nReturn = setConcurrency( (SQLUINTEGER)pValue );
+ break;
+
+ case SQL_CURSOR_TYPE:
+ nReturn = setCursorType( (SQLUINTEGER)pValue );
+ break;
+
+ case SQL_KEYSET_SIZE:
+ nReturn = setKeysetSize( (SQLUINTEGER)pValue );
+ break;
+
+ case SQL_MAX_LENGTH:
+ nReturn = setMaxLength( (SQLUINTEGER)pValue );
+ break;
+
+ case SQL_MAX_ROWS:
+ nReturn = setMaxRows( (SQLUINTEGER)pValue );
+ break;
+
+ case SQL_NOSCAN:
+ nReturn = setNoscan( (SQLUINTEGER)pValue );
+ break;
+
+ case SQL_QUERY_TIMEOUT:
+ nReturn = setQueryTimeout( (SQLUINTEGER)pValue );
+ break;
+
+ case SQL_RETRIEVE_DATA:
+ nReturn = setRetrieveData( (SQLUINTEGER)pValue );
+ break;
+
+ case SQL_ROWSET_SIZE:
+ nReturn = setRowsetSize( (SQLUINTEGER)pValue );
+ break;
+
+ case SQL_SIMULATE_CURSOR:
+ nReturn = setSimulateCursor( (SQLUINTEGER)pValue );
+ break;
+
+ case SQL_USE_BOOKMARKS:
+ nReturn = setUseBookmarks( (SQLUINTEGER)pValue );
+ break;
+
+ default:
+ /*!
+ \internal ODBC RULE (ODBC v2)
+
+ This method only called if ODBC v2 app. and ODBC v2 spec. does not error
for this.
+ */
+ MYODBCDbgReturn( SQL_SUCCESS );
+ break;
+ }
+
+ if ( !SQL_SUCCEEDED( nReturn ) )
+ MYODBCDbgReturn( nReturn );
+
+ if ( nReturn != SQL_SUCCESS )
+ bWarning = true;
+
+ /* for each statement set value, any MStatement errors get downgraded to generic
warnings in MConnection */
+ {
+ QList<QObject*> listObjects;
+ QListIterator<QObject*> i( (QList<QObject*>)children() );
+
+ while ( i.hasNext() )
+ {
+ QObject *pObject = i.next();
+ if ( pObject->objectName() == "MStatement" )
+ {
+ MStatement *pStatement = (MStatement*)pObject;
+ nReturn = pStatement->setStmtAttr( nAttribute, pValue, nStringLength
);
+ if ( !SQL_SUCCEEDED( nReturn ) )
+ {
+ bWarning = true;
+ getDiagnostic()->doAppend( MDiagnostic::STATE_01000, 0, tr("Failed
to set a statement attribute.") );
+ }
+ }
+ }
+ }
+
+ if ( bWarning )
+ MYODBCDbgReturn( SQL_SUCCESS_WITH_INFO );
+
+ MYODBCDbgReturn( SQL_SUCCESS );
+}
+
SQLRETURN MConnection::setAsyncEnable( SQLUINTEGER nAsyncEnable )
{
MYODBCDbgEnter();
@@ -2578,9 +2719,12 @@
MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_HY092B ) );
}
- this->nAsyncEnable = nAsyncEnable;
+ /*!
+ \internal MYODBC RULE
- MYODBCDbgReturn( SQL_SUCCESS );
+ We dot not support asynch operations.
+ */
+ MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_HYC00 ) );
}
SQLRETURN MConnection::setAutocommit( SQLUINTEGER nAutocommit )
@@ -3168,6 +3312,98 @@
MYODBCDbgReturn3( "%d", nTxnIsolation );
}
+SQLUINTEGER MConnection::getConcurrency()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn3( "%d", nConcurrency );
+}
+
+SQLUINTEGER MConnection::getCursorType()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn3( "%d", nCursorType );
+}
+
+SQLUINTEGER MConnection::getKeysetSize()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn3( "%d", nKeysetSize );
+}
+
+SQLUINTEGER MConnection::getMaxLength()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn3( "%d", nMaxLength );
+}
+
+SQLUINTEGER MConnection::getMaxRows()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn3( "%d", nMaxRows );
+}
+
+SQLUINTEGER MConnection::getNoscan()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn3( "%d", nNoscan );
+}
+
+SQLUINTEGER MConnection::getQueryTimeout()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn3( "%d", nQueryTimeout );
+}
+
+SQLUINTEGER MConnection::getRetrieveData()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn3( "%d", nRetrieveData );
+}
+
+SQLUINTEGER MConnection::getBindType()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn3( "%d", nBindType );
+}
+
+SQLUINTEGER MConnection::getRowsetSize()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn3( "%d", nRowsetSize );
+}
+
+SQLUINTEGER MConnection::getSimulateCursor()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn3( "%d", nSimulateCursor );
+}
+
+SQLUINTEGER MConnection::getUseBookmarks()
+{
+ MYODBCDbgEnter();
+
+ /*!
+ \internal MYODBC RULE
+
+ Warn if bookmarks are meaningless to us.
+ */
+ if ( getInfoBookmarkPersistence() == 0 )
+ getDiagnostic()->doAppend( MDiagnostic::STATE_01000, 0, tr("Bookmarks not
supported.") );
+
+ MYODBCDbgReturn3( "%d", nUseBookmarks );
+}
+
QString MConnection::getInfoAccessibleProcedures()
{
MYODBCDbgEnter();
@@ -3981,6 +4217,7 @@
community.
*/
MYODBCDbgReturn1( SQL_SPEC_STRING );
+ // MYODBCDbgReturn1( "03.51" );
}
QString MConnection::getInfoDriverVer()
@@ -5458,8 +5695,6 @@
{
MYODBCDbgEnter();
-// QList<QObject*> listObjects = MYODBCC::getChildren( this, "MStatement" );
-
QList<MStatement*> listStatements = findChildren<MStatement*>();
QListIterator<MStatement*> i( listStatements );
while ( i.hasNext() )
@@ -5501,5 +5736,187 @@
MYODBCDbgReturn3( "%d", false );
}
+SQLRETURN MConnection::setConcurrency( SQLUINTEGER nConcurrency )
+{
+ MYODBCDbgEnter();
+ switch ( nConcurrency )
+ {
+ case SQL_CONCUR_READ_ONLY:
+ case SQL_CONCUR_LOCK:
+ case SQL_CONCUR_ROWVER:
+ case SQL_CONCUR_VALUES:
+ break;
+ default:
+ MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_HY092B ) );
+ }
+
+ this->nConcurrency = nConcurrency;
+
+ MYODBCDbgReturn( SQL_SUCCESS );
+}
+
+SQLRETURN MConnection::setCursorType( SQLUINTEGER nCursorType )
+{
+ MYODBCDbgEnter();
+
+ switch ( nCursorType )
+ {
+ case SQL_CURSOR_FORWARD_ONLY:
+ case SQL_CURSOR_STATIC:
+ case SQL_CURSOR_KEYSET_DRIVEN:
+ case SQL_CURSOR_DYNAMIC:
+ break;
+
+ default:
+ MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_HY092B ) );
+ }
+
+ this->nCursorType = nCursorType;
+
+ MYODBCDbgReturn( SQL_SUCCESS );
+}
+
+SQLRETURN MConnection::setKeysetSize( SQLUINTEGER nKeysetSize )
+{
+ MYODBCDbgEnter();
+
+ this->nKeysetSize = nKeysetSize;
+
+ MYODBCDbgReturn( SQL_SUCCESS );
+}
+
+SQLRETURN MConnection::setMaxLength( SQLUINTEGER nMaxLength )
+{
+ MYODBCDbgEnter();
+
+#if MYODBC_DBG > 1
+ MYODBCDbgInfo( QString( "nMaxLength=%1" ).arg( nMaxLength ) );
+#endif
+
+ this->nMaxLength = nMaxLength;
+
+ MYODBCDbgReturn( SQL_SUCCESS );
+}
+
+SQLRETURN MConnection::setMaxRows( SQLUINTEGER nMaxRows )
+{
+ MYODBCDbgEnter();
+
+ this->nMaxRows = nMaxRows;
+
+ MYODBCDbgReturn( SQL_SUCCESS );
+}
+
+SQLRETURN MConnection::setNoscan( SQLUINTEGER nNoscan )
+{
+ MYODBCDbgEnter();
+
+ switch ( nNoscan )
+ {
+ case SQL_NOSCAN_OFF:
+ case SQL_NOSCAN_ON:
+ break;
+ default:
+ MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_HY024 ) );
+ }
+
+ this->nNoscan = nNoscan;
+
+ MYODBCDbgReturn( SQL_SUCCESS );
+}
+
+SQLRETURN MConnection::setQueryTimeout( SQLUINTEGER nQueryTimeout )
+{
+ MYODBCDbgEnter();
+
+#if MYODBC_DBG > 1
+ MYODBCDbgInfo( QString( "nQueryTimeout=%1" ).arg( nQueryTimeout ) );
+#endif
+
+ this->nQueryTimeout = nQueryTimeout;
+
+ MYODBCDbgReturn( SQL_SUCCESS );
+}
+
+SQLRETURN MConnection::setRetrieveData( SQLUINTEGER nRetrieveData )
+{
+ MYODBCDbgEnter();
+
+ switch ( nRetrieveData )
+ {
+ case SQL_RD_ON:
+ case SQL_RD_OFF:
+ break;
+ default:
+ MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_HY024 ) );
+ }
+
+ this->nRetrieveData = nRetrieveData;
+
+ MYODBCDbgReturn( SQL_SUCCESS );
+}
+
+SQLRETURN MConnection::setBindType( SQLUINTEGER nBindType )
+{
+ MYODBCDbgEnter();
+
+ if ( !MYODBCC::isDescBindType( nBindType ) )
+ MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_HY092B ) );
+
+ this->nBindType = nBindType;
+
+ MYODBCDbgReturn( SQL_SUCCESS );
+}
+
+SQLRETURN MConnection::setRowsetSize( SQLUINTEGER nRowsetSize )
+{
+ MYODBCDbgEnter();
+
+ this->nRowsetSize = nRowsetSize;
+
+ MYODBCDbgReturn( SQL_SUCCESS );
+}
+
+
+SQLRETURN MConnection::setSimulateCursor( SQLUINTEGER nSimulateCursor )
+{
+ MYODBCDbgEnter();
+
+ switch ( nSimulateCursor )
+ {
+ case SQL_SC_NON_UNIQUE:
+ case SQL_SC_TRY_UNIQUE:
+ case SQL_SC_UNIQUE:
+ break;
+ default:
+ MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_HY024 ) );
+ }
+
+ this->nSimulateCursor = nSimulateCursor;
+
+ MYODBCDbgReturn( SQL_SUCCESS );
+}
+
+SQLRETURN MConnection::setUseBookmarks( SQLUINTEGER nUseBookmarks )
+{
+ MYODBCDbgEnter();
+
+ if ( nUseBookmarks != SQL_UB_OFF && getInfoBookmarkPersistence() == 0 )
+ MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_HYC00 ) );
+
+ switch ( nUseBookmarks )
+ {
+ case SQL_UB_OFF:
+ case SQL_UB_VARIABLE:
+ break;
+ default:
+ MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_HY024 ) );
+ }
+
+ this->nUseBookmarks = nUseBookmarks;
+
+ MYODBCDbgReturn( SQL_SUCCESS );
+}
+
Modified: trunk/SDK/MYSQLPlus/Library/MStatement.cpp
===================================================================
--- trunk/SDK/MYSQLPlus/Library/MStatement.cpp 2006-10-08 00:38:08 UTC (rev 580)
+++ trunk/SDK/MYSQLPlus/Library/MStatement.cpp 2006-10-09 05:12:18 UTC (rev 581)
@@ -42,28 +42,40 @@
nState = STATE_S1;
pDiagnostic = new MDiagnostic( this,
pConnection->getEnvironment()->getDiagnostic()->getODBCVersion() );
+
+ /* descriptors */
pAppParamDesc = pAppParamDescOrig = new MDescriptorAPD( this );
pAppRowDesc = pAppRowDescOrig = new MDescriptorARD( this );
+ pImpParamDesc = new MDescriptorIPD( this );
+ pImpRowDesc = new MDescriptorIRD( this );
+
+ /* attributes */
bImplicitPrepare = false;
- nAsyncEnable = SQL_ASYNC_ENABLE_DEFAULT;
- nConcurrency = SQL_CONCUR_DEFAULT;
nCursorScrollable = SQL_NONSCROLLABLE;
nCursorSensitivity = SQL_UNSPECIFIED;
- nCursorType = SQL_CURSOR_TYPE_DEFAULT;
nEnableAutoIPD = SQL_FALSE;
pFetchBookmarkPtr = NULL;
- pImpParamDesc = new MDescriptorIPD( this );
- pImpRowDesc = new MDescriptorIRD( this );
- nKeysetSize = SQL_KEYSET_SIZE_DEFAULT;
- nMaxLength = SQL_MAX_LENGTH_DEFAULT;
- nMaxRows = SQL_MAX_ROWS_DEFAULT;
+
+ /* attributes: adopt from MConnection to support ODBC v3 */
nMetadataID = pConnection->getMetadataID();
- nNoscan = SQL_NOSCAN_DEFAULT;
- nQueryTimeout = SQL_QUERY_TIMEOUT_DEFAULT;
- nRetrieveData = SQL_RD_DEFAULT;
- nSimulateCursor = SQL_SC_TRY_UNIQUE;
- nUseBookmarks = SQL_UB_DEFAULT;
+ /* attributes: adopt from MConnection to support ODBC v2 */
+ pAppRowDesc->setBindType( pConnection->getBindType() );
+ nConcurrency = pConnection->getConcurrency();
+ nCursorType = pConnection->getCursorType();
+ nKeysetSize = pConnection->getKeysetSize();
+ nMaxLength = pConnection->getMaxLength();
+ nMaxRows = pConnection->getMaxRows();
+ nNoscan = pConnection->getNoscan();
+ nQueryTimeout = pConnection->getQueryTimeout();
+ nRetrieveData = pConnection->getRetrieveData();
+ nSimulateCursor = pConnection->getSimulateCursor();
+ nUseBookmarks = pConnection->getUseBookmarks();
+
+ /* attributes: adopt from MConnection to support ODBC v2 and ODBC v3 */
+ nAsyncEnable = pConnection->getAsyncEnable();
+
+
/*!
\internal ODBC RULE
@@ -878,7 +890,14 @@
*(SQLPOINTER *)pValue = pAppParamDesc;
// *((MDescriptor**)pValue) = pAppParamDesc;
if ( pAppParamDesc )
- MYODBCCSet( pnStringLength, sizeof(char*) );
+ MYODBCCSet( pnStringLength, sizeof(SQLPOINTER) );
+ else
+ MYODBCCSet( pnStringLength, 0 );
+#if MYODBC_DBG > 1
+ MYODBCDbgInfo( QString( "SQL_ATTR_APP_PARAM_DESC=%1" ).arg(
(qulonglong)pAppParamDesc ) );
+ if ( pnStringLength )
+ MYODBCDbgInfo( QString( "pnStringLength=%1" ).arg( *pnStringLength )
);
+#endif
}
break;
@@ -890,7 +909,14 @@
// *((MDescriptor**)pValue) = pAppRowDesc;
if ( pAppRowDesc )
- MYODBCCSet( pnStringLength, sizeof(char*) );
+ MYODBCCSet( pnStringLength, sizeof(SQLPOINTER) );
+ else
+ MYODBCCSet( pnStringLength, 0 );
+#if MYODBC_DBG > 1
+ MYODBCDbgInfo( QString( "SQL_ATTR_APP_ROW_DESC=%1" ).arg(
(qulonglong)pAppRowDesc ) );
+ if ( pnStringLength )
+ MYODBCDbgInfo( QString( "pnStringLength=%1" ).arg( *pnStringLength )
);
+#endif
}
break;
@@ -932,7 +958,14 @@
*(SQLPOINTER *)pValue = pImpParamDesc;
// *((MDescriptor**)pValue) = pImpParamDesc;
if ( pImpParamDesc )
- MYODBCCSet( pnStringLength, sizeof(char*) );
+ MYODBCCSet( pnStringLength, sizeof(SQLPOINTER) );
+ else
+ MYODBCCSet( pnStringLength, 0 );
+#if MYODBC_DBG > 1
+ MYODBCDbgInfo( QString( "SQL_ATTR_IMP_PARAM_DESC=%1" ).arg(
(qulonglong)pImpParamDesc ) );
+ if ( pnStringLength )
+ MYODBCDbgInfo( QString( "pnStringLength=%1" ).arg( *pnStringLength )
);
+#endif
}
break;
@@ -943,7 +976,14 @@
*(SQLPOINTER *)pValue = pImpRowDesc;
// *((MDescriptor**)pValue) = pImpRowDesc;
if ( pImpRowDesc )
- MYODBCCSet( pnStringLength, sizeof(char*) );
+ MYODBCCSet( pnStringLength, sizeof(SQLPOINTER) );
+ else
+ MYODBCCSet( pnStringLength, 0 );
+#if MYODBC_DBG > 1
+ MYODBCDbgInfo( QString( "SQL_ATTR_IMP_ROW_DESC=%1" ).arg(
(qulonglong)pImpRowDesc ) );
+ if ( pnStringLength )
+ MYODBCDbgInfo( QString( "pnStringLength=%1" ).arg( *pnStringLength )
);
+#endif
}
break;
Modified: trunk/SDK/MYSQLPlus/include/MConnection.h
===================================================================
--- trunk/SDK/MYSQLPlus/include/MConnection.h 2006-10-08 00:38:08 UTC (rev 580)
+++ trunk/SDK/MYSQLPlus/include/MConnection.h 2006-10-09 05:12:18 UTC (rev 581)
@@ -100,12 +100,12 @@
*/
/*@{*/
SQLRETURN setAccessMode( SQLUINTEGER nAccessMode );
- SQLRETURN setAsyncEnable( SQLUINTEGER nAsyncEnable );
+ SQLRETURN setAsyncEnable( SQLUINTEGER nAsyncEnable ); /*!< Used as
default for MStatement's */
SQLRETURN setAutocommit( SQLUINTEGER nAutocommit );
SQLRETURN setConnectionTimeout( SQLUINTEGER nConnectionTimeout );
SQLRETURN setCurrentCatalog( QString stringCurrentCatalog );
SQLRETURN setLoginTimeout( SQLUINTEGER nLoginTimeout );
- SQLRETURN setMetadataID( SQLUINTEGER nMetadataID );
+ SQLRETURN setMetadataID( SQLUINTEGER nMetadataID ); /*!< Used as
default for MStatement's */
SQLRETURN setODBCCursors( SQLUINTEGER nODBCCursors );
SQLRETURN setPacketSize( SQLUINTEGER nPacketSize );
SQLRETURN setQuietMode( HWND hQuietMode );
@@ -133,14 +133,14 @@
*/
/*@{*/
SQLUINTEGER getAccessMode();
- SQLUINTEGER getAsyncEnable();
+ SQLUINTEGER getAsyncEnable(); /*!< Used as default for MStatement's */
SQLUINTEGER getAutoIPD();
SQLUINTEGER getAutocommit();
SQLUINTEGER getConnectionDead();
SQLUINTEGER getConnectionTimeout();
QString getCurrentCatalog();
SQLUINTEGER getLoginTimeout();
- SQLUINTEGER getMetadataID();
+ SQLUINTEGER getMetadataID(); /*!< Used as default for MStatement's */
SQLUINTEGER getODBCCursors();
SQLUINTEGER getPacketSize();
HWND getQuietMode();
@@ -153,6 +153,29 @@
/*!
\internal
+ \name Statement (some) attributes getters.
+
+ These correspond to the SQL_ATTR_* statement attributes and are used to
support ODBC v2 app's
+ ability to set statement attributes on a connection and have new
statements use the values.
+ */
+ /*@{*/
+ /* SQLUINTEGER getAsyncEnable(); */ /*!< MStatement::SQL_ATTR_ASYNC_ENABLE
*/
+ SQLUINTEGER getBindType(); /*!< MStatement::ARD::SQL_DESC_BIND_TYPE
*/
+ SQLUINTEGER getConcurrency(); /*!< MStatement::SQL_ATTR_CONCURRENCY
*/
+ SQLUINTEGER getCursorType(); /*!< MStatement::SQL_ATTR_CURSOR_TYPE
*/
+ SQLUINTEGER getKeysetSize(); /*!< MStatement::SQL_ATTR_KEYSET_SIZE
*/
+ SQLUINTEGER getMaxLength(); /*!< MStatement::SQL_ATTR_MAX_LENGTH
*/
+ SQLUINTEGER getMaxRows(); /*!< MStatement::SQL_ATTR_MAX_ROWS
*/
+ SQLUINTEGER getNoscan(); /*!< MStatement::SQL_ATTR_NOSCAN
*/
+ SQLUINTEGER getQueryTimeout(); /*!< MStatement::SQL_ATTR_QUERY_TIMEOUT
*/
+ SQLUINTEGER getRetrieveData(); /*!< MStatement::SQL_ATTR_RETRIEVE_DATA
*/
+ SQLUINTEGER getRowsetSize(); /*!< MStatement::ARD::SQL_DESC_ARRAY_SIZE
*/
+ SQLUINTEGER getSimulateCursor(); /*!< MStatement::SQL_ATTR_SIMULATE_CURSOR
*/
+ SQLUINTEGER getUseBookmarks(); /*!< MStatement::SQL_ATTR_USE_BOOKMARKS
*/
+ /*@}*/
+
+ /*!
+ \internal
\name Feature information.
These correspond to the SQL_* InfoType values used when calling
SQLGetInfo and are used to support getInfo() and some
@@ -384,9 +407,10 @@
/*!
\internal
- \name Connection attributes getters.
+ \name Connection attributes.
- Private storage for these folks to control access. Use setters and
getters to access.
+ Private storage for these folks to control access. Use setters
+ and getters to access.
*/
/*@{*/
SQLUINTEGER nAccessMode; /*!< SQL_ATTR_ACCESS_MODE */
@@ -408,9 +432,65 @@
qint32 nTxnIsolation; /*!< SQL_ATTR_TXN_ISOLATION */
/*@}*/
- QTime timeLastQuery; /*!< part of ensuring we keep our
connection */
- int nServerAliveSanityCheckInterval; /*!< milliseconds between queries
which we consider a connection check needed */
+ /*!
+ \internal
+ \name Statement attributes.
+ ODBC v3 does not support these in a connection but ODBC v2 does.
+ We have these here for compat. with ODBC v2 applications. This
+ needs to be done even when the DM is mapping for us because the DM
+ is unable to map this functionality.
+
+ These are applied to a statement when the statement is created.
+
+ Private storage for these folks to control access. Use setters
+ and getters to access.
+ */
+ /*@{*/
+ /* SQLUINTEGER nAsyncEnable; */ /*!< MStatement::SQL_ATTR_ASYNC_ENABLE
*/
+ SQLUINTEGER nBindType; /*!< MStatement::ARD::SQL_DESC_BIND_TYPE
*/
+ SQLUINTEGER nConcurrency; /*!< MStatement::SQL_ATTR_CONCURRENCY
*/
+ SQLUINTEGER nCursorType; /*!< MStatement::SQL_ATTR_CURSOR_TYPE
*/
+ SQLUINTEGER nKeysetSize; /*!< MStatement::SQL_ATTR_KEYSET_SIZE
*/
+ SQLUINTEGER nMaxLength; /*!< MStatement::SQL_ATTR_MAX_LENGTH
*/
+ SQLUINTEGER nMaxRows; /*!< MStatement::SQL_ATTR_MAX_ROWS
*/
+ SQLUINTEGER nNoscan; /*!< MStatement::SQL_ATTR_NOSCAN
*/
+ SQLUINTEGER nQueryTimeout; /*!< MStatement::SQL_ATTR_QUERY_TIMEOUT
*/
+ SQLUINTEGER nRetrieveData; /*!< MStatement::SQL_ATTR_RETRIEVE_DATA
*/
+ SQLUINTEGER nRowsetSize; /*!< MStatement::ARD::SQL_DESC_ARRAY_SIZE
*/
+ SQLUINTEGER nSimulateCursor; /*!< MStatement::SQL_ATTR_SIMULATE_CURSOR
*/
+ SQLUINTEGER nUseBookmarks; /*!< MStatement::SQL_ATTR_USE_BOOKMARKS
*/
+ /*@}*/
+
+ QTime timeLastQuery; /*!< part of ensuring we keep
our connection */
+ int nServerAliveSanityCheckInterval; /*!< milliseconds between
queries which we consider a connection check needed */
+
+ /*!
+ \internal
+ \name Statement (some) attributes setters.
+
+ These correspond to the SQL_ATTR_* statement attributes and are used to
support ODBC v2 app's
+ ability to set statement attributes on a connection and have new
statements use the values.
+
+ May seem a bit silly to have these but allows them to show up in a trace
- possibly
+ opimitize away at a later date.
+ */
+ /*@{*/
+ SQLRETURN setStmtOption( SQLINTEGER nAttribute, SQLPOINTER pValue, SQLINTEGER
nStringLength );
+ /* SQLRETURN setAsyncEnable( SQLUINTEGER nAsyncEnable ); */
+ SQLRETURN setBindType( SQLUINTEGER nBindType );
+ SQLRETURN setConcurrency( SQLUINTEGER nConcurrency );
+ SQLRETURN setCursorType( SQLUINTEGER nCursorType );
+ SQLRETURN setKeysetSize( SQLUINTEGER nKeysetSize );
+ SQLRETURN setMaxLength( SQLUINTEGER nMaxLength );
+ SQLRETURN setMaxRows( SQLUINTEGER nMaxRows );
+ SQLRETURN setNoscan( SQLUINTEGER nNoscan );
+ SQLRETURN setQueryTimeout( SQLUINTEGER nQueryTimeout );
+ SQLRETURN setRetrieveData( SQLUINTEGER nRetrieveData );
+ SQLRETURN setRowsetSize( SQLUINTEGER nRowsetSize );
+ SQLRETURN setSimulateCursor( SQLUINTEGER nSimulateCursor );
+ SQLRETURN setUseBookmarks( SQLUINTEGER nUseBookmarks );
+ /*@}*/
};
#endif
Modified: trunk/SDK/MYSQLPlus/include/MStatement.h
===================================================================
--- trunk/SDK/MYSQLPlus/include/MStatement.h 2006-10-08 00:38:08 UTC (rev 580)
+++ trunk/SDK/MYSQLPlus/include/MStatement.h 2006-10-09 05:12:18 UTC (rev 581)
@@ -218,3 +218,4 @@
#endif
+
| Thread |
|---|
| • Connector/ODBC 5 commit: r581 - in trunk: Driver/Driver/Library SDK/MYSQLPlus/Library SDK/MYSQLPlus/include | pharvey | 9 Oct |