Added:
trunk/SDK/MYSQLPlus/Library/MConnection_props.cpp
Modified:
trunk/SDK/MYSQLPlus/Library/Library.pro
trunk/SDK/MYSQLPlus/Library/MConnection.cpp
trunk/SDK/MYSQLPlus/include/MConnection.h
Log:
Appended short names to state numbers in MConnection.
Split out simple prop get/set from MConnection to separate file.
Modified: trunk/SDK/MYSQLPlus/Library/Library.pro
===================================================================
--- trunk/SDK/MYSQLPlus/Library/Library.pro 2006-11-29 20:08:05 UTC (rev 702)
+++ trunk/SDK/MYSQLPlus/Library/Library.pro 2006-11-30 06:47:10 UTC (rev 703)
@@ -46,6 +46,7 @@
MCommands.cpp \
MEnvironment.cpp \
MConnection.cpp \
+ MConnection_props.cpp \
MStatement.cpp \
MDescriptor.cpp \
MResult.cpp \
Modified: trunk/SDK/MYSQLPlus/Library/MConnection.cpp
===================================================================
--- trunk/SDK/MYSQLPlus/Library/MConnection.cpp 2006-11-29 20:08:05 UTC (rev 702)
+++ trunk/SDK/MYSQLPlus/Library/MConnection.cpp 2006-11-30 06:47:10 UTC (rev 703)
@@ -1,3 +1,7 @@
+/*
+ * Main functionality of MConnection
+ */
+
#include "MInternal.h"
typedef BOOL (*MYODBCInsDriverConnectFunc)( SQLHWND, MYODBCInsDriverConnect * );
@@ -35,7 +39,7 @@
pEnvironment->pDiagnostic->doClear();
- nState = STATE_C2;
+ nState = STATE_C2_ALLOC;
pDiagnostic = new MDiagnostic( this,
pEnvironment->getDiagnostic()->getODBCVersion() );
pDiagnosticCaller = NULL;
nStatementType = STATEMENT_RES; // STATEMENT_DYNAMIC;
@@ -108,1408 +112,281 @@
MYODBCDbgReturn2();
}
-SQLRETURN MConnection::setConnectAttr( SQLINTEGER nAttribute, SQLPOINTER pValue,
SQLINTEGER nStringLength )
+MConnection::STATE MConnection::getState()
{
MYODBCDbgEnter();
-#if MYODBC_DBG > 1
- MYODBCDbgInfo( QString( "nAttribute=%1=%2" ).arg( nAttribute ).arg(
MYODBCC::getConnectAttrString( nAttribute ) ) );
-#endif
+ /* Its possible our state has changed but we do not know it yet so... */
+ if ( nState == STATE_C4_CONN )
+ {
+ if ( !MYODBCC::getChildren( this, "MStatement" ).isEmpty() )
+ setState( STATE_C5_STMT );
+ }
+ else if ( nState == STATE_C5_STMT )
+ {
+ if ( MYODBCC::getChildren( this, "MStatement" ).isEmpty() )
+ setState( STATE_C4_CONN );
+ }
/*!
\internal ODBC RULE
- We clear diagnostic each time an ODBC API call is made (with exceptions).
+ It is possible for a connection to be in state C6 with no statements allocated on
the
+ connection. For example, suppose the connection is in manual commit mode and is
in
+ state C4. If a statement is allocated, executed (starting a transaction), and
then
+ freed, the transaction remains active but there are no statements on the
connection.
*/
- pDiagnostic->doClear();
-
/*!
- \internal MYODBC RULE (DM)
+ \internal MYODBC RULE
+ \todo
- We can ignore the following ODBC RULE as we do not support
- asynch.
+ What the server tells us about a transaction has precedence over what we may
think?
- "An asynchronously executing function was called for a
- StatementHandle associated with the ConnectionHandle and
- was still executing when SQLSetConnectAttr was called."
- */
-
- /*!
- \internal ODBC RULE (DM)
-
- SQLExecute, SQLExecDirect, SQLBulkOperations, or
- SQLSetPos was called for a StatementHandle associated with
- the ConnectionHandle and returned SQL_NEED_DATA. This
- function was called before data was sent for all
- data-at-execution parameters or columns.
+ \sa SERVER_STATUS_IN_TRANS
*/
-
- /*! \todo scan statements checking thier state for above rule */
-
- /*!
- \internal ODBC RULE (DM)
-
- SQLBrowseConnect was called for the ConnectionHandle and returned
- SQL_NEED_DATA. This function was called before SQLBrowseConnect
- returned SQL_SUCCESS_WITH_INFO or SQL_SUCCESS.
- */
- if ( getState() == STATE_C3 )
- MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_HY010 ) );
-
- switch ( nAttribute )
- {
- case SQL_ATTR_ACCESS_MODE:
- MYODBCDbgReturn( setAccessMode( (SQLUINTEGER)pValue ) );
-
- case SQL_ATTR_ANSI_APP:
- /*!
- \internal ODBC RULE
- If the application is using ANSI APIs, SQL_ATTR_ANSI_APP will be set to
SQL_AA_TRUE, and if it is using
- Unicode, it will be set to a value of SQL_AA_FALSE.
- ...
- If a driver exhibits the same behavior for both ANSI and Unicode
applications, it should return SQL_ERROR
- for this attribute. If the driver returns SQL_SUCCESS, the Driver Manager
will separate ANSI and Unicode
- connections when Connection Pooling is used.
- */
- /*!
- \internal MYODBC RULE
+ MYODBCDbgReturn3( "%d", nState );
+}
- We only have an ANSI API - no UNICODE API. So at first blush it looks
like we should return an error
- here. However;
+SQLRETURN MConnection::setAutocommit( SQLUINTEGER nAutocommit )
+{
+ MYODBCDbgEnter();
- - we may depend upon connection level settings with the server for proper
character/string handling
- - the downside of separating the two for connection pooling (hopefully
that is all that is happening) is
- very minimal
- */
- /* MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_HY000,
0, tr("Driver does NOT behave differently if the application is ANSI.") ) ); */
- break;
-
- case SQL_ATTR_ASYNC_ENABLE:
- MYODBCDbgReturn( setAsyncEnable( (SQLUINTEGER)pValue ) );
-
- case SQL_ATTR_AUTO_IPD:
- MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_HY092B ) );
-
- case SQL_ATTR_AUTOCOMMIT:
- MYODBCDbgReturn( setAutocommit( (SQLUINTEGER)pValue ) );
-
- case SQL_ATTR_CONNECTION_DEAD:
- MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_HY092B ) );
-
- case SQL_ATTR_CONNECTION_TIMEOUT:
- MYODBCDbgReturn( setConnectionTimeout( (SQLUINTEGER)pValue ) );
-
- case SQL_ATTR_CURRENT_CATALOG:
+ switch ( nAutocommit )
+ {
+ case SQL_AUTOCOMMIT_ON:
+ if ( getState() >= STATE_C4_CONN )
{
- /*!
- \internal ODBC RULE (DM)
+ if ( getInfoTxnCapable() == SQL_TC_NONE )
+ MYODBCDbgReturn( getDiagnostic()->doAppend(
MDiagnostic::STATE_HYC00, 0, tr("Server does not support transactions.") ) );
- (DM) *ValuePtr is a character string, and BufferLength was less than
zero
- but not equal to SQL_NTS.
- */
- if ( nStringLength < 0 && nStringLength != SQL_NTS )
- MYODBCDbgReturn( getDiagnostic()->doAppend(
MDiagnostic::STATE_HY090 ) );
-
- QString stringCurrentCatalog;
- if ( nStringLength == SQL_NTS )
- stringCurrentCatalog = MYODBCC::QString_fromWCharArray(
(SQLWCHAR*)pValue );
- else
- stringCurrentCatalog = MYODBCC::QString_fromWCharArray(
(SQLWCHAR*)pValue, nStringLength );
-
- MYODBCDbgReturn( setCurrentCatalog( stringCurrentCatalog ) );
+ if ( !SQL_SUCCEEDED( doSubmitCommand( "SET AUTOCOMMIT=1" ) ) )
+ MYODBCDbgReturn( getDiagnostic()->doAppend(
MDiagnostic::STATE_HY000 ) );
}
-
- case SQL_ATTR_LOGIN_TIMEOUT:
- MYODBCDbgReturn( setLoginTimeout( (SQLUINTEGER)pValue ) );
+ break;
- case SQL_ATTR_METADATA_ID:
- MYODBCDbgReturn( setMetadataID( (SQLUINTEGER)pValue ) );
-
- case SQL_ATTR_ODBC_CURSORS:
- MYODBCDbgReturn( setODBCCursors( (SQLUINTEGER)pValue ) );
-
- case SQL_ATTR_PACKET_SIZE:
- MYODBCDbgReturn( setPacketSize( (SQLUINTEGER)pValue ) );
-
- case SQL_ATTR_QUIET_MODE:
- MYODBCDbgReturn( setQuietMode( (HWND)pValue ) );
-
- case SQL_ATTR_TRACE:
- MYODBCDbgReturn( setTrace( (SQLUINTEGER)pValue ) );
-
- case SQL_ATTR_TRACEFILE:
+ case SQL_AUTOCOMMIT_OFF:
+ if ( getState() >= STATE_C4_CONN )
{
- /*!
- \internal ODBC RULE (DM)
-
- *ValuePtr is a character string, and BufferLength was less than zero
- but not equal to SQL_NTS.
- */
- if ( nStringLength < 0 && nStringLength != SQL_NTS )
- MYODBCDbgReturn( getDiagnostic()->doAppend(
MDiagnostic::STATE_HY090 ) );
-
- QString stringTracefile;
- if ( nStringLength == SQL_NTS )
- stringTracefile = MYODBCC::QString_fromWCharArray( (SQLWCHAR*)pValue
);
- else
- stringTracefile = MYODBCC::QString_fromWCharArray( (SQLWCHAR*)pValue,
nStringLength );
-
- MYODBCDbgReturn( setTracefile( stringTracefile ) );
+ if ( !SQL_SUCCEEDED( doSubmitCommand( "SET AUTOCOMMIT=0" ) ) )
+ MYODBCDbgReturn( getDiagnostic()->doAppend(
MDiagnostic::STATE_HY000 ) );
}
+ break;
- case SQL_ATTR_TRANSLATE_LIB:
- {
- /*!
- \internal ODBC RULE (DM)
-
- *ValuePtr is a character string, and BufferLength was less than zero
- but not equal to SQL_NTS.
- */
- if ( nStringLength < 0 && nStringLength != SQL_NTS )
- MYODBCDbgReturn( getDiagnostic()->doAppend(
MDiagnostic::STATE_HY090 ) );
-
- QString stringTranslateLib;
- if ( nStringLength == SQL_NTS )
- stringTranslateLib = MYODBCC::QString_fromWCharArray(
(SQLWCHAR*)pValue );
- else
- stringTranslateLib = MYODBCC::QString_fromWCharArray(
(SQLWCHAR*)pValue, nStringLength );
-
- MYODBCDbgReturn( setTranslateLib( stringTranslateLib ) );
- }
-
- case SQL_ATTR_TRANSLATE_OPTION:
- MYODBCDbgReturn( setTranslateOption( (qint32)pValue ) );
-
- case SQL_ATTR_TXN_ISOLATION:
- MYODBCDbgReturn( setTxnIsolation( (qint32)pValue ) );
-
default:
- {
- /*!
- \internal ODBC RULE (ODBC v2)
-
- 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
-
- 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( getDiagnostic()->doAppend( MDiagnostic::STATE_HY092B ) );
}
- MYODBCDbgReturn( SQL_SUCCESS );
-}
+ this->nAutocommit = nAutocommit;
-SQLRETURN MConnection::setStatementType( STATEMENT_TYPE nType )
-{
- MYODBCDbgEnter();
-
- nStatementType = nType;
-
MYODBCDbgReturn( SQL_SUCCESS );
}
-SQLRETURN MConnection::setBufferedType( BUFFERED_TYPE nType )
+SQLRETURN MConnection::setTxnIsolation( qint32 nTxnIsolation )
{
MYODBCDbgEnter();
- nBufferedType = nType;
+ if ( getInfoTxnCapable() == SQL_TC_NONE )
+ MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_HYC00, 0,
tr("Server does not support transactions.") ) );
- MYODBCDbgReturn( SQL_SUCCESS );
-}
-
-SQLRETURN MConnection::getConnectAttr( SQLINTEGER nAttribute, SQLPOINTER pValue,
SQLINTEGER nBufferLength, SQLINTEGER *pnStringLength )
-{
- MYODBCDbgEnter();
-
-#if MYODBC_DBG > 1
- MYODBCDbgInfo( QString( "nAttribute=%1=%2" ).arg( nAttribute ).arg(
MYODBCC::getConnectAttrString( nAttribute ) ) );
-#endif
-
- BOOL bCopyOk;
-
- /* handle case where we are not provided viable pnStringLength */
- SQLINTEGER nLen = 0;
- SQLINTEGER * pnLen;
- if ( pnStringLength )
- pnLen = pnStringLength;
- else
- pnLen = &nLen;
-
/*!
\internal ODBC RULE
- We clear diagnostic each time an ODBC API call is made (with exceptions).
+ An application must call SQLEndTran to commit or roll back all open
+ transactions on a connection, before calling SQLSetConnectAttr with
+ this option.
*/
- pDiagnostic->doClear();
+ if ( isTransaction() )
+ MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_HY011 ) );
- /*!
- \internal ODBC Rule
+ QString stringStatement;
- (DM) SQLBrowseConnect was called for the ConnectionHandle and returned
- SQL_NEED_DATA. This function was called before SQLBrowseConnect
- returned SQL_SUCCESS_WITH_INFO or SQL_SUCCESS.
- */
- if ( getState() == STATE_C3 )
- MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_HY010 ) );
+ if ( nTxnIsolation & SQL_TXN_SERIALIZABLE )
+ stringStatement = "SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE";
+ else if ( nTxnIsolation & SQL_TXN_REPEATABLE_READ )
+ stringStatement = "SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ";
+ else if ( nTxnIsolation & SQL_TXN_READ_COMMITTED )
+ stringStatement = "SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED";
+ else if ( nTxnIsolation & SQL_TXN_READ_UNCOMMITTED )
+ stringStatement = "SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED";
+ else
+ MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_HY092B ) );
- switch ( nAttribute )
+ /* Connected so do it now */
+ if ( isConnected() )
{
- case SQL_ATTR_ACCESS_MODE:
- if ( pValue )
- *((SQLUINTEGER*)pValue) = getAccessMode();
- *pnLen = SQL_IS_UINTEGER ;
- break;
+ if ( !SQL_SUCCEEDED( doSubmitCommand( stringStatement.toUtf8().data() ) ) )
+ MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_HY000 ) );
+ }
- case SQL_ATTR_ASYNC_ENABLE:
- if ( pValue )
- *((SQLUINTEGER*)pValue) = getAsyncEnable();
- *pnLen = SQL_IS_UINTEGER ;
- break;
+ this->nTxnIsolation = nTxnIsolation;
- case SQL_ATTR_AUTO_IPD:
- if ( pValue )
- *((SQLUINTEGER*)pValue) = getAutoIPD();
- *pnLen = SQL_IS_UINTEGER ;
- break;
+ MYODBCDbgReturn( SQL_SUCCESS );
+}
- case SQL_ATTR_AUTOCOMMIT:
- if ( pValue )
- *((SQLUINTEGER*)pValue) = getAutocommit();
- *pnLen = SQL_IS_UINTEGER ;
- break;
+SQLUINTEGER MConnection::getConnectionDead()
+{
+ MYODBCDbgEnter();
- case SQL_ATTR_CONNECTION_DEAD:
- if ( pValue )
- *((SQLUINTEGER*)pValue) = getConnectionDead();
- *pnLen = SQL_IS_UINTEGER ;
- break;
+ SQLUINTEGER nConnectionDead = SQL_CD_TRUE;
- case SQL_ATTR_CONNECTION_TIMEOUT:
- if ( pValue )
- *((SQLUINTEGER*)pValue) = getConnectionTimeout();
- *pnLen = SQL_IS_UINTEGER ;
- break;
+ if ( getState() >= STATE_C4_CONN )
+ {
+ int nReturn = mysql_ping( (MYSQL*)pMySQL );
+ switch ( nReturn )
+ {
+ case 0:
+ nConnectionDead = SQL_CD_FALSE;
+ break;
+ case CR_COMMANDS_OUT_OF_SYNC:
+ getDiagnostic()->doAppend( MDiagnostic::STATE_01000, nReturn,
"CR_COMMANDS_OUT_OF_SYNC" );
+ break;
+ case CR_SERVER_GONE_ERROR:
+ getDiagnostic()->doAppend( MDiagnostic::STATE_01000, nReturn,
"CR_SERVER_GONE_ERROR" );
+ break;
+ case CR_UNKNOWN_ERROR:
+ getDiagnostic()->doAppend( MDiagnostic::STATE_01000, nReturn,
"CR_UNKNOWN_ERROR" );
+ break;
+ case CR_SERVER_LOST:
+ getDiagnostic()->doAppend( MDiagnostic::STATE_01000, nReturn,
"CR_SERVER_LOST" );
+ break;
+ default:
+ MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_HY000,
nReturn, tr("Unhandled return code from mysql_ping()") ) );
+ }
+ }
- case SQL_ATTR_CURRENT_CATALOG:
- /*!
- \internal MYODBC RULE
+ MYODBCDbgReturn3( "%d", nConnectionDead );
+}
- We mst have a the length at pValue.
- */
- if ( nBufferLength < 1 )
- MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_HY090 )
);
+ulong MConnection::getClientFlag( ulong nOptions, const QString &stringSTMT )
+{
+ ulong nClientFlag = CLIENT_ODBC;
- *pnLen = 0;
+ if ( nOptions & (MYODBC_FLAG_FOUND_ROWS | MYODBC_FLAG_SAFE) )
+ nClientFlag |= CLIENT_FOUND_ROWS;
- if ( getCurrentCatalog().isNull() )
- MYODBCDbgReturn( SQL_NO_DATA );
+ if ( nOptions & MYODBC_FLAG_NO_SCHEMA )
+ nClientFlag |= CLIENT_NO_SCHEMA;
+/*
+ if (nOptions & (MYODBC_FLAG_BIG_PACKETS | MYODBC_FLAG_SAFE))
+ max_allowed_packet=~0L;
+*/
- /* copy string */
- bCopyOk = MYODBCC::doStringCopyOut( (SQLWCHAR*)pValue, nBufferLength /
sizeof(SQLWCHAR), getCurrentCatalog(), pnLen );
- *pnLen = *pnLen * sizeof(SQLWCHAR); /* because we have char len but we want
byte len */
- if ( !bCopyOk )
- MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_01004 )
);
- break;
+ if ( nOptions & MYODBC_FLAG_COMPRESSED_PROTO )
+ nClientFlag |= CLIENT_COMPRESS;
- case SQL_ATTR_LOGIN_TIMEOUT:
- if ( pValue )
- *((SQLUINTEGER*)pValue) = getLoginTimeout();
- *pnLen = SQL_IS_UINTEGER ;
- break;
+ if ( nOptions & MYODBC_FLAG_IGNORE_SPACE )
+ nClientFlag |= CLIENT_IGNORE_SPACE;
- case SQL_ATTR_METADATA_ID:
- if ( pValue )
- *((SQLUINTEGER*)pValue) = getMetadataID();
- *pnLen = SQL_IS_UINTEGER ;
- break;
+#ifdef __WIN__
+ if ( nOptions & MYODBC_FLAG_NAMED_PIPE )
+ mysql_options( (MYSQL*)pMySQL, MYSQL_OPT_NAMED_PIPE, NULL );
+#endif
- case SQL_ATTR_ODBC_CURSORS:
- if ( pValue )
- *((SQLUINTEGER*)pValue) = getODBCCursors();
- *pnLen = SQL_IS_UINTEGER ;
- break;
+ if ( nOptions & MYODBC_FLAG_USE_MYCNF )
+ mysql_options( (MYSQL*)pMySQL, MYSQL_READ_DEFAULT_GROUP, "odbc" );
- case SQL_ATTR_PACKET_SIZE:
- if ( pValue )
- *((SQLUINTEGER*)pValue) = getPacketSize();
- *pnLen = SQL_IS_UINTEGER ;
- break;
+ if ( !stringSTMT.isEmpty() )
+ mysql_options( (MYSQL*)pMySQL, MYSQL_INIT_COMMAND, stringSTMT.toUtf8().data() );
- case SQL_ATTR_QUIET_MODE:
- if ( pValue )
- *((SQLINTEGER*)pValue) = (SQLINTEGER)getQuietMode();
- *pnLen = SQL_IS_INTEGER;
- break;
+ mysql_options( (MYSQL*)pMySQL, MYSQL_OPT_CONNECT_TIMEOUT, (const char
*)&nLoginTimeout );
- case SQL_ATTR_TRACE:
- if ( pValue )
- *((SQLUINTEGER*)pValue) = getTrace();
- *pnLen = SQL_IS_UINTEGER ;
- break;
-
- case SQL_ATTR_TRACEFILE:
- /*!
- \internal MYODBC RULE
-
- We mst have a the length at pValue.
- */
- if ( nBufferLength < 1 )
- MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_HY090 )
);
-
- *pnLen = 0;
-
- if ( getTracefile().isNull() )
- MYODBCDbgReturn( SQL_NO_DATA );
-
- /* copy string */
- bCopyOk = MYODBCC::doStringCopyOut( (SQLWCHAR*)pValue, nBufferLength /
sizeof(SQLWCHAR), getTracefile(), pnLen );
- *pnLen = *pnLen * sizeof(SQLWCHAR); /* because we have char len but we want
byte len */
- if ( !bCopyOk )
- MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_01004 )
);
- break;
-
- case SQL_ATTR_TRANSLATE_LIB:
- /*!
- \internal MYODBC RULE
-
- We mst have a the length at pValue.
- */
- if ( nBufferLength < 1 )
- MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_HY090 )
);
-
- *pnLen = 0;
-
- if ( getTranslateLib().isNull() )
- MYODBCDbgReturn( SQL_NO_DATA );
-
- /* copy string */
- bCopyOk = MYODBCC::doStringCopyOut( (SQLWCHAR*)pValue, nBufferLength /
sizeof(SQLWCHAR), getTranslateLib(), pnLen );
- *pnLen = *pnLen * sizeof(SQLWCHAR); /* because we have char len but we want
byte len */
- if ( !bCopyOk )
- MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_01004 )
);
- break;
-
- case SQL_ATTR_TRANSLATE_OPTION:
- if ( pValue )
- *((SQLINTEGER*)pValue) = (SQLINTEGER)getTranslateOption();
- *pnLen = SQL_IS_INTEGER ;
- break;
-
- case SQL_ATTR_TXN_ISOLATION:
- if ( pValue )
- *((SQLINTEGER*)pValue) = (SQLINTEGER)getTxnIsolation();
- *pnLen = SQL_IS_INTEGER ;
- break;
-
- case 30002:
- /*!
- \internal MYODBC RULE
-
- MS Access tries to get/set this unknown attribute. Most drivers,
including C/ODBC v3
- ignore it and return SQL_SUCCESS.
-
- We take exception to this.
- */
-
- default:
- MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_HY092B ) );
- }
-
- MYODBCDbgReturn( SQL_SUCCESS );
+ return nClientFlag;
}
-SQLRETURN MConnection::getDiagField( SQLSMALLINT nRecNumber, SQLSMALLINT nDiagIdentifier,
SQLPOINTER pDiagInfo, SQLSMALLINT nBufferLength, SQLSMALLINT *pnStringLength )
+QString MConnection::getInfoDbmsVer()
{
MYODBCDbgEnter();
- MYODBCDbgReturn( pDiagnostic->getDiagField( nRecNumber, nDiagIdentifier,
pDiagInfo, nBufferLength, pnStringLength ) );
+
+ if ( getMySQL() )
+ MYODBCDbgReturn1( mysql_get_server_info( (MYSQL*)getMySQL() ) );
+
+ MYODBCDbgReturn1( "" );
}
-SQLRETURN MConnection::getDiagRec( SQLSMALLINT nRecNumber, SQLWCHAR *psSQLState,
SQLINTEGER *pnNativeError, SQLWCHAR *psMessageText, SQLSMALLINT nBufferLength,
SQLSMALLINT *pnTextLength )
+QString MConnection::getInfoServerName()
{
MYODBCDbgEnter();
- MYODBCDbgReturn( pDiagnostic->getDiagRec( nRecNumber, psSQLState, pnNativeError,
psMessageText, nBufferLength, pnTextLength ) )
+
+ if ( getMySQL() )
+ MYODBCDbgReturn1( mysql_get_host_info( (MYSQL*)getMySQL() ) );
+
+ MYODBCDbgReturn1( "" );
}
-SQLRETURN MConnection::getInfo( SQLUSMALLINT nInfoType, SQLPOINTER pInfoValue,
SQLSMALLINT nBufferLength /* bytes */, SQLSMALLINT *pnStringLengthBytesPtr )
+QString MConnection::getCurrentCatalog()
{
MYODBCDbgEnter();
-#if MYODBC_DBG > 1
- MYODBCDbgInfo( QString( "nInfoType=%1=%2" ).arg( nInfoType).arg(
MYODBCC::getInfoTypeString( nInfoType ) ) );
-#endif
-
- /* cast here to make code below a little cleaner */
- SQLUSMALLINT * pnSQLUSMALLINT = (SQLUSMALLINT *)pInfoValue;
- SQLSMALLINT * pnSQLSMALLINT = (SQLSMALLINT *)pInfoValue;
- SQLUINTEGER * pnSQLUINTEGER = (SQLUINTEGER *)pInfoValue;
- SQLWCHAR * pszSQLWCHAR = (SQLWCHAR *)pInfoValue;
- /* pnStringLengthBytes is optional so provide dummy to make code below a little
cleaner */
- SQLSMALLINT nStringLengthBytes;
- SQLSMALLINT * pnStringLengthBytes = pnStringLengthBytesPtr;
- SQLINTEGER nStringLengthChars;
- BOOL bCopyOk;
-
/*!
- \internal ODBC RULE
-
- We clear diagnostic each time an ODBC API call is made (with exceptions).
- */
- pDiagnostic->doClear();
-
- /*!
- \internal ODBC RULE (DM)
-
- The value specified for argument BufferLength was less than 0.
- */
- if ( nBufferLength < 0 )
- MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_HY090 ) );
-
- /*!
- \internal ODBC RULE (DM)
-
- If *InfoValuePtr is a Unicode string (when calling SQLGetInfoW), the BufferLength
argument must be
- an even number; if not, SQLSTATE HY090 (Invalid string or buffer length) is
returned.
- */
- if ( nBufferLength % 2)
- MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_HY090 ) );
-
- /*!
\internal MYODBC RULE
- We DO NOT consider pInfoValue to be optional.
- */
- if ( !pInfoValue )
- MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_HY000, 0,
tr("buffer, to return value, must be provided") ) );
+ If we are called while we are connected - then we return the current database
accounting for
+ any "USE DATABASE" possibly submitted since we connected. Otherwise we just
return the
+ connection attribute.
- /*!
- \internal MYODBC RULE
-
- The following ODBC Rule makes pnStringLength optional.
+ We do NOT alter the connection attribute just because the current database has
been changed
+ by other means.
*/
- /*!
- \internal ODBC RULE
-
- For all other types (other than string) of data, the value of BufferLength is
ignored
- and the driver assumes the size of *InfoValuePtr is SQLUSMALLINT or SQLUINTEGER,
depending
- on the InfoType.
-
- \note
-
- The above rule is true for ODBC v3 and v2. However; testing for MS Access exposed
that the
- DM on XP really does care. The numeric sizes must be returned as well otherwise
pInfoValue
- is ignored.
- */
- if ( !pnStringLengthBytesPtr )
- pnStringLengthBytes = &nStringLengthBytes;
- *pnStringLengthBytes = sizeof(SQLUINTEGER);
-
- /*!
- \internal ODBC RULE (DM)
-
- The type of information requested in InfoType requires an open connection. Of the
- information types reserved by ODBC, only SQL_ODBC_VER can be returned without an
open
- connection.
- */
- if ( getState() < STATE_C4 && (nInfoType != SQL_ODBC_VER &&
nInfoType != SQL_DRIVER_ODBC_VER) )
- MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_08003 ) );
-
- /*!
- \internal
- \todo
-
- Much the values returned here are copied from the 3.51 driver with only a quick
check to
- see that they still make sense. So this function needs to be reviewed to ensure
that it
- is fully up-to-date. The large number of info-types to be handled has dictated
that this
- be done in more than one pass/effort.
- */
- /*!
- \internal
- \todo
-
- Some of the values in here are dependent upon the version of the server we are
using
- and possibly the client library. This needs to be handled.
- */
- /*!
- \internal
- \todo
-
- Some of the values in here are conservative in the exposure of features in the
driver as
- some features are not complete enough to be used. Subsequently; this function
will need
- to be revisited as features are added/completed.
- */
- /* ALPHA ordered list of posssible info types */
- switch ( nInfoType )
+ if ( getState() > STATE_C3_DATA )
{
- case SQL_ACCESSIBLE_PROCEDURES:
- bCopyOk = MYODBCC::doStringCopyOut( pszSQLWCHAR, nBufferLength /
sizeof(SQLWCHAR), getInfoAccessibleProcedures(), &nStringLengthChars );
- *pnStringLengthBytes = nStringLengthChars * sizeof(SQLWCHAR);
- if ( !bCopyOk )
- MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_01004 )
);
- break;
- case SQL_ACCESSIBLE_TABLES:
- bCopyOk = MYODBCC::doStringCopyOut( pszSQLWCHAR, nBufferLength /
sizeof(SQLWCHAR), getInfoAccessibleTables(), &nStringLengthChars );
- *pnStringLengthBytes = nStringLengthChars * sizeof(SQLWCHAR);
- if ( !bCopyOk )
- MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_01004 )
);
- break;
- case SQL_ACTIVE_ENVIRONMENTS:
- *pnSQLUSMALLINT = getInfoActiveEnvironments();
- *pnStringLengthBytes = sizeof(SQLUSMALLINT);
- break;
- case SQL_AGGREGATE_FUNCTIONS:
- *pnSQLUINTEGER = getInfoAggregateFunctions();
- break;
- case SQL_ALTER_DOMAIN:
- *pnSQLUINTEGER = getInfoAlterDomain();
- break;
- case SQL_ALTER_TABLE:
- *pnSQLUINTEGER = getInfoAlterTable();
- break;
- case SQL_ASYNC_MODE:
- *pnSQLUINTEGER = getInfoAsyncMode();
- break;
- case SQL_BATCH_ROW_COUNT:
- *pnSQLUINTEGER = getInfoBatchRowCount();
- break;
- case SQL_BATCH_SUPPORT:
- *pnSQLUINTEGER = getInfoBatchSupport();
- break;
- case SQL_BOOKMARK_PERSISTENCE:
- *pnSQLUINTEGER = getInfoBookmarkPersistence();
- break;
- case SQL_CATALOG_LOCATION:
- *pnSQLUSMALLINT = getInfoCatalogLocation();
- *pnStringLengthBytes = sizeof(SQLUSMALLINT);
- break;
- case SQL_CATALOG_NAME:
- bCopyOk = MYODBCC::doStringCopyOut( pszSQLWCHAR, nBufferLength /
sizeof(SQLWCHAR), getInfoCatalogName(), &nStringLengthChars );
- *pnStringLengthBytes = nStringLengthChars * sizeof(SQLWCHAR);
- if ( !bCopyOk )
- MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_01004 )
);
- break;
- case SQL_CATALOG_NAME_SEPARATOR:
- bCopyOk = MYODBCC::doStringCopyOut( pszSQLWCHAR, nBufferLength /
sizeof(SQLWCHAR), getInfoCatalogNameSeparator(), &nStringLengthChars );
- *pnStringLengthBytes = nStringLengthChars * sizeof(SQLWCHAR);
- if ( !bCopyOk )
- MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_01004 )
);
- break;
- case SQL_CATALOG_TERM:
- bCopyOk = MYODBCC::doStringCopyOut( pszSQLWCHAR, nBufferLength /
sizeof(SQLWCHAR), getInfoCatalogTerm(), &nStringLengthChars );
- *pnStringLengthBytes = nStringLengthChars * sizeof(SQLWCHAR);
- if ( !bCopyOk )
- MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_01004 )
);
- break;
- case SQL_CATALOG_USAGE:
- *pnSQLUINTEGER = getInfoCatalogUsage();
- break;
- case SQL_COLLATION_SEQ:
- bCopyOk = MYODBCC::doStringCopyOut( pszSQLWCHAR, nBufferLength /
sizeof(SQLWCHAR), getInfoCollationSeq(), &nStringLengthChars );
- *pnStringLengthBytes = nStringLengthChars * sizeof(SQLWCHAR);
- if ( !bCopyOk )
- MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_01004 )
);
- break;
- case SQL_COLUMN_ALIAS:
- bCopyOk = MYODBCC::doStringCopyOut( pszSQLWCHAR, nBufferLength /
sizeof(SQLWCHAR), getInfoColumnAlias(), &nStringLengthChars );
- *pnStringLengthBytes = nStringLengthChars * sizeof(SQLWCHAR);
- if ( !bCopyOk )
- MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_01004 )
);
- break;
- case SQL_CONCAT_NULL_BEHAVIOR:
- *pnSQLUSMALLINT = getInfoConcatNullBehavior();
- *pnStringLengthBytes = sizeof(SQLUSMALLINT);
- break;
- case SQL_CONVERT_BIGINT:
- *pnSQLUINTEGER = getInfoConvertBigint();
- break;
- case SQL_CONVERT_BINARY:
- *pnSQLUINTEGER = getInfoConvertBinary();
- break;
- case SQL_CONVERT_BIT:
- *pnSQLUINTEGER = getInfoConvertBit();
- break;
- case SQL_CONVERT_CHAR:
- *pnSQLUINTEGER = getInfoConvertChar();
- break;
-#ifdef SQL_CONVERT_GUID
- case SQL_CONVERT_GUID:
- *pnSQLUINTEGER = getInfoConvertGuid();
- break;
-#endif
- case SQL_CONVERT_DATE:
- *pnSQLUINTEGER = getInfoConvertDate();
- break;
- case SQL_CONVERT_DECIMAL:
- *pnSQLUINTEGER = getInfoConvertDecimal();
- break;
- case SQL_CONVERT_DOUBLE:
- *pnSQLUINTEGER = getInfoConvertDouble();
- break;
- case SQL_CONVERT_FLOAT:
- *pnSQLUINTEGER = getInfoConvertFloat();
- break;
- case SQL_CONVERT_INTEGER:
- *pnSQLUINTEGER = getInfoConvertInteger();
- break;
- case SQL_CONVERT_INTERVAL_YEAR_MONTH:
- *pnSQLUINTEGER = getInfoConvertIntervalYearMonth();
- break;
- case SQL_CONVERT_INTERVAL_DAY_TIME:
- *pnSQLUINTEGER = getInfoConvertIntervalDayTime();
- break;
- case SQL_CONVERT_LONGVARBINARY:
- *pnSQLUINTEGER = getInfoConvertLongvarbinary();
- break;
- case SQL_CONVERT_LONGVARCHAR:
- *pnSQLUINTEGER = getInfoConvertLongvarchar();
- break;
- case SQL_CONVERT_NUMERIC:
- *pnSQLUINTEGER = getInfoConvertNumeric();
- break;
- case SQL_CONVERT_REAL:
- *pnSQLUINTEGER = getInfoConvertReal();
- break;
- case SQL_CONVERT_SMALLINT:
- *pnSQLUINTEGER = getInfoConvertSmallint();
- break;
- case SQL_CONVERT_TIME:
- *pnSQLUINTEGER = getInfoConvertTime();
- break;
- case SQL_CONVERT_TIMESTAMP:
- *pnSQLUINTEGER = getInfoConvertTimestamp();
- break;
- case SQL_CONVERT_TINYINT:
- *pnSQLUINTEGER = getInfoConvertTinyint();
- break;
- case SQL_CONVERT_VARBINARY:
- *pnSQLUINTEGER = getInfoConvertVarbinary();
- break;
- case SQL_CONVERT_VARCHAR:
- *pnSQLUINTEGER = getInfoConvertVarchar();
- break;
- case SQL_CONVERT_FUNCTIONS:
- *pnSQLUINTEGER = getInfoConvertFunctions();
- break;
- case SQL_CORRELATION_NAME:
- *pnSQLUSMALLINT = getInfoCorrelationName();
- *pnStringLengthBytes = sizeof(SQLUSMALLINT);
- break;
- case SQL_CREATE_ASSERTION:
- *pnSQLUINTEGER = getInfoCreateAssertion();
- break;
- case SQL_CREATE_CHARACTER_SET:
- *pnSQLUINTEGER = getInfoCreateCharacterSet();
- break;
- case SQL_CREATE_COLLATION:
- *pnSQLUINTEGER = getInfoCreateCollation();
- break;
- case SQL_CREATE_DOMAIN:
- *pnSQLUINTEGER = getInfoCreateDomain();
- break;
- case SQL_CREATE_SCHEMA:
- *pnSQLUINTEGER = getInfoCreateSchema();
- break;
- case SQL_CREATE_TABLE:
- *pnSQLUINTEGER = getInfoCreateTable();
- break;
- case SQL_CREATE_TRANSLATION:
- *pnSQLUINTEGER = getInfoCreateTranslation();
- break;
- case SQL_CREATE_VIEW:
- *pnSQLUINTEGER = getInfoCreateView();
- break;
- case SQL_CURSOR_COMMIT_BEHAVIOR:
- *pnSQLUSMALLINT = getInfoCursorCommitBehavior();
- *pnStringLengthBytes = sizeof(SQLUSMALLINT);
- break;
- case SQL_CURSOR_ROLLBACK_BEHAVIOR:
- *pnSQLUSMALLINT = getInfoCursorRollbackBehavior();
- *pnStringLengthBytes = sizeof(SQLUSMALLINT);
- break;
- case SQL_CURSOR_SENSITIVITY:
- *pnSQLUINTEGER = getInfoCursorSensitivity();
- break;
- case SQL_DATA_SOURCE_NAME:
- bCopyOk = MYODBCC::doStringCopyOut( pszSQLWCHAR, nBufferLength /
sizeof(SQLWCHAR), getInfoDataSourceName(), &nStringLengthChars );
- *pnStringLengthBytes = nStringLengthChars * sizeof(SQLWCHAR);
- if ( !bCopyOk )
- MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_01004 )
);
- break;
- case SQL_DATA_SOURCE_READ_ONLY:
- bCopyOk = MYODBCC::doStringCopyOut( pszSQLWCHAR, nBufferLength /
sizeof(SQLWCHAR), getInfoDataSourceReadOnly(), &nStringLengthChars );
- *pnStringLengthBytes = nStringLengthChars * sizeof(SQLWCHAR);
- if ( !bCopyOk )
- MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_01004 )
);
- break;
- case SQL_DATABASE_NAME:
- bCopyOk = MYODBCC::doStringCopyOut( pszSQLWCHAR, nBufferLength /
sizeof(SQLWCHAR), getInfoDatabaseName(), &nStringLengthChars );
- *pnStringLengthBytes = nStringLengthChars * sizeof(SQLWCHAR);
- if ( !bCopyOk )
- MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_01004 )
);
- break;
- case SQL_DATETIME_LITERALS:
- *pnSQLUINTEGER = getInfoDatetimeLiterals();
- break;
- case SQL_DBMS_NAME:
- bCopyOk = MYODBCC::doStringCopyOut( pszSQLWCHAR, nBufferLength /
sizeof(SQLWCHAR), getInfoDbmsName(), &nStringLengthChars );
- *pnStringLengthBytes = nStringLengthChars * sizeof(SQLWCHAR);
- if ( !bCopyOk )
- MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_01004 )
);
- break;
- case SQL_DBMS_VER:
- bCopyOk = MYODBCC::doStringCopyOut( pszSQLWCHAR, nBufferLength /
sizeof(SQLWCHAR), getInfoDbmsVer(), &nStringLengthChars );
- *pnStringLengthBytes = nStringLengthChars * sizeof(SQLWCHAR);
- if ( !bCopyOk )
- MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_01004 )
);
- break;
- case SQL_DDL_INDEX:
- *pnSQLUINTEGER = getInfoDdlIndex();
- break;
- case SQL_DEFAULT_TXN_ISOLATION:
- *pnSQLUINTEGER = getInfoDefaultTxnIsolation();
- break;
- case SQL_DESCRIBE_PARAMETER:
- bCopyOk = MYODBCC::doStringCopyOut( pszSQLWCHAR, nBufferLength /
sizeof(SQLWCHAR), getInfoDescribeParameter(), &nStringLengthChars );
- *pnStringLengthBytes = nStringLengthChars * sizeof(SQLWCHAR);
- if ( !bCopyOk )
- MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_01004 )
);
- break;
- case SQL_DM_VER:
- bCopyOk = MYODBCC::doStringCopyOut( pszSQLWCHAR, nBufferLength /
sizeof(SQLWCHAR), getInfoDmVer(), &nStringLengthChars );
- *pnStringLengthBytes = nStringLengthChars * sizeof(SQLWCHAR);
- if ( !bCopyOk )
- MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_01004 )
);
- break;
- case SQL_DRIVER_HDBC:
- if ( !pInfoValue )
- MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_HY024 )
);
- *pnSQLUINTEGER = getInfoDriverHdbc();
- break;
- case SQL_DRIVER_HENV:
- if ( !pInfoValue )
- MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_HY024 )
);
- *pnSQLUINTEGER = getInfoDriverHenv();
- break;
- case SQL_DRIVER_HDESC:
- /*!
- \internal ODBC RULE (DM)
+ QString stringDatabase;
+ MYSQL * pMySQL = (MYSQL*)getMySQL();
- The InfoType argument was SQL_DRIVER_HDESC, and the value pointed to by
- InfoValuePtr was not a valid descriptor handle.
-
- \note
-
- We can not validate the handle type so we assume any non-null is valid.
- */
- if ( !pInfoValue )
- MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_HY024 )
);
-
- /*!
- \internal
- \note
-
- The request is to get the *drivers* descriptor handle for the given
*driver managers* descriptor
- handle.
-
- The only way we would get this request is if the app linked directly to
the driver - if there
- is no driver manager in the equation. With this in mind we must have been
passed our own
- descriptor handle so we just return success.
- */
- break;
- case SQL_DRIVER_HLIB:
- /*!
- \internal MYODBC Rule
-
- We are not, of course, a Driver Manager. However; applications may link
to
- us directly so lets handle this.
- */
- /*!
- \todo
-
- We can get this (see dll.c in 3.51 driver).
- */
- MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_HYC00 ) );
- break;
- case SQL_DRIVER_HSTMT:
- /*!
- \internal ODBC RULE (DM)
-
- The InfoType argument was SQL_DRIVER_HSTMT, and the value pointed to by
- InfoValuePtr was not a valid statement handle.
-
- \note
-
- We can not validate the handle type so we assume any non-null is valid.
- */
- if ( !pInfoValue )
- MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_HY024 )
);
-
- /*!
- \internal
- \note
-
- The request is to get the *drivers* statement handle for the given
*driver managers* statement
- handle.
-
- The only way we would get this request is if the app linked directly to
the driver - if there
- is no driver manager in the equation. With this in mind we must have been
passed our own
- descriptor handle so we just return success.
- */
- break;
- case SQL_DRIVER_NAME:
- bCopyOk = MYODBCC::doStringCopyOut( (SQLWCHAR*)pInfoValue, nBufferLength,
getInfoDriverName(), &nStringLengthChars );
- *pnStringLengthBytes = nStringLengthChars * sizeof(SQLWCHAR);
- if ( !bCopyOk )
- MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_01004 )
);
- break;
- case SQL_DRIVER_ODBC_VER:
- bCopyOk = MYODBCC::doStringCopyOut( pszSQLWCHAR, nBufferLength /
sizeof(SQLWCHAR), getInfoDriverOdbcVer(), &nStringLengthChars );
- *pnStringLengthBytes = nStringLengthChars * sizeof(SQLWCHAR);
- if ( !bCopyOk )
- MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_01004 )
);
- break;
- case SQL_DRIVER_VER:
- bCopyOk = MYODBCC::doStringCopyOut( (SQLWCHAR*)pInfoValue, nBufferLength,
getInfoDriverVer(), &nStringLengthChars );
- *pnStringLengthBytes = nStringLengthChars * sizeof(SQLWCHAR);
- if ( !bCopyOk )
- MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_01004 )
);
- break;
- case SQL_DROP_ASSERTION:
- *pnSQLUINTEGER = getInfoDropAssertion();
- break;
- case SQL_DROP_CHARACTER_SET:
- *pnSQLUINTEGER = getInfoDropCharacterSet();
- break;
- case SQL_DROP_COLLATION:
- *pnSQLUINTEGER = getInfoDropCollation();
- break;
- case SQL_DROP_DOMAIN:
- *pnSQLUINTEGER = getInfoDropDomain();
- break;
- case SQL_DROP_SCHEMA:
- *pnSQLUINTEGER = getInfoDropSchema();
- break;
- case SQL_DROP_TABLE:
- *pnSQLUINTEGER = getInfoDropTable();
- break;
- case SQL_DROP_TRANSLATION:
- *pnSQLUINTEGER = getInfoDropTranslation();
- break;
- case SQL_DROP_VIEW:
- *pnSQLUINTEGER = getInfoDropView();
- break;
- case SQL_DYNAMIC_CURSOR_ATTRIBUTES1:
- *pnSQLUINTEGER = getInfoDynamicCursorAttributes1();
- break;
- case SQL_DYNAMIC_CURSOR_ATTRIBUTES2:
- *pnSQLUINTEGER = getInfoDynamicCursorAttributes2();
- break;
- case SQL_EXPRESSIONS_IN_ORDERBY:
- bCopyOk = MYODBCC::doStringCopyOut( (SQLWCHAR*)pInfoValue, nBufferLength,
getInfoExpressionsInOrderby(), &nStringLengthChars );
- *pnStringLengthBytes = nStringLengthChars * sizeof(SQLWCHAR);
- if ( !bCopyOk )
- MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_01004 )
);
- break;
- case SQL_FILE_USAGE:
- *pnSQLUSMALLINT = getInfoFileUsage();
- *pnStringLengthBytes = sizeof(SQLUSMALLINT);
- break;
- case SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES1:
- *pnSQLUINTEGER = getInfoForwardOnlyCursorAttributes1();
- break;
- case SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES2:
- *pnSQLUINTEGER = getInfoForwardOnlyCursorAttributes2();
- break;
- case SQL_GETDATA_EXTENSIONS:
- *pnSQLUINTEGER = getInfoGetdataExtensions();
- break;
- case SQL_GROUP_BY:
- *pnSQLUSMALLINT = getInfoGroupBy();
- *pnStringLengthBytes = sizeof(SQLUSMALLINT);
- break;
- case SQL_IDENTIFIER_CASE:
- *pnSQLUSMALLINT = getInfoIdentifierCase();
- *pnStringLengthBytes = sizeof(SQLUSMALLINT);
- break;
- case SQL_IDENTIFIER_QUOTE_CHAR:
- bCopyOk = MYODBCC::doStringCopyOut( (SQLWCHAR*)pInfoValue, nBufferLength,
getInfoIdentifierQuoteChar(), &nStringLengthChars );
- *pnStringLengthBytes = nStringLengthChars * sizeof(SQLWCHAR);
- if ( !bCopyOk )
- MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_01004 )
);
- break;
- case SQL_INDEX_KEYWORDS:
- *pnSQLUINTEGER = getInfoIndexKeywords();
- break;
- case SQL_INFO_SCHEMA_VIEWS:
- *pnSQLUINTEGER = getInfoInfoSchemaViews();
- break;
- case SQL_INSERT_STATEMENT:
- *pnSQLUINTEGER = getInfoInsertStatement();
- break;
- case SQL_INTEGRITY:
- bCopyOk = MYODBCC::doStringCopyOut( (SQLWCHAR*)pInfoValue, nBufferLength,
getInfoIntegrity(), &nStringLengthChars );
- *pnStringLengthBytes = nStringLengthChars * sizeof(SQLWCHAR);
- if ( !bCopyOk )
- MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_01004 )
);
- break;
- case SQL_KEYSET_CURSOR_ATTRIBUTES1:
- *pnSQLUINTEGER = getInfoKeysetCursorAttributes1();
- break;
- case SQL_KEYSET_CURSOR_ATTRIBUTES2:
- *pnSQLUINTEGER = getInfoKeysetCursorAttributes2();
- break;
- case SQL_KEYWORDS:
- bCopyOk = MYODBCC::doStringCopyOut( (SQLWCHAR*)pInfoValue, nBufferLength,
getInfoKeywords(), &nStringLengthChars );
- *pnStringLengthBytes = nStringLengthChars * sizeof(SQLWCHAR);
- if ( !bCopyOk )
- MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_01004 )
);
- break;
- case SQL_LIKE_ESCAPE_CLAUSE:
- bCopyOk = MYODBCC::doStringCopyOut( (SQLWCHAR*)pInfoValue, nBufferLength,
getInfoLikeEscapeClause(), &nStringLengthChars );
- *pnStringLengthBytes = nStringLengthChars * sizeof(SQLWCHAR);
- if ( !bCopyOk )
- MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_01004 )
);
- break;
- case SQL_MAX_ASYNC_CONCURRENT_STATEMENTS:
- *pnSQLUINTEGER = getInfoMaxAsyncConcurrentStatements();
- break;
- case SQL_MAX_BINARY_LITERAL_LEN:
- *pnSQLUINTEGER = getInfoMaxBinaryLiteralLen();
- break;
- case SQL_MAX_CATALOG_NAME_LEN:
- *pnSQLUSMALLINT = getInfoMaxCatalogNameLen();
- *pnStringLengthBytes = sizeof(SQLUSMALLINT);
- break;
- case SQL_MAX_CHAR_LITERAL_LEN:
- *pnSQLUINTEGER = getInfoMaxCharLiteralLen();
- break;
- case SQL_MAX_COLUMN_NAME_LEN:
- *pnSQLUSMALLINT = getInfoMaxColumnNameLen();
- *pnStringLengthBytes = sizeof(SQLUSMALLINT);
- break;
- case SQL_MAX_COLUMNS_IN_GROUP_BY:
- *pnSQLUSMALLINT = getInfoMaxColumnsInGroupBy();
- *pnStringLengthBytes = sizeof(SQLUSMALLINT);
- break;
- case SQL_MAX_COLUMNS_IN_INDEX:
- *pnSQLUSMALLINT = getInfoMaxColumnsInIndex();
- *pnStringLengthBytes = sizeof(SQLUSMALLINT);
- break;
- case SQL_MAX_COLUMNS_IN_ORDER_BY:
- *pnSQLUSMALLINT = getInfoMaxColumnsInOrderBy();
- *pnStringLengthBytes = sizeof(SQLUSMALLINT);
- break;
- case SQL_MAX_COLUMNS_IN_SELECT:
- *pnSQLUSMALLINT = getInfoMaxColumnsInSelect();
- *pnStringLengthBytes = sizeof(SQLUSMALLINT);
- break;
- case SQL_MAX_COLUMNS_IN_TABLE:
- *pnSQLUSMALLINT = getInfoMaxColumnsInTable();
- *pnStringLengthBytes = sizeof(SQLUSMALLINT);
- break;
- case SQL_MAX_CONCURRENT_ACTIVITIES:
- *pnSQLUSMALLINT = getInfoMaxConcurrentActivities();
- *pnStringLengthBytes = sizeof(SQLUSMALLINT);
- break;
- case SQL_MAX_CURSOR_NAME_LEN:
- *pnSQLUSMALLINT = getInfoMaxCursorNameLen();
- *pnStringLengthBytes = sizeof(SQLUSMALLINT);
- break;
- case SQL_MAX_DRIVER_CONNECTIONS:
- *pnSQLUSMALLINT = getInfoMaxDriverConnections();
- *pnStringLengthBytes = sizeof(SQLUSMALLINT);
- break;
- case SQL_MAX_IDENTIFIER_LEN:
- *pnSQLUSMALLINT = getInfoMaxIdentifierLen();
- *pnStringLengthBytes = sizeof(SQLUSMALLINT);
- break;
- case SQL_MAX_INDEX_SIZE:
- *pnSQLUINTEGER = getInfoMaxIndexSize();
- break;
- case SQL_MAX_PROCEDURE_NAME_LEN:
- *pnSQLUSMALLINT = getInfoMaxProcedureNameLen();
- *pnStringLengthBytes = sizeof(SQLUSMALLINT);
- break;
- case SQL_MAX_ROW_SIZE:
- *pnSQLUINTEGER = getInfoMaxRowSize();
- break;
- case SQL_MAX_ROW_SIZE_INCLUDES_LONG:
- bCopyOk = MYODBCC::doStringCopyOut( (SQLWCHAR*)pInfoValue, nBufferLength,
getInfoMaxRowSizeIncludesLong(), &nStringLengthChars );
- *pnStringLengthBytes = nStringLengthChars * sizeof(SQLWCHAR);
- if ( !bCopyOk )
- MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_01004 )
);
- break;
- case SQL_MAX_SCHEMA_NAME_LEN:
- *pnSQLUSMALLINT = getInfoMaxSchemaNameLen();
- *pnStringLengthBytes = sizeof(SQLUSMALLINT);
- break;
- case SQL_MAX_STATEMENT_LEN:
- *pnSQLUINTEGER = getInfoMaxStatementLen();
- break;
- case SQL_MAX_TABLE_NAME_LEN:
- *pnSQLUSMALLINT = getInfoMaxTableNameLen();
- *pnStringLengthBytes = sizeof(SQLUSMALLINT);
- break;
- case SQL_MAX_TABLES_IN_SELECT:
- *pnSQLUSMALLINT = getInfoMaxTablesInSelect();
- *pnStringLengthBytes = sizeof(SQLUSMALLINT);
- break;
- case SQL_MAX_USER_NAME_LEN:
- *pnSQLUSMALLINT = getInfoMaxUserNameLen();
- *pnStringLengthBytes = sizeof(SQLUSMALLINT);
- break;
- case SQL_MULT_RESULT_SETS:
- bCopyOk = MYODBCC::doStringCopyOut( (SQLWCHAR*)pInfoValue, nBufferLength,
getInfoMultiResultSets(), &nStringLengthChars );
- *pnStringLengthBytes = nStringLengthChars * sizeof(SQLWCHAR);
- if ( !bCopyOk )
- MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_01004 )
);
- break;
- case SQL_MULTIPLE_ACTIVE_TXN:
- bCopyOk = MYODBCC::doStringCopyOut( (SQLWCHAR*)pInfoValue, nBufferLength,
getInfoMultipleActiveTxn(), &nStringLengthChars );
- *pnStringLengthBytes = nStringLengthChars * sizeof(SQLWCHAR);
- if ( !bCopyOk )
- MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_01004 )
);
- break;
- case SQL_NEED_LONG_DATA_LEN:
- bCopyOk = MYODBCC::doStringCopyOut( (SQLWCHAR*)pInfoValue, nBufferLength,
getInfoNeedLongDataLen(), &nStringLengthChars );
- *pnStringLengthBytes = nStringLengthChars * sizeof(SQLWCHAR);
- if ( !bCopyOk )
- MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_01004 )
);
- break;
- case SQL_NON_NULLABLE_COLUMNS:
- *pnSQLUSMALLINT = getInfoNonNullableColumns();
- *pnStringLengthBytes = sizeof(SQLUSMALLINT);
- break;
- case SQL_NULL_COLLATION:
- *pnSQLUSMALLINT = getInfoNullCollation();
- *pnStringLengthBytes = sizeof(SQLUSMALLINT);
- break;
- case SQL_NUMERIC_FUNCTIONS:
- *pnSQLUINTEGER = getInfoNumericFunctions();
- break;
- case SQL_ODBC_INTERFACE_CONFORMANCE:
- *pnSQLUINTEGER = getInfoOdbcInterfaceConformance();
- break;
- case SQL_ODBC_VER:
- bCopyOk = MYODBCC::doStringCopyOut( pszSQLWCHAR, nBufferLength /
sizeof(SQLWCHAR), getInfoOdbcVer(), &nStringLengthChars );
- *pnStringLengthBytes = nStringLengthChars * sizeof(SQLWCHAR);
- if ( !bCopyOk )
- MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_01004 )
);
- break;
- case SQL_OJ_CAPABILITIES:
- *pnSQLUINTEGER = getInfoOjCapabilities();
- break;
- case SQL_ORDER_BY_COLUMNS_IN_SELECT:
- bCopyOk = MYODBCC::doStringCopyOut( pszSQLWCHAR, nBufferLength /
sizeof(SQLWCHAR), getInfoOrderByColumnsInSelect(), &nStringLengthChars );
- *pnStringLengthBytes = nStringLengthChars * sizeof(SQLWCHAR);
- if ( !bCopyOk )
- MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_01004 )
);
- break;
- case SQL_PARAM_ARRAY_ROW_COUNTS:
- *pnSQLUINTEGER = getInfoParamArrayRowCounts();
- break;
- case SQL_PARAM_ARRAY_SELECTS:
- *pnSQLUINTEGER = getInfoParamArraySelects();
- break;
- case SQL_PROCEDURE_TERM:
- bCopyOk = MYODBCC::doStringCopyOut( pszSQLWCHAR, nBufferLength /
sizeof(SQLWCHAR), getInfoProcedureTerm() , &nStringLengthChars );
- *pnStringLengthBytes = nStringLengthChars * sizeof(SQLWCHAR);
- if ( !bCopyOk )
- MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_01004 )
);
- break;
- case SQL_PROCEDURES:
- bCopyOk = MYODBCC::doStringCopyOut( pszSQLWCHAR, nBufferLength /
sizeof(SQLWCHAR), getInfoProcedures(), &nStringLengthChars );
- *pnStringLengthBytes = nStringLengthChars * sizeof(SQLWCHAR);
- if ( !bCopyOk )
- MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_01004 )
);
- break;
- case SQL_QUOTED_IDENTIFIER_CASE:
- *pnSQLUSMALLINT = getInfoQuotedIdentifierCase();
- *pnStringLengthBytes = sizeof(SQLUSMALLINT);
- break;
- case SQL_ROW_UPDATES:
- bCopyOk = MYODBCC::doStringCopyOut( pszSQLWCHAR, nBufferLength /
sizeof(SQLWCHAR), getInfoRowUpdates(), &nStringLengthChars );
- *pnStringLengthBytes = nStringLengthChars * sizeof(SQLWCHAR);
- if ( !bCopyOk )
- MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_01004 )
);
- break;
- case SQL_SCHEMA_TERM:
- bCopyOk = MYODBCC::doStringCopyOut( pszSQLWCHAR, nBufferLength /
sizeof(SQLWCHAR), getInfoSchemaTerm(), &nStringLengthChars );
- *pnStringLengthBytes = nStringLengthChars * sizeof(SQLWCHAR);
- if ( !bCopyOk )
- MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_01004 )
);
- break;
- case SQL_SCHEMA_USAGE:
- *pnSQLUINTEGER = getInfoSchemaUsage();
- break;
- case SQL_SCROLL_OPTIONS:
- *pnSQLUINTEGER = getInfoScrollOptions();
- break;
- case SQL_SEARCH_PATTERN_ESCAPE:
- bCopyOk = MYODBCC::doStringCopyOut( pszSQLWCHAR, nBufferLength /
sizeof(SQLWCHAR), getInfoSearchPatternEscape(), &nStringLengthChars );
- *pnStringLengthBytes = nStringLengthChars * sizeof(SQLWCHAR);
- if ( !bCopyOk )
- MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_01004 )
);
- break;
- case SQL_SERVER_NAME:
- bCopyOk = MYODBCC::doStringCopyOut( pszSQLWCHAR, nBufferLength /
sizeof(SQLWCHAR), getInfoServerName(), &nStringLengthChars );
- *pnStringLengthBytes = nStringLengthChars * sizeof(SQLWCHAR);
- if ( !bCopyOk )
- MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_01004 )
);
- break;
- case SQL_SPECIAL_CHARACTERS:
- bCopyOk = MYODBCC::doStringCopyOut( pszSQLWCHAR, nBufferLength /
sizeof(SQLWCHAR), getInfoSpecialCharacters(), &nStringLengthChars );
- *pnStringLengthBytes = nStringLengthChars * sizeof(SQLWCHAR);
- if ( !bCopyOk )
- MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_01004 )
);
- break;
- case SQL_SQL_CONFORMANCE:
- *pnSQLUINTEGER = getInfoSqlConformance();
- break;
- case SQL_SQL92_DATETIME_FUNCTIONS:
- *pnSQLUINTEGER = getInfoSql92DatetimeFunctions();
- break;
- case SQL_SQL92_FOREIGN_KEY_DELETE_RULE:
- *pnSQLUINTEGER = getInfoSql92ForeignKeyDeleteRule();
- break;
- case SQL_SQL92_FOREIGN_KEY_UPDATE_RULE:
- *pnSQLUINTEGER = getInfoSql92ForeignKeyUpdateRule();
- break;
- case SQL_SQL92_GRANT:
- *pnSQLUINTEGER = getInfoSql92Grant();
- break;
- case SQL_SQL92_NUMERIC_VALUE_FUNCTIONS:
- *pnSQLUINTEGER = getInfoSql92NumericValueFunctions();
- break;
- case SQL_SQL92_PREDICATES:
- *pnSQLUINTEGER = getInfoSql92Predicates();
- break;
- case SQL_SQL92_RELATIONAL_JOIN_OPERATORS:
- *pnSQLUINTEGER = getInfoSql92RelationalJoinOperations();
- break;
- case SQL_SQL92_REVOKE:
- *pnSQLUINTEGER = getInfoSql92Revoke();
- break;
- case SQL_SQL92_ROW_VALUE_CONSTRUCTOR:
- *pnSQLUINTEGER = getInfoSql92RowValueConstructor();
- break;
- case SQL_SQL92_STRING_FUNCTIONS:
- *pnSQLUINTEGER = getInfoSql92StringFunctions();
- break;
- case SQL_SQL92_VALUE_EXPRESSIONS:
- *pnSQLUINTEGER = getInfoSql92ValueExpressins();
- break;
- case SQL_STANDARD_CLI_CONFORMANCE:
- *pnSQLUINTEGER = getInfoStandardCliConformance();
- break;
- case SQL_STATIC_CURSOR_ATTRIBUTES1:
- *pnSQLUINTEGER = getInfoStaticCursorAttributes1();
- break;
- case SQL_STATIC_CURSOR_ATTRIBUTES2:
- *pnSQLUINTEGER = getInfoStaticCursorAttributes2();
- break;
- case SQL_STRING_FUNCTIONS:
- *pnSQLUINTEGER = getInfoStringFunctions();
- break;
- case SQL_SUBQUERIES:
- *pnSQLUINTEGER = getInfoSubqueries();
- break;
- case SQL_SYSTEM_FUNCTIONS:
- *pnSQLUINTEGER = getInfoSystemFunctions();
- break;
- case SQL_TABLE_TERM:
- bCopyOk = MYODBCC::doStringCopyOut( pszSQLWCHAR, nBufferLength /
sizeof(SQLWCHAR), getInfoTableTerm(), &nStringLengthChars );
- *pnStringLengthBytes = nStringLengthChars * sizeof(SQLWCHAR);
- if ( !bCopyOk )
- MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_01004 )
);
- break;
- case SQL_TIMEDATE_ADD_INTERVALS:
- *pnSQLUINTEGER = getInfoTimedateAddIntervals();
- break;
- case SQL_TIMEDATE_DIFF_INTERVALS:
- *pnSQLUINTEGER = getInfoTimedateDiffIntervals();
- break;
- case SQL_TIMEDATE_FUNCTIONS:
- *pnSQLUINTEGER = getInfoTimedateFunctions();
- break;
- case SQL_TXN_CAPABLE:
- *pnSQLUSMALLINT = getInfoTxnCapable();
- *pnStringLengthBytes = sizeof(SQLUSMALLINT);
- break;
- case SQL_TXN_ISOLATION_OPTION:
- *pnSQLUINTEGER = getInfoTxnIsolationOption();
- break;
- case SQL_UNION:
- *pnSQLUINTEGER = getInfoUnion();
- break;
- case SQL_USER_NAME:
- bCopyOk = MYODBCC::doStringCopyOut( pszSQLWCHAR, nBufferLength /
sizeof(SQLWCHAR), getInfoUserName(), &nStringLengthChars );
- *pnStringLengthBytes = nStringLengthChars * sizeof(SQLWCHAR);
- if ( !bCopyOk )
- MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_01004 )
);
- break;
- case SQL_XOPEN_CLI_YEAR:
- bCopyOk = MYODBCC::doStringCopyOut( pszSQLWCHAR, nBufferLength /
sizeof(SQLWCHAR), getInfoXopenCliYear(), &nStringLengthChars );
- *pnStringLengthBytes = nStringLengthChars * sizeof(SQLWCHAR);
- if ( !bCopyOk )
- MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_01004 )
);
- break;
- default:
- if ( getEnvironment()->getODBCVersion() == SQL_OV_ODBC2 )
+ if ( !mysql_query( pMySQL, "SELECT database()" ) )
+ {
+ MYSQL_RES *pResult = mysql_use_result( pMySQL );
+ if ( pResult )
{
- /*!
- \internal
- \note
+ MYSQL_ROW pRow = mysql_fetch_row( pResult );
+ if ( pRow && pRow[0] )
+ stringDatabase = pRow[0];
- ODBC v3 spec. says that this func only returns; strings, SQLUINTEGER
or SQLUSMALLINT. However; these come from
- the ODBC v2 spec. and there it says (for example)
SQL_ODBC_SQL_CONFORMANCE is a 16 bit numeric - SQLSMALLINT
- in old MS code. We choose to obey ODBC v3 spec. by upsizing the
numerics.
- */
- switch ( nInfoType )
- {
- case SQL_FETCH_DIRECTION:
- *pnSQLUINTEGER = getInfoFetchDirection();
- break;
- case SQL_LOCK_TYPES:
- *pnSQLUINTEGER = getInfoLockTypes();
- break;
- case SQL_ODBC_API_CONFORMANCE:
- *pnSQLSMALLINT = getInfoOdbcApiConformance();
- *pnStringLengthBytes = sizeof(SQLUSMALLINT);
- break;
- case SQL_ODBC_SQL_CONFORMANCE:
- *pnSQLSMALLINT = getInfoOdbcSqlConformance();
- *pnStringLengthBytes = sizeof(SQLUSMALLINT);
- break;
- case SQL_POS_OPERATIONS:
- *pnSQLUINTEGER = getInfoPosOperations();
- break;
- case SQL_POSITIONED_STATEMENTS:
- *pnSQLUINTEGER = getInfoPositionedStatements();
- break;
- case SQL_SCROLL_CONCURRENCY:
- *pnSQLUINTEGER = getInfoScrollConcurrency();
- break;
- case SQL_STATIC_SENSITIVITY:
- *pnSQLUINTEGER = getInfoStaticSensitivity();
- break;
- default:
- MYODBCDbgReturn( getDiagnostic()->doAppend(
MDiagnostic::STATE_HYC00 ) );
- }
+ mysql_free_result( pResult );
}
else
- MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_HYC00 )
);
+ getDiagnostic()->doAppend( MDiagnostic::STATE_HY000, mysql_errno(
pMySQL ), mysql_error( pMySQL ) );
+ }
+ else
+ getDiagnostic()->doAppend( MDiagnostic::STATE_HY000, mysql_errno( pMySQL
), mysql_error( pMySQL ) );
+
+ if ( !stringDatabase.isEmpty() )
+ MYODBCDbgReturn1( stringDatabase );
}
- MYODBCDbgReturn( SQL_SUCCESS );
+ MYODBCDbgReturn1( stringCurrentCatalog );
}
-MConnection::STATE MConnection::getState()
+SQLRETURN MConnection::setCurrentCatalog( QString stringCurrentCatalog )
{
MYODBCDbgEnter();
- /* Its possible our state has changed but we do not know it yet so... */
- if ( nState == STATE_C4 )
+// if ( stringCurrentCatalog.isEmpty() )
+// MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_HY090, 0,
tr("Missing database name.") ) );
+
+ /* are we connected? */
+ if ( getState() > STATE_C3_DATA )
{
- if ( !MYODBCC::getChildren( this, "MStatement" ).isEmpty() )
- setState( STATE_C5 );
- }
- else if ( nState == STATE_C5 )
- {
- if ( MYODBCC::getChildren( this, "MStatement" ).isEmpty() )
- setState( STATE_C4 );
- }
+ /*!
+ \internal ODBC Rule
- /*!
- \internal ODBC RULE
+ The Attribute argument was SQL_ATTR_CURRENT_CATALOG, and a result
+ set was pending.
+ */
+ /* do we have statement which is prepared (or better)? */
+ if ( isStatementActive() )
+ MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_24000 ) );
- It is possible for a connection to be in state C6 with no statements allocated on
the
- connection. For example, suppose the connection is in manual commit mode and is
in
- state C4. If a statement is allocated, executed (starting a transaction), and
then
- freed, the transaction remains active but there are no statements on the
connection.
- */
- /*!
- \internal MYODBC RULE
- \todo
+ /* try to switch databases */
+ if ( mysql_select_db( (MYSQL*)getMySQL(), stringCurrentCatalog.toUtf8().data() )
)
+ MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_3D000,
mysql_errno( (MYSQL*)getMySQL() ), mysql_error( (MYSQL*)getMySQL() ) ) );
+ }
- What the server tells us about a transaction has precedence over what we may
think?
+ this->stringCurrentCatalog = stringCurrentCatalog;
- \sa SERVER_STATUS_IN_TRANS
- */
-
- MYODBCDbgReturn3( "%d", nState );
+ MYODBCDbgReturn( SQL_SUCCESS );
}
-MConnection::STATEMENT_TYPE MConnection::getStatementType()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn3( "%d", nStatementType );
-}
-
-MConnection::BUFFERED_TYPE MConnection::getBufferedType()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn3( "%d", nBufferedType );
-}
-
-SQLHANDLE MConnection::getMySQL()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn3( "%p", pMySQL );
-}
-
-QStringList MConnection::getDiagnostics()
-{
- MYODBCDbgEnter();
- QStringList stringlist = pDiagnostic->getDiagnostics();
- MYODBCDbgReturn3( "%p", stringlist );
-}
-
-MStatement *MConnection::getStatementWithCursor( const QString &stringCursorName )
-{
- MYODBCDbgEnter();
-
- QList<QObject*> listObjects;
- QListIterator<QObject*> i( (QList<QObject*>)children() );
-
- while ( i.hasNext() )
- {
- QObject *pObject = i.next();
- if ( pObject->objectName() == "MStatement" )
- {
- MStatement *pStatement = (MStatement*)pObject;
- if ( pStatement->getCursorName() == stringCursorName )
- MYODBCDbgReturn3( "%p", pStatement );
- }
- }
-
- MYODBCDbgReturn3( "%p", NULL );
-}
-
SQLRETURN MConnection::doDiagnosticClear()
{
MYODBCDbgEnter();
@@ -1717,7 +594,7 @@
We will return an error if pnStringLength2Ptr is not provided and we get a
truncation as it is
likely that the caller will catch the truncation (it would have to get our
state info to see
- that we are, in fact, still wanting more data - STATE_C3).
+ that we are, in fact, still wanting more data - STATE_C3_DATA).
*/
SQLRETURN nReturn = SQL_NEED_DATA;
@@ -1732,7 +609,7 @@
}
/* we want more data - regardless of the return value */
- setState( STATE_C3 );
+ setState( STATE_C3_DATA );
MYODBCDbgReturn( nReturn );
}
@@ -1777,7 +654,7 @@
Normally a DM thing but we also handle here for case when app linked
directly to driver.
*/
- if ( getState() != STATE_C2 )
+ if ( getState() != STATE_C2_ALLOC )
MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_08002 ) );
/*!
@@ -1909,7 +786,7 @@
Normally a DM thing but we also handle here for case when app linked
directly to driver.
*/
- if ( getState() != STATE_C2 )
+ if ( getState() != STATE_C2_ALLOC )
MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_08002 ) );
/* do it */
@@ -2023,7 +900,7 @@
setDataSourceName( QString::null );
setUserIdentifier( QString::null );
- setState( STATE_C2 );
+ setState( STATE_C2_ALLOC );
setCurrentCatalog( QString::null ); /* !!! we must do this after the state has been
changed */
MYODBCDbgReturn( SQL_SUCCESS );
@@ -2061,7 +938,7 @@
Normally a DM thing but we also handle here for case when app linked
directly to driver.
*/
- if ( getState() != STATE_C2 )
+ if ( getState() != STATE_C2_ALLOC )
MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_08002 ) );
/*!
@@ -2520,2768 +1397,6 @@
MYODBCDbgReturn( nReturn );
}
-/*!
- \brief Set the diagnostic to be used by this descriptor.
-
- This is used to temp. replace the default diagnostic. This is sometimes
needed
- to redirect the diagnostic messages to the callers diagnostic.
-
- \note This should be reset to default diagnostic as soon as possible. The caller
- must do this when done.
-
- \param pDiagnostic The diagnostic handle we should send diagnostic information to.
This
- should be NULL to reset the diagnostic to the default.
-
- \return BOOL
-
- \sa getDiagnostic
-*/
-BOOL MConnection::setDiagnostic( MDiagnostic *pDiagnostic )
-{
- MYODBCDbgEnter();
-
- pDiagnosticCaller = pDiagnostic;
-
- MYODBCDbgReturn3( "%d", true );
-}
-
-BOOL MConnection::setState( STATE nState )
-{
- MYODBCDbgEnter();
-
- this->nState = nState;
-
- MYODBCDbgReturn3( "%d", true );
-}
-
-BOOL MConnection::setServerAliveSanityCheckInterval( int nMilliseconds )
-{
- MYODBCDbgEnter();
-
- nServerAliveSanityCheckInterval = nMilliseconds;
-
- MYODBCDbgReturn3( "%d", true );
-}
-
-BOOL MConnection::setDataSourceName( const QString &stringDataSourceName )
-{
- MYODBCDbgEnter();
-
- this->stringDataSourceName = stringDataSourceName;
-
- MYODBCDbgReturn3( "%d", true );
-}
-
-BOOL MConnection::setUserIdentifier( const QString &stringUserIdentifier )
-{
- MYODBCDbgEnter();
-
- this->stringUserIdentifier = stringUserIdentifier;
-
- MYODBCDbgReturn3( "%d", true );
-}
-
-SQLRETURN MConnection::setAccessMode( SQLUINTEGER nAccessMode )
-{
- MYODBCDbgEnter();
-
- switch ( nAccessMode )
- {
- case SQL_MODE_READ_ONLY:
- case SQL_MODE_READ_WRITE:
- break;
- default:
- MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_HY092B ) );
- }
-
- this->nAccessMode = nAccessMode;
-
- MYODBCDbgReturn( SQL_SUCCESS );
-}
-
-SQLRETURN MConnection::setStmtOption( SQLINTEGER nAttribute, SQLPOINTER pValue,
SQLINTEGER nStringLength )
-{
- MYODBCDbgEnter();
-
- BOOL 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();
-
- /*!
- \internal ODBC RULE
-
- Drivers that operate only on multithread operating systems do not need
- to support asynchronous execution.
- */
- /*!
- \internal MYODBC RULE
-
- We dot not support asynch.
- */
- switch ( nAsyncEnable )
- {
- case SQL_ASYNC_ENABLE_OFF:
- break;
- case SQL_ASYNC_ENABLE_ON:
- MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_HYC00 ) );
- default:
- MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_HY092B ) );
- }
-
- /*!
- \internal MYODBC RULE
-
- We dot not support asynch operations.
- */
- MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_HYC00 ) );
-}
-
-SQLRETURN MConnection::setAutocommit( SQLUINTEGER nAutocommit )
-{
- MYODBCDbgEnter();
-
- switch ( nAutocommit )
- {
- case SQL_AUTOCOMMIT_ON:
- if ( getState() >= STATE_C4 )
- {
- if ( getInfoTxnCapable() == SQL_TC_NONE )
- MYODBCDbgReturn( getDiagnostic()->doAppend(
MDiagnostic::STATE_HYC00, 0, tr("Server does not support transactions.") ) );
-
- if ( !SQL_SUCCEEDED( doSubmitCommand( "SET AUTOCOMMIT=1" ) ) )
- MYODBCDbgReturn( getDiagnostic()->doAppend(
MDiagnostic::STATE_HY000 ) );
- }
- break;
-
- case SQL_AUTOCOMMIT_OFF:
- if ( getState() >= STATE_C4 )
- {
- if ( !SQL_SUCCEEDED( doSubmitCommand( "SET AUTOCOMMIT=0" ) ) )
- MYODBCDbgReturn( getDiagnostic()->doAppend(
MDiagnostic::STATE_HY000 ) );
- }
- break;
-
- default:
- MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_HY092B ) );
- }
-
- this->nAutocommit = nAutocommit;
-
- MYODBCDbgReturn( SQL_SUCCESS );
-}
-
-SQLRETURN MConnection::setConnectionTimeout( SQLUINTEGER nConnectionTimeout )
-{
- MYODBCDbgEnter();
-
- /*!
- \internal MYODBC RULE
-
- Value mst be sane so limit to 120 seconds max.
- */
- if ( nConnectionTimeout > 120 )
- {
- this->nConnectionTimeout = 120;
- MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_01S02 ) );
- }
-
- this->nConnectionTimeout = nConnectionTimeout;
-
- MYODBCDbgReturn( SQL_SUCCESS );
-}
-
-SQLRETURN MConnection::setCurrentCatalog( QString stringCurrentCatalog )
-{
- MYODBCDbgEnter();
-
-// if ( stringCurrentCatalog.isEmpty() )
-// MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_HY090, 0,
tr("Missing database name.") ) );
-
- /* are we connected? */
- if ( getState() > STATE_C3 )
- {
- /*!
- \internal ODBC Rule
-
- The Attribute argument was SQL_ATTR_CURRENT_CATALOG, and a result
- set was pending.
- */
- /* do we have statement which is prepared (or better)? */
- if ( isStatementActive() )
- MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_24000 ) );
-
- /* try to switch databases */
- if ( mysql_select_db( (MYSQL*)getMySQL(), stringCurrentCatalog.toUtf8().data() )
)
- MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_3D000,
mysql_errno( (MYSQL*)getMySQL() ), mysql_error( (MYSQL*)getMySQL() ) ) );
- }
-
- this->stringCurrentCatalog = stringCurrentCatalog;
-
- MYODBCDbgReturn( SQL_SUCCESS );
-}
-
-SQLRETURN MConnection::setLoginTimeout( SQLUINTEGER nLoginTimeout )
-{
- MYODBCDbgEnter();
-
- /*!
- \internal
- \note This will get used during a connect - it is not applied now.
- */
- this->nLoginTimeout = nLoginTimeout;
-
- MYODBCDbgReturn( SQL_SUCCESS );
-}
-
-SQLRETURN MConnection::setMetadataID( SQLUINTEGER nMetadataID )
-{
- MYODBCDbgEnter();
-
- switch ( nMetadataID )
- {
- case SQL_TRUE:
- case SQL_FALSE:
- break;
- default:
- MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_HY092B ) );
- }
-
- this->nMetadataID = nMetadataID;
-
- MYODBCDbgReturn( SQL_SUCCESS );
-}
-
-SQLRETURN MConnection::setODBCCursors( SQLUINTEGER nODBCCursors )
-{
- MYODBCDbgEnter();
-
- /*!
- \internal ODBC Rule
-
- The Attribute argument was SQL_ATTR_ODBC_CURSORS, and the
- driver was already connected to the data source.
- */
- if ( getState() >= STATE_C4 )
- MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_08002 ) );
-
- /*!
- \internal MYODBC RULE
-
- Try to support DM attributes in case app is linked directly to us.
- */
- switch ( nODBCCursors )
- {
- case SQL_CUR_USE_IF_NEEDED:
- case SQL_CUR_USE_ODBC:
- MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_HYC00 ) );
- case SQL_CUR_USE_DRIVER:
- break;
- default:
- MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_HY092B ) );
- }
-
- this->nODBCCursors = nODBCCursors;
-
- MYODBCDbgReturn( SQL_SUCCESS );
-}
-
-SQLRETURN MConnection::setPacketSize( SQLUINTEGER nPacketSize )
-{
- MYODBCDbgEnter();
-
- /*!
- \internal ODBC RULE
-
- If the application sets packet size after a connection has already been
- made, the driver will return SQLSTATE HY011 (Attribute cannot be set now).
- */
- if ( getState() > STATE_C3 )
- MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_HY011 ) );
-
- /*!
- \internal
- \todo We can probably make use of this.
- */
- MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_HYC00 ) );
-
- this->nPacketSize = nPacketSize;
-
- MYODBCDbgReturn( SQL_SUCCESS );
-}
-
-SQLRETURN MConnection::setQuietMode( HWND hQuietMode )
-{
- MYODBCDbgEnter();
-
- /*!
- \internal
- \note We do not use this.
- */
- this->hQuietMode = hQuietMode;
-
- MYODBCDbgReturn( SQL_SUCCESS );
-}
-
-SQLRETURN MConnection::setTrace( SQLUINTEGER nTrace )
-{
- MYODBCDbgEnter();
-
- /*!
- \internal MYODBC RULE
-
- Try to support DM attributes in case app is linked directly to us.
- */
-
- /*!
- \internal
- \todo make use of this
- */
-
- switch ( nTrace )
- {
- case SQL_OPT_TRACE_OFF:
- break;
- case SQL_OPT_TRACE_ON:
- MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_HYC00 ) );
- default:
- MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_HY092B ) );
- }
-
- this->nTrace = nTrace;
-
- MYODBCDbgReturn( SQL_SUCCESS );
-}
-
-SQLRETURN MConnection::setTracefile( QString stringTracefile )
-{
- MYODBCDbgEnter();
-
- /*!
- \internal MYODBC RULE
-
- Try to support DM attributes in case app is linked directly to us.
- */
-
- /*!
- \internal
- \todo make use of this
- */
- this->stringTracefile = stringTracefile;
-
- MYODBCDbgReturn( SQL_SUCCESS );
-}
-
-SQLRETURN MConnection::setTranslateLib( QString stringTranslateLib )
-{
- MYODBCDbgEnter();
-
- /*!
- \internal MYODBC RULE
-
- We dot not support the following ODBC RULE;
-
- "The setting of this attribute will persist across connections."
- */
-
- /*!
- \internal ODBC RULE
-
- This attribute can be specified only if the driver has connected
- to the data source.
- */
- if ( !isConnected() )
- MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_HY011 ) );
-
- /*!
- \internal
- \todo support translation library
- */
- this->stringTranslateLib = stringTranslateLib;
-
- MYODBCDbgReturn( SQL_SUCCESS );
-}
-
-SQLRETURN MConnection::setTranslateOption( qint32 nTranslateOption )
-{
- MYODBCDbgEnter();
-
- /*!
- \internal ODBC RULE
-
- This attribute can be specified only if the driver has connected
- to the data source.
- */
- if ( !isConnected() )
- MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_HY011 ) );
-
- /*!
- \internal
- \todo support translation library
- */
- this->nTranslateOption = nTranslateOption;
-
- MYODBCDbgReturn( SQL_SUCCESS );
-}
-
-SQLRETURN MConnection::setTxnIsolation( qint32 nTxnIsolation )
-{
- MYODBCDbgEnter();
-
- if ( getInfoTxnCapable() == SQL_TC_NONE )
- MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_HYC00, 0,
tr("Server does not support transactions.") ) );
-
- /*!
- \internal ODBC RULE
-
- An application must call SQLEndTran to commit or roll back all open
- transactions on a connection, before calling SQLSetConnectAttr with
- this option.
- */
- if ( isTransaction() )
- MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_HY011 ) );
-
- QString stringStatement;
-
- if ( nTxnIsolation & SQL_TXN_SERIALIZABLE )
- stringStatement = "SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE";
- else if ( nTxnIsolation & SQL_TXN_REPEATABLE_READ )
- stringStatement = "SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ";
- else if ( nTxnIsolation & SQL_TXN_READ_COMMITTED )
- stringStatement = "SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED";
- else if ( nTxnIsolation & SQL_TXN_READ_UNCOMMITTED )
- stringStatement = "SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED";
- else
- MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_HY092B ) );
-
- /* Connected so do it now */
- if ( isConnected() )
- {
- if ( !SQL_SUCCEEDED( doSubmitCommand( stringStatement.toUtf8().data() ) ) )
- MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_HY000 ) );
- }
-
- this->nTxnIsolation = nTxnIsolation;
-
- MYODBCDbgReturn( SQL_SUCCESS );
-}
-
-MEnvironment *MConnection::getEnvironment()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn3( "%p", ((MEnvironment*)parent()) );
-}
-
-MDiagnostic *MConnection::getDiagnostic()
-{
- MYODBCDbgEnter();
-
- if ( pDiagnosticCaller )
- MYODBCDbgReturn3( "%p", pDiagnosticCaller );
-
- MYODBCDbgReturn3( "%p", pDiagnostic );
-}
-
-ulong MConnection::getClientFlag( ulong nOptions, const QString &stringSTMT )
-{
- ulong nClientFlag = CLIENT_ODBC;
-
- if ( nOptions & (MYODBC_FLAG_FOUND_ROWS | MYODBC_FLAG_SAFE) )
- nClientFlag |= CLIENT_FOUND_ROWS;
-
- if ( nOptions & MYODBC_FLAG_NO_SCHEMA )
- nClientFlag |= CLIENT_NO_SCHEMA;
-/*
- if (nOptions & (MYODBC_FLAG_BIG_PACKETS | MYODBC_FLAG_SAFE))
- max_allowed_packet=~0L;
-*/
-
- if ( nOptions & MYODBC_FLAG_COMPRESSED_PROTO )
- nClientFlag |= CLIENT_COMPRESS;
-
- if ( nOptions & MYODBC_FLAG_IGNORE_SPACE )
- nClientFlag |= CLIENT_IGNORE_SPACE;
-
-#ifdef __WIN__
- if ( nOptions & MYODBC_FLAG_NAMED_PIPE )
- mysql_options( (MYSQL*)pMySQL, MYSQL_OPT_NAMED_PIPE, NULL );
-#endif
-
- if ( nOptions & MYODBC_FLAG_USE_MYCNF )
- mysql_options( (MYSQL*)pMySQL, MYSQL_READ_DEFAULT_GROUP, "odbc" );
-
- if ( !stringSTMT.isEmpty() )
- mysql_options( (MYSQL*)pMySQL, MYSQL_INIT_COMMAND, stringSTMT.toUtf8().data() );
-
- mysql_options( (MYSQL*)pMySQL, MYSQL_OPT_CONNECT_TIMEOUT, (const char
*)&nLoginTimeout );
-
- return nClientFlag;
-}
-
-int MConnection::getServerAliveSanityCheckInterval()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn3( "%d", nServerAliveSanityCheckInterval );
-}
-
-QString MConnection::getDataSourceName()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn1( stringDataSourceName );
-}
-
-QString MConnection::getUserIdentifier()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn1( stringUserIdentifier );
-}
-
-SQLUINTEGER MConnection::getAccessMode()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn3( "%d", nAccessMode );
-}
-
-SQLUINTEGER MConnection::getAsyncEnable()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn3( "%d", nAsyncEnable );
-}
-
-SQLUINTEGER MConnection::getAutoIPD()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn3( "%d", SQL_TRUE );
-}
-
-SQLUINTEGER MConnection::getAutocommit()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn3( "%d", nAutocommit );
-}
-
-SQLUINTEGER MConnection::getConnectionDead()
-{
- MYODBCDbgEnter();
-
- SQLUINTEGER nConnectionDead = SQL_CD_TRUE;
-
- if ( getState() >= STATE_C4 )
- {
- int nReturn = mysql_ping( (MYSQL*)pMySQL );
- switch ( nReturn )
- {
- case 0:
- nConnectionDead = SQL_CD_FALSE;
- break;
- case CR_COMMANDS_OUT_OF_SYNC:
- getDiagnostic()->doAppend( MDiagnostic::STATE_01000, nReturn,
"CR_COMMANDS_OUT_OF_SYNC" );
- break;
- case CR_SERVER_GONE_ERROR:
- getDiagnostic()->doAppend( MDiagnostic::STATE_01000, nReturn,
"CR_SERVER_GONE_ERROR" );
- break;
- case CR_UNKNOWN_ERROR:
- getDiagnostic()->doAppend( MDiagnostic::STATE_01000, nReturn,
"CR_UNKNOWN_ERROR" );
- break;
- case CR_SERVER_LOST:
- getDiagnostic()->doAppend( MDiagnostic::STATE_01000, nReturn,
"CR_SERVER_LOST" );
- break;
- default:
- MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_HY000,
nReturn, tr("Unhandled return code from mysql_ping()") ) );
- }
- }
-
- MYODBCDbgReturn3( "%d", nConnectionDead );
-}
-
-SQLUINTEGER MConnection::getConnectionTimeout()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn3( "%d", nConnectionTimeout );
-}
-
-QString MConnection::getCurrentCatalog()
-{
- MYODBCDbgEnter();
-
- /*!
- \internal MYODBC RULE
-
- If we are called while we are connected - then we return the current database
accounting for
- any "USE DATABASE" possibly submitted since we connected. Otherwise we just
return the
- connection attribute.
-
- We do NOT alter the connection attribute just because the current database has
been changed
- by other means.
- */
- if ( getState() > STATE_C3 )
- {
- QString stringDatabase;
- MYSQL * pMySQL = (MYSQL*)getMySQL();
-
- if ( !mysql_query( pMySQL, "SELECT database()" ) )
- {
- MYSQL_RES *pResult = mysql_use_result( pMySQL );
- if ( pResult )
- {
- MYSQL_ROW pRow = mysql_fetch_row( pResult );
- if ( pRow && pRow[0] )
- stringDatabase = pRow[0];
-
- mysql_free_result( pResult );
- }
- else
- getDiagnostic()->doAppend( MDiagnostic::STATE_HY000, mysql_errno(
pMySQL ), mysql_error( pMySQL ) );
- }
- else
- getDiagnostic()->doAppend( MDiagnostic::STATE_HY000, mysql_errno( pMySQL
), mysql_error( pMySQL ) );
-
- if ( !stringDatabase.isEmpty() )
- MYODBCDbgReturn1( stringDatabase );
- }
-
- MYODBCDbgReturn1( stringCurrentCatalog );
-}
-
-SQLUINTEGER MConnection::getLoginTimeout()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn3( "%d", nLoginTimeout );
-}
-
-SQLUINTEGER MConnection::getMetadataID()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn3( "%d", nMetadataID );
-}
-
-SQLUINTEGER MConnection::getODBCCursors()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn3( "%d", nODBCCursors );
-}
-
-SQLUINTEGER MConnection::getPacketSize()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn3( "%d", nPacketSize );
-}
-
-HWND MConnection::getQuietMode()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn3( "%p", hQuietMode );
-}
-
-SQLUINTEGER MConnection::getTrace()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn3( "%d", nTrace );
-}
-
-QString MConnection::getTracefile()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn1( stringTracefile );
-}
-
-QString MConnection::getTranslateLib()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn1( stringTranslateLib );
-}
-
-qint32 MConnection::getTranslateOption()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn3( "%d", nTranslateOption );
-}
-
-qint32 MConnection::getTxnIsolation()
-{
- MYODBCDbgEnter();
-
- 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();
-
- MYODBCDbgReturn1( "Y" );
-}
-
-QString MConnection::getInfoAccessibleTables()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn1( "Y" );
-}
-
-SQLUSMALLINT MConnection::getInfoActiveEnvironments()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn3( "%d", 0 );
-}
-
-SQLUINTEGER MConnection::getInfoAggregateFunctions()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn3( "%d", ( SQL_AF_ALL |
- SQL_AF_AVG |
- SQL_AF_COUNT |
- SQL_AF_DISTINCT |
- SQL_AF_MAX |
- SQL_AF_MIN |
- SQL_AF_SUM ) );
-}
-
-SQLUINTEGER MConnection::getInfoAlterDomain()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn3( "%d", 0 );
-}
-
-SQLUINTEGER MConnection::getInfoAlterTable()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn3( "%d", ( SQL_AT_ADD_COLUMN |
- SQL_AT_DROP_COLUMN |
- SQL_AT_ADD_COLUMN_COLLATION |
- SQL_AT_ADD_COLUMN_DEFAULT |
- SQL_AT_ADD_CONSTRAINT |
- SQL_AT_ADD_TABLE_CONSTRAINT |
- SQL_AT_CONSTRAINT_NAME_DEFINITION |
- SQL_AT_SET_COLUMN_DEFAULT ) );
-}
-
-SQLUINTEGER MConnection::getInfoAsyncMode()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn3( "%d", SQL_AM_NONE );
-}
-
-SQLUINTEGER MConnection::getInfoBatchRowCount()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn3( "%d", ( SQL_BRC_PROCEDURES |
- SQL_BRC_EXPLICIT ) );
-}
-
-SQLUINTEGER MConnection::getInfoBatchSupport()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn3( "%d", ( SQL_BS_SELECT_EXPLICIT |
- SQL_BS_ROW_COUNT_EXPLICIT |
- SQL_BS_SELECT_PROC |
- SQL_BS_ROW_COUNT_PROC ) );
-}
-
-SQLUINTEGER MConnection::getInfoBookmarkPersistence()
-{
- MYODBCDbgEnter();
- /*!
- \internal
- \todo
-
- Add support for some kind of bookmark.
-
- SQL_BP_CLOSE
- SQL_BP_DELETE
- SQL_BP_DROP
- SQL_BP_TRANSACTION
- SQL_BP_UPDATE
- SQL_BP_OTHER_HSTMT
- */
- MYODBCDbgReturn3( "%d", 0 );
-}
-
-SQLUSMALLINT MConnection::getInfoCatalogLocation()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn3( "%d", SQL_CL_START );
-}
-
-QString MConnection::getInfoCatalogName()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn1( "Y" );
-}
-
-QString MConnection::getInfoCatalogNameSeparator()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn1( "." );
-}
-
-QString MConnection::getInfoCatalogTerm()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn1( "database" );
-}
-
-SQLUINTEGER MConnection::getInfoCatalogUsage()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn3( "%d", ( SQL_CU_DML_STATEMENTS |
- SQL_CU_PROCEDURE_INVOCATION |
- SQL_CU_TABLE_DEFINITION |
- SQL_CU_INDEX_DEFINITION |
- SQL_CU_PRIVILEGE_DEFINITION ) );
-}
-
-QString MConnection::getInfoCollationSeq()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn1( "" );
-}
-
-QString MConnection::getInfoColumnAlias()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn1( "Y" );
-}
-
-SQLUSMALLINT MConnection::getInfoConcatNullBehavior()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn3( "%d", SQL_CB_NULL );
-}
-
-SQLUINTEGER MConnection::getInfoConvertBigint()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn3( "%d", ( SQL_CVT_CHAR |
- SQL_CVT_NUMERIC |
- SQL_CVT_DECIMAL |
- SQL_CVT_INTEGER |
- SQL_CVT_SMALLINT |
- SQL_CVT_FLOAT |
- SQL_CVT_REAL |
- SQL_CVT_DOUBLE |
- SQL_CVT_VARCHAR |
- SQL_CVT_LONGVARCHAR |
- SQL_CVT_BIT |
- SQL_CVT_TINYINT |
- SQL_CVT_BIGINT |
- SQL_CVT_DATE |
- SQL_CVT_TIME |
- SQL_CVT_TIMESTAMP ) );
-}
-
-SQLUINTEGER MConnection::getInfoConvertBinary()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn3( "%d", 0L );
-}
-
-SQLUINTEGER MConnection::getInfoConvertBit()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn3( "%d", ( SQL_CVT_CHAR |
- SQL_CVT_NUMERIC |
- SQL_CVT_DECIMAL |
- SQL_CVT_INTEGER |
- SQL_CVT_SMALLINT |
- SQL_CVT_FLOAT |
- SQL_CVT_REAL |
- SQL_CVT_DOUBLE |
- SQL_CVT_VARCHAR |
- SQL_CVT_LONGVARCHAR |
- SQL_CVT_BIT |
- SQL_CVT_TINYINT |
- SQL_CVT_BIGINT |
- SQL_CVT_DATE |
- SQL_CVT_TIME |
- SQL_CVT_TIMESTAMP ) );
-}
-
-SQLUINTEGER MConnection::getInfoConvertChar()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn3( "%d", ( SQL_CVT_CHAR |
- SQL_CVT_NUMERIC |
- SQL_CVT_DECIMAL |
- SQL_CVT_INTEGER |
- SQL_CVT_SMALLINT |
- SQL_CVT_FLOAT |
- SQL_CVT_REAL |
- SQL_CVT_DOUBLE |
- SQL_CVT_VARCHAR |
- SQL_CVT_LONGVARCHAR |
- SQL_CVT_BIT |
- SQL_CVT_TINYINT |
- SQL_CVT_BIGINT |
- SQL_CVT_DATE |
- SQL_CVT_TIME |
- SQL_CVT_TIMESTAMP ) );
-}
-
-SQLUINTEGER MConnection::getInfoConvertGuid()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn3( "%d", 0L );
-}
-
-SQLUINTEGER MConnection::getInfoConvertDate()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn3( "%d", ( SQL_CVT_CHAR |
- SQL_CVT_NUMERIC |
- SQL_CVT_DECIMAL |
- SQL_CVT_INTEGER |
- SQL_CVT_SMALLINT |
- SQL_CVT_FLOAT |
- SQL_CVT_REAL |
- SQL_CVT_DOUBLE |
- SQL_CVT_VARCHAR |
- SQL_CVT_LONGVARCHAR |
- SQL_CVT_BIT |
- SQL_CVT_TINYINT |
- SQL_CVT_BIGINT |
- SQL_CVT_DATE |
- SQL_CVT_TIME |
- SQL_CVT_TIMESTAMP ) );
-}
-
-SQLUINTEGER MConnection::getInfoConvertDecimal()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn3( "%d", ( SQL_CVT_CHAR |
- SQL_CVT_NUMERIC |
- SQL_CVT_DECIMAL |
- SQL_CVT_INTEGER |
- SQL_CVT_SMALLINT |
- SQL_CVT_FLOAT |
- SQL_CVT_REAL |
- SQL_CVT_DOUBLE |
- SQL_CVT_VARCHAR |
- SQL_CVT_LONGVARCHAR |
- SQL_CVT_BIT |
- SQL_CVT_TINYINT |
- SQL_CVT_BIGINT |
- SQL_CVT_DATE |
- SQL_CVT_TIME |
- SQL_CVT_TIMESTAMP ) );
-}
-
-SQLUINTEGER MConnection::getInfoConvertDouble()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn3( "%d", ( SQL_CVT_CHAR |
- SQL_CVT_NUMERIC |
- SQL_CVT_DECIMAL |
- SQL_CVT_INTEGER |
- SQL_CVT_SMALLINT |
- SQL_CVT_FLOAT |
- SQL_CVT_REAL |
- SQL_CVT_DOUBLE |
- SQL_CVT_VARCHAR |
- SQL_CVT_LONGVARCHAR |
- SQL_CVT_BIT |
- SQL_CVT_TINYINT |
- SQL_CVT_BIGINT |
- SQL_CVT_DATE |
- SQL_CVT_TIME |
- SQL_CVT_TIMESTAMP ) );
-}
-
-SQLUINTEGER MConnection::getInfoConvertFloat()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn3( "%d", ( SQL_CVT_CHAR |
- SQL_CVT_NUMERIC |
- SQL_CVT_DECIMAL |
- SQL_CVT_INTEGER |
- SQL_CVT_SMALLINT |
- SQL_CVT_FLOAT |
- SQL_CVT_REAL |
- SQL_CVT_DOUBLE |
- SQL_CVT_VARCHAR |
- SQL_CVT_LONGVARCHAR |
- SQL_CVT_BIT |
- SQL_CVT_TINYINT |
- SQL_CVT_BIGINT |
- SQL_CVT_DATE |
- SQL_CVT_TIME |
- SQL_CVT_TIMESTAMP ) );
-}
-
-SQLUINTEGER MConnection::getInfoConvertInteger()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn3( "%d", ( SQL_CVT_CHAR |
- SQL_CVT_NUMERIC |
- SQL_CVT_DECIMAL |
- SQL_CVT_INTEGER |
- SQL_CVT_SMALLINT |
- SQL_CVT_FLOAT |
- SQL_CVT_REAL |
- SQL_CVT_DOUBLE |
- SQL_CVT_VARCHAR |
- SQL_CVT_LONGVARCHAR |
- SQL_CVT_BIT |
- SQL_CVT_TINYINT |
- SQL_CVT_BIGINT |
- SQL_CVT_DATE |
- SQL_CVT_TIME |
- SQL_CVT_TIMESTAMP ) );
-}
-
-SQLUINTEGER MConnection::getInfoConvertIntervalYearMonth()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn3( "%d", 0L );
-}
-
-SQLUINTEGER MConnection::getInfoConvertIntervalDayTime()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn3( "%d", 0L );
-}
-
-SQLUINTEGER MConnection::getInfoConvertLongvarbinary()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn3( "%d", 0L );
-}
-
-SQLUINTEGER MConnection::getInfoConvertLongvarchar()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn3( "%d", ( SQL_CVT_CHAR |
- SQL_CVT_NUMERIC |
- SQL_CVT_DECIMAL |
- SQL_CVT_INTEGER |
- SQL_CVT_SMALLINT |
- SQL_CVT_FLOAT |
- SQL_CVT_REAL |
- SQL_CVT_DOUBLE |
- SQL_CVT_VARCHAR |
- SQL_CVT_LONGVARCHAR |
- SQL_CVT_BIT |
- SQL_CVT_TINYINT |
- SQL_CVT_BIGINT |
- SQL_CVT_DATE |
- SQL_CVT_TIME |
- SQL_CVT_TIMESTAMP ) );
-}
-
-SQLUINTEGER MConnection::getInfoConvertNumeric()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn3( "%d", ( SQL_CVT_CHAR |
- SQL_CVT_NUMERIC |
- SQL_CVT_DECIMAL |
- SQL_CVT_INTEGER |
- SQL_CVT_SMALLINT |
- SQL_CVT_FLOAT |
- SQL_CVT_REAL |
- SQL_CVT_DOUBLE |
- SQL_CVT_VARCHAR |
- SQL_CVT_LONGVARCHAR |
- SQL_CVT_BIT |
- SQL_CVT_TINYINT |
- SQL_CVT_BIGINT |
- SQL_CVT_DATE |
- SQL_CVT_TIME |
- SQL_CVT_TIMESTAMP ) );
-}
-
-SQLUINTEGER MConnection::getInfoConvertReal()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn3( "%d", ( SQL_CVT_CHAR |
- SQL_CVT_NUMERIC |
- SQL_CVT_DECIMAL |
- SQL_CVT_INTEGER |
- SQL_CVT_SMALLINT |
- SQL_CVT_FLOAT |
- SQL_CVT_REAL |
- SQL_CVT_DOUBLE |
- SQL_CVT_VARCHAR |
- SQL_CVT_LONGVARCHAR |
- SQL_CVT_BIT |
- SQL_CVT_TINYINT |
- SQL_CVT_BIGINT |
- SQL_CVT_DATE |
- SQL_CVT_TIME |
- SQL_CVT_TIMESTAMP ) );
-}
-
-SQLUINTEGER MConnection::getInfoConvertSmallint()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn3( "%d", ( SQL_CVT_CHAR |
- SQL_CVT_NUMERIC |
- SQL_CVT_DECIMAL |
- SQL_CVT_INTEGER |
- SQL_CVT_SMALLINT |
- SQL_CVT_FLOAT |
- SQL_CVT_REAL |
- SQL_CVT_DOUBLE |
- SQL_CVT_VARCHAR |
- SQL_CVT_LONGVARCHAR |
- SQL_CVT_BIT |
- SQL_CVT_TINYINT |
- SQL_CVT_BIGINT |
- SQL_CVT_DATE |
- SQL_CVT_TIME |
- SQL_CVT_TIMESTAMP ) );
-}
-
-SQLUINTEGER MConnection::getInfoConvertTime()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn3( "%d", ( SQL_CVT_CHAR |
- SQL_CVT_NUMERIC |
- SQL_CVT_DECIMAL |
- SQL_CVT_INTEGER |
- SQL_CVT_SMALLINT |
- SQL_CVT_FLOAT |
- SQL_CVT_REAL |
- SQL_CVT_DOUBLE |
- SQL_CVT_VARCHAR |
- SQL_CVT_LONGVARCHAR |
- SQL_CVT_BIT |
- SQL_CVT_TINYINT |
- SQL_CVT_BIGINT |
- SQL_CVT_DATE |
- SQL_CVT_TIME |
- SQL_CVT_TIMESTAMP ) );
-}
-
-SQLUINTEGER MConnection::getInfoConvertTimestamp()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn3( "%d", ( SQL_CVT_CHAR |
- SQL_CVT_NUMERIC |
- SQL_CVT_DECIMAL |
- SQL_CVT_INTEGER |
- SQL_CVT_SMALLINT |
- SQL_CVT_FLOAT |
- SQL_CVT_REAL |
- SQL_CVT_DOUBLE |
- SQL_CVT_VARCHAR |
- SQL_CVT_LONGVARCHAR |
- SQL_CVT_BIT |
- SQL_CVT_TINYINT |
- SQL_CVT_BIGINT |
- SQL_CVT_DATE |
- SQL_CVT_TIME |
- SQL_CVT_TIMESTAMP ) );
-}
-
-SQLUINTEGER MConnection::getInfoConvertTinyint()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn3( "%d", ( SQL_CVT_CHAR |
- SQL_CVT_NUMERIC |
- SQL_CVT_DECIMAL |
- SQL_CVT_INTEGER |
- SQL_CVT_SMALLINT |
- SQL_CVT_FLOAT |
- SQL_CVT_REAL |
- SQL_CVT_DOUBLE |
- SQL_CVT_VARCHAR |
- SQL_CVT_LONGVARCHAR |
- SQL_CVT_BIT |
- SQL_CVT_TINYINT |
- SQL_CVT_BIGINT |
- SQL_CVT_DATE |
- SQL_CVT_TIME |
- SQL_CVT_TIMESTAMP ) );
-}
-
-SQLUINTEGER MConnection::getInfoConvertVarbinary()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn3( "%d", 0L );
-}
-
-SQLUINTEGER MConnection::getInfoConvertVarchar()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn3( "%d", ( SQL_CVT_CHAR |
- SQL_CVT_NUMERIC |
- SQL_CVT_DECIMAL |
- SQL_CVT_INTEGER |
- SQL_CVT_SMALLINT |
- SQL_CVT_FLOAT |
- SQL_CVT_REAL |
- SQL_CVT_DOUBLE |
- SQL_CVT_VARCHAR |
- SQL_CVT_LONGVARCHAR |
- SQL_CVT_BIT |
- SQL_CVT_TINYINT |
- SQL_CVT_BIGINT |
- SQL_CVT_DATE |
- SQL_CVT_TIME |
- SQL_CVT_TIMESTAMP ) );
-}
-
-SQLUINTEGER MConnection::getInfoConvertFunctions()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn3( "%d", 0L );
-}
-
-SQLUINTEGER MConnection::getInfoCorrelationName()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn3( "%d", SQL_CN_DIFFERENT );
-}
-
-SQLUINTEGER MConnection::getInfoCreateAssertion()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn3( "%d", 0L );
-}
-
-SQLUINTEGER MConnection::getInfoCreateCharacterSet()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn3( "%d", 0L );
-}
-
-SQLUINTEGER MConnection::getInfoCreateCollation()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn3( "%d", 0L );
-}
-
-SQLUINTEGER MConnection::getInfoCreateDomain()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn3( "%d", 0L );
-}
-
-SQLUINTEGER MConnection::getInfoCreateSchema()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn3( "%d", 0L );
-}
-
-SQLUINTEGER MConnection::getInfoCreateTable()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn3( "%d", ( SQL_CT_CREATE_TABLE |
- SQL_CT_TABLE_CONSTRAINT |
- SQL_CT_CONSTRAINT_NAME_DEFINITION |
- SQL_CT_COMMIT_DELETE |
- SQL_CT_LOCAL_TEMPORARY |
- SQL_CT_COLUMN_CONSTRAINT |
- SQL_CT_COLUMN_DEFAULT |
- SQL_CT_COLUMN_COLLATION ) );
-}
-
-SQLUINTEGER MConnection::getInfoCreateTranslation()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn3( "%d", 0L );
-}
-
-SQLUINTEGER MConnection::getInfoCreateView()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn3( "%d", SQL_CV_CREATE_VIEW );
-}
-
-SQLUSMALLINT MConnection::getInfoCursorCommitBehavior()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn3( "%d", SQL_CB_PRESERVE );
-}
-
-SQLUSMALLINT MConnection::getInfoCursorRollbackBehavior()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn3( "%d", SQL_CB_PRESERVE );
-}
-
-SQLUINTEGER MConnection::getInfoCursorSensitivity()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn3( "%d", SQL_UNSPECIFIED );
-}
-
-QString MConnection::getInfoDataSourceName()
-{
- MYODBCDbgEnter();
-
- if ( getDataSourceName().isNull() )
- MYODBCDbgReturn1( "" );
-
- MYODBCDbgReturn1( getDataSourceName() );
-}
-
-QString MConnection::getInfoDataSourceReadOnly()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn1( "N" );
-}
-
-QString MConnection::getInfoDatabaseName()
-{
- MYODBCDbgEnter();
-
- /*!
- \internal ODBC Rule
-
- A character string with the name of the current database in use, if the data
source defines
- a named object called "database".
- ... also SQL_ATTR_CURRENT_CATALOG.
- */
- /*!
- \internal MYODBC Rule
-
- We account for the fact that SQL_ATTR_CURRENT_CATALOG may be inaccurate due
- to the possible use of "USE DATABASE". So this may not be the value of 'database'
from
- a DSN.
- */
- QString stringDatabaseName = getCurrentCatalog();
-
- if ( stringDatabaseName.isNull() )
- MYODBCDbgReturn1( "" );
-
- MYODBCDbgReturn1( stringDatabaseName );
-}
-
-SQLUINTEGER MConnection::getInfoDatetimeLiterals()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn3( "%d", ( SQL_DL_SQL92_DATE |
- SQL_DL_SQL92_TIME |
- SQL_DL_SQL92_TIMESTAMP ) );
-}
-
-QString MConnection::getInfoDbmsName()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn1( "MySQL" );
-}
-
-QString MConnection::getInfoDbmsVer()
-{
- MYODBCDbgEnter();
-
- if ( getMySQL() )
- MYODBCDbgReturn1( mysql_get_server_info( (MYSQL*)getMySQL() ) );
-
- MYODBCDbgReturn1( "" );
-}
-
-SQLUINTEGER MConnection::getInfoDdlIndex()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn3( "%d", ( SQL_DI_CREATE_INDEX |
- SQL_DI_DROP_INDEX ) );
-}
-
-SQLUINTEGER MConnection::getInfoDefaultTxnIsolation()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn3( "%d", SQL_TXN_READ_COMMITTED );
-}
-
-QString MConnection::getInfoDescribeParameter()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn1( "N" );
-}
-
-QString MConnection::getInfoDmVer()
-{
- MYODBCDbgEnter();
-
- /*!
- \internal MYODBC RULE
-
- We are not, of course, a Driver Manager. However; applications may link to
- us directly. I suppose that someone could even use us as a replacement for
- a DM (say on a lean machine). So lets fake it. Applications mileage may vary.
- */
- MYODBCDbgReturn1( (SQL_SPEC_STRING ".0000.0000") );
-}
-
-SQLUINTEGER MConnection::getInfoDriverHdbc()
-{
- MYODBCDbgEnter();
-
- /*!
- \internal
- \note
-
- The request is to get the *drivers* connection handle.
-
- The only way we would get this request is if the app linked directly to the
driver - if there
- is no driver manager in the equation. So we just return "this" as we are the
handle the caller is
- looking for.
- */
- MYODBCDbgReturn3( "%d", (SQLUINTEGER)this );
-}
-
-SQLUINTEGER MConnection::getInfoDriverHenv()
-{
- MYODBCDbgEnter();
-
- /*!
- \internal
- \note
-
- The request is to get the *drivers* environment handle for this connection.
-
- The only way we would get this request is if the app linked directly to the
driver - if there
- is no driver manager in the equation.
- */
- MYODBCDbgReturn3( "%d", (SQLUINTEGER)getEnvironment() );
-}
-
-QString MConnection::getInfoDriverName()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn1( MYODBC_DRIVER_NAME );
-}
-
-QString MConnection::getInfoDriverOdbcVer()
-{
- MYODBCDbgEnter();
-
- /*!
- \internal ODBC RULE
-
- A character string with the version of ODBC that the driver supports. The version
is of the form ##.##,
- where the first two digits are the major version and the next two digits are the
minor version.
-
- \note
-
- We report what we want to support (latest) - not what we actually support. In
this way we hope to get feedback
- about features missing and implement them in the order which best reflects the
needs of the
- community.
- */
- MYODBCDbgReturn1( SQL_SPEC_STRING );
-}
-
-QString MConnection::getInfoDriverVer()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn1( MYODBC_VERSION );
-}
-
-SQLUINTEGER MConnection::getInfoDropAssertion()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn3( "%d", 0L );
-}
-
-SQLUINTEGER MConnection::getInfoDropCharacterSet()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn3( "%d", 0L );
-}
-
-SQLUINTEGER MConnection::getInfoDropCollation()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn3( "%d", 0L );
-}
-
-SQLUINTEGER MConnection::getInfoDropDomain()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn3( "%d", 0L );
-}
-
-SQLUINTEGER MConnection::getInfoDropSchema()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn3( "%d", 0L );
-}
-
-SQLUINTEGER MConnection::getInfoDropTable()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn3( "%d", ( SQL_DT_DROP_TABLE |
- SQL_DT_CASCADE |
- SQL_DT_RESTRICT ) );
-}
-
-SQLUINTEGER MConnection::getInfoDropTranslation()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn3( "%d", 0L );
-}
-
-SQLUINTEGER MConnection::getInfoDropView()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn3( "%d", SQL_DT_DROP_TABLE );
-}
-
-SQLUINTEGER MConnection::getInfoDynamicCursorAttributes1()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn3( "%d", 0L );
-/*!
- \internal
- \todo
- MYODBCDbgReturn3( "%d", ( SQL_CA1_NEXT |
- SQL_CA1_ABSOLUTE |
- SQL_CA1_RELATIVE |
- SQL_CA1_LOCK_NO_CHANGE |
- SQL_CA1_POS_POSITION |
- SQL_CA1_POS_UPDATE |
- SQL_CA1_POS_DELETE |
- SQL_CA1_POS_REFRESH |
- SQL_CA1_POSITIONED_UPDATE |
- SQL_CA1_POSITIONED_DELETE |
- SQL_CA1_BULK_ADD ) );
-*/
-}
-
-SQLUINTEGER MConnection::getInfoDynamicCursorAttributes2()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn3( "%d", 0L );
-/*!
- \internal
- \todo
- MYODBCDbgReturn3( "%d", ( SQL_CA2_SENSITIVITY_ADDITIONS |
- SQL_CA2_SENSITIVITY_DELETIONS |
- SQL_CA2_SENSITIVITY_UPDATES |
- SQL_CA2_MAX_ROWS_SELECT |
- SQL_CA2_MAX_ROWS_INSERT |
- SQL_CA2_MAX_ROWS_DELETE |
- SQL_CA2_MAX_ROWS_UPDATE |
- SQL_CA2_CRC_EXACT |
- SQL_CA2_SIMULATE_TRY_UNIQUE ) );
-*/
-}
-
-QString MConnection::getInfoExpressionsInOrderby()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn1( "Y" );
-}
-
-SQLUINTEGER MConnection::getInfoFetchDirection()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn3( "%d", ( SQL_FD_FETCH_NEXT |
- SQL_FD_FETCH_FIRST |
- SQL_FD_FETCH_LAST |
- SQL_FD_FETCH_PRIOR |
- SQL_FD_FETCH_ABSOLUTE |
- SQL_FD_FETCH_RELATIVE ) );
-}
-
-SQLUSMALLINT MConnection::getInfoFileUsage()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn3( "%d", SQL_FILE_NOT_SUPPORTED );
-}
-
-SQLUINTEGER MConnection::getInfoForwardOnlyCursorAttributes1()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn3( "%d", ( SQL_CA1_NEXT |
-// SQL_CA1_ABSOLUTE |
-// SQL_CA1_RELATIVE |
- SQL_CA1_LOCK_NO_CHANGE |
- SQL_CA1_POS_POSITION |
- SQL_CA1_POS_UPDATE |
- SQL_CA1_POS_DELETE |
- SQL_CA1_POS_REFRESH |
- SQL_CA1_POSITIONED_UPDATE |
- SQL_CA1_POSITIONED_DELETE |
- SQL_CA1_BULK_ADD ) );
-}
-
-SQLUINTEGER MConnection::getInfoForwardOnlyCursorAttributes2()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn3( "%d", ( SQL_CA2_MAX_ROWS_SELECT |
- SQL_CA2_MAX_ROWS_INSERT |
- SQL_CA2_MAX_ROWS_DELETE |
- SQL_CA2_MAX_ROWS_UPDATE |
- SQL_CA2_CRC_EXACT ) );
-}
-
-SQLUINTEGER MConnection::getInfoGetdataExtensions()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn3( "%d", ( SQL_GD_ANY_COLUMN |
- SQL_GD_ANY_ORDER |
- SQL_GD_BOUND |
- SQL_GD_BLOCK ) );
-}
-
-SQLUSMALLINT MConnection::getInfoGroupBy()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn3( "%d", SQL_GB_NO_RELATION );
-}
-
-SQLUSMALLINT MConnection::getInfoIdentifierCase()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn3( "%d", SQL_IC_MIXED );
-}
-
-QString MConnection::getInfoIdentifierQuoteChar()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn1( "`" );
-}
-
-SQLUINTEGER MConnection::getInfoIndexKeywords()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn3( "%d", SQL_IK_NONE );
-}
-
-SQLUINTEGER MConnection::getInfoInfoSchemaViews()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn3( "%d", 0L );
-}
-
-SQLUINTEGER MConnection::getInfoInsertStatement()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn3( "%d", ( SQL_IS_INSERT_LITERALS |
- SQL_IS_INSERT_SEARCHED |
- SQL_IS_SELECT_INTO ) );
-}
-
-QString MConnection::getInfoIntegrity()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn1( "N" );
-}
-
-SQLUINTEGER MConnection::getInfoKeysetCursorAttributes1()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn3( "%d", 0L );
-}
-
-SQLUINTEGER MConnection::getInfoKeysetCursorAttributes2()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn3( "%d", 0L );
-}
-
-QString MConnection::getInfoKeywords()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn1(
"UNIQUE,ZEROFILL,UNSIGNED,BIGINT,BLOB,TINYBLOB,MEDIMUMBLOB,LONGBLOB,MEDIUMINT,PROCEDURE,SHOW,LIMIT,DEFAULT,TABLES,REGEXP,RLIKE,KEYS,TINYTEXT,MEDIUMTEXT"
);
-}
-
-QString MConnection::getInfoLikeEscapeClause()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn1( "Y" );
-}
-
-SQLUINTEGER MConnection::getInfoLockTypes()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn3( "%d", 0L );
-}
-
-SQLUINTEGER MConnection::getInfoMaxAsyncConcurrentStatements()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn3( "%d", 0L );
-}
-
-SQLUINTEGER MConnection::getInfoMaxBinaryLiteralLen()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn3( "%d", 0L );
-}
-
-SQLUSMALLINT MConnection::getInfoMaxCatalogNameLen()
-{
- MYODBCDbgEnter();
-
- /*!
- \internal
- \note
-
- NAME_LEN is, at this time, found in mysql_com.h.
- */
- MYODBCDbgReturn3( "%d", NAME_LEN );
-}
-
-SQLUINTEGER MConnection::getInfoMaxCharLiteralLen()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn3( "%d", 0L );
-}
-
-SQLUSMALLINT MConnection::getInfoMaxColumnNameLen()
-{
- MYODBCDbgEnter();
-
- /*!
- \internal
- \note
-
- NAME_LEN is, at this time, found in mysql_com.h.
- */
- MYODBCDbgReturn3( "%d", NAME_LEN );
-}
-
-SQLUSMALLINT MConnection::getInfoMaxColumnsInGroupBy()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn3( "%d", 0L );
-}
-
-SQLUSMALLINT MConnection::getInfoMaxColumnsInIndex()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn3( "%d", 32 );
-}
-
-SQLUSMALLINT MConnection::getInfoMaxColumnsInOrderBy()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn3( "%d", 0L );
-}
-
-SQLUSMALLINT MConnection::getInfoMaxColumnsInSelect()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn3( "%d", 0L );
-}
-
-SQLUSMALLINT MConnection::getInfoMaxColumnsInTable()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn3( "%d", 0L );
-}
-
-SQLUSMALLINT MConnection::getInfoMaxConcurrentActivities()
-{
- MYODBCDbgEnter();
-
- /*!
- \todo
-
- We need to be smarter about this. There are certian circumstances where we
- can support unlimited (for example if we store all results for the connection).
- But for now lets just support a single activity per connection.
- */
- MYODBCDbgReturn3( "%d", 1L );
-// MYODBCDbgReturn3( "%d", 0L );
-}
-
-SQLUSMALLINT MConnection::getInfoMaxCursorNameLen()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn3( "%d", 0L );
-}
-
-SQLUINTEGER MConnection::getInfoMaxDriverConnections()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn3( "%d", 0L );
-}
-
-SQLUSMALLINT MConnection::getInfoMaxIdentifierLen()
-{
- MYODBCDbgEnter();
-
- /*!
- \internal
- \note
-
- NAME_LEN is, at this time, found in mysql_com.h.
- */
- MYODBCDbgReturn3( "%d", NAME_LEN );
-}
-
-SQLUINTEGER MConnection::getInfoMaxIndexSize()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn3( "%d", 500 );
-}
-
-SQLUSMALLINT MConnection::getInfoMaxProcedureNameLen()
-{
- MYODBCDbgEnter();
-
- /*!
- \internal
- \note
-
- NAME_LEN is, at this time, found in mysql_com.h.
- */
- MYODBCDbgReturn3( "%d", NAME_LEN );
-}
-
-SQLUINTEGER MConnection::getInfoMaxRowSize()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn3( "%d", 0L );
-}
-
-QString MConnection::getInfoMaxRowSizeIncludesLong()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn1( "Y" );
-}
-
-SQLUSMALLINT MConnection::getInfoMaxSchemaNameLen()
-{
- MYODBCDbgEnter();
-
- /*!
- \internal
- \note
-
- NAME_LEN is, at this time, found in mysql_com.h.
- */
- MYODBCDbgReturn3( "%d", NAME_LEN );
-}
-
-SQLUINTEGER MConnection::getInfoMaxStatementLen()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn3( "%d", net_buffer_length );
-}
-
-SQLUSMALLINT MConnection::getInfoMaxTableNameLen()
-{
- MYODBCDbgEnter();
-
- /*!
- \internal
- \note
-
- NAME_LEN is, at this time, found in mysql_com.h.
- */
- MYODBCDbgReturn3( "%d", NAME_LEN );
-}
-
-SQLUSMALLINT MConnection::getInfoMaxTablesInSelect()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn3( "%d", 31 );
-}
-
-SQLUSMALLINT MConnection::getInfoMaxUserNameLen()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn3( "%d", 16 );
-}
-
-QString MConnection::getInfoMultiResultSets()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn1( "Y" );
-}
-
-QString MConnection::getInfoMultipleActiveTxn()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn1( "Y" );
-}
-
-QString MConnection::getInfoNeedLongDataLen()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn1( "N" );
-}
-
-SQLUSMALLINT MConnection::getInfoNonNullableColumns()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn3( "%d", SQL_NNC_NON_NULL );
-}
-
-SQLUSMALLINT MConnection::getInfoNullCollation()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn3( "%d", SQL_NC_START );
-}
-
-SQLUINTEGER MConnection::getInfoNumericFunctions()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn3( "%d", ( SQL_FN_NUM_ABS |
- SQL_FN_NUM_ACOS |
- SQL_FN_NUM_ASIN |
- SQL_FN_NUM_ATAN |
- SQL_FN_NUM_ATAN2 |
- SQL_FN_NUM_CEILING |
- SQL_FN_NUM_COS |
- SQL_FN_NUM_COT |
- SQL_FN_NUM_EXP |
- SQL_FN_NUM_FLOOR |
- SQL_FN_NUM_LOG |
- SQL_FN_NUM_MOD |
- SQL_FN_NUM_SIGN |
- SQL_FN_NUM_SIN |
- SQL_FN_NUM_SQRT |
- SQL_FN_NUM_TAN |
- SQL_FN_NUM_PI |
- SQL_FN_NUM_RAND |
- SQL_FN_NUM_DEGREES |
- SQL_FN_NUM_LOG10 |
- SQL_FN_NUM_POWER |
- SQL_FN_NUM_RADIANS |
- SQL_FN_NUM_ROUND |
- SQL_FN_NUM_TRUNCATE ) );
-}
-
-SQLUSMALLINT MConnection::getInfoOdbcApiConformance()
-{
- MYODBCDbgEnter();
-
- /*!
- \internal
- \note
-
- MS Access 2000 (possibly other versions) requires a driver to report
- SQL_OAC_LEVEL1 or better.
- */
- MYODBCDbgReturn3( "%d", SQL_OAC_LEVEL1 );
-}
-
-SQLUINTEGER MConnection::getInfoOdbcInterfaceConformance()
-{
- MYODBCDbgEnter();
- MYODBCDbgReturn3( "%d", SQL_OIC_CORE );
-}
-
-SQLSMALLINT MConnection::getInfoOdbcSqlConformance()
-{
- MYODBCDbgEnter();
- MYODBCDbgReturn3( "%d", SQL_OSC_MINIMUM );
-}
-
-QString MConnection::getInfoOdbcVer()
-{
- MYODBCDbgEnter();
-
- /*!
- \internal MYODBC RULE
-
- We are not, of course, a Driver Manager. However; applications may link to
- us directly so lets handle this.
- */
- /*!
- \internal ODBC RULE
-
- A character string with the version of ODBC to which the Driver Manager
- conforms. The version is of the form ##.##.0000, where the first two digits
- are the major version and the next two digits are the minor version. This
- is implemented solely in the Driver Manager.
- */
- MYODBCDbgReturn1( SQL_SPEC_STRING ".0000" );
-}
-
-SQLUINTEGER MConnection::getInfoOjCapabilities()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn3( "%d", ( SQL_OJ_LEFT |
- SQL_OJ_NESTED |
- SQL_OJ_NOT_ORDERED |
- SQL_OJ_INNER |
- SQL_OJ_ALL_COMPARISON_OPS |
- SQL_OJ_RIGHT ) );
-}
-
-QString MConnection::getInfoOrderByColumnsInSelect()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn1( "Y" );
-}
-
-SQLUINTEGER MConnection::getInfoParamArrayRowCounts()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn3( "%d", SQL_PARC_NO_BATCH );
-}
-
-SQLUINTEGER MConnection::getInfoParamArraySelects()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn3( "%d", SQL_PAS_NO_SELECT );
-}
-
-QString MConnection::getInfoProcedureTerm()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn1( "procedure" );
-}
-
-QString MConnection::getInfoProcedures()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn1( "Y" );
-}
-
-SQLUINTEGER MConnection::getInfoPosOperations()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn3( "%d", ( SQL_POS_POSITION |
- SQL_POS_UPDATE |
- SQL_POS_DELETE |
- SQL_POS_ADD |
- SQL_POS_REFRESH ) );
-}
-
-SQLUINTEGER MConnection::getInfoPositionedStatements()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn3( "%d", ( SQL_PS_POSITIONED_DELETE |
- SQL_PS_POSITIONED_UPDATE ) );
-}
-
-SQLUSMALLINT MConnection::getInfoQuotedIdentifierCase()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn3( "%d", SQL_IC_SENSITIVE );
-}
-
-QString MConnection::getInfoRowUpdates()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn1( "N" );
-}
-
-QString MConnection::getInfoSchemaTerm()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn1( "schema" );
-}
-
-SQLUINTEGER MConnection::getInfoSchemaUsage()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn3( "%d", 0L );
-}
-
-SQLUINTEGER MConnection::getInfoScrollConcurrency()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn3( "%d", ( SQL_SS_ADDITIONS |
- SQL_SS_DELETIONS |
- SQL_SS_UPDATES ) );
-}
-
-SQLUINTEGER MConnection::getInfoScrollOptions()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn3( "%d", SQL_SO_FORWARD_ONLY );
-/*!
- \internal
- \todo
- MYODBCDbgReturn3( "%d", ( SQL_SO_FORWARD_ONLY |
- SQL_SO_STATIC |
- SQL_SO_KEYSET_DRIVEN |
- SQL_SO_DYNAMIC |
- SQL_SO_MIXED ) );
-*/
-}
-
-QString MConnection::getInfoSearchPatternEscape()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn1( "\\" );
-}
-
-QString MConnection::getInfoServerName()
-{
- MYODBCDbgEnter();
-
- if ( getMySQL() )
- MYODBCDbgReturn1( mysql_get_host_info( (MYSQL*)getMySQL() ) );
-
- MYODBCDbgReturn1( "" );
-}
-
-QString MConnection::getInfoSpecialCharacters()
-{
- MYODBCDbgEnter();
-
- char MYODBC_DRV_VALID_CHARS[]=
- {
- '\307','\374','\351','\342','\344','\340','\345','\347','\352','\353',
- '\350','\357','\356','\354','\304','\305','\311','\346','\306','\364',
- '\366','\362','\373','\371','\377','\326','\334','\341','\355','\363',
- '\372','\361','\321',0
- };
-
- MYODBCDbgReturn1( MYODBC_DRV_VALID_CHARS );
-}
-
-SQLUINTEGER MConnection::getInfoSqlConformance()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn3( "%d", SQL_SC_SQL92_INTERMEDIATE );
-}
-
-SQLUINTEGER MConnection::getInfoSql92DatetimeFunctions()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn3( "%d", ( SQL_SDF_CURRENT_DATE |
- SQL_SDF_CURRENT_TIME |
- SQL_SDF_CURRENT_TIMESTAMP ) );
-}
-
-SQLUINTEGER MConnection::getInfoSql92ForeignKeyDeleteRule()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn3( "%d", 0L );
-}
-
-SQLUINTEGER MConnection::getInfoSql92ForeignKeyUpdateRule()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn3( "%d", 0L );
-}
-
-SQLUINTEGER MConnection::getInfoSql92Grant()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn3( "%d", ( SQL_SG_DELETE_TABLE |
- SQL_SG_INSERT_COLUMN |
- SQL_SG_INSERT_TABLE |
- SQL_SG_REFERENCES_TABLE |
- SQL_SG_REFERENCES_COLUMN |
- SQL_SG_SELECT_TABLE |
- SQL_SG_UPDATE_COLUMN |
- SQL_SG_UPDATE_TABLE ) );
-}
-
-SQLUINTEGER MConnection::getInfoSql92NumericValueFunctions()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn3( "%d", 0L );
-}
-
-SQLUINTEGER MConnection::getInfoSql92Predicates()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn3( "%d", 0L );
-}
-
-SQLUINTEGER MConnection::getInfoSql92RelationalJoinOperations()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn3( "%d", ( SQL_SRJO_CROSS_JOIN |
- SQL_SRJO_INNER_JOIN |
- SQL_SRJO_LEFT_OUTER_JOIN |
- SQL_SRJO_NATURAL_JOIN |
- SQL_SRJO_RIGHT_OUTER_JOIN ) );
-}
-
-SQLUINTEGER MConnection::getInfoSql92Revoke()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn3( "%d", ( SQL_SR_DELETE_TABLE |
- SQL_SR_INSERT_COLUMN |
- SQL_SR_INSERT_TABLE |
- SQL_SR_REFERENCES_TABLE |
- SQL_SR_REFERENCES_COLUMN |
- SQL_SR_SELECT_TABLE |
- SQL_SR_UPDATE_COLUMN |
- SQL_SR_UPDATE_TABLE ) );
-}
-
-SQLUINTEGER MConnection::getInfoSql92RowValueConstructor()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn3( "%d", ( SQL_SRVC_VALUE_EXPRESSION |
- SQL_SRVC_NULL |
- SQL_SRVC_DEFAULT ) );
-}
-
-SQLUINTEGER MConnection::getInfoSql92StringFunctions()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn3( "%d", ( SQL_SSF_CONVERT |
- SQL_SSF_LOWER |
- SQL_SSF_UPPER |
- SQL_SSF_SUBSTRING |
- SQL_SSF_TRANSLATE |
- SQL_SSF_TRIM_BOTH |
- SQL_SSF_TRIM_LEADING |
- SQL_SSF_TRIM_TRAILING ) );
-}
-
-SQLUINTEGER MConnection::getInfoSql92ValueExpressins()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn3( "%d", 0L );
-}
-
-SQLUINTEGER MConnection::getInfoStandardCliConformance()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn3( "%d", SQL_SCC_ISO92_CLI );
-}
-
-SQLUINTEGER MConnection::getInfoStaticCursorAttributes1()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn3( "%d", 0L );
-/*!
- \internal
- \todo
- MYODBCDbgReturn3( "%d", ( SQL_CA1_NEXT |
- SQL_CA1_ABSOLUTE |
- SQL_CA1_RELATIVE |
- SQL_CA1_LOCK_NO_CHANGE |
- SQL_CA1_POS_POSITION |
- SQL_CA1_POS_UPDATE |
- SQL_CA1_POS_DELETE |
- SQL_CA1_POS_REFRESH |
- SQL_CA1_POSITIONED_UPDATE |
- SQL_CA1_POSITIONED_DELETE |
- SQL_CA1_BULK_ADD ) );
-*/
-}
-
-SQLUINTEGER MConnection::getInfoStaticCursorAttributes2()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn3( "%d", 0L );
-/*!
- \internal
- \todo
- MYODBCDbgReturn3( "%d", ( SQL_CA2_MAX_ROWS_SELECT |
- SQL_CA2_MAX_ROWS_INSERT |
- SQL_CA2_MAX_ROWS_DELETE |
- SQL_CA2_MAX_ROWS_UPDATE |
- SQL_CA2_CRC_EXACT ) );
-*/
-}
-
-SQLUINTEGER MConnection::getInfoStaticSensitivity()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn3( "%d", ( SQL_SS_ADDITIONS |
- SQL_SS_DELETIONS |
- SQL_SS_UPDATES ) );
-}
-
-SQLUINTEGER MConnection::getInfoStringFunctions()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn3( "%d", ( SQL_FN_STR_CONCAT |
- SQL_FN_STR_INSERT |
- SQL_FN_STR_LEFT |
- SQL_FN_STR_LTRIM |
- SQL_FN_STR_LENGTH |
- SQL_FN_STR_LOCATE |
- SQL_FN_STR_LCASE |
- SQL_FN_STR_REPEAT |
- SQL_FN_STR_REPLACE |
- SQL_FN_STR_RIGHT |
- SQL_FN_STR_RTRIM |
- SQL_FN_STR_SUBSTRING |
- SQL_FN_STR_UCASE |
- SQL_FN_STR_ASCII |
- SQL_FN_STR_CHAR |
- SQL_FN_STR_LOCATE_2 |
- SQL_FN_STR_SOUNDEX |
- SQL_FN_STR_SPACE ) );
-}
-
-SQLUINTEGER MConnection::getInfoSubqueries()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn3( "%d", 0L );
-}
-
-SQLUINTEGER MConnection::getInfoSystemFunctions()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn3( "%d", ( SQL_FN_SYS_DBNAME |
- SQL_FN_SYS_IFNULL |
- SQL_FN_SYS_USERNAME ) );
-}
-
-QString MConnection::getInfoTableTerm()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn1( "table" );
-}
-
-SQLUINTEGER MConnection::getInfoTimedateAddIntervals()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn3( "%d", 0L );
-}
-
-SQLUINTEGER MConnection::getInfoTimedateDiffIntervals()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn3( "%d", 0L );
-}
-
-SQLUINTEGER MConnection::getInfoTimedateFunctions()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn3( "%d", ( SQL_FN_TD_NOW |
- SQL_FN_TD_CURDATE |
- SQL_FN_TD_DAYOFMONTH |
- SQL_FN_TD_DAYOFWEEK |
- SQL_FN_TD_DAYOFYEAR |
- SQL_FN_TD_MONTH |
- SQL_FN_TD_QUARTER |
- SQL_FN_TD_WEEK |
- SQL_FN_TD_YEAR |
- SQL_FN_TD_CURTIME |
- SQL_FN_TD_HOUR |
- SQL_FN_TD_MINUTE |
- SQL_FN_TD_SECOND |
- SQL_FN_TD_DAYNAME |
- SQL_FN_TD_MONTHNAME ) );
-}
-
-SQLUSMALLINT MConnection::getInfoTxnCapable()
-{
- MYODBCDbgEnter();
-
- MYSQL* pMySQL = (MYSQL*)getMySQL();
-
- /*!
- \internal
- \note
-
- We can not determine if we support transactions until we have a mysql handle and
even then we
- should probably be connected so we can query the server for feature support.
-
- We may make an assumption that we do support transactions as its default for
mysql server v4 and
- later.
- */
- if ( !pMySQL )
- {
- getDiagnostic()->doAppend( MDiagnostic::STATE_01000, 0, tr("No mysql handle
yet so we are going to guess that we do have support.") );
- MYODBCDbgReturn3( "%d", SQL_TC_DDL_COMMIT );
- }
- if ( !isConnected() )
- {
- getDiagnostic()->doAppend( MDiagnostic::STATE_01000, 0, tr("No connection yet
so we are going to guess that we do have support.") );
- MYODBCDbgReturn3( "%d", SQL_TC_DDL_COMMIT );
- }
-
- /*!
- \internal
- \note
-
- We make an assumption here - that our support for transactions is limited to data
manipulation Language (DML)
- statements such as; SELECT, INSERT, DELETE, and UPDATE.
-
- This should be in synch with MCommand behaviour.
- */
- if ( pMySQL->server_capabilities & CLIENT_TRANSACTIONS )
- MYODBCDbgReturn3( "%d", SQL_TC_DDL_COMMIT );
-
- MYODBCDbgReturn3( "%d", SQL_TC_NONE );
-}
-
-SQLUINTEGER MConnection::getInfoTxnIsolationOption()
-{
- MYODBCDbgEnter();
-
- /*!
- \internal
- \todo
-
- Implement transaction support.
- */
- MYODBCDbgReturn3( "%d", SQL_TXN_READ_COMMITTED );
-}
-
-SQLUINTEGER MConnection::getInfoUnion()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn3( "%d", 0L );
-}
-
-QString MConnection::getInfoUserName()
-{
- MYODBCDbgEnter();
-
- if ( getUserIdentifier().isNull() )
- MYODBCDbgReturn1( "" );
-
- MYODBCDbgReturn1( getUserIdentifier() );
-}
-
-QString MConnection::getInfoXopenCliYear()
-{
- MYODBCDbgEnter();
-
- MYODBCDbgReturn1( "1992" );
-}
-
SQLRETURN MConnection::doConnectInternal( MYODBCInsDataSource *pDataSource )
{
MYODBCDbgEnter();
@@ -5337,7 +1452,7 @@
setDataSourceName( pDataSource->getName() );
setUserIdentifier( pDataSource->getUID() );
- setState( STATE_C4 );
+ setState( STATE_C4_CONN );
MYODBCDbgReturn( SQL_SUCCESS );
}
@@ -5397,7 +1512,7 @@
setDataSourceName( pDriverConnect->getDSN() );
setUserIdentifier( pDriverConnect->getUID() );
- setState( STATE_C4 );
+ setState( STATE_C4_CONN );
MYODBCDbgReturn( SQL_SUCCESS );
}
@@ -5429,7 +1544,7 @@
This is a convenience function which is used to request that the server
starts a transaction.
- This will adjust the state to STATE_C6 if success.
+ This will adjust the state to STATE_C6_TRXN if success.
\note The caller must ensure that this request fits in with the state, config
options
and features available. This just sends the request to the server.
@@ -5444,7 +1559,7 @@
if ( !SQL_SUCCEEDED( doSubmitCommand( "START TRANSACTION" ) ) )
MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_HY000, 0,
tr("Failed to start transaction.") ) );
- setState( STATE_C6 );
+ setState( STATE_C6_TRXN );
MYODBCDbgReturn( SQL_SUCCESS );
}
@@ -5455,7 +1570,7 @@
This is a convenience function which is used to request that the server
commit a transaction.
- This will adjust the state (away from STATE_C6) if success.
+ This will adjust the state (away from STATE_C6_TRXN) if success.
\note The caller must ensure that this request fits in with the state, config
options
and features available. This just sends the request to the server.
@@ -5551,7 +1666,7 @@
}
/* we no longer have a transaction in play so... */
- setState( STATE_C5 );
+ setState( STATE_C5_STMT );
MYODBCDbgReturn( SQL_SUCCESS );
}
@@ -5562,7 +1677,7 @@
This is a convenience function which is used to request that the server
rollback a transaction.
- This will adjust the state (away from STATE_C6) if success.
+ This will adjust the state (away from STATE_C6_TRXN) if success.
\note The caller must ensure that this request fits in with the state, config
options
and features available. This just sends the request to the server.
@@ -5658,287 +1773,7 @@
}
/* we no longer have a transaction in play so... */
- setState( STATE_C5 );
+ setState( STATE_C5_STMT );
MYODBCDbgReturn( SQL_SUCCESS );
}
-
-/*!
- \brief Convenience method for checking if the state 'is connected'.
-
- This is a convenience method which, hopefully, makes the calling code
- a little easier to understand.
-
- This does not check if the connection is alive, it simply reports the
- state without verification.
-
- \return BOOL
-
- \retval true We are in a connected state.
- \retval false We are in a disconnected state.
-
- \sa doServerAliveSanityCheck
- getConnectionDead
-*/
-BOOL MConnection::isConnected()
-{
- MYODBCDbgEnter();
-
- if ( getState() >= STATE_C4 )
- MYODBCDbgReturn3( "%d", true );
-
- MYODBCDbgReturn3( "%d", false );
-}
-
-/*!
- \brief Convenience method for checking if we are in a transaction.
-
- This is a convenience method which, hopefully, makes the calling code
- a little easier to understand.
-
- \return BOOL
-
- \retval true We are in a transaction.
- \retval false We are not in a transaction.
-
- \sa
-*/
-BOOL MConnection::isTransaction()
-{
- MYODBCDbgEnter();
-
- if ( getState() == STATE_C6 )
- MYODBCDbgReturn3( "%d", true );
-
- MYODBCDbgReturn3( "%d", false );
-}
-
-BOOL MConnection::isAsyncInProgress()
-{
- MYODBCDbgEnter();
-
- QList<QObject*> listStatements = MYODBCC::getChildren( this,
"MStatement" ); // findChildren<MStatement*>();
- QListIterator<QObject*> i( listStatements );
- while ( i.hasNext() )
- {
- if ( ((MStatement*)i.next())->isAsyncInProgress() )
- MYODBCDbgReturn3( "%d", true );
- }
-
- MYODBCDbgReturn3( "%d", false );
-}
-
-BOOL MConnection::isStatementActive()
-{
- MYODBCDbgEnter();
-
- QList<QObject*> listStatements = MYODBCC::getChildren( this,
"MStatement" ); // findChildren<MStatement*>();
- QListIterator<QObject*> i( listStatements );
- while ( i.hasNext() )
- {
- if ( ((MStatement*)i.next())->getState() > MStatement::STATE_S1 )
- MYODBCDbgReturn3( "%d", true );
- }
-
- MYODBCDbgReturn3( "%d", false );
-}
-
-BOOL MConnection::isDataNeeded()
-{
- MYODBCDbgEnter();
-
- QList<QObject*> listStatements = MYODBCC::getChildren( this,
"MStatement" ); // findChildren<MStatement*>();
- QListIterator<QObject*> i( listStatements );
- while ( i.hasNext() )
- {
- if ( ((MStatement*)i.next())->isDataNeeded() )
- MYODBCDbgReturn3( "%d", true );
- }
-
- 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 );
-}
-
Added: trunk/SDK/MYSQLPlus/Library/MConnection_props.cpp
===================================================================
--- trunk/SDK/MYSQLPlus/Library/MConnection_props.cpp 2006-11-29 20:08:05 UTC (rev 702)
+++ trunk/SDK/MYSQLPlus/Library/MConnection_props.cpp 2006-11-30 06:47:10 UTC (rev 703)
@@ -0,0 +1,4176 @@
+/*
+ * Property handling methods for MConnection
+ */
+
+#include "MInternal.h"
+
+SQLRETURN MConnection::setConnectAttr( SQLINTEGER nAttribute, SQLPOINTER pValue,
SQLINTEGER nStringLength )
+{
+ MYODBCDbgEnter();
+
+#if MYODBC_DBG > 1
+ MYODBCDbgInfo( QString( "nAttribute=%1=%2" ).arg( nAttribute ).arg(
MYODBCC::getConnectAttrString( nAttribute ) ) );
+#endif
+
+ /*!
+ \internal ODBC RULE
+
+ We clear diagnostic each time an ODBC API call is made (with exceptions).
+ */
+ pDiagnostic->doClear();
+
+ /*!
+ \internal MYODBC RULE (DM)
+
+ We can ignore the following ODBC RULE as we do not support
+ asynch.
+
+ "An asynchronously executing function was called for a
+ StatementHandle associated with the ConnectionHandle and
+ was still executing when SQLSetConnectAttr was called."
+ */
+
+ /*!
+ \internal ODBC RULE (DM)
+
+ SQLExecute, SQLExecDirect, SQLBulkOperations, or
+ SQLSetPos was called for a StatementHandle associated with
+ the ConnectionHandle and returned SQL_NEED_DATA. This
+ function was called before data was sent for all
+ data-at-execution parameters or columns.
+ */
+
+ /*! \todo scan statements checking thier state for above rule */
+
+ /*!
+ \internal ODBC RULE (DM)
+
+ SQLBrowseConnect was called for the ConnectionHandle and returned
+ SQL_NEED_DATA. This function was called before SQLBrowseConnect
+ returned SQL_SUCCESS_WITH_INFO or SQL_SUCCESS.
+ */
+ if ( getState() == STATE_C3_DATA )
+ MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_HY010 ) );
+
+ switch ( nAttribute )
+ {
+ case SQL_ATTR_ACCESS_MODE:
+ MYODBCDbgReturn( setAccessMode( (SQLUINTEGER)pValue ) );
+
+ case SQL_ATTR_ANSI_APP:
+ /*!
+ \internal ODBC RULE
+
+ If the application is using ANSI APIs, SQL_ATTR_ANSI_APP will be set to
SQL_AA_TRUE, and if it is using
+ Unicode, it will be set to a value of SQL_AA_FALSE.
+ ...
+ If a driver exhibits the same behavior for both ANSI and Unicode
applications, it should return SQL_ERROR
+ for this attribute. If the driver returns SQL_SUCCESS, the Driver Manager
will separate ANSI and Unicode
+ connections when Connection Pooling is used.
+ */
+ /*!
+ \internal MYODBC RULE
+
+ We only have an ANSI API - no UNICODE API. So at first blush it looks
like we should return an error
+ here. However;
+
+ - we may depend upon connection level settings with the server for proper
character/string handling
+ - the downside of separating the two for connection pooling (hopefully
that is all that is happening) is
+ very minimal
+ */
+ /* MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_HY000,
0, tr("Driver does NOT behave differently if the application is ANSI.") ) ); */
+ break;
+
+ case SQL_ATTR_ASYNC_ENABLE:
+ MYODBCDbgReturn( setAsyncEnable( (SQLUINTEGER)pValue ) );
+
+ case SQL_ATTR_AUTO_IPD:
+ MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_HY092B ) );
+
+ case SQL_ATTR_AUTOCOMMIT:
+ MYODBCDbgReturn( setAutocommit( (SQLUINTEGER)pValue ) );
+
+ case SQL_ATTR_CONNECTION_DEAD:
+ MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_HY092B ) );
+
+ case SQL_ATTR_CONNECTION_TIMEOUT:
+ MYODBCDbgReturn( setConnectionTimeout( (SQLUINTEGER)pValue ) );
+
+ case SQL_ATTR_CURRENT_CATALOG:
+ {
+ /*!
+ \internal ODBC RULE (DM)
+
+ (DM) *ValuePtr is a character string, and BufferLength was less than
zero
+ but not equal to SQL_NTS.
+ */
+ if ( nStringLength < 0 && nStringLength != SQL_NTS )
+ MYODBCDbgReturn( getDiagnostic()->doAppend(
MDiagnostic::STATE_HY090 ) );
+
+ QString stringCurrentCatalog;
+ if ( nStringLength == SQL_NTS )
+ stringCurrentCatalog = MYODBCC::QString_fromWCharArray(
(SQLWCHAR*)pValue );
+ else
+ stringCurrentCatalog = MYODBCC::QString_fromWCharArray(
(SQLWCHAR*)pValue, nStringLength );
+
+ MYODBCDbgReturn( setCurrentCatalog( stringCurrentCatalog ) );
+ }
+
+ case SQL_ATTR_LOGIN_TIMEOUT:
+ MYODBCDbgReturn( setLoginTimeout( (SQLUINTEGER)pValue ) );
+
+ case SQL_ATTR_METADATA_ID:
+ MYODBCDbgReturn( setMetadataID( (SQLUINTEGER)pValue ) );
+
+ case SQL_ATTR_ODBC_CURSORS:
+ MYODBCDbgReturn( setODBCCursors( (SQLUINTEGER)pValue ) );
+
+ case SQL_ATTR_PACKET_SIZE:
+ MYODBCDbgReturn( setPacketSize( (SQLUINTEGER)pValue ) );
+
+ case SQL_ATTR_QUIET_MODE:
+ MYODBCDbgReturn( setQuietMode( (HWND)pValue ) );
+
+ case SQL_ATTR_TRACE:
+ MYODBCDbgReturn( setTrace( (SQLUINTEGER)pValue ) );
+
+ case SQL_ATTR_TRACEFILE:
+ {
+ /*!
+ \internal ODBC RULE (DM)
+
+ *ValuePtr is a character string, and BufferLength was less than zero
+ but not equal to SQL_NTS.
+ */
+ if ( nStringLength < 0 && nStringLength != SQL_NTS )
+ MYODBCDbgReturn( getDiagnostic()->doAppend(
MDiagnostic::STATE_HY090 ) );
+
+ QString stringTracefile;
+ if ( nStringLength == SQL_NTS )
+ stringTracefile = MYODBCC::QString_fromWCharArray( (SQLWCHAR*)pValue
);
+ else
+ stringTracefile = MYODBCC::QString_fromWCharArray( (SQLWCHAR*)pValue,
nStringLength );
+
+ MYODBCDbgReturn( setTracefile( stringTracefile ) );
+ }
+
+ case SQL_ATTR_TRANSLATE_LIB:
+ {
+ /*!
+ \internal ODBC RULE (DM)
+
+ *ValuePtr is a character string, and BufferLength was less than zero
+ but not equal to SQL_NTS.
+ */
+ if ( nStringLength < 0 && nStringLength != SQL_NTS )
+ MYODBCDbgReturn( getDiagnostic()->doAppend(
MDiagnostic::STATE_HY090 ) );
+
+ QString stringTranslateLib;
+ if ( nStringLength == SQL_NTS )
+ stringTranslateLib = MYODBCC::QString_fromWCharArray(
(SQLWCHAR*)pValue );
+ else
+ stringTranslateLib = MYODBCC::QString_fromWCharArray(
(SQLWCHAR*)pValue, nStringLength );
+
+ MYODBCDbgReturn( setTranslateLib( stringTranslateLib ) );
+ }
+
+ case SQL_ATTR_TRANSLATE_OPTION:
+ MYODBCDbgReturn( setTranslateOption( (qint32)pValue ) );
+
+ case SQL_ATTR_TXN_ISOLATION:
+ MYODBCDbgReturn( setTxnIsolation( (qint32)pValue ) );
+
+ default:
+ {
+ /*!
+ \internal ODBC RULE (ODBC v2)
+
+ 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
+
+ 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 );
+}
+
+SQLRETURN MConnection::setStatementType( STATEMENT_TYPE nType )
+{
+ MYODBCDbgEnter();
+
+ nStatementType = nType;
+
+ MYODBCDbgReturn( SQL_SUCCESS );
+}
+
+SQLRETURN MConnection::setBufferedType( BUFFERED_TYPE nType )
+{
+ MYODBCDbgEnter();
+
+ nBufferedType = nType;
+
+ MYODBCDbgReturn( SQL_SUCCESS );
+}
+
+SQLRETURN MConnection::getConnectAttr( SQLINTEGER nAttribute, SQLPOINTER pValue,
SQLINTEGER nBufferLength, SQLINTEGER *pnStringLength )
+{
+ MYODBCDbgEnter();
+
+#if MYODBC_DBG > 1
+ MYODBCDbgInfo( QString( "nAttribute=%1=%2" ).arg( nAttribute ).arg(
MYODBCC::getConnectAttrString( nAttribute ) ) );
+#endif
+
+ BOOL bCopyOk;
+
+ /* handle case where we are not provided viable pnStringLength */
+ SQLINTEGER nLen = 0;
+ SQLINTEGER * pnLen;
+ if ( pnStringLength )
+ pnLen = pnStringLength;
+ else
+ pnLen = &nLen;
+
+ /*!
+ \internal ODBC RULE
+
+ We clear diagnostic each time an ODBC API call is made (with exceptions).
+ */
+ pDiagnostic->doClear();
+
+ /*!
+ \internal ODBC Rule
+
+ (DM) SQLBrowseConnect was called for the ConnectionHandle and returned
+ SQL_NEED_DATA. This function was called before SQLBrowseConnect
+ returned SQL_SUCCESS_WITH_INFO or SQL_SUCCESS.
+ */
+ if ( getState() == STATE_C3_DATA )
+ MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_HY010 ) );
+
+ switch ( nAttribute )
+ {
+ case SQL_ATTR_ACCESS_MODE:
+ if ( pValue )
+ *((SQLUINTEGER*)pValue) = getAccessMode();
+ *pnLen = SQL_IS_UINTEGER ;
+ break;
+
+ case SQL_ATTR_ASYNC_ENABLE:
+ if ( pValue )
+ *((SQLUINTEGER*)pValue) = getAsyncEnable();
+ *pnLen = SQL_IS_UINTEGER ;
+ break;
+
+ case SQL_ATTR_AUTO_IPD:
+ if ( pValue )
+ *((SQLUINTEGER*)pValue) = getAutoIPD();
+ *pnLen = SQL_IS_UINTEGER ;
+ break;
+
+ case SQL_ATTR_AUTOCOMMIT:
+ if ( pValue )
+ *((SQLUINTEGER*)pValue) = getAutocommit();
+ *pnLen = SQL_IS_UINTEGER ;
+ break;
+
+ case SQL_ATTR_CONNECTION_DEAD:
+ if ( pValue )
+ *((SQLUINTEGER*)pValue) = getConnectionDead();
+ *pnLen = SQL_IS_UINTEGER ;
+ break;
+
+ case SQL_ATTR_CONNECTION_TIMEOUT:
+ if ( pValue )
+ *((SQLUINTEGER*)pValue) = getConnectionTimeout();
+ *pnLen = SQL_IS_UINTEGER ;
+ break;
+
+ case SQL_ATTR_CURRENT_CATALOG:
+ /*!
+ \internal MYODBC RULE
+
+ We mst have a the length at pValue.
+ */
+ if ( nBufferLength < 1 )
+ MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_HY090 )
);
+
+ *pnLen = 0;
+
+ if ( getCurrentCatalog().isNull() )
+ MYODBCDbgReturn( SQL_NO_DATA );
+
+ /* copy string */
+ bCopyOk = MYODBCC::doStringCopyOut( (SQLWCHAR*)pValue, nBufferLength /
sizeof(SQLWCHAR), getCurrentCatalog(), pnLen );
+ /* because we have char len but we want byte len */
+ *pnLen = *pnLen * sizeof(SQLWCHAR);
+ if ( !bCopyOk )
+ MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_01004 )
);
+ break;
+
+ case SQL_ATTR_LOGIN_TIMEOUT:
+ if ( pValue )
+ *((SQLUINTEGER*)pValue) = getLoginTimeout();
+ *pnLen = SQL_IS_UINTEGER ;
+ break;
+
+ case SQL_ATTR_METADATA_ID:
+ if ( pValue )
+ *((SQLUINTEGER*)pValue) = getMetadataID();
+ *pnLen = SQL_IS_UINTEGER ;
+ break;
+
+ case SQL_ATTR_ODBC_CURSORS:
+ if ( pValue )
+ *((SQLUINTEGER*)pValue) = getODBCCursors();
+ *pnLen = SQL_IS_UINTEGER ;
+ break;
+
+ case SQL_ATTR_PACKET_SIZE:
+ if ( pValue )
+ *((SQLUINTEGER*)pValue) = getPacketSize();
+ *pnLen = SQL_IS_UINTEGER ;
+ break;
+
+ case SQL_ATTR_QUIET_MODE:
+ if ( pValue )
+ *((SQLINTEGER*)pValue) = (SQLINTEGER)getQuietMode();
+ *pnLen = SQL_IS_INTEGER;
+ break;
+
+ case SQL_ATTR_TRACE:
+ if ( pValue )
+ *((SQLUINTEGER*)pValue) = getTrace();
+ *pnLen = SQL_IS_UINTEGER ;
+ break;
+
+ case SQL_ATTR_TRACEFILE:
+ /*!
+ \internal MYODBC RULE
+
+ We mst have a the length at pValue.
+ */
+ if ( nBufferLength < 1 )
+ MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_HY090 )
);
+
+ *pnLen = 0;
+
+ if ( getTracefile().isNull() )
+ MYODBCDbgReturn( SQL_NO_DATA );
+
+ /* copy string */
+ bCopyOk = MYODBCC::doStringCopyOut( (SQLWCHAR*)pValue, nBufferLength /
sizeof(SQLWCHAR), getTracefile(), pnLen );
+ /* because we have char len but we want byte len */
+ *pnLen = *pnLen * sizeof(SQLWCHAR);
+ if ( !bCopyOk )
+ MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_01004 )
);
+ break;
+
+ case SQL_ATTR_TRANSLATE_LIB:
+ /*!
+ \internal MYODBC RULE
+
+ We mst have a the length at pValue.
+ */
+ if ( nBufferLength < 1 )
+ MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_HY090 )
);
+
+ *pnLen = 0;
+
+ if ( getTranslateLib().isNull() )
+ MYODBCDbgReturn( SQL_NO_DATA );
+
+ /* copy string */
+ bCopyOk = MYODBCC::doStringCopyOut( (SQLWCHAR*)pValue, nBufferLength /
sizeof(SQLWCHAR), getTranslateLib(), pnLen );
+ /* because we have char len but we want byte len */
+ *pnLen = *pnLen * sizeof(SQLWCHAR);
+ if ( !bCopyOk )
+ MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_01004 )
);
+ break;
+
+ case SQL_ATTR_TRANSLATE_OPTION:
+ if ( pValue )
+ *((SQLINTEGER*)pValue) = (SQLINTEGER)getTranslateOption();
+ *pnLen = SQL_IS_INTEGER ;
+ break;
+
+ case SQL_ATTR_TXN_ISOLATION:
+ if ( pValue )
+ *((SQLINTEGER*)pValue) = (SQLINTEGER)getTxnIsolation();
+ *pnLen = SQL_IS_INTEGER ;
+ break;
+
+ case 30002:
+ /*!
+ \internal MYODBC RULE
+
+ MS Access tries to get/set this unknown attribute. Most drivers,
including C/ODBC v3
+ ignore it and return SQL_SUCCESS.
+
+ We take exception to this.
+ */
+
+ default:
+ MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_HY092B ) );
+ }
+
+ MYODBCDbgReturn( SQL_SUCCESS );
+}
+
+SQLRETURN MConnection::getDiagField( SQLSMALLINT nRecNumber, SQLSMALLINT nDiagIdentifier,
SQLPOINTER pDiagInfo, SQLSMALLINT nBufferLength, SQLSMALLINT *pnStringLength )
+{
+ MYODBCDbgEnter();
+ MYODBCDbgReturn( pDiagnostic->getDiagField( nRecNumber, nDiagIdentifier,
pDiagInfo, nBufferLength, pnStringLength ) );
+}
+
+SQLRETURN MConnection::getDiagRec( SQLSMALLINT nRecNumber, SQLWCHAR *psSQLState,
SQLINTEGER *pnNativeError, SQLWCHAR *psMessageText, SQLSMALLINT nBufferLength,
SQLSMALLINT *pnTextLength )
+{
+ MYODBCDbgEnter();
+ MYODBCDbgReturn( pDiagnostic->getDiagRec( nRecNumber, psSQLState, pnNativeError,
psMessageText, nBufferLength, pnTextLength ) )
+}
+
+SQLRETURN MConnection::getInfo( SQLUSMALLINT nInfoType, SQLPOINTER pInfoValue,
SQLSMALLINT nBufferLength /* bytes */, SQLSMALLINT *pnStringLengthBytesPtr )
+{
+ MYODBCDbgEnter();
+
+#if MYODBC_DBG > 1
+ MYODBCDbgInfo( QString( "nInfoType=%1=%2" ).arg( nInfoType).arg(
MYODBCC::getInfoTypeString( nInfoType ) ) );
+#endif
+
+ /* cast here to make code below a little cleaner */
+ SQLUSMALLINT * pnSQLUSMALLINT = (SQLUSMALLINT *)pInfoValue;
+ SQLSMALLINT * pnSQLSMALLINT = (SQLSMALLINT *)pInfoValue;
+ SQLUINTEGER * pnSQLUINTEGER = (SQLUINTEGER *)pInfoValue;
+ SQLWCHAR * pszSQLWCHAR = (SQLWCHAR *)pInfoValue;
+ /* pnStringLengthBytes is optional so provide dummy to make code below a little
cleaner */
+ SQLSMALLINT nStringLengthBytes;
+ SQLSMALLINT * pnStringLengthBytes = pnStringLengthBytesPtr;
+ SQLINTEGER nStringLengthChars;
+ BOOL bCopyOk;
+
+ /*!
+ \internal ODBC RULE
+
+ We clear diagnostic each time an ODBC API call is made (with exceptions).
+ */
+ pDiagnostic->doClear();
+
+ /*!
+ \internal ODBC RULE (DM)
+
+ The value specified for argument BufferLength was less than 0.
+ */
+ if ( nBufferLength < 0 )
+ MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_HY090 ) );
+
+ /*!
+ \internal ODBC RULE (DM)
+
+ If *InfoValuePtr is a Unicode string (when calling SQLGetInfoW), the BufferLength
argument must be
+ an even number; if not, SQLSTATE HY090 (Invalid string or buffer length) is
returned.
+ */
+ if ( nBufferLength % 2)
+ MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_HY090 ) );
+
+ /*!
+ \internal MYODBC RULE
+
+ We DO NOT consider pInfoValue to be optional.
+ */
+ if ( !pInfoValue )
+ MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_HY000, 0,
tr("buffer, to return value, must be provided") ) );
+
+ /*!
+ \internal MYODBC RULE
+
+ The following ODBC Rule makes pnStringLength optional.
+ */
+ /*!
+ \internal ODBC RULE
+
+ For all other types (other than string) of data, the value of BufferLength is
ignored
+ and the driver assumes the size of *InfoValuePtr is SQLUSMALLINT or SQLUINTEGER,
depending
+ on the InfoType.
+
+ \note
+
+ The above rule is true for ODBC v3 and v2. However; testing for MS Access exposed
that the
+ DM on XP really does care. The numeric sizes must be returned as well otherwise
pInfoValue
+ is ignored.
+ */
+ if ( !pnStringLengthBytesPtr )
+ pnStringLengthBytes = &nStringLengthBytes;
+ *pnStringLengthBytes = sizeof(SQLUINTEGER);
+
+ /*!
+ \internal ODBC RULE (DM)
+
+ The type of information requested in InfoType requires an open connection. Of the
+ information types reserved by ODBC, only SQL_ODBC_VER can be returned without an
open
+ connection.
+ */
+ if ( getState() < STATE_C4_CONN && (nInfoType != SQL_ODBC_VER &&
nInfoType != SQL_DRIVER_ODBC_VER) )
+ MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_08003 ) );
+
+ /*!
+ \internal
+ \todo
+
+ Much the values returned here are copied from the 3.51 driver with only a quick
check to
+ see that they still make sense. So this function needs to be reviewed to ensure
that it
+ is fully up-to-date. The large number of info-types to be handled has dictated
that this
+ be done in more than one pass/effort.
+ */
+ /*!
+ \internal
+ \todo
+
+ Some of the values in here are dependent upon the version of the server we are
using
+ and possibly the client library. This needs to be handled.
+ */
+ /*!
+ \internal
+ \todo
+
+ Some of the values in here are conservative in the exposure of features in the
driver as
+ some features are not complete enough to be used. Subsequently; this function
will need
+ to be revisited as features are added/completed.
+ */
+ /* ALPHA ordered list of posssible info types */
+ switch ( nInfoType )
+ {
+ case SQL_ACCESSIBLE_PROCEDURES:
+ bCopyOk = MYODBCC::doStringCopyOut( pszSQLWCHAR, nBufferLength /
sizeof(SQLWCHAR), getInfoAccessibleProcedures(), &nStringLengthChars );
+ *pnStringLengthBytes = nStringLengthChars * sizeof(SQLWCHAR);
+ if ( !bCopyOk )
+ MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_01004 )
);
+ break;
+ case SQL_ACCESSIBLE_TABLES:
+ bCopyOk = MYODBCC::doStringCopyOut( pszSQLWCHAR, nBufferLength /
sizeof(SQLWCHAR), getInfoAccessibleTables(), &nStringLengthChars );
+ *pnStringLengthBytes = nStringLengthChars * sizeof(SQLWCHAR);
+ if ( !bCopyOk )
+ MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_01004 )
);
+ break;
+ case SQL_ACTIVE_ENVIRONMENTS:
+ *pnSQLUSMALLINT = getInfoActiveEnvironments();
+ *pnStringLengthBytes = sizeof(SQLUSMALLINT);
+ break;
+ case SQL_AGGREGATE_FUNCTIONS:
+ *pnSQLUINTEGER = getInfoAggregateFunctions();
+ break;
+ case SQL_ALTER_DOMAIN:
+ *pnSQLUINTEGER = getInfoAlterDomain();
+ break;
+ case SQL_ALTER_TABLE:
+ *pnSQLUINTEGER = getInfoAlterTable();
+ break;
+ case SQL_ASYNC_MODE:
+ *pnSQLUINTEGER = getInfoAsyncMode();
+ break;
+ case SQL_BATCH_ROW_COUNT:
+ *pnSQLUINTEGER = getInfoBatchRowCount();
+ break;
+ case SQL_BATCH_SUPPORT:
+ *pnSQLUINTEGER = getInfoBatchSupport();
+ break;
+ case SQL_BOOKMARK_PERSISTENCE:
+ *pnSQLUINTEGER = getInfoBookmarkPersistence();
+ break;
+ case SQL_CATALOG_LOCATION:
+ *pnSQLUSMALLINT = getInfoCatalogLocation();
+ *pnStringLengthBytes = sizeof(SQLUSMALLINT);
+ break;
+ case SQL_CATALOG_NAME:
+ bCopyOk = MYODBCC::doStringCopyOut( pszSQLWCHAR, nBufferLength /
sizeof(SQLWCHAR), getInfoCatalogName(), &nStringLengthChars );
+ *pnStringLengthBytes = nStringLengthChars * sizeof(SQLWCHAR);
+ if ( !bCopyOk )
+ MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_01004 )
);
+ break;
+ case SQL_CATALOG_NAME_SEPARATOR:
+ bCopyOk = MYODBCC::doStringCopyOut( pszSQLWCHAR, nBufferLength /
sizeof(SQLWCHAR), getInfoCatalogNameSeparator(), &nStringLengthChars );
+ *pnStringLengthBytes = nStringLengthChars * sizeof(SQLWCHAR);
+ if ( !bCopyOk )
+ MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_01004 )
);
+ break;
+ case SQL_CATALOG_TERM:
+ bCopyOk = MYODBCC::doStringCopyOut( pszSQLWCHAR, nBufferLength /
sizeof(SQLWCHAR), getInfoCatalogTerm(), &nStringLengthChars );
+ *pnStringLengthBytes = nStringLengthChars * sizeof(SQLWCHAR);
+ if ( !bCopyOk )
+ MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_01004 )
);
+ break;
+ case SQL_CATALOG_USAGE:
+ *pnSQLUINTEGER = getInfoCatalogUsage();
+ break;
+ case SQL_COLLATION_SEQ:
+ bCopyOk = MYODBCC::doStringCopyOut( pszSQLWCHAR, nBufferLength /
sizeof(SQLWCHAR), getInfoCollationSeq(), &nStringLengthChars );
+ *pnStringLengthBytes = nStringLengthChars * sizeof(SQLWCHAR);
+ if ( !bCopyOk )
+ MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_01004 )
);
+ break;
+ case SQL_COLUMN_ALIAS:
+ bCopyOk = MYODBCC::doStringCopyOut( pszSQLWCHAR, nBufferLength /
sizeof(SQLWCHAR), getInfoColumnAlias(), &nStringLengthChars );
+ *pnStringLengthBytes = nStringLengthChars * sizeof(SQLWCHAR);
+ if ( !bCopyOk )
+ MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_01004 )
);
+ break;
+ case SQL_CONCAT_NULL_BEHAVIOR:
+ *pnSQLUSMALLINT = getInfoConcatNullBehavior();
+ *pnStringLengthBytes = sizeof(SQLUSMALLINT);
+ break;
+ case SQL_CONVERT_BIGINT:
+ *pnSQLUINTEGER = getInfoConvertBigint();
+ break;
+ case SQL_CONVERT_BINARY:
+ *pnSQLUINTEGER = getInfoConvertBinary();
+ break;
+ case SQL_CONVERT_BIT:
+ *pnSQLUINTEGER = getInfoConvertBit();
+ break;
+ case SQL_CONVERT_CHAR:
+ *pnSQLUINTEGER = getInfoConvertChar();
+ break;
+#ifdef SQL_CONVERT_GUID
+ case SQL_CONVERT_GUID:
+ *pnSQLUINTEGER = getInfoConvertGuid();
+ break;
+#endif
+ case SQL_CONVERT_DATE:
+ *pnSQLUINTEGER = getInfoConvertDate();
+ break;
+ case SQL_CONVERT_DECIMAL:
+ *pnSQLUINTEGER = getInfoConvertDecimal();
+ break;
+ case SQL_CONVERT_DOUBLE:
+ *pnSQLUINTEGER = getInfoConvertDouble();
+ break;
+ case SQL_CONVERT_FLOAT:
+ *pnSQLUINTEGER = getInfoConvertFloat();
+ break;
+ case SQL_CONVERT_INTEGER:
+ *pnSQLUINTEGER = getInfoConvertInteger();
+ break;
+ case SQL_CONVERT_INTERVAL_YEAR_MONTH:
+ *pnSQLUINTEGER = getInfoConvertIntervalYearMonth();
+ break;
+ case SQL_CONVERT_INTERVAL_DAY_TIME:
+ *pnSQLUINTEGER = getInfoConvertIntervalDayTime();
+ break;
+ case SQL_CONVERT_LONGVARBINARY:
+ *pnSQLUINTEGER = getInfoConvertLongvarbinary();
+ break;
+ case SQL_CONVERT_LONGVARCHAR:
+ *pnSQLUINTEGER = getInfoConvertLongvarchar();
+ break;
+ case SQL_CONVERT_NUMERIC:
+ *pnSQLUINTEGER = getInfoConvertNumeric();
+ break;
+ case SQL_CONVERT_REAL:
+ *pnSQLUINTEGER = getInfoConvertReal();
+ break;
+ case SQL_CONVERT_SMALLINT:
+ *pnSQLUINTEGER = getInfoConvertSmallint();
+ break;
+ case SQL_CONVERT_TIME:
+ *pnSQLUINTEGER = getInfoConvertTime();
+ break;
+ case SQL_CONVERT_TIMESTAMP:
+ *pnSQLUINTEGER = getInfoConvertTimestamp();
+ break;
+ case SQL_CONVERT_TINYINT:
+ *pnSQLUINTEGER = getInfoConvertTinyint();
+ break;
+ case SQL_CONVERT_VARBINARY:
+ *pnSQLUINTEGER = getInfoConvertVarbinary();
+ break;
+ case SQL_CONVERT_VARCHAR:
+ *pnSQLUINTEGER = getInfoConvertVarchar();
+ break;
+ case SQL_CONVERT_FUNCTIONS:
+ *pnSQLUINTEGER = getInfoConvertFunctions();
+ break;
+ case SQL_CORRELATION_NAME:
+ *pnSQLUSMALLINT = getInfoCorrelationName();
+ *pnStringLengthBytes = sizeof(SQLUSMALLINT);
+ break;
+ case SQL_CREATE_ASSERTION:
+ *pnSQLUINTEGER = getInfoCreateAssertion();
+ break;
+ case SQL_CREATE_CHARACTER_SET:
+ *pnSQLUINTEGER = getInfoCreateCharacterSet();
+ break;
+ case SQL_CREATE_COLLATION:
+ *pnSQLUINTEGER = getInfoCreateCollation();
+ break;
+ case SQL_CREATE_DOMAIN:
+ *pnSQLUINTEGER = getInfoCreateDomain();
+ break;
+ case SQL_CREATE_SCHEMA:
+ *pnSQLUINTEGER = getInfoCreateSchema();
+ break;
+ case SQL_CREATE_TABLE:
+ *pnSQLUINTEGER = getInfoCreateTable();
+ break;
+ case SQL_CREATE_TRANSLATION:
+ *pnSQLUINTEGER = getInfoCreateTranslation();
+ break;
+ case SQL_CREATE_VIEW:
+ *pnSQLUINTEGER = getInfoCreateView();
+ break;
+ case SQL_CURSOR_COMMIT_BEHAVIOR:
+ *pnSQLUSMALLINT = getInfoCursorCommitBehavior();
+ *pnStringLengthBytes = sizeof(SQLUSMALLINT);
+ break;
+ case SQL_CURSOR_ROLLBACK_BEHAVIOR:
+ *pnSQLUSMALLINT = getInfoCursorRollbackBehavior();
+ *pnStringLengthBytes = sizeof(SQLUSMALLINT);
+ break;
+ case SQL_CURSOR_SENSITIVITY:
+ *pnSQLUINTEGER = getInfoCursorSensitivity();
+ break;
+ case SQL_DATA_SOURCE_NAME:
+ bCopyOk = MYODBCC::doStringCopyOut( pszSQLWCHAR, nBufferLength /
sizeof(SQLWCHAR), getInfoDataSourceName(), &nStringLengthChars );
+ *pnStringLengthBytes = nStringLengthChars * sizeof(SQLWCHAR);
+ if ( !bCopyOk )
+ MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_01004 )
);
+ break;
+ case SQL_DATA_SOURCE_READ_ONLY:
+ bCopyOk = MYODBCC::doStringCopyOut( pszSQLWCHAR, nBufferLength /
sizeof(SQLWCHAR), getInfoDataSourceReadOnly(), &nStringLengthChars );
+ *pnStringLengthBytes = nStringLengthChars * sizeof(SQLWCHAR);
+ if ( !bCopyOk )
+ MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_01004 )
);
+ break;
+ case SQL_DATABASE_NAME:
+ bCopyOk = MYODBCC::doStringCopyOut( pszSQLWCHAR, nBufferLength /
sizeof(SQLWCHAR), getInfoDatabaseName(), &nStringLengthChars );
+ *pnStringLengthBytes = nStringLengthChars * sizeof(SQLWCHAR);
+ if ( !bCopyOk )
+ MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_01004 )
);
+ break;
+ case SQL_DATETIME_LITERALS:
+ *pnSQLUINTEGER = getInfoDatetimeLiterals();
+ break;
+ case SQL_DBMS_NAME:
+ bCopyOk = MYODBCC::doStringCopyOut( pszSQLWCHAR, nBufferLength /
sizeof(SQLWCHAR), getInfoDbmsName(), &nStringLengthChars );
+ *pnStringLengthBytes = nStringLengthChars * sizeof(SQLWCHAR);
+ if ( !bCopyOk )
+ MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_01004 )
);
+ break;
+ case SQL_DBMS_VER:
+ bCopyOk = MYODBCC::doStringCopyOut( pszSQLWCHAR, nBufferLength /
sizeof(SQLWCHAR), getInfoDbmsVer(), &nStringLengthChars );
+ *pnStringLengthBytes = nStringLengthChars * sizeof(SQLWCHAR);
+ if ( !bCopyOk )
+ MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_01004 )
);
+ break;
+ case SQL_DDL_INDEX:
+ *pnSQLUINTEGER = getInfoDdlIndex();
+ break;
+ case SQL_DEFAULT_TXN_ISOLATION:
+ *pnSQLUINTEGER = getInfoDefaultTxnIsolation();
+ break;
+ case SQL_DESCRIBE_PARAMETER:
+ bCopyOk = MYODBCC::doStringCopyOut( pszSQLWCHAR, nBufferLength /
sizeof(SQLWCHAR), getInfoDescribeParameter(), &nStringLengthChars );
+ *pnStringLengthBytes = nStringLengthChars * sizeof(SQLWCHAR);
+ if ( !bCopyOk )
+ MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_01004 )
);
+ break;
+ case SQL_DM_VER:
+ bCopyOk = MYODBCC::doStringCopyOut( pszSQLWCHAR, nBufferLength /
sizeof(SQLWCHAR), getInfoDmVer(), &nStringLengthChars );
+ *pnStringLengthBytes = nStringLengthChars * sizeof(SQLWCHAR);
+ if ( !bCopyOk )
+ MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_01004 )
);
+ break;
+ case SQL_DRIVER_HDBC:
+ if ( !pInfoValue )
+ MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_HY024 )
);
+ *pnSQLUINTEGER = getInfoDriverHdbc();
+ break;
+ case SQL_DRIVER_HENV:
+ if ( !pInfoValue )
+ MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_HY024 )
);
+ *pnSQLUINTEGER = getInfoDriverHenv();
+ break;
+ case SQL_DRIVER_HDESC:
+ /*!
+ \internal ODBC RULE (DM)
+
+ The InfoType argument was SQL_DRIVER_HDESC, and the value pointed to by
+ InfoValuePtr was not a valid descriptor handle.
+
+ \note
+
+ We can not validate the handle type so we assume any non-null is valid.
+ */
+ if ( !pInfoValue )
+ MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_HY024 )
);
+
+ /*!
+ \internal
+ \note
+
+ The request is to get the *drivers* descriptor handle for the given
*driver managers* descriptor
+ handle.
+
+ The only way we would get this request is if the app linked directly to
the driver - if there
+ is no driver manager in the equation. With this in mind we must have been
passed our own
+ descriptor handle so we just return success.
+ */
+ break;
+ case SQL_DRIVER_HLIB:
+ /*!
+ \internal MYODBC Rule
+
+ We are not, of course, a Driver Manager. However; applications may link
to
+ us directly so lets handle this.
+ */
+ /*!
+ \todo
+
+ We can get this (see dll.c in 3.51 driver).
+ */
+ MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_HYC00 ) );
+ break;
+ case SQL_DRIVER_HSTMT:
+ /*!
+ \internal ODBC RULE (DM)
+
+ The InfoType argument was SQL_DRIVER_HSTMT, and the value pointed to by
+ InfoValuePtr was not a valid statement handle.
+
+ \note
+
+ We can not validate the handle type so we assume any non-null is valid.
+ */
+ if ( !pInfoValue )
+ MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_HY024 )
);
+
+ /*!
+ \internal
+ \note
+
+ The request is to get the *drivers* statement handle for the given
*driver managers* statement
+ handle.
+
+ The only way we would get this request is if the app linked directly to
the driver - if there
+ is no driver manager in the equation. With this in mind we must have been
passed our own
+ descriptor handle so we just return success.
+ */
+ break;
+ case SQL_DRIVER_NAME:
+ bCopyOk = MYODBCC::doStringCopyOut( (SQLWCHAR*)pInfoValue, nBufferLength,
getInfoDriverName(), &nStringLengthChars );
+ *pnStringLengthBytes = nStringLengthChars * sizeof(SQLWCHAR);
+ if ( !bCopyOk )
+ MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_01004 )
);
+ break;
+ case SQL_DRIVER_ODBC_VER:
+ bCopyOk = MYODBCC::doStringCopyOut( pszSQLWCHAR, nBufferLength /
sizeof(SQLWCHAR), getInfoDriverOdbcVer(), &nStringLengthChars );
+ *pnStringLengthBytes = nStringLengthChars * sizeof(SQLWCHAR);
+ if ( !bCopyOk )
+ MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_01004 )
);
+ break;
+ case SQL_DRIVER_VER:
+ bCopyOk = MYODBCC::doStringCopyOut( (SQLWCHAR*)pInfoValue, nBufferLength,
getInfoDriverVer(), &nStringLengthChars );
+ *pnStringLengthBytes = nStringLengthChars * sizeof(SQLWCHAR);
+ if ( !bCopyOk )
+ MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_01004 )
);
+ break;
+ case SQL_DROP_ASSERTION:
+ *pnSQLUINTEGER = getInfoDropAssertion();
+ break;
+ case SQL_DROP_CHARACTER_SET:
+ *pnSQLUINTEGER = getInfoDropCharacterSet();
+ break;
+ case SQL_DROP_COLLATION:
+ *pnSQLUINTEGER = getInfoDropCollation();
+ break;
+ case SQL_DROP_DOMAIN:
+ *pnSQLUINTEGER = getInfoDropDomain();
+ break;
+ case SQL_DROP_SCHEMA:
+ *pnSQLUINTEGER = getInfoDropSchema();
+ break;
+ case SQL_DROP_TABLE:
+ *pnSQLUINTEGER = getInfoDropTable();
+ break;
+ case SQL_DROP_TRANSLATION:
+ *pnSQLUINTEGER = getInfoDropTranslation();
+ break;
+ case SQL_DROP_VIEW:
+ *pnSQLUINTEGER = getInfoDropView();
+ break;
+ case SQL_DYNAMIC_CURSOR_ATTRIBUTES1:
+ *pnSQLUINTEGER = getInfoDynamicCursorAttributes1();
+ break;
+ case SQL_DYNAMIC_CURSOR_ATTRIBUTES2:
+ *pnSQLUINTEGER = getInfoDynamicCursorAttributes2();
+ break;
+ case SQL_EXPRESSIONS_IN_ORDERBY:
+ bCopyOk = MYODBCC::doStringCopyOut( (SQLWCHAR*)pInfoValue, nBufferLength,
getInfoExpressionsInOrderby(), &nStringLengthChars );
+ *pnStringLengthBytes = nStringLengthChars * sizeof(SQLWCHAR);
+ if ( !bCopyOk )
+ MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_01004 )
);
+ break;
+ case SQL_FILE_USAGE:
+ *pnSQLUSMALLINT = getInfoFileUsage();
+ *pnStringLengthBytes = sizeof(SQLUSMALLINT);
+ break;
+ case SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES1:
+ *pnSQLUINTEGER = getInfoForwardOnlyCursorAttributes1();
+ break;
+ case SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES2:
+ *pnSQLUINTEGER = getInfoForwardOnlyCursorAttributes2();
+ break;
+ case SQL_GETDATA_EXTENSIONS:
+ *pnSQLUINTEGER = getInfoGetdataExtensions();
+ break;
+ case SQL_GROUP_BY:
+ *pnSQLUSMALLINT = getInfoGroupBy();
+ *pnStringLengthBytes = sizeof(SQLUSMALLINT);
+ break;
+ case SQL_IDENTIFIER_CASE:
+ *pnSQLUSMALLINT = getInfoIdentifierCase();
+ *pnStringLengthBytes = sizeof(SQLUSMALLINT);
+ break;
+ case SQL_IDENTIFIER_QUOTE_CHAR:
+ bCopyOk = MYODBCC::doStringCopyOut( (SQLWCHAR*)pInfoValue, nBufferLength,
getInfoIdentifierQuoteChar(), &nStringLengthChars );
+ *pnStringLengthBytes = nStringLengthChars * sizeof(SQLWCHAR);
+ if ( !bCopyOk )
+ MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_01004 )
);
+ break;
+ case SQL_INDEX_KEYWORDS:
+ *pnSQLUINTEGER = getInfoIndexKeywords();
+ break;
+ case SQL_INFO_SCHEMA_VIEWS:
+ *pnSQLUINTEGER = getInfoInfoSchemaViews();
+ break;
+ case SQL_INSERT_STATEMENT:
+ *pnSQLUINTEGER = getInfoInsertStatement();
+ break;
+ case SQL_INTEGRITY:
+ bCopyOk = MYODBCC::doStringCopyOut( (SQLWCHAR*)pInfoValue, nBufferLength,
getInfoIntegrity(), &nStringLengthChars );
+ *pnStringLengthBytes = nStringLengthChars * sizeof(SQLWCHAR);
+ if ( !bCopyOk )
+ MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_01004 )
);
+ break;
+ case SQL_KEYSET_CURSOR_ATTRIBUTES1:
+ *pnSQLUINTEGER = getInfoKeysetCursorAttributes1();
+ break;
+ case SQL_KEYSET_CURSOR_ATTRIBUTES2:
+ *pnSQLUINTEGER = getInfoKeysetCursorAttributes2();
+ break;
+ case SQL_KEYWORDS:
+ bCopyOk = MYODBCC::doStringCopyOut( (SQLWCHAR*)pInfoValue, nBufferLength,
getInfoKeywords(), &nStringLengthChars );
+ *pnStringLengthBytes = nStringLengthChars * sizeof(SQLWCHAR);
+ if ( !bCopyOk )
+ MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_01004 )
);
+ break;
+ case SQL_LIKE_ESCAPE_CLAUSE:
+ bCopyOk = MYODBCC::doStringCopyOut( (SQLWCHAR*)pInfoValue, nBufferLength,
getInfoLikeEscapeClause(), &nStringLengthChars );
+ *pnStringLengthBytes = nStringLengthChars * sizeof(SQLWCHAR);
+ if ( !bCopyOk )
+ MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_01004 )
);
+ break;
+ case SQL_MAX_ASYNC_CONCURRENT_STATEMENTS:
+ *pnSQLUINTEGER = getInfoMaxAsyncConcurrentStatements();
+ break;
+ case SQL_MAX_BINARY_LITERAL_LEN:
+ *pnSQLUINTEGER = getInfoMaxBinaryLiteralLen();
+ break;
+ case SQL_MAX_CATALOG_NAME_LEN:
+ *pnSQLUSMALLINT = getInfoMaxCatalogNameLen();
+ *pnStringLengthBytes = sizeof(SQLUSMALLINT);
+ break;
+ case SQL_MAX_CHAR_LITERAL_LEN:
+ *pnSQLUINTEGER = getInfoMaxCharLiteralLen();
+ break;
+ case SQL_MAX_COLUMN_NAME_LEN:
+ *pnSQLUSMALLINT = getInfoMaxColumnNameLen();
+ *pnStringLengthBytes = sizeof(SQLUSMALLINT);
+ break;
+ case SQL_MAX_COLUMNS_IN_GROUP_BY:
+ *pnSQLUSMALLINT = getInfoMaxColumnsInGroupBy();
+ *pnStringLengthBytes = sizeof(SQLUSMALLINT);
+ break;
+ case SQL_MAX_COLUMNS_IN_INDEX:
+ *pnSQLUSMALLINT = getInfoMaxColumnsInIndex();
+ *pnStringLengthBytes = sizeof(SQLUSMALLINT);
+ break;
+ case SQL_MAX_COLUMNS_IN_ORDER_BY:
+ *pnSQLUSMALLINT = getInfoMaxColumnsInOrderBy();
+ *pnStringLengthBytes = sizeof(SQLUSMALLINT);
+ break;
+ case SQL_MAX_COLUMNS_IN_SELECT:
+ *pnSQLUSMALLINT = getInfoMaxColumnsInSelect();
+ *pnStringLengthBytes = sizeof(SQLUSMALLINT);
+ break;
+ case SQL_MAX_COLUMNS_IN_TABLE:
+ *pnSQLUSMALLINT = getInfoMaxColumnsInTable();
+ *pnStringLengthBytes = sizeof(SQLUSMALLINT);
+ break;
+ case SQL_MAX_CONCURRENT_ACTIVITIES:
+ *pnSQLUSMALLINT = getInfoMaxConcurrentActivities();
+ *pnStringLengthBytes = sizeof(SQLUSMALLINT);
+ break;
+ case SQL_MAX_CURSOR_NAME_LEN:
+ *pnSQLUSMALLINT = getInfoMaxCursorNameLen();
+ *pnStringLengthBytes = sizeof(SQLUSMALLINT);
+ break;
+ case SQL_MAX_DRIVER_CONNECTIONS:
+ *pnSQLUSMALLINT = getInfoMaxDriverConnections();
+ *pnStringLengthBytes = sizeof(SQLUSMALLINT);
+ break;
+ case SQL_MAX_IDENTIFIER_LEN:
+ *pnSQLUSMALLINT = getInfoMaxIdentifierLen();
+ *pnStringLengthBytes = sizeof(SQLUSMALLINT);
+ break;
+ case SQL_MAX_INDEX_SIZE:
+ *pnSQLUINTEGER = getInfoMaxIndexSize();
+ break;
+ case SQL_MAX_PROCEDURE_NAME_LEN:
+ *pnSQLUSMALLINT = getInfoMaxProcedureNameLen();
+ *pnStringLengthBytes = sizeof(SQLUSMALLINT);
+ break;
+ case SQL_MAX_ROW_SIZE:
+ *pnSQLUINTEGER = getInfoMaxRowSize();
+ break;
+ case SQL_MAX_ROW_SIZE_INCLUDES_LONG:
+ bCopyOk = MYODBCC::doStringCopyOut( (SQLWCHAR*)pInfoValue, nBufferLength,
getInfoMaxRowSizeIncludesLong(), &nStringLengthChars );
+ *pnStringLengthBytes = nStringLengthChars * sizeof(SQLWCHAR);
+ if ( !bCopyOk )
+ MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_01004 )
);
+ break;
+ case SQL_MAX_SCHEMA_NAME_LEN:
+ *pnSQLUSMALLINT = getInfoMaxSchemaNameLen();
+ *pnStringLengthBytes = sizeof(SQLUSMALLINT);
+ break;
+ case SQL_MAX_STATEMENT_LEN:
+ *pnSQLUINTEGER = getInfoMaxStatementLen();
+ break;
+ case SQL_MAX_TABLE_NAME_LEN:
+ *pnSQLUSMALLINT = getInfoMaxTableNameLen();
+ *pnStringLengthBytes = sizeof(SQLUSMALLINT);
+ break;
+ case SQL_MAX_TABLES_IN_SELECT:
+ *pnSQLUSMALLINT = getInfoMaxTablesInSelect();
+ *pnStringLengthBytes = sizeof(SQLUSMALLINT);
+ break;
+ case SQL_MAX_USER_NAME_LEN:
+ *pnSQLUSMALLINT = getInfoMaxUserNameLen();
+ *pnStringLengthBytes = sizeof(SQLUSMALLINT);
+ break;
+ case SQL_MULT_RESULT_SETS:
+ bCopyOk = MYODBCC::doStringCopyOut( (SQLWCHAR*)pInfoValue, nBufferLength,
getInfoMultiResultSets(), &nStringLengthChars );
+ *pnStringLengthBytes = nStringLengthChars * sizeof(SQLWCHAR);
+ if ( !bCopyOk )
+ MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_01004 )
);
+ break;
+ case SQL_MULTIPLE_ACTIVE_TXN:
+ bCopyOk = MYODBCC::doStringCopyOut( (SQLWCHAR*)pInfoValue, nBufferLength,
getInfoMultipleActiveTxn(), &nStringLengthChars );
+ *pnStringLengthBytes = nStringLengthChars * sizeof(SQLWCHAR);
+ if ( !bCopyOk )
+ MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_01004 )
);
+ break;
+ case SQL_NEED_LONG_DATA_LEN:
+ bCopyOk = MYODBCC::doStringCopyOut( (SQLWCHAR*)pInfoValue, nBufferLength,
getInfoNeedLongDataLen(), &nStringLengthChars );
+ *pnStringLengthBytes = nStringLengthChars * sizeof(SQLWCHAR);
+ if ( !bCopyOk )
+ MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_01004 )
);
+ break;
+ case SQL_NON_NULLABLE_COLUMNS:
+ *pnSQLUSMALLINT = getInfoNonNullableColumns();
+ *pnStringLengthBytes = sizeof(SQLUSMALLINT);
+ break;
+ case SQL_NULL_COLLATION:
+ *pnSQLUSMALLINT = getInfoNullCollation();
+ *pnStringLengthBytes = sizeof(SQLUSMALLINT);
+ break;
+ case SQL_NUMERIC_FUNCTIONS:
+ *pnSQLUINTEGER = getInfoNumericFunctions();
+ break;
+ case SQL_ODBC_INTERFACE_CONFORMANCE:
+ *pnSQLUINTEGER = getInfoOdbcInterfaceConformance();
+ break;
+ case SQL_ODBC_VER:
+ bCopyOk = MYODBCC::doStringCopyOut( pszSQLWCHAR, nBufferLength /
sizeof(SQLWCHAR), getInfoOdbcVer(), &nStringLengthChars );
+ *pnStringLengthBytes = nStringLengthChars * sizeof(SQLWCHAR);
+ if ( !bCopyOk )
+ MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_01004 )
);
+ break;
+ case SQL_OJ_CAPABILITIES:
+ *pnSQLUINTEGER = getInfoOjCapabilities();
+ break;
+ case SQL_ORDER_BY_COLUMNS_IN_SELECT:
+ bCopyOk = MYODBCC::doStringCopyOut( pszSQLWCHAR, nBufferLength /
sizeof(SQLWCHAR), getInfoOrderByColumnsInSelect(), &nStringLengthChars );
+ *pnStringLengthBytes = nStringLengthChars * sizeof(SQLWCHAR);
+ if ( !bCopyOk )
+ MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_01004 )
);
+ break;
+ case SQL_PARAM_ARRAY_ROW_COUNTS:
+ *pnSQLUINTEGER = getInfoParamArrayRowCounts();
+ break;
+ case SQL_PARAM_ARRAY_SELECTS:
+ *pnSQLUINTEGER = getInfoParamArraySelects();
+ break;
+ case SQL_PROCEDURE_TERM:
+ bCopyOk = MYODBCC::doStringCopyOut( pszSQLWCHAR, nBufferLength /
sizeof(SQLWCHAR), getInfoProcedureTerm() , &nStringLengthChars );
+ *pnStringLengthBytes = nStringLengthChars * sizeof(SQLWCHAR);
+ if ( !bCopyOk )
+ MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_01004 )
);
+ break;
+ case SQL_PROCEDURES:
+ bCopyOk = MYODBCC::doStringCopyOut( pszSQLWCHAR, nBufferLength /
sizeof(SQLWCHAR), getInfoProcedures(), &nStringLengthChars );
+ *pnStringLengthBytes = nStringLengthChars * sizeof(SQLWCHAR);
+ if ( !bCopyOk )
+ MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_01004 )
);
+ break;
+ case SQL_QUOTED_IDENTIFIER_CASE:
+ *pnSQLUSMALLINT = getInfoQuotedIdentifierCase();
+ *pnStringLengthBytes = sizeof(SQLUSMALLINT);
+ break;
+ case SQL_ROW_UPDATES:
+ bCopyOk = MYODBCC::doStringCopyOut( pszSQLWCHAR, nBufferLength /
sizeof(SQLWCHAR), getInfoRowUpdates(), &nStringLengthChars );
+ *pnStringLengthBytes = nStringLengthChars * sizeof(SQLWCHAR);
+ if ( !bCopyOk )
+ MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_01004 )
);
+ break;
+ case SQL_SCHEMA_TERM:
+ bCopyOk = MYODBCC::doStringCopyOut( pszSQLWCHAR, nBufferLength /
sizeof(SQLWCHAR), getInfoSchemaTerm(), &nStringLengthChars );
+ *pnStringLengthBytes = nStringLengthChars * sizeof(SQLWCHAR);
+ if ( !bCopyOk )
+ MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_01004 )
);
+ break;
+ case SQL_SCHEMA_USAGE:
+ *pnSQLUINTEGER = getInfoSchemaUsage();
+ break;
+ case SQL_SCROLL_OPTIONS:
+ *pnSQLUINTEGER = getInfoScrollOptions();
+ break;
+ case SQL_SEARCH_PATTERN_ESCAPE:
+ bCopyOk = MYODBCC::doStringCopyOut( pszSQLWCHAR, nBufferLength /
sizeof(SQLWCHAR), getInfoSearchPatternEscape(), &nStringLengthChars );
+ *pnStringLengthBytes = nStringLengthChars * sizeof(SQLWCHAR);
+ if ( !bCopyOk )
+ MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_01004 )
);
+ break;
+ case SQL_SERVER_NAME:
+ bCopyOk = MYODBCC::doStringCopyOut( pszSQLWCHAR, nBufferLength /
sizeof(SQLWCHAR), getInfoServerName(), &nStringLengthChars );
+ *pnStringLengthBytes = nStringLengthChars * sizeof(SQLWCHAR);
+ if ( !bCopyOk )
+ MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_01004 )
);
+ break;
+ case SQL_SPECIAL_CHARACTERS:
+ bCopyOk = MYODBCC::doStringCopyOut( pszSQLWCHAR, nBufferLength /
sizeof(SQLWCHAR), getInfoSpecialCharacters(), &nStringLengthChars );
+ *pnStringLengthBytes = nStringLengthChars * sizeof(SQLWCHAR);
+ if ( !bCopyOk )
+ MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_01004 )
);
+ break;
+ case SQL_SQL_CONFORMANCE:
+ *pnSQLUINTEGER = getInfoSqlConformance();
+ break;
+ case SQL_SQL92_DATETIME_FUNCTIONS:
+ *pnSQLUINTEGER = getInfoSql92DatetimeFunctions();
+ break;
+ case SQL_SQL92_FOREIGN_KEY_DELETE_RULE:
+ *pnSQLUINTEGER = getInfoSql92ForeignKeyDeleteRule();
+ break;
+ case SQL_SQL92_FOREIGN_KEY_UPDATE_RULE:
+ *pnSQLUINTEGER = getInfoSql92ForeignKeyUpdateRule();
+ break;
+ case SQL_SQL92_GRANT:
+ *pnSQLUINTEGER = getInfoSql92Grant();
+ break;
+ case SQL_SQL92_NUMERIC_VALUE_FUNCTIONS:
+ *pnSQLUINTEGER = getInfoSql92NumericValueFunctions();
+ break;
+ case SQL_SQL92_PREDICATES:
+ *pnSQLUINTEGER = getInfoSql92Predicates();
+ break;
+ case SQL_SQL92_RELATIONAL_JOIN_OPERATORS:
+ *pnSQLUINTEGER = getInfoSql92RelationalJoinOperations();
+ break;
+ case SQL_SQL92_REVOKE:
+ *pnSQLUINTEGER = getInfoSql92Revoke();
+ break;
+ case SQL_SQL92_ROW_VALUE_CONSTRUCTOR:
+ *pnSQLUINTEGER = getInfoSql92RowValueConstructor();
+ break;
+ case SQL_SQL92_STRING_FUNCTIONS:
+ *pnSQLUINTEGER = getInfoSql92StringFunctions();
+ break;
+ case SQL_SQL92_VALUE_EXPRESSIONS:
+ *pnSQLUINTEGER = getInfoSql92ValueExpressins();
+ break;
+ case SQL_STANDARD_CLI_CONFORMANCE:
+ *pnSQLUINTEGER = getInfoStandardCliConformance();
+ break;
+ case SQL_STATIC_CURSOR_ATTRIBUTES1:
+ *pnSQLUINTEGER = getInfoStaticCursorAttributes1();
+ break;
+ case SQL_STATIC_CURSOR_ATTRIBUTES2:
+ *pnSQLUINTEGER = getInfoStaticCursorAttributes2();
+ break;
+ case SQL_STRING_FUNCTIONS:
+ *pnSQLUINTEGER = getInfoStringFunctions();
+ break;
+ case SQL_SUBQUERIES:
+ *pnSQLUINTEGER = getInfoSubqueries();
+ break;
+ case SQL_SYSTEM_FUNCTIONS:
+ *pnSQLUINTEGER = getInfoSystemFunctions();
+ break;
+ case SQL_TABLE_TERM:
+ bCopyOk = MYODBCC::doStringCopyOut( pszSQLWCHAR, nBufferLength /
sizeof(SQLWCHAR), getInfoTableTerm(), &nStringLengthChars );
+ *pnStringLengthBytes = nStringLengthChars * sizeof(SQLWCHAR);
+ if ( !bCopyOk )
+ MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_01004 )
);
+ break;
+ case SQL_TIMEDATE_ADD_INTERVALS:
+ *pnSQLUINTEGER = getInfoTimedateAddIntervals();
+ break;
+ case SQL_TIMEDATE_DIFF_INTERVALS:
+ *pnSQLUINTEGER = getInfoTimedateDiffIntervals();
+ break;
+ case SQL_TIMEDATE_FUNCTIONS:
+ *pnSQLUINTEGER = getInfoTimedateFunctions();
+ break;
+ case SQL_TXN_CAPABLE:
+ *pnSQLUSMALLINT = getInfoTxnCapable();
+ *pnStringLengthBytes = sizeof(SQLUSMALLINT);
+ break;
+ case SQL_TXN_ISOLATION_OPTION:
+ *pnSQLUINTEGER = getInfoTxnIsolationOption();
+ break;
+ case SQL_UNION:
+ *pnSQLUINTEGER = getInfoUnion();
+ break;
+ case SQL_USER_NAME:
+ bCopyOk = MYODBCC::doStringCopyOut( pszSQLWCHAR, nBufferLength /
sizeof(SQLWCHAR), getInfoUserName(), &nStringLengthChars );
+ *pnStringLengthBytes = nStringLengthChars * sizeof(SQLWCHAR);
+ if ( !bCopyOk )
+ MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_01004 )
);
+ break;
+ case SQL_XOPEN_CLI_YEAR:
+ bCopyOk = MYODBCC::doStringCopyOut( pszSQLWCHAR, nBufferLength /
sizeof(SQLWCHAR), getInfoXopenCliYear(), &nStringLengthChars );
+ *pnStringLengthBytes = nStringLengthChars * sizeof(SQLWCHAR);
+ if ( !bCopyOk )
+ MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_01004 )
);
+ break;
+ default:
+ if ( getEnvironment()->getODBCVersion() == SQL_OV_ODBC2 )
+ {
+ /*!
+ \internal
+ \note
+
+ ODBC v3 spec. says that this func only returns; strings, SQLUINTEGER
or SQLUSMALLINT. However; these come from
+ the ODBC v2 spec. and there it says (for example)
SQL_ODBC_SQL_CONFORMANCE is a 16 bit numeric - SQLSMALLINT
+ in old MS code. We choose to obey ODBC v3 spec. by upsizing the
numerics.
+ */
+ switch ( nInfoType )
+ {
+ case SQL_FETCH_DIRECTION:
+ *pnSQLUINTEGER = getInfoFetchDirection();
+ break;
+ case SQL_LOCK_TYPES:
+ *pnSQLUINTEGER = getInfoLockTypes();
+ break;
+ case SQL_ODBC_API_CONFORMANCE:
+ *pnSQLSMALLINT = getInfoOdbcApiConformance();
+ *pnStringLengthBytes = sizeof(SQLUSMALLINT);
+ break;
+ case SQL_ODBC_SQL_CONFORMANCE:
+ *pnSQLSMALLINT = getInfoOdbcSqlConformance();
+ *pnStringLengthBytes = sizeof(SQLUSMALLINT);
+ break;
+ case SQL_POS_OPERATIONS:
+ *pnSQLUINTEGER = getInfoPosOperations();
+ break;
+ case SQL_POSITIONED_STATEMENTS:
+ *pnSQLUINTEGER = getInfoPositionedStatements();
+ break;
+ case SQL_SCROLL_CONCURRENCY:
+ *pnSQLUINTEGER = getInfoScrollConcurrency();
+ break;
+ case SQL_STATIC_SENSITIVITY:
+ *pnSQLUINTEGER = getInfoStaticSensitivity();
+ break;
+ default:
+ MYODBCDbgReturn( getDiagnostic()->doAppend(
MDiagnostic::STATE_HYC00 ) );
+ }
+ }
+ else
+ MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_HYC00 )
);
+ }
+
+ MYODBCDbgReturn( SQL_SUCCESS );
+}
+
+MConnection::STATEMENT_TYPE MConnection::getStatementType()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn3( "%d", nStatementType );
+}
+
+MConnection::BUFFERED_TYPE MConnection::getBufferedType()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn3( "%d", nBufferedType );
+}
+
+SQLHANDLE MConnection::getMySQL()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn3( "%p", pMySQL );
+}
+
+QStringList MConnection::getDiagnostics()
+{
+ MYODBCDbgEnter();
+ QStringList stringlist = pDiagnostic->getDiagnostics();
+ MYODBCDbgReturn3( "%p", stringlist );
+}
+
+MStatement *MConnection::getStatementWithCursor( const QString &stringCursorName )
+{
+ MYODBCDbgEnter();
+
+ QList<QObject*> listObjects;
+ QListIterator<QObject*> i( (QList<QObject*>)children() );
+
+ while ( i.hasNext() )
+ {
+ QObject *pObject = i.next();
+ if ( pObject->objectName() == "MStatement" )
+ {
+ MStatement *pStatement = (MStatement*)pObject;
+ if ( pStatement->getCursorName() == stringCursorName )
+ MYODBCDbgReturn3( "%p", pStatement );
+ }
+ }
+
+ MYODBCDbgReturn3( "%p", NULL );
+}
+
+/*!
+ \brief Set the diagnostic to be used by this descriptor.
+
+ This is used to temp. replace the default diagnostic. This is sometimes
needed
+ to redirect the diagnostic messages to the callers diagnostic.
+
+ \note This should be reset to default diagnostic as soon as possible. The caller
+ must do this when done.
+
+ \param pDiagnostic The diagnostic handle we should send diagnostic information to.
This
+ should be NULL to reset the diagnostic to the default.
+
+ \return BOOL
+
+ \sa getDiagnostic
+*/
+BOOL MConnection::setDiagnostic( MDiagnostic *pDiagnostic )
+{
+ MYODBCDbgEnter();
+
+ pDiagnosticCaller = pDiagnostic;
+
+ MYODBCDbgReturn3( "%d", true );
+}
+
+BOOL MConnection::setState( STATE nState )
+{
+ MYODBCDbgEnter();
+
+ this->nState = nState;
+
+ MYODBCDbgReturn3( "%d", true );
+}
+
+BOOL MConnection::setServerAliveSanityCheckInterval( int nMilliseconds )
+{
+ MYODBCDbgEnter();
+
+ nServerAliveSanityCheckInterval = nMilliseconds;
+
+ MYODBCDbgReturn3( "%d", true );
+}
+
+BOOL MConnection::setDataSourceName( const QString &stringDataSourceName )
+{
+ MYODBCDbgEnter();
+
+ this->stringDataSourceName = stringDataSourceName;
+
+ MYODBCDbgReturn3( "%d", true );
+}
+
+BOOL MConnection::setUserIdentifier( const QString &stringUserIdentifier )
+{
+ MYODBCDbgEnter();
+
+ this->stringUserIdentifier = stringUserIdentifier;
+
+ MYODBCDbgReturn3( "%d", true );
+}
+
+SQLRETURN MConnection::setAccessMode( SQLUINTEGER nAccessMode )
+{
+ MYODBCDbgEnter();
+
+ switch ( nAccessMode )
+ {
+ case SQL_MODE_READ_ONLY:
+ case SQL_MODE_READ_WRITE:
+ break;
+ default:
+ MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_HY092B ) );
+ }
+
+ this->nAccessMode = nAccessMode;
+
+ MYODBCDbgReturn( SQL_SUCCESS );
+}
+
+SQLRETURN MConnection::setStmtOption( SQLINTEGER nAttribute, SQLPOINTER pValue,
SQLINTEGER nStringLength )
+{
+ MYODBCDbgEnter();
+
+ BOOL 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();
+
+ /*!
+ \internal ODBC RULE
+
+ Drivers that operate only on multithread operating systems do not need
+ to support asynchronous execution.
+ */
+ /*!
+ \internal MYODBC RULE
+
+ We dot not support asynch.
+ */
+ switch ( nAsyncEnable )
+ {
+ case SQL_ASYNC_ENABLE_OFF:
+ break;
+ case SQL_ASYNC_ENABLE_ON:
+ MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_HYC00 ) );
+ default:
+ MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_HY092B ) );
+ }
+
+ /*!
+ \internal MYODBC RULE
+
+ We dot not support asynch operations.
+ */
+ MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_HYC00 ) );
+}
+
+SQLRETURN MConnection::setConnectionTimeout( SQLUINTEGER nConnectionTimeout )
+{
+ MYODBCDbgEnter();
+
+ /*!
+ \internal MYODBC RULE
+
+ Value mst be sane so limit to 120 seconds max.
+ */
+ if ( nConnectionTimeout > 120 )
+ {
+ this->nConnectionTimeout = 120;
+ MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_01S02 ) );
+ }
+
+ this->nConnectionTimeout = nConnectionTimeout;
+
+ MYODBCDbgReturn( SQL_SUCCESS );
+}
+
+SQLRETURN MConnection::setLoginTimeout( SQLUINTEGER nLoginTimeout )
+{
+ MYODBCDbgEnter();
+
+ /*!
+ \internal
+ \note This will get used during a connect - it is not applied now.
+ */
+ this->nLoginTimeout = nLoginTimeout;
+
+ MYODBCDbgReturn( SQL_SUCCESS );
+}
+
+SQLRETURN MConnection::setMetadataID( SQLUINTEGER nMetadataID )
+{
+ MYODBCDbgEnter();
+
+ switch ( nMetadataID )
+ {
+ case SQL_TRUE:
+ case SQL_FALSE:
+ break;
+ default:
+ MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_HY092B ) );
+ }
+
+ this->nMetadataID = nMetadataID;
+
+ MYODBCDbgReturn( SQL_SUCCESS );
+}
+
+SQLRETURN MConnection::setODBCCursors( SQLUINTEGER nODBCCursors )
+{
+ MYODBCDbgEnter();
+
+ /*!
+ \internal ODBC Rule
+
+ The Attribute argument was SQL_ATTR_ODBC_CURSORS, and the
+ driver was already connected to the data source.
+ */
+ if ( getState() >= STATE_C4_CONN )
+ MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_08002 ) );
+
+ /*!
+ \internal MYODBC RULE
+
+ Try to support DM attributes in case app is linked directly to us.
+ */
+ switch ( nODBCCursors )
+ {
+ case SQL_CUR_USE_IF_NEEDED:
+ case SQL_CUR_USE_ODBC:
+ MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_HYC00 ) );
+ case SQL_CUR_USE_DRIVER:
+ break;
+ default:
+ MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_HY092B ) );
+ }
+
+ this->nODBCCursors = nODBCCursors;
+
+ MYODBCDbgReturn( SQL_SUCCESS );
+}
+
+SQLRETURN MConnection::setPacketSize( SQLUINTEGER nPacketSize )
+{
+ MYODBCDbgEnter();
+
+ /*!
+ \internal ODBC RULE
+
+ If the application sets packet size after a connection has already been
+ made, the driver will return SQLSTATE HY011 (Attribute cannot be set now).
+ */
+ if ( getState() > STATE_C3_DATA )
+ MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_HY011 ) );
+
+ /*!
+ \internal
+ \todo We can probably make use of this.
+ */
+ MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_HYC00 ) );
+
+ this->nPacketSize = nPacketSize;
+
+ MYODBCDbgReturn( SQL_SUCCESS );
+}
+
+SQLRETURN MConnection::setQuietMode( HWND hQuietMode )
+{
+ MYODBCDbgEnter();
+
+ /*!
+ \internal
+ \note We do not use this.
+ */
+ this->hQuietMode = hQuietMode;
+
+ MYODBCDbgReturn( SQL_SUCCESS );
+}
+
+SQLRETURN MConnection::setTrace( SQLUINTEGER nTrace )
+{
+ MYODBCDbgEnter();
+
+ /*!
+ \internal MYODBC RULE
+
+ Try to support DM attributes in case app is linked directly to us.
+ */
+
+ /*!
+ \internal
+ \todo make use of this
+ */
+
+ switch ( nTrace )
+ {
+ case SQL_OPT_TRACE_OFF:
+ break;
+ case SQL_OPT_TRACE_ON:
+ MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_HYC00 ) );
+ default:
+ MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_HY092B ) );
+ }
+
+ this->nTrace = nTrace;
+
+ MYODBCDbgReturn( SQL_SUCCESS );
+}
+
+SQLRETURN MConnection::setTracefile( QString stringTracefile )
+{
+ MYODBCDbgEnter();
+
+ /*!
+ \internal MYODBC RULE
+
+ Try to support DM attributes in case app is linked directly to us.
+ */
+
+ /*!
+ \internal
+ \todo make use of this
+ */
+ this->stringTracefile = stringTracefile;
+
+ MYODBCDbgReturn( SQL_SUCCESS );
+}
+
+SQLRETURN MConnection::setTranslateLib( QString stringTranslateLib )
+{
+ MYODBCDbgEnter();
+
+ /*!
+ \internal MYODBC RULE
+
+ We dot not support the following ODBC RULE;
+
+ "The setting of this attribute will persist across connections."
+ */
+
+ /*!
+ \internal ODBC RULE
+
+ This attribute can be specified only if the driver has connected
+ to the data source.
+ */
+ if ( !isConnected() )
+ MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_HY011 ) );
+
+ /*!
+ \internal
+ \todo support translation library
+ */
+ this->stringTranslateLib = stringTranslateLib;
+
+ MYODBCDbgReturn( SQL_SUCCESS );
+}
+
+SQLRETURN MConnection::setTranslateOption( qint32 nTranslateOption )
+{
+ MYODBCDbgEnter();
+
+ /*!
+ \internal ODBC RULE
+
+ This attribute can be specified only if the driver has connected
+ to the data source.
+ */
+ if ( !isConnected() )
+ MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_HY011 ) );
+
+ /*!
+ \internal
+ \todo support translation library
+ */
+ this->nTranslateOption = nTranslateOption;
+
+ MYODBCDbgReturn( SQL_SUCCESS );
+}
+
+MEnvironment *MConnection::getEnvironment()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn3( "%p", ((MEnvironment*)parent()) );
+}
+
+MDiagnostic *MConnection::getDiagnostic()
+{
+ MYODBCDbgEnter();
+
+ if ( pDiagnosticCaller )
+ MYODBCDbgReturn3( "%p", pDiagnosticCaller );
+
+ MYODBCDbgReturn3( "%p", pDiagnostic );
+}
+
+int MConnection::getServerAliveSanityCheckInterval()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn3( "%d", nServerAliveSanityCheckInterval );
+}
+
+QString MConnection::getDataSourceName()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn1( stringDataSourceName );
+}
+
+QString MConnection::getUserIdentifier()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn1( stringUserIdentifier );
+}
+
+SQLUINTEGER MConnection::getAccessMode()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn3( "%d", nAccessMode );
+}
+
+SQLUINTEGER MConnection::getAsyncEnable()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn3( "%d", nAsyncEnable );
+}
+
+SQLUINTEGER MConnection::getAutoIPD()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn3( "%d", SQL_TRUE );
+}
+
+SQLUINTEGER MConnection::getAutocommit()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn3( "%d", nAutocommit );
+}
+
+SQLUINTEGER MConnection::getConnectionTimeout()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn3( "%d", nConnectionTimeout );
+}
+
+SQLUINTEGER MConnection::getLoginTimeout()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn3( "%d", nLoginTimeout );
+}
+
+SQLUINTEGER MConnection::getMetadataID()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn3( "%d", nMetadataID );
+}
+
+SQLUINTEGER MConnection::getODBCCursors()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn3( "%d", nODBCCursors );
+}
+
+SQLUINTEGER MConnection::getPacketSize()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn3( "%d", nPacketSize );
+}
+
+HWND MConnection::getQuietMode()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn3( "%p", hQuietMode );
+}
+
+SQLUINTEGER MConnection::getTrace()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn3( "%d", nTrace );
+}
+
+QString MConnection::getTracefile()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn1( stringTracefile );
+}
+
+QString MConnection::getTranslateLib()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn1( stringTranslateLib );
+}
+
+qint32 MConnection::getTranslateOption()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn3( "%d", nTranslateOption );
+}
+
+qint32 MConnection::getTxnIsolation()
+{
+ MYODBCDbgEnter();
+
+ 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();
+
+ MYODBCDbgReturn1( "Y" );
+}
+
+QString MConnection::getInfoAccessibleTables()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn1( "Y" );
+}
+
+SQLUSMALLINT MConnection::getInfoActiveEnvironments()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn3( "%d", 0 );
+}
+
+SQLUINTEGER MConnection::getInfoAggregateFunctions()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn3( "%d", ( SQL_AF_ALL |
+ SQL_AF_AVG |
+ SQL_AF_COUNT |
+ SQL_AF_DISTINCT |
+ SQL_AF_MAX |
+ SQL_AF_MIN |
+ SQL_AF_SUM ) );
+}
+
+SQLUINTEGER MConnection::getInfoAlterDomain()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn3( "%d", 0 );
+}
+
+SQLUINTEGER MConnection::getInfoAlterTable()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn3( "%d", ( SQL_AT_ADD_COLUMN |
+ SQL_AT_DROP_COLUMN |
+ SQL_AT_ADD_COLUMN_COLLATION |
+ SQL_AT_ADD_COLUMN_DEFAULT |
+ SQL_AT_ADD_CONSTRAINT |
+ SQL_AT_ADD_TABLE_CONSTRAINT |
+ SQL_AT_CONSTRAINT_NAME_DEFINITION |
+ SQL_AT_SET_COLUMN_DEFAULT ) );
+}
+
+SQLUINTEGER MConnection::getInfoAsyncMode()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn3( "%d", SQL_AM_NONE );
+}
+
+SQLUINTEGER MConnection::getInfoBatchRowCount()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn3( "%d", ( SQL_BRC_PROCEDURES |
+ SQL_BRC_EXPLICIT ) );
+}
+
+SQLUINTEGER MConnection::getInfoBatchSupport()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn3( "%d", ( SQL_BS_SELECT_EXPLICIT |
+ SQL_BS_ROW_COUNT_EXPLICIT |
+ SQL_BS_SELECT_PROC |
+ SQL_BS_ROW_COUNT_PROC ) );
+}
+
+SQLUINTEGER MConnection::getInfoBookmarkPersistence()
+{
+ MYODBCDbgEnter();
+ /*!
+ \internal
+ \todo
+
+ Add support for some kind of bookmark.
+
+ SQL_BP_CLOSE
+ SQL_BP_DELETE
+ SQL_BP_DROP
+ SQL_BP_TRANSACTION
+ SQL_BP_UPDATE
+ SQL_BP_OTHER_HSTMT
+ */
+ MYODBCDbgReturn3( "%d", 0 );
+}
+
+SQLUSMALLINT MConnection::getInfoCatalogLocation()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn3( "%d", SQL_CL_START );
+}
+
+QString MConnection::getInfoCatalogName()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn1( "Y" );
+}
+
+QString MConnection::getInfoCatalogNameSeparator()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn1( "." );
+}
+
+QString MConnection::getInfoCatalogTerm()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn1( "database" );
+}
+
+SQLUINTEGER MConnection::getInfoCatalogUsage()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn3( "%d", ( SQL_CU_DML_STATEMENTS |
+ SQL_CU_PROCEDURE_INVOCATION |
+ SQL_CU_TABLE_DEFINITION |
+ SQL_CU_INDEX_DEFINITION |
+ SQL_CU_PRIVILEGE_DEFINITION ) );
+}
+
+QString MConnection::getInfoCollationSeq()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn1( "" );
+}
+
+QString MConnection::getInfoColumnAlias()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn1( "Y" );
+}
+
+SQLUSMALLINT MConnection::getInfoConcatNullBehavior()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn3( "%d", SQL_CB_NULL );
+}
+
+SQLUINTEGER MConnection::getInfoConvertBigint()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn3( "%d", ( SQL_CVT_CHAR |
+ SQL_CVT_NUMERIC |
+ SQL_CVT_DECIMAL |
+ SQL_CVT_INTEGER |
+ SQL_CVT_SMALLINT |
+ SQL_CVT_FLOAT |
+ SQL_CVT_REAL |
+ SQL_CVT_DOUBLE |
+ SQL_CVT_VARCHAR |
+ SQL_CVT_LONGVARCHAR |
+ SQL_CVT_BIT |
+ SQL_CVT_TINYINT |
+ SQL_CVT_BIGINT |
+ SQL_CVT_DATE |
+ SQL_CVT_TIME |
+ SQL_CVT_TIMESTAMP ) );
+}
+
+SQLUINTEGER MConnection::getInfoConvertBinary()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn3( "%d", 0L );
+}
+
+SQLUINTEGER MConnection::getInfoConvertBit()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn3( "%d", ( SQL_CVT_CHAR |
+ SQL_CVT_NUMERIC |
+ SQL_CVT_DECIMAL |
+ SQL_CVT_INTEGER |
+ SQL_CVT_SMALLINT |
+ SQL_CVT_FLOAT |
+ SQL_CVT_REAL |
+ SQL_CVT_DOUBLE |
+ SQL_CVT_VARCHAR |
+ SQL_CVT_LONGVARCHAR |
+ SQL_CVT_BIT |
+ SQL_CVT_TINYINT |
+ SQL_CVT_BIGINT |
+ SQL_CVT_DATE |
+ SQL_CVT_TIME |
+ SQL_CVT_TIMESTAMP ) );
+}
+
+SQLUINTEGER MConnection::getInfoConvertChar()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn3( "%d", ( SQL_CVT_CHAR |
+ SQL_CVT_NUMERIC |
+ SQL_CVT_DECIMAL |
+ SQL_CVT_INTEGER |
+ SQL_CVT_SMALLINT |
+ SQL_CVT_FLOAT |
+ SQL_CVT_REAL |
+ SQL_CVT_DOUBLE |
+ SQL_CVT_VARCHAR |
+ SQL_CVT_LONGVARCHAR |
+ SQL_CVT_BIT |
+ SQL_CVT_TINYINT |
+ SQL_CVT_BIGINT |
+ SQL_CVT_DATE |
+ SQL_CVT_TIME |
+ SQL_CVT_TIMESTAMP ) );
+}
+
+SQLUINTEGER MConnection::getInfoConvertGuid()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn3( "%d", 0L );
+}
+
+SQLUINTEGER MConnection::getInfoConvertDate()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn3( "%d", ( SQL_CVT_CHAR |
+ SQL_CVT_NUMERIC |
+ SQL_CVT_DECIMAL |
+ SQL_CVT_INTEGER |
+ SQL_CVT_SMALLINT |
+ SQL_CVT_FLOAT |
+ SQL_CVT_REAL |
+ SQL_CVT_DOUBLE |
+ SQL_CVT_VARCHAR |
+ SQL_CVT_LONGVARCHAR |
+ SQL_CVT_BIT |
+ SQL_CVT_TINYINT |
+ SQL_CVT_BIGINT |
+ SQL_CVT_DATE |
+ SQL_CVT_TIME |
+ SQL_CVT_TIMESTAMP ) );
+}
+
+SQLUINTEGER MConnection::getInfoConvertDecimal()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn3( "%d", ( SQL_CVT_CHAR |
+ SQL_CVT_NUMERIC |
+ SQL_CVT_DECIMAL |
+ SQL_CVT_INTEGER |
+ SQL_CVT_SMALLINT |
+ SQL_CVT_FLOAT |
+ SQL_CVT_REAL |
+ SQL_CVT_DOUBLE |
+ SQL_CVT_VARCHAR |
+ SQL_CVT_LONGVARCHAR |
+ SQL_CVT_BIT |
+ SQL_CVT_TINYINT |
+ SQL_CVT_BIGINT |
+ SQL_CVT_DATE |
+ SQL_CVT_TIME |
+ SQL_CVT_TIMESTAMP ) );
+}
+
+SQLUINTEGER MConnection::getInfoConvertDouble()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn3( "%d", ( SQL_CVT_CHAR |
+ SQL_CVT_NUMERIC |
+ SQL_CVT_DECIMAL |
+ SQL_CVT_INTEGER |
+ SQL_CVT_SMALLINT |
+ SQL_CVT_FLOAT |
+ SQL_CVT_REAL |
+ SQL_CVT_DOUBLE |
+ SQL_CVT_VARCHAR |
+ SQL_CVT_LONGVARCHAR |
+ SQL_CVT_BIT |
+ SQL_CVT_TINYINT |
+ SQL_CVT_BIGINT |
+ SQL_CVT_DATE |
+ SQL_CVT_TIME |
+ SQL_CVT_TIMESTAMP ) );
+}
+
+SQLUINTEGER MConnection::getInfoConvertFloat()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn3( "%d", ( SQL_CVT_CHAR |
+ SQL_CVT_NUMERIC |
+ SQL_CVT_DECIMAL |
+ SQL_CVT_INTEGER |
+ SQL_CVT_SMALLINT |
+ SQL_CVT_FLOAT |
+ SQL_CVT_REAL |
+ SQL_CVT_DOUBLE |
+ SQL_CVT_VARCHAR |
+ SQL_CVT_LONGVARCHAR |
+ SQL_CVT_BIT |
+ SQL_CVT_TINYINT |
+ SQL_CVT_BIGINT |
+ SQL_CVT_DATE |
+ SQL_CVT_TIME |
+ SQL_CVT_TIMESTAMP ) );
+}
+
+SQLUINTEGER MConnection::getInfoConvertInteger()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn3( "%d", ( SQL_CVT_CHAR |
+ SQL_CVT_NUMERIC |
+ SQL_CVT_DECIMAL |
+ SQL_CVT_INTEGER |
+ SQL_CVT_SMALLINT |
+ SQL_CVT_FLOAT |
+ SQL_CVT_REAL |
+ SQL_CVT_DOUBLE |
+ SQL_CVT_VARCHAR |
+ SQL_CVT_LONGVARCHAR |
+ SQL_CVT_BIT |
+ SQL_CVT_TINYINT |
+ SQL_CVT_BIGINT |
+ SQL_CVT_DATE |
+ SQL_CVT_TIME |
+ SQL_CVT_TIMESTAMP ) );
+}
+
+SQLUINTEGER MConnection::getInfoConvertIntervalYearMonth()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn3( "%d", 0L );
+}
+
+SQLUINTEGER MConnection::getInfoConvertIntervalDayTime()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn3( "%d", 0L );
+}
+
+SQLUINTEGER MConnection::getInfoConvertLongvarbinary()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn3( "%d", 0L );
+}
+
+SQLUINTEGER MConnection::getInfoConvertLongvarchar()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn3( "%d", ( SQL_CVT_CHAR |
+ SQL_CVT_NUMERIC |
+ SQL_CVT_DECIMAL |
+ SQL_CVT_INTEGER |
+ SQL_CVT_SMALLINT |
+ SQL_CVT_FLOAT |
+ SQL_CVT_REAL |
+ SQL_CVT_DOUBLE |
+ SQL_CVT_VARCHAR |
+ SQL_CVT_LONGVARCHAR |
+ SQL_CVT_BIT |
+ SQL_CVT_TINYINT |
+ SQL_CVT_BIGINT |
+ SQL_CVT_DATE |
+ SQL_CVT_TIME |
+ SQL_CVT_TIMESTAMP ) );
+}
+
+SQLUINTEGER MConnection::getInfoConvertNumeric()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn3( "%d", ( SQL_CVT_CHAR |
+ SQL_CVT_NUMERIC |
+ SQL_CVT_DECIMAL |
+ SQL_CVT_INTEGER |
+ SQL_CVT_SMALLINT |
+ SQL_CVT_FLOAT |
+ SQL_CVT_REAL |
+ SQL_CVT_DOUBLE |
+ SQL_CVT_VARCHAR |
+ SQL_CVT_LONGVARCHAR |
+ SQL_CVT_BIT |
+ SQL_CVT_TINYINT |
+ SQL_CVT_BIGINT |
+ SQL_CVT_DATE |
+ SQL_CVT_TIME |
+ SQL_CVT_TIMESTAMP ) );
+}
+
+SQLUINTEGER MConnection::getInfoConvertReal()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn3( "%d", ( SQL_CVT_CHAR |
+ SQL_CVT_NUMERIC |
+ SQL_CVT_DECIMAL |
+ SQL_CVT_INTEGER |
+ SQL_CVT_SMALLINT |
+ SQL_CVT_FLOAT |
+ SQL_CVT_REAL |
+ SQL_CVT_DOUBLE |
+ SQL_CVT_VARCHAR |
+ SQL_CVT_LONGVARCHAR |
+ SQL_CVT_BIT |
+ SQL_CVT_TINYINT |
+ SQL_CVT_BIGINT |
+ SQL_CVT_DATE |
+ SQL_CVT_TIME |
+ SQL_CVT_TIMESTAMP ) );
+}
+
+SQLUINTEGER MConnection::getInfoConvertSmallint()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn3( "%d", ( SQL_CVT_CHAR |
+ SQL_CVT_NUMERIC |
+ SQL_CVT_DECIMAL |
+ SQL_CVT_INTEGER |
+ SQL_CVT_SMALLINT |
+ SQL_CVT_FLOAT |
+ SQL_CVT_REAL |
+ SQL_CVT_DOUBLE |
+ SQL_CVT_VARCHAR |
+ SQL_CVT_LONGVARCHAR |
+ SQL_CVT_BIT |
+ SQL_CVT_TINYINT |
+ SQL_CVT_BIGINT |
+ SQL_CVT_DATE |
+ SQL_CVT_TIME |
+ SQL_CVT_TIMESTAMP ) );
+}
+
+SQLUINTEGER MConnection::getInfoConvertTime()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn3( "%d", ( SQL_CVT_CHAR |
+ SQL_CVT_NUMERIC |
+ SQL_CVT_DECIMAL |
+ SQL_CVT_INTEGER |
+ SQL_CVT_SMALLINT |
+ SQL_CVT_FLOAT |
+ SQL_CVT_REAL |
+ SQL_CVT_DOUBLE |
+ SQL_CVT_VARCHAR |
+ SQL_CVT_LONGVARCHAR |
+ SQL_CVT_BIT |
+ SQL_CVT_TINYINT |
+ SQL_CVT_BIGINT |
+ SQL_CVT_DATE |
+ SQL_CVT_TIME |
+ SQL_CVT_TIMESTAMP ) );
+}
+
+SQLUINTEGER MConnection::getInfoConvertTimestamp()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn3( "%d", ( SQL_CVT_CHAR |
+ SQL_CVT_NUMERIC |
+ SQL_CVT_DECIMAL |
+ SQL_CVT_INTEGER |
+ SQL_CVT_SMALLINT |
+ SQL_CVT_FLOAT |
+ SQL_CVT_REAL |
+ SQL_CVT_DOUBLE |
+ SQL_CVT_VARCHAR |
+ SQL_CVT_LONGVARCHAR |
+ SQL_CVT_BIT |
+ SQL_CVT_TINYINT |
+ SQL_CVT_BIGINT |
+ SQL_CVT_DATE |
+ SQL_CVT_TIME |
+ SQL_CVT_TIMESTAMP ) );
+}
+
+SQLUINTEGER MConnection::getInfoConvertTinyint()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn3( "%d", ( SQL_CVT_CHAR |
+ SQL_CVT_NUMERIC |
+ SQL_CVT_DECIMAL |
+ SQL_CVT_INTEGER |
+ SQL_CVT_SMALLINT |
+ SQL_CVT_FLOAT |
+ SQL_CVT_REAL |
+ SQL_CVT_DOUBLE |
+ SQL_CVT_VARCHAR |
+ SQL_CVT_LONGVARCHAR |
+ SQL_CVT_BIT |
+ SQL_CVT_TINYINT |
+ SQL_CVT_BIGINT |
+ SQL_CVT_DATE |
+ SQL_CVT_TIME |
+ SQL_CVT_TIMESTAMP ) );
+}
+
+SQLUINTEGER MConnection::getInfoConvertVarbinary()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn3( "%d", 0L );
+}
+
+SQLUINTEGER MConnection::getInfoConvertVarchar()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn3( "%d", ( SQL_CVT_CHAR |
+ SQL_CVT_NUMERIC |
+ SQL_CVT_DECIMAL |
+ SQL_CVT_INTEGER |
+ SQL_CVT_SMALLINT |
+ SQL_CVT_FLOAT |
+ SQL_CVT_REAL |
+ SQL_CVT_DOUBLE |
+ SQL_CVT_VARCHAR |
+ SQL_CVT_LONGVARCHAR |
+ SQL_CVT_BIT |
+ SQL_CVT_TINYINT |
+ SQL_CVT_BIGINT |
+ SQL_CVT_DATE |
+ SQL_CVT_TIME |
+ SQL_CVT_TIMESTAMP ) );
+}
+
+SQLUINTEGER MConnection::getInfoConvertFunctions()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn3( "%d", 0L );
+}
+
+SQLUINTEGER MConnection::getInfoCorrelationName()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn3( "%d", SQL_CN_DIFFERENT );
+}
+
+SQLUINTEGER MConnection::getInfoCreateAssertion()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn3( "%d", 0L );
+}
+
+SQLUINTEGER MConnection::getInfoCreateCharacterSet()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn3( "%d", 0L );
+}
+
+SQLUINTEGER MConnection::getInfoCreateCollation()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn3( "%d", 0L );
+}
+
+SQLUINTEGER MConnection::getInfoCreateDomain()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn3( "%d", 0L );
+}
+
+SQLUINTEGER MConnection::getInfoCreateSchema()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn3( "%d", 0L );
+}
+
+SQLUINTEGER MConnection::getInfoCreateTable()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn3( "%d", ( SQL_CT_CREATE_TABLE |
+ SQL_CT_TABLE_CONSTRAINT |
+ SQL_CT_CONSTRAINT_NAME_DEFINITION |
+ SQL_CT_COMMIT_DELETE |
+ SQL_CT_LOCAL_TEMPORARY |
+ SQL_CT_COLUMN_CONSTRAINT |
+ SQL_CT_COLUMN_DEFAULT |
+ SQL_CT_COLUMN_COLLATION ) );
+}
+
+SQLUINTEGER MConnection::getInfoCreateTranslation()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn3( "%d", 0L );
+}
+
+SQLUINTEGER MConnection::getInfoCreateView()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn3( "%d", SQL_CV_CREATE_VIEW );
+}
+
+SQLUSMALLINT MConnection::getInfoCursorCommitBehavior()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn3( "%d", SQL_CB_PRESERVE );
+}
+
+SQLUSMALLINT MConnection::getInfoCursorRollbackBehavior()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn3( "%d", SQL_CB_PRESERVE );
+}
+
+SQLUINTEGER MConnection::getInfoCursorSensitivity()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn3( "%d", SQL_UNSPECIFIED );
+}
+
+QString MConnection::getInfoDataSourceName()
+{
+ MYODBCDbgEnter();
+
+ if ( getDataSourceName().isNull() )
+ MYODBCDbgReturn1( "" );
+
+ MYODBCDbgReturn1( getDataSourceName() );
+}
+
+QString MConnection::getInfoDataSourceReadOnly()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn1( "N" );
+}
+
+QString MConnection::getInfoDatabaseName()
+{
+ MYODBCDbgEnter();
+
+ /*!
+ \internal ODBC Rule
+
+ A character string with the name of the current database in use, if the data
source defines
+ a named object called "database".
+ ... also SQL_ATTR_CURRENT_CATALOG.
+ */
+ /*!
+ \internal MYODBC Rule
+
+ We account for the fact that SQL_ATTR_CURRENT_CATALOG may be inaccurate due
+ to the possible use of "USE DATABASE". So this may not be the value of 'database'
from
+ a DSN.
+ */
+ QString stringDatabaseName = getCurrentCatalog();
+
+ if ( stringDatabaseName.isNull() )
+ MYODBCDbgReturn1( "" );
+
+ MYODBCDbgReturn1( stringDatabaseName );
+}
+
+SQLUINTEGER MConnection::getInfoDatetimeLiterals()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn3( "%d", ( SQL_DL_SQL92_DATE |
+ SQL_DL_SQL92_TIME |
+ SQL_DL_SQL92_TIMESTAMP ) );
+}
+
+QString MConnection::getInfoDbmsName()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn1( "MySQL" );
+}
+
+SQLUINTEGER MConnection::getInfoDdlIndex()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn3( "%d", ( SQL_DI_CREATE_INDEX |
+ SQL_DI_DROP_INDEX ) );
+}
+
+SQLUINTEGER MConnection::getInfoDefaultTxnIsolation()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn3( "%d", SQL_TXN_READ_COMMITTED );
+}
+
+QString MConnection::getInfoDescribeParameter()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn1( "N" );
+}
+
+QString MConnection::getInfoDmVer()
+{
+ MYODBCDbgEnter();
+
+ /*!
+ \internal MYODBC RULE
+
+ We are not, of course, a Driver Manager. However; applications may link to
+ us directly. I suppose that someone could even use us as a replacement for
+ a DM (say on a lean machine). So lets fake it. Applications mileage may vary.
+ */
+ MYODBCDbgReturn1( (SQL_SPEC_STRING ".0000.0000") );
+}
+
+SQLUINTEGER MConnection::getInfoDriverHdbc()
+{
+ MYODBCDbgEnter();
+
+ /*!
+ \internal
+ \note
+
+ The request is to get the *drivers* connection handle.
+
+ The only way we would get this request is if the app linked directly to the
driver - if there
+ is no driver manager in the equation. So we just return "this" as we are the
handle the caller is
+ looking for.
+ */
+ MYODBCDbgReturn3( "%d", (SQLUINTEGER)this );
+}
+
+SQLUINTEGER MConnection::getInfoDriverHenv()
+{
+ MYODBCDbgEnter();
+
+ /*!
+ \internal
+ \note
+
+ The request is to get the *drivers* environment handle for this connection.
+
+ The only way we would get this request is if the app linked directly to the
driver - if there
+ is no driver manager in the equation.
+ */
+ MYODBCDbgReturn3( "%d", (SQLUINTEGER)getEnvironment() );
+}
+
+QString MConnection::getInfoDriverName()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn1( MYODBC_DRIVER_NAME );
+}
+
+QString MConnection::getInfoDriverOdbcVer()
+{
+ MYODBCDbgEnter();
+
+ /*!
+ \internal ODBC RULE
+
+ A character string with the version of ODBC that the driver supports. The version
is of the form ##.##,
+ where the first two digits are the major version and the next two digits are the
minor version.
+
+ \note
+
+ We report what we want to support (latest) - not what we actually support. In
this way we hope to get feedback
+ about features missing and implement them in the order which best reflects the
needs of the
+ community.
+ */
+ MYODBCDbgReturn1( SQL_SPEC_STRING );
+}
+
+QString MConnection::getInfoDriverVer()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn1( MYODBC_VERSION );
+}
+
+SQLUINTEGER MConnection::getInfoDropAssertion()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn3( "%d", 0L );
+}
+
+SQLUINTEGER MConnection::getInfoDropCharacterSet()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn3( "%d", 0L );
+}
+
+SQLUINTEGER MConnection::getInfoDropCollation()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn3( "%d", 0L );
+}
+
+SQLUINTEGER MConnection::getInfoDropDomain()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn3( "%d", 0L );
+}
+
+SQLUINTEGER MConnection::getInfoDropSchema()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn3( "%d", 0L );
+}
+
+SQLUINTEGER MConnection::getInfoDropTable()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn3( "%d", ( SQL_DT_DROP_TABLE |
+ SQL_DT_CASCADE |
+ SQL_DT_RESTRICT ) );
+}
+
+SQLUINTEGER MConnection::getInfoDropTranslation()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn3( "%d", 0L );
+}
+
+SQLUINTEGER MConnection::getInfoDropView()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn3( "%d", SQL_DT_DROP_TABLE );
+}
+
+SQLUINTEGER MConnection::getInfoDynamicCursorAttributes1()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn3( "%d", 0L );
+/*!
+ \internal
+ \todo
+ MYODBCDbgReturn3( "%d", ( SQL_CA1_NEXT |
+ SQL_CA1_ABSOLUTE |
+ SQL_CA1_RELATIVE |
+ SQL_CA1_LOCK_NO_CHANGE |
+ SQL_CA1_POS_POSITION |
+ SQL_CA1_POS_UPDATE |
+ SQL_CA1_POS_DELETE |
+ SQL_CA1_POS_REFRESH |
+ SQL_CA1_POSITIONED_UPDATE |
+ SQL_CA1_POSITIONED_DELETE |
+ SQL_CA1_BULK_ADD ) );
+*/
+}
+
+SQLUINTEGER MConnection::getInfoDynamicCursorAttributes2()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn3( "%d", 0L );
+/*!
+ \internal
+ \todo
+ MYODBCDbgReturn3( "%d", ( SQL_CA2_SENSITIVITY_ADDITIONS |
+ SQL_CA2_SENSITIVITY_DELETIONS |
+ SQL_CA2_SENSITIVITY_UPDATES |
+ SQL_CA2_MAX_ROWS_SELECT |
+ SQL_CA2_MAX_ROWS_INSERT |
+ SQL_CA2_MAX_ROWS_DELETE |
+ SQL_CA2_MAX_ROWS_UPDATE |
+ SQL_CA2_CRC_EXACT |
+ SQL_CA2_SIMULATE_TRY_UNIQUE ) );
+*/
+}
+
+QString MConnection::getInfoExpressionsInOrderby()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn1( "Y" );
+}
+
+SQLUINTEGER MConnection::getInfoFetchDirection()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn3( "%d", ( SQL_FD_FETCH_NEXT |
+ SQL_FD_FETCH_FIRST |
+ SQL_FD_FETCH_LAST |
+ SQL_FD_FETCH_PRIOR |
+ SQL_FD_FETCH_ABSOLUTE |
+ SQL_FD_FETCH_RELATIVE ) );
+}
+
+SQLUSMALLINT MConnection::getInfoFileUsage()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn3( "%d", SQL_FILE_NOT_SUPPORTED );
+}
+
+SQLUINTEGER MConnection::getInfoForwardOnlyCursorAttributes1()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn3( "%d", ( SQL_CA1_NEXT |
+// SQL_CA1_ABSOLUTE |
+// SQL_CA1_RELATIVE |
+ SQL_CA1_LOCK_NO_CHANGE |
+ SQL_CA1_POS_POSITION |
+ SQL_CA1_POS_UPDATE |
+ SQL_CA1_POS_DELETE |
+ SQL_CA1_POS_REFRESH |
+ SQL_CA1_POSITIONED_UPDATE |
+ SQL_CA1_POSITIONED_DELETE |
+ SQL_CA1_BULK_ADD ) );
+}
+
+SQLUINTEGER MConnection::getInfoForwardOnlyCursorAttributes2()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn3( "%d", ( SQL_CA2_MAX_ROWS_SELECT |
+ SQL_CA2_MAX_ROWS_INSERT |
+ SQL_CA2_MAX_ROWS_DELETE |
+ SQL_CA2_MAX_ROWS_UPDATE |
+ SQL_CA2_CRC_EXACT ) );
+}
+
+SQLUINTEGER MConnection::getInfoGetdataExtensions()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn3( "%d", ( SQL_GD_ANY_COLUMN |
+ SQL_GD_ANY_ORDER |
+ SQL_GD_BOUND |
+ SQL_GD_BLOCK ) );
+}
+
+SQLUSMALLINT MConnection::getInfoGroupBy()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn3( "%d", SQL_GB_NO_RELATION );
+}
+
+SQLUSMALLINT MConnection::getInfoIdentifierCase()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn3( "%d", SQL_IC_MIXED );
+}
+
+QString MConnection::getInfoIdentifierQuoteChar()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn1( "`" );
+}
+
+SQLUINTEGER MConnection::getInfoIndexKeywords()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn3( "%d", SQL_IK_NONE );
+}
+
+SQLUINTEGER MConnection::getInfoInfoSchemaViews()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn3( "%d", 0L );
+}
+
+SQLUINTEGER MConnection::getInfoInsertStatement()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn3( "%d", ( SQL_IS_INSERT_LITERALS |
+ SQL_IS_INSERT_SEARCHED |
+ SQL_IS_SELECT_INTO ) );
+}
+
+QString MConnection::getInfoIntegrity()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn1( "N" );
+}
+
+SQLUINTEGER MConnection::getInfoKeysetCursorAttributes1()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn3( "%d", 0L );
+}
+
+SQLUINTEGER MConnection::getInfoKeysetCursorAttributes2()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn3( "%d", 0L );
+}
+
+QString MConnection::getInfoKeywords()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn1(
"UNIQUE,ZEROFILL,UNSIGNED,BIGINT,BLOB,TINYBLOB,MEDIMUMBLOB,LONGBLOB,MEDIUMINT,PROCEDURE,SHOW,LIMIT,DEFAULT,TABLES,REGEXP,RLIKE,KEYS,TINYTEXT,MEDIUMTEXT"
);
+}
+
+QString MConnection::getInfoLikeEscapeClause()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn1( "Y" );
+}
+
+SQLUINTEGER MConnection::getInfoLockTypes()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn3( "%d", 0L );
+}
+
+SQLUINTEGER MConnection::getInfoMaxAsyncConcurrentStatements()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn3( "%d", 0L );
+}
+
+SQLUINTEGER MConnection::getInfoMaxBinaryLiteralLen()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn3( "%d", 0L );
+}
+
+SQLUSMALLINT MConnection::getInfoMaxCatalogNameLen()
+{
+ MYODBCDbgEnter();
+
+ /*!
+ \internal
+ \note
+
+ NAME_LEN is, at this time, found in mysql_com.h.
+ */
+ MYODBCDbgReturn3( "%d", NAME_LEN );
+}
+
+SQLUINTEGER MConnection::getInfoMaxCharLiteralLen()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn3( "%d", 0L );
+}
+
+SQLUSMALLINT MConnection::getInfoMaxColumnNameLen()
+{
+ MYODBCDbgEnter();
+
+ /*!
+ \internal
+ \note
+
+ NAME_LEN is, at this time, found in mysql_com.h.
+ */
+ MYODBCDbgReturn3( "%d", NAME_LEN );
+}
+
+SQLUSMALLINT MConnection::getInfoMaxColumnsInGroupBy()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn3( "%d", 0L );
+}
+
+SQLUSMALLINT MConnection::getInfoMaxColumnsInIndex()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn3( "%d", 32 );
+}
+
+SQLUSMALLINT MConnection::getInfoMaxColumnsInOrderBy()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn3( "%d", 0L );
+}
+
+SQLUSMALLINT MConnection::getInfoMaxColumnsInSelect()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn3( "%d", 0L );
+}
+
+SQLUSMALLINT MConnection::getInfoMaxColumnsInTable()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn3( "%d", 0L );
+}
+
+SQLUSMALLINT MConnection::getInfoMaxConcurrentActivities()
+{
+ MYODBCDbgEnter();
+
+ /*!
+ \todo
+
+ We need to be smarter about this. There are certian circumstances where we
+ can support unlimited (for example if we store all results for the connection).
+ But for now lets just support a single activity per connection.
+ */
+ MYODBCDbgReturn3( "%d", 1L );
+// MYODBCDbgReturn3( "%d", 0L );
+}
+
+SQLUSMALLINT MConnection::getInfoMaxCursorNameLen()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn3( "%d", 0L );
+}
+
+SQLUINTEGER MConnection::getInfoMaxDriverConnections()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn3( "%d", 0L );
+}
+
+SQLUSMALLINT MConnection::getInfoMaxIdentifierLen()
+{
+ MYODBCDbgEnter();
+
+ /*!
+ \internal
+ \note
+
+ NAME_LEN is, at this time, found in mysql_com.h.
+ */
+ MYODBCDbgReturn3( "%d", NAME_LEN );
+}
+
+SQLUINTEGER MConnection::getInfoMaxIndexSize()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn3( "%d", 500 );
+}
+
+SQLUSMALLINT MConnection::getInfoMaxProcedureNameLen()
+{
+ MYODBCDbgEnter();
+
+ /*!
+ \internal
+ \note
+
+ NAME_LEN is, at this time, found in mysql_com.h.
+ */
+ MYODBCDbgReturn3( "%d", NAME_LEN );
+}
+
+SQLUINTEGER MConnection::getInfoMaxRowSize()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn3( "%d", 0L );
+}
+
+QString MConnection::getInfoMaxRowSizeIncludesLong()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn1( "Y" );
+}
+
+SQLUSMALLINT MConnection::getInfoMaxSchemaNameLen()
+{
+ MYODBCDbgEnter();
+
+ /*!
+ \internal
+ \note
+
+ NAME_LEN is, at this time, found in mysql_com.h.
+ */
+ MYODBCDbgReturn3( "%d", NAME_LEN );
+}
+
+SQLUINTEGER MConnection::getInfoMaxStatementLen()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn3( "%d", net_buffer_length );
+}
+
+SQLUSMALLINT MConnection::getInfoMaxTableNameLen()
+{
+ MYODBCDbgEnter();
+
+ /*!
+ \internal
+ \note
+
+ NAME_LEN is, at this time, found in mysql_com.h.
+ */
+ MYODBCDbgReturn3( "%d", NAME_LEN );
+}
+
+SQLUSMALLINT MConnection::getInfoMaxTablesInSelect()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn3( "%d", 31 );
+}
+
+SQLUSMALLINT MConnection::getInfoMaxUserNameLen()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn3( "%d", 16 );
+}
+
+QString MConnection::getInfoMultiResultSets()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn1( "Y" );
+}
+
+QString MConnection::getInfoMultipleActiveTxn()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn1( "Y" );
+}
+
+QString MConnection::getInfoNeedLongDataLen()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn1( "N" );
+}
+
+SQLUSMALLINT MConnection::getInfoNonNullableColumns()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn3( "%d", SQL_NNC_NON_NULL );
+}
+
+SQLUSMALLINT MConnection::getInfoNullCollation()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn3( "%d", SQL_NC_START );
+}
+
+SQLUINTEGER MConnection::getInfoNumericFunctions()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn3( "%d", ( SQL_FN_NUM_ABS |
+ SQL_FN_NUM_ACOS |
+ SQL_FN_NUM_ASIN |
+ SQL_FN_NUM_ATAN |
+ SQL_FN_NUM_ATAN2 |
+ SQL_FN_NUM_CEILING |
+ SQL_FN_NUM_COS |
+ SQL_FN_NUM_COT |
+ SQL_FN_NUM_EXP |
+ SQL_FN_NUM_FLOOR |
+ SQL_FN_NUM_LOG |
+ SQL_FN_NUM_MOD |
+ SQL_FN_NUM_SIGN |
+ SQL_FN_NUM_SIN |
+ SQL_FN_NUM_SQRT |
+ SQL_FN_NUM_TAN |
+ SQL_FN_NUM_PI |
+ SQL_FN_NUM_RAND |
+ SQL_FN_NUM_DEGREES |
+ SQL_FN_NUM_LOG10 |
+ SQL_FN_NUM_POWER |
+ SQL_FN_NUM_RADIANS |
+ SQL_FN_NUM_ROUND |
+ SQL_FN_NUM_TRUNCATE ) );
+}
+
+SQLUSMALLINT MConnection::getInfoOdbcApiConformance()
+{
+ MYODBCDbgEnter();
+
+ /*!
+ \internal
+ \note
+
+ MS Access 2000 (possibly other versions) requires a driver to report
+ SQL_OAC_LEVEL1 or better.
+ */
+ MYODBCDbgReturn3( "%d", SQL_OAC_LEVEL1 );
+}
+
+SQLUINTEGER MConnection::getInfoOdbcInterfaceConformance()
+{
+ MYODBCDbgEnter();
+ MYODBCDbgReturn3( "%d", SQL_OIC_CORE );
+}
+
+SQLSMALLINT MConnection::getInfoOdbcSqlConformance()
+{
+ MYODBCDbgEnter();
+ MYODBCDbgReturn3( "%d", SQL_OSC_MINIMUM );
+}
+
+QString MConnection::getInfoOdbcVer()
+{
+ MYODBCDbgEnter();
+
+ /*!
+ \internal MYODBC RULE
+
+ We are not, of course, a Driver Manager. However; applications may link to
+ us directly so lets handle this.
+ */
+ /*!
+ \internal ODBC RULE
+
+ A character string with the version of ODBC to which the Driver Manager
+ conforms. The version is of the form ##.##.0000, where the first two digits
+ are the major version and the next two digits are the minor version. This
+ is implemented solely in the Driver Manager.
+ */
+ MYODBCDbgReturn1( SQL_SPEC_STRING ".0000" );
+}
+
+SQLUINTEGER MConnection::getInfoOjCapabilities()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn3( "%d", ( SQL_OJ_LEFT |
+ SQL_OJ_NESTED |
+ SQL_OJ_NOT_ORDERED |
+ SQL_OJ_INNER |
+ SQL_OJ_ALL_COMPARISON_OPS |
+ SQL_OJ_RIGHT ) );
+}
+
+QString MConnection::getInfoOrderByColumnsInSelect()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn1( "Y" );
+}
+
+SQLUINTEGER MConnection::getInfoParamArrayRowCounts()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn3( "%d", SQL_PARC_NO_BATCH );
+}
+
+SQLUINTEGER MConnection::getInfoParamArraySelects()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn3( "%d", SQL_PAS_NO_SELECT );
+}
+
+QString MConnection::getInfoProcedureTerm()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn1( "procedure" );
+}
+
+QString MConnection::getInfoProcedures()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn1( "Y" );
+}
+
+SQLUINTEGER MConnection::getInfoPosOperations()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn3( "%d", ( SQL_POS_POSITION |
+ SQL_POS_UPDATE |
+ SQL_POS_DELETE |
+ SQL_POS_ADD |
+ SQL_POS_REFRESH ) );
+}
+
+SQLUINTEGER MConnection::getInfoPositionedStatements()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn3( "%d", ( SQL_PS_POSITIONED_DELETE |
+ SQL_PS_POSITIONED_UPDATE ) );
+}
+
+SQLUSMALLINT MConnection::getInfoQuotedIdentifierCase()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn3( "%d", SQL_IC_SENSITIVE );
+}
+
+QString MConnection::getInfoRowUpdates()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn1( "N" );
+}
+
+QString MConnection::getInfoSchemaTerm()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn1( "schema" );
+}
+
+SQLUINTEGER MConnection::getInfoSchemaUsage()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn3( "%d", 0L );
+}
+
+SQLUINTEGER MConnection::getInfoScrollConcurrency()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn3( "%d", ( SQL_SS_ADDITIONS |
+ SQL_SS_DELETIONS |
+ SQL_SS_UPDATES ) );
+}
+
+SQLUINTEGER MConnection::getInfoScrollOptions()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn3( "%d", SQL_SO_FORWARD_ONLY );
+/*!
+ \internal
+ \todo
+ MYODBCDbgReturn3( "%d", ( SQL_SO_FORWARD_ONLY |
+ SQL_SO_STATIC |
+ SQL_SO_KEYSET_DRIVEN |
+ SQL_SO_DYNAMIC |
+ SQL_SO_MIXED ) );
+*/
+}
+
+QString MConnection::getInfoSearchPatternEscape()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn1( "\\" );
+}
+
+QString MConnection::getInfoSpecialCharacters()
+{
+ MYODBCDbgEnter();
+
+ char MYODBC_DRV_VALID_CHARS[]=
+ {
+ '\307','\374','\351','\342','\344','\340','\345','\347','\352','\353',
+ '\350','\357','\356','\354','\304','\305','\311','\346','\306','\364',
+ '\366','\362','\373','\371','\377','\326','\334','\341','\355','\363',
+ '\372','\361','\321',0
+ };
+
+ MYODBCDbgReturn1( MYODBC_DRV_VALID_CHARS );
+}
+
+SQLUINTEGER MConnection::getInfoSqlConformance()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn3( "%d", SQL_SC_SQL92_INTERMEDIATE );
+}
+
+SQLUINTEGER MConnection::getInfoSql92DatetimeFunctions()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn3( "%d", ( SQL_SDF_CURRENT_DATE |
+ SQL_SDF_CURRENT_TIME |
+ SQL_SDF_CURRENT_TIMESTAMP ) );
+}
+
+SQLUINTEGER MConnection::getInfoSql92ForeignKeyDeleteRule()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn3( "%d", 0L );
+}
+
+SQLUINTEGER MConnection::getInfoSql92ForeignKeyUpdateRule()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn3( "%d", 0L );
+}
+
+SQLUINTEGER MConnection::getInfoSql92Grant()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn3( "%d", ( SQL_SG_DELETE_TABLE |
+ SQL_SG_INSERT_COLUMN |
+ SQL_SG_INSERT_TABLE |
+ SQL_SG_REFERENCES_TABLE |
+ SQL_SG_REFERENCES_COLUMN |
+ SQL_SG_SELECT_TABLE |
+ SQL_SG_UPDATE_COLUMN |
+ SQL_SG_UPDATE_TABLE ) );
+}
+
+SQLUINTEGER MConnection::getInfoSql92NumericValueFunctions()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn3( "%d", 0L );
+}
+
+SQLUINTEGER MConnection::getInfoSql92Predicates()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn3( "%d", 0L );
+}
+
+SQLUINTEGER MConnection::getInfoSql92RelationalJoinOperations()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn3( "%d", ( SQL_SRJO_CROSS_JOIN |
+ SQL_SRJO_INNER_JOIN |
+ SQL_SRJO_LEFT_OUTER_JOIN |
+ SQL_SRJO_NATURAL_JOIN |
+ SQL_SRJO_RIGHT_OUTER_JOIN ) );
+}
+
+SQLUINTEGER MConnection::getInfoSql92Revoke()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn3( "%d", ( SQL_SR_DELETE_TABLE |
+ SQL_SR_INSERT_COLUMN |
+ SQL_SR_INSERT_TABLE |
+ SQL_SR_REFERENCES_TABLE |
+ SQL_SR_REFERENCES_COLUMN |
+ SQL_SR_SELECT_TABLE |
+ SQL_SR_UPDATE_COLUMN |
+ SQL_SR_UPDATE_TABLE ) );
+}
+
+SQLUINTEGER MConnection::getInfoSql92RowValueConstructor()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn3( "%d", ( SQL_SRVC_VALUE_EXPRESSION |
+ SQL_SRVC_NULL |
+ SQL_SRVC_DEFAULT ) );
+}
+
+SQLUINTEGER MConnection::getInfoSql92StringFunctions()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn3( "%d", ( SQL_SSF_CONVERT |
+ SQL_SSF_LOWER |
+ SQL_SSF_UPPER |
+ SQL_SSF_SUBSTRING |
+ SQL_SSF_TRANSLATE |
+ SQL_SSF_TRIM_BOTH |
+ SQL_SSF_TRIM_LEADING |
+ SQL_SSF_TRIM_TRAILING ) );
+}
+
+SQLUINTEGER MConnection::getInfoSql92ValueExpressins()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn3( "%d", 0L );
+}
+
+SQLUINTEGER MConnection::getInfoStandardCliConformance()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn3( "%d", SQL_SCC_ISO92_CLI );
+}
+
+SQLUINTEGER MConnection::getInfoStaticCursorAttributes1()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn3( "%d", 0L );
+/*!
+ \internal
+ \todo
+ MYODBCDbgReturn3( "%d", ( SQL_CA1_NEXT |
+ SQL_CA1_ABSOLUTE |
+ SQL_CA1_RELATIVE |
+ SQL_CA1_LOCK_NO_CHANGE |
+ SQL_CA1_POS_POSITION |
+ SQL_CA1_POS_UPDATE |
+ SQL_CA1_POS_DELETE |
+ SQL_CA1_POS_REFRESH |
+ SQL_CA1_POSITIONED_UPDATE |
+ SQL_CA1_POSITIONED_DELETE |
+ SQL_CA1_BULK_ADD ) );
+*/
+}
+
+SQLUINTEGER MConnection::getInfoStaticCursorAttributes2()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn3( "%d", 0L );
+/*!
+ \internal
+ \todo
+ MYODBCDbgReturn3( "%d", ( SQL_CA2_MAX_ROWS_SELECT |
+ SQL_CA2_MAX_ROWS_INSERT |
+ SQL_CA2_MAX_ROWS_DELETE |
+ SQL_CA2_MAX_ROWS_UPDATE |
+ SQL_CA2_CRC_EXACT ) );
+*/
+}
+
+SQLUINTEGER MConnection::getInfoStaticSensitivity()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn3( "%d", ( SQL_SS_ADDITIONS |
+ SQL_SS_DELETIONS |
+ SQL_SS_UPDATES ) );
+}
+
+SQLUINTEGER MConnection::getInfoStringFunctions()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn3( "%d", ( SQL_FN_STR_CONCAT |
+ SQL_FN_STR_INSERT |
+ SQL_FN_STR_LEFT |
+ SQL_FN_STR_LTRIM |
+ SQL_FN_STR_LENGTH |
+ SQL_FN_STR_LOCATE |
+ SQL_FN_STR_LCASE |
+ SQL_FN_STR_REPEAT |
+ SQL_FN_STR_REPLACE |
+ SQL_FN_STR_RIGHT |
+ SQL_FN_STR_RTRIM |
+ SQL_FN_STR_SUBSTRING |
+ SQL_FN_STR_UCASE |
+ SQL_FN_STR_ASCII |
+ SQL_FN_STR_CHAR |
+ SQL_FN_STR_LOCATE_2 |
+ SQL_FN_STR_SOUNDEX |
+ SQL_FN_STR_SPACE ) );
+}
+
+SQLUINTEGER MConnection::getInfoSubqueries()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn3( "%d", 0L );
+}
+
+SQLUINTEGER MConnection::getInfoSystemFunctions()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn3( "%d", ( SQL_FN_SYS_DBNAME |
+ SQL_FN_SYS_IFNULL |
+ SQL_FN_SYS_USERNAME ) );
+}
+
+QString MConnection::getInfoTableTerm()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn1( "table" );
+}
+
+SQLUINTEGER MConnection::getInfoTimedateAddIntervals()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn3( "%d", 0L );
+}
+
+SQLUINTEGER MConnection::getInfoTimedateDiffIntervals()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn3( "%d", 0L );
+}
+
+SQLUINTEGER MConnection::getInfoTimedateFunctions()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn3( "%d", ( SQL_FN_TD_NOW |
+ SQL_FN_TD_CURDATE |
+ SQL_FN_TD_DAYOFMONTH |
+ SQL_FN_TD_DAYOFWEEK |
+ SQL_FN_TD_DAYOFYEAR |
+ SQL_FN_TD_MONTH |
+ SQL_FN_TD_QUARTER |
+ SQL_FN_TD_WEEK |
+ SQL_FN_TD_YEAR |
+ SQL_FN_TD_CURTIME |
+ SQL_FN_TD_HOUR |
+ SQL_FN_TD_MINUTE |
+ SQL_FN_TD_SECOND |
+ SQL_FN_TD_DAYNAME |
+ SQL_FN_TD_MONTHNAME ) );
+}
+
+SQLUSMALLINT MConnection::getInfoTxnCapable()
+{
+ MYODBCDbgEnter();
+
+ MYSQL* pMySQL = (MYSQL*)getMySQL();
+
+ /*!
+ \internal
+ \note
+
+ We can not determine if we support transactions until we have a mysql handle and
even then we
+ should probably be connected so we can query the server for feature support.
+
+ We may make an assumption that we do support transactions as its default for
mysql server v4 and
+ later.
+ */
+ if ( !pMySQL )
+ {
+ getDiagnostic()->doAppend( MDiagnostic::STATE_01000, 0, tr("No mysql handle
yet so we are going to guess that we do have support.") );
+ MYODBCDbgReturn3( "%d", SQL_TC_DDL_COMMIT );
+ }
+ if ( !isConnected() )
+ {
+ getDiagnostic()->doAppend( MDiagnostic::STATE_01000, 0, tr("No connection yet
so we are going to guess that we do have support.") );
+ MYODBCDbgReturn3( "%d", SQL_TC_DDL_COMMIT );
+ }
+
+ /*!
+ \internal
+ \note
+
+ We make an assumption here - that our support for transactions is limited to data
manipulation Language (DML)
+ statements such as; SELECT, INSERT, DELETE, and UPDATE.
+
+ This should be in synch with MCommand behaviour.
+ */
+ if ( pMySQL->server_capabilities & CLIENT_TRANSACTIONS )
+ MYODBCDbgReturn3( "%d", SQL_TC_DDL_COMMIT );
+
+ MYODBCDbgReturn3( "%d", SQL_TC_NONE );
+}
+
+SQLUINTEGER MConnection::getInfoTxnIsolationOption()
+{
+ MYODBCDbgEnter();
+
+ /*!
+ \internal
+ \todo
+
+ Implement transaction support.
+ */
+ MYODBCDbgReturn3( "%d", SQL_TXN_READ_COMMITTED );
+}
+
+SQLUINTEGER MConnection::getInfoUnion()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn3( "%d", 0L );
+}
+
+QString MConnection::getInfoUserName()
+{
+ MYODBCDbgEnter();
+
+ if ( getUserIdentifier().isNull() )
+ MYODBCDbgReturn1( "" );
+
+ MYODBCDbgReturn1( getUserIdentifier() );
+}
+
+QString MConnection::getInfoXopenCliYear()
+{
+ MYODBCDbgEnter();
+
+ MYODBCDbgReturn1( "1992" );
+}
+
+/*!
+ \brief Convenience method for checking if the state 'is connected'.
+
+ This is a convenience method which, hopefully, makes the calling code
+ a little easier to understand.
+
+ This does not check if the connection is alive, it simply reports the
+ state without verification.
+
+ \return BOOL
+
+ \retval true We are in a connected state.
+ \retval false We are in a disconnected state.
+
+ \sa doServerAliveSanityCheck
+ getConnectionDead
+*/
+BOOL MConnection::isConnected()
+{
+ MYODBCDbgEnter();
+
+ if ( getState() >= STATE_C4_CONN )
+ MYODBCDbgReturn3( "%d", true );
+
+ MYODBCDbgReturn3( "%d", false );
+}
+
+/*!
+ \brief Convenience method for checking if we are in a transaction.
+
+ This is a convenience method which, hopefully, makes the calling code
+ a little easier to understand.
+
+ \return BOOL
+
+ \retval true We are in a transaction.
+ \retval false We are not in a transaction.
+
+ \sa
+*/
+BOOL MConnection::isTransaction()
+{
+ MYODBCDbgEnter();
+
+ if ( getState() == STATE_C6_TRXN )
+ MYODBCDbgReturn3( "%d", true );
+
+ MYODBCDbgReturn3( "%d", false );
+}
+
+BOOL MConnection::isAsyncInProgress()
+{
+ MYODBCDbgEnter();
+
+ QList<QObject*> listStatements = MYODBCC::getChildren( this,
"MStatement" ); // findChildren<MStatement*>();
+ QListIterator<QObject*> i( listStatements );
+ while ( i.hasNext() )
+ {
+ if ( ((MStatement*)i.next())->isAsyncInProgress() )
+ MYODBCDbgReturn3( "%d", true );
+ }
+
+ MYODBCDbgReturn3( "%d", false );
+}
+
+BOOL MConnection::isStatementActive()
+{
+ MYODBCDbgEnter();
+
+ QList<QObject*> listStatements = MYODBCC::getChildren( this,
"MStatement" ); // findChildren<MStatement*>();
+ QListIterator<QObject*> i( listStatements );
+ while ( i.hasNext() )
+ {
+ if ( ((MStatement*)i.next())->getState() > MStatement::STATE_S1 )
+ MYODBCDbgReturn3( "%d", true );
+ }
+
+ MYODBCDbgReturn3( "%d", false );
+}
+
+BOOL MConnection::isDataNeeded()
+{
+ MYODBCDbgEnter();
+
+ QList<QObject*> listStatements = MYODBCC::getChildren( this,
"MStatement" ); // findChildren<MStatement*>();
+ QListIterator<QObject*> i( listStatements );
+ while ( i.hasNext() )
+ {
+ if ( ((MStatement*)i.next())->isDataNeeded() )
+ MYODBCDbgReturn3( "%d", true );
+ }
+
+ 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/include/MConnection.h
===================================================================
--- trunk/SDK/MYSQLPlus/include/MConnection.h 2006-11-29 20:08:05 UTC (rev 702)
+++ trunk/SDK/MYSQLPlus/include/MConnection.h 2006-11-30 06:47:10 UTC (rev 703)
@@ -26,13 +26,13 @@
enum STATE
{
- STATE_C0, /*!< Unallocated environment, unallocated connection */
- STATE_C1, /*!< Allocated environment, unallocated connection */
- STATE_C2, /*!< Allocated environment, allocated connection */
- STATE_C3, /*!< Connection function needs data */
- STATE_C4, /*!< Connected connection */
- STATE_C5, /*!< Connected connection, allocated statement */
- STATE_C6 /*!< Connected connection, transaction in progress. */
+ STATE_C0_NOENV, /*!< Unallocated environment, unallocated connection */
+ STATE_C1_UNALL, /*!< Allocated environment, unallocated connection */
+ STATE_C2_ALLOC, /*!< Allocated environment, allocated connection */
+ STATE_C3_DATA, /*!< Connection function needs data */
+ STATE_C4_CONN, /*!< Connected connection */
+ STATE_C5_STMT, /*!< Connected connection, allocated statement */
+ STATE_C6_TRXN /*!< Connected connection, transaction in progress. */
};
/* STMT_TYPE connection attribute */
@@ -383,7 +383,7 @@
SQLRETURN doConnectInternal( MYODBCInsDataSource *pDataSource );
SQLRETURN doConnectInternal( MYODBCInsDriverConnect *pDriverConnect );
SQLRETURN doSubmitCommand( const QString &stringCommand );
- BOOL doServerAliveSanityCheck();
+ BOOL doServerAliveSanityCheck();
SQLRETURN doTransactionStart();
SQLRETURN doTransactionCommit();
SQLRETURN doTransactionRollback();
| Thread |
|---|
| • Connector/ODBC 5 commit: r703 - in trunk/SDK/MYSQLPlus: Library include | jbalint | 30 Nov |