Modified:
trunk/SDK/Installer/Library/MYODBCIns.cpp
trunk/SDK/Installer/Library/MYODBCInsDriverConnect.cpp
trunk/SDK/Installer/include/MYODBCInsDataSource.h
trunk/SDK/Installer/include/MYODBCInsDriverConnect.h
trunk/SDK/MYSQLPlus/Library/MConnection.cpp
trunk/SDK/MYSQLPlus/Library/MEnvironment.cpp
trunk/SDK/MYSQLPlus/Library/MStatement.cpp
Log:
FIX: SQLDriverConnect was failing because it was not xref'ing to the SETUP library
(handled as a plugin). MS Access now connects fine.
Modified: trunk/SDK/Installer/Library/MYODBCIns.cpp
===================================================================
--- trunk/SDK/Installer/Library/MYODBCIns.cpp 2006-09-30 23:34:17 UTC (rev 566)
+++ trunk/SDK/Installer/Library/MYODBCIns.cpp 2006-10-02 01:38:06 UTC (rev 567)
@@ -175,6 +175,7 @@
switch ( nState )
{
case PARSE_STATE_NAME_START:
+ /* start of keyword? */
{
if ( stringKeywordValues[nScanChar].isLetter() )
{
@@ -184,6 +185,7 @@
}
break;
case PARSE_STATE_NAME:
+ /* end of keyword? */
{
if ( stringKeywordValues[nScanChar] == cEqual )
{
@@ -194,6 +196,7 @@
}
break;
case PARSE_STATE_VALUE_START:
+ /* start of value? (ODBC says no spaces here but silently eat'm anyway)
*/
{
if ( !stringKeywordValues[nScanChar].isSpace() )
{
@@ -212,6 +215,7 @@
break;
case PARSE_STATE_VALUE:
case PARSE_STATE_VALUE_BRACED:
+ /* end of value? */
if ( nState == PARSE_STATE_VALUE )
{
if ( !isDelim( stringKeywordValues, nScanChar, &nDelim ) )
@@ -232,23 +236,27 @@
}
// printf( "[PAH][%s][%d] (%s)=(%s) nAnchorChar=%d nScanChar=%d\n", __FILE__, __LINE__,
stringKeyword.toAscii().data(), stringKeywordValues.mid( nAnchorChar, nScanChar -
nAnchorChar ).toAscii().data(), nAnchorChar, nScanChar );
+ /* we now have a keyword/value pair */
+
/*
\internal ODBC Rule
If the DSN and DRIVER keywords are included in the same connection
string,
- the Driver Manager and the driver use whichever keyword appears
first.
+ the Driver Manager and the driver use whichever keyword appears
first.
\note
+ This is for SQLDriverConnect().
+
We assume we are processing for a ConfigDSN(), not a connection
string, when
- we are using DELIM_NULL.
+ we are using DELIM_NULL. This is a bit of trickery - sorry.
*/
if ( nDelim != MYODBCIns::DELIM_NULL )
{
- if ( stringKeyword == "DSN" &&
phashKeywordValues->contains( "DRIVER" ) )
+ if ( stringKeyword == "DSN" &&
!(*phashKeywordValues)["DRIVER"].isNull() )
break;
- if ( stringKeyword == "DRIVER" &&
phashKeywordValues->contains( "DSN" ) )
+ if ( stringKeyword == "DRIVER" &&
!(*phashKeywordValues)["DSN"].isNull() )
break;
}
Modified: trunk/SDK/Installer/Library/MYODBCInsDriverConnect.cpp
===================================================================
--- trunk/SDK/Installer/Library/MYODBCInsDriverConnect.cpp 2006-09-30 23:34:17 UTC (rev
566)
+++ trunk/SDK/Installer/Library/MYODBCInsDriverConnect.cpp 2006-10-02 01:38:06 UTC (rev
567)
@@ -28,16 +28,35 @@
*/
#include "MYODBCInsInternal.h"
-MYODBCInsDriverConnect::MYODBCInsDriverConnect( DRIVERCONNECT_METHOD nMethod,
DRIVERCONNECT_PROMPT nPrompt )
+MYODBCInsDriverConnect::MYODBCInsDriverConnect( DRIVERCONNECT_PROMPT nPrompt )
{
MYODBCDbgEnter();
- /* prime our hash with all known attribute keywords inserted with null value */
- doClear();
+ this->nPrompt = nPrompt;
- this->nMethod = nMethod;
- this->nPrompt = nPrompt;
+ /*
+ These are the attributes we expect to find in a connection string.
+ 1. All DSN attributes are valid here but not all connection string attributes are
valid for DSN.
+ 2. The DSN and DRIVER attributes are mutually exclusive (1st is valid other is
filtered out).
+ 3. Duplicates should not exist (1st is valid rest filtered out).
+ */
+ vectorAttributesValid.append( "DSN" ); /*!< Data Source Name.
*/
+ vectorAttributesValid.append( "DRIVER" ); /*!< Friendly driver name.
*/
+ vectorAttributesValid.append( "DESCRIPTION" ); /*!< General description or long
name of DSN. */
+ vectorAttributesValid.append( "SERVER" ); /*!< The hostname of the MySQL
server. */
+ vectorAttributesValid.append( "UID" ); /*!< The username used to connect
to MySQL. */
+ vectorAttributesValid.append( "PWD" ); /*!< The password for the server
user combination. */
+ vectorAttributesValid.append( "DATABASE" ); /*!< The default database.
*/
+ vectorAttributesValid.append( "PORT" ); /*!< The TCP/IP port to use if
SERVER is not localhost. */
+ vectorAttributesValid.append( "SOCKET" ); /*!< Unix socket file or Windows
named pipe to connect to. */
+ vectorAttributesValid.append( "STMT" ); /*!< Statement that will be exec
when connecting to MySQL. */
+ vectorAttributesValid.append( "OPTION" ); /*!< Options that specify how
MyODBC should work. */
+ vectorAttributesValid.append( "FILEDSN" ); /*!< This is to support case where
app is linked directly to driver. */
+ vectorAttributesValid.append( "SAVEFILE" ); /*!< This is to support case where
app is linked directly to driver. */
+
+ doClear();
+
MYODBCDbgReturn2();
}
@@ -45,14 +64,6 @@
{
MYODBCDbgEnter();
- MYODBCIns::PARSE_STATE nState = MYODBCIns::PARSE_STATE_NAME_START;
- int nAnchorChar = 0;
- int nScanChar = 0;
- QString stringKeyword;
- QChar cEqual( '=' ); /* separates a key and value */
- QChar cDelim( ';' ); /* separates key/value pairs */
- QChar cNull( '\0' ); /* terminates the entire connection string */
-
/*!
\internal MYODBC RULE
@@ -62,120 +73,53 @@
/* set all fields to null */
doClear();
- /*!
- \internal ODBC RULE
+ /* parse attributes string */
+ if ( !MYODBCIns::getKeywordValues( &hashAttributes, stringAttributes,
MYODBCIns::DELIM_SEMI ) )
+ MYODBCDbgReturn3( "%d", false );
- If neither DRIVER nor DSN were supplied we assume default DSN.
- */
- setMethod( DRIVERCONNECT_METHOD_DSN );
+ /* DSN or DRIVER based? */
+ if ( !getDRIVER().isNull() )
+ setMethod( DRIVERCONNECT_METHOD_DRIVER );
+ else if ( !getDSN().isNull() )
+ setMethod( DRIVERCONNECT_METHOD_DSN );
+ else
+ {
+ /* this is done by DM but app may be linked to us directly so... */
+ setDSN( "DEFAULT" );
+ setMethod( DRIVERCONNECT_METHOD_DSN );
+ }
- /* short circuit if we have not been given stuff to parse - this is not an error */
- if ( stringAttributes.isEmpty() )
- MYODBCDbgReturn3( "%d", true );
-
/*!
- \internal
- \note
+ \internal ODBC RULE
- We can not use QString::split() on ';' because ';' can be a viable char in values
- embraced with "{}".
- */
- while ( 1 )
+ If the connection string contains the DSN keyword, the driver
+ retrieves the information for the specified data source (and
+ merges it into given connection info with given connection info
+ having precedence).
+ */
+ if ( getMethod() == DRIVERCONNECT_METHOD_DSN )
{
- switch ( nState )
+ if ( !MYODBCIns::isExistsDataSourceName( getDSN(),
MYODBCInsDataSource::DATASOURCE_SCOPE_BOTH ) )
{
- case MYODBCIns::PARSE_STATE_NAME_START:
- /* start of keyword? */
- if ( stringAttributes[nScanChar].isLetter() )
- {
- nAnchorChar = nScanChar;
- nState = MYODBCIns::PARSE_STATE_NAME;
- }
- break;
-
- case MYODBCIns::PARSE_STATE_NAME:
- /* end of keyword? */
- if ( stringAttributes[nScanChar] == cEqual )
- {
- stringKeyword = stringAttributes.mid( nAnchorChar, nScanChar -
nAnchorChar );
- nState = MYODBCIns::PARSE_STATE_VALUE_START;
- }
- break;
-
- case MYODBCIns::PARSE_STATE_VALUE_START:
- /* start of value? (ODBC says no spaces here but silently eat'm anyway)
*/
- if ( !stringAttributes[nScanChar].isSpace() )
- {
- nAnchorChar = nScanChar;
- nState = MYODBCIns::PARSE_STATE_VALUE;
- }
- break;
-
- case MYODBCIns::PARSE_STATE_VALUE:
- /* end of value? */
- if ( stringAttributes[nScanChar] != cDelim &&
stringAttributes[nScanChar] != cNull )
- break;
-
- /* we now have a keyword/value pair */
-
- /*!
- \internal ODBC Rule
-
- If the DSN and DRIVER keywords are included in the same connection
string,
- the Driver Manager and the driver use whichever keyword appears
first.
- */
- if ( stringKeyword == "DSN" )
- {
- if ( !hashAttributes["DRIVER"].isNull() )
- break;
- setMethod( DRIVERCONNECT_METHOD_DSN );
- }
-
- if ( stringKeyword == "DRIVER" )
- {
- if ( !hashAttributes["DSN"].isNull() )
- break;
- setMethod( DRIVERCONNECT_METHOD_DRIVER );
- }
-
- /*!
- \internal ODBC RULE (DM)
-
- An invalid attribute keyword was specified in the connection string
(InConnectionString),
- but the driver was able to connect to the data source anyway.
(Function returns
- SQL_SUCCESS_WITH_INFO.)
- */
- if ( !hashAttributes.contains( stringKeyword ) )
- break;
-
- /*!
- \internal ODBC Rule
-
- If any keywords are repeated in the connection string, the driver
uses the value
- associated with the first occurrence of the keyword.
- */
- if ( !hashAttributes[stringKeyword].isNull() )
- break;
-
- hashAttributes.insert( stringKeyword, stringAttributes.mid( nAnchorChar,
nScanChar - nAnchorChar ) );
- stringKeyword = QString::null;
- break;
- default:
- Q_ASSERT( 0 );
+ if ( getDSN() == "DEFAULT" )
+ {
+ MYODBCIns::setError( QString( "[%1][%2][ERROR] Could not find 'DEFAULT'
DSN in system information." ).arg( __FILE__ ).arg( __LINE__ ) );
+ MYODBCDbgReturn3( "%d", false );
+ }
}
+ else if ( !doRead() )
+ MYODBCDbgReturn3( "%d", false );
+ }
- /* terminated a name/value pair */
- if ( stringAttributes[nScanChar] == cDelim )
- nState = MYODBCIns::PARSE_STATE_NAME_START;
+ /* at this point we should have DRIVER attribute (if not we try to carry on)... */
+ if ( getDRIVER().isEmpty() )
+ MYODBCIns::setError( QString( "[%1][%2][WARNING] DRIVER attribute missing."
).arg( __FILE__ ).arg( __LINE__ ) );
- /* have we advanced to end of string */
- if ( stringAttributes[nScanChar] == cNull )
- break;
+ /* we *must* have SETUP if we are going to do any prompting... */
+ setSETUP( getSETUP( getDRIVER() ) );
+ if ( getSETUP().isEmpty() )
+ MYODBCIns::setError( QString( "[%1][%2][WARNING] Could not determine SETUP
attribute." ).arg( __FILE__ ).arg( __LINE__ ) );
- nScanChar++;
-
- } /* while scan */
-
MYODBCDbgReturn3( "%d", true );
}
@@ -282,7 +226,7 @@
{
MYODBCDbgEnter();
- hashAttributes["SETUP"] = stringSETUP;
+ this->stringSETUP = stringSETUP;
MYODBCDbgReturn3( "%d", true )
}
@@ -427,7 +371,7 @@
{
MYODBCDbgEnter();
- MYODBCDbgReturn1( hashAttributes["SETUP"] );
+ MYODBCDbgReturn1( stringSETUP );
}
MYODBCInsDriverConnect::DRIVERCONNECT_METHOD MYODBCInsDriverConnect::getMethod()
@@ -526,145 +470,66 @@
{
MYODBCDbgEnter();
- /*!
- \internal
- \note
+ /* DO NOT clear nPrompt here */
+ nMethod = DRIVERCONNECT_METHOD_UNKNOWN;
+ hashAttributes.clear();
+ stringSETUP.clear();
- These are the driver connection string attributes we understand. A Null value
- means that the keyword was not used in the connection string.
-
- The "[]" operator will silently add attribute if not in hash.
- */
- hashAttributes["DSN"] = QString::null; /*!< Data Source Name.
*/
- hashAttributes["DRIVER"] = QString::null; /*!< Friendly driver name.
*/
- hashAttributes["DESCRIPTION"] = QString::null; /*!< General description or
long name of DSN. */
- hashAttributes["SERVER"] = QString::null; /*!< The hostname of the MySQL
server. */
- hashAttributes["UID"] = QString::null; /*!< The username used to
connect to MySQL. */
- hashAttributes["PWD"] = QString::null; /*!< The password for the
server user combination. */
- hashAttributes["DATABASE"] = QString::null; /*!< The default database.
*/
- hashAttributes["PORT"] = QString::null; /*!< The TCP/IP port to use if
SERVER is not localhost. */
- hashAttributes["SOCKET"] = QString::null; /*!< Unix socket file or
Windows named pipe to connect to. */
- hashAttributes["STMT"] = QString::null; /*!< Statement that will be
exec when connecting to MySQL. */
- hashAttributes["OPTION"] = QString::null; /*!< Options that specify how
MyODBC should work. */
- hashAttributes["SETUP"] = QString::null; /*!< Path/file of setup/gui
lib. */
- hashAttributes["FILEDSN"] = QString::null; /*!< This is to support case
where app is linked directly to driver. */
- hashAttributes["SAVEFILE"] = QString::null; /*!< This is to support case
where app is linked directly to driver. */
-
MYODBCDbgReturn2();
}
+/*!
+ \brief Merge DSN in system information (if any) into existing attributes.
+ This is only relevant when we are DRIVERCONNECT_METHOD_DSN and have a
+ DSN attribute and the DSN exists in system information - in all other
+ cases this call does nothing.
+
+ By 'merge' we mean that the system information will be used to try to
+ add missing/unset attributes - attributes we already have are NOT
+ replaced.
+*/
BOOLEAN MYODBCInsDriverConnect::doRead()
{
MYODBCDbgEnter();
- SQLWCHAR sEntryNames[SQL_MAX_DSN_LENGTH * MYODBC_INS_MAX_DSN_NAMES];
- SQLWCHAR * psEntryName;
- SQLWCHAR sValue[4096];
- int nChars = 0;
- BOOLEAN bReturn = false;
- UWORD nScopeToRestore = ODBC_BOTH_DSN;
- QString stringDataSourceName = getDSN();
-
- if ( !SQLGetConfigMode( &nScopeToRestore ) )
- MYODBCDbgReturn3( "%d", false )
-
- SQLSetConfigMode( ODBC_BOTH_DSN );
-
- /*!
- \internal ODBC RULE
-
- If neither DRIVER nor DSN were supplied we assume default DSN.
- */
- if ( stringDataSourceName.isEmpty() )
- stringDataSourceName = "DEFAULT";
-
- *sEntryNames = '\0';
- if ( ( nChars = SQLGetPrivateProfileString( stringDataSourceName.utf16(), NULL, NULL,
sEntryNames, sizeof(sEntryNames) / sizeof(SQLWCHAR), L"ODBC.INI" ) ) < 1 )
- goto doReadExit1;
-
-#if defined(WIN32)
+ /* some sanity checks... */
+ if ( getMethod() != DRIVERCONNECT_METHOD_DSN )
{
- int nLen = MYODBCC::getStrLen( sEntryNames, SQL_MAX_DSN_LENGTH *
MYODBC_INS_MAX_DSN_NAMES );
+ MYODBCIns::setError( QString( "[%1][%2][ERROR] doRead only relevant for
DRIVERCONNECT_METHOD_DSN." ).arg( __FILE__ ).arg( __LINE__ ) );
+ MYODBCDbgReturn3( "%d", false );
+ }
- /*!
- \note XP
-
- Bug in SQLGetPrivateProfileString when mode is ODBC_BOTH_DSN and we
are looking for a system
- DSN. In this case SQLGetPrivateProfileString will find the system dsn
but return a corrupt
- list of attributes.
-
- A corrupt list of attributes can be identified because the first
attribute (if any) will be
- followed by more than one '\0'.
-
- The solution is to detect this condition and set mode to
ODBC_SYSTEM_DSN and try again. We
- also ensure we reset the mode when done - regardless of outcome.
- */
- if ( nLen < nChars && sEntryNames[nLen + 1 ] == '\0' )
- {
- *sEntryNames = '\0';
- SQLSetConfigMode( ODBC_SYSTEM_DSN );
-
- if ( ( nChars = SQLGetPrivateProfileString( stringDataSourceName.utf16(),
NULL, NULL, sEntryNames, sizeof(sEntryNames) / sizeof(SQLWCHAR), L"ODBC.INI" ) ) < 1 )
- goto doReadExit1;
- }
+ if ( getDSN().isEmpty() )
+ {
+ MYODBCIns::setError( QString( "[%1][%2][ERROR] doRead only relevant when we have
a DSN." ).arg( __FILE__ ).arg( __LINE__ ) );
+ MYODBCDbgReturn3( "%d", false );
}
-#endif
- /*!
- Scan result and return MYODBC_C_TRUE if we find a match.
- */
- psEntryName = sEntryNames;
- while ( *psEntryName )
+ if ( !MYODBCIns::isExistsDataSourceName( getDSN(),
MYODBCInsDataSource::DATASOURCE_SCOPE_BOTH ) )
{
- *sValue = '\0';
- if ( SQLGetPrivateProfileString( stringDataSourceName.utf16(), psEntryName, L"",
sValue, sizeof( sValue ) / sizeof(SQLWCHAR), L"ODBC.INI" ) > 0 )
- {
- QString stringEntryName( QString::fromUtf16( psEntryName ) );
- QString stringEntryNameUpper = stringEntryName.toUpper();
- QString stringValue( QString::fromUtf16( sValue ) );
+ MYODBCIns::setError( QString( "[%1][%2][ERROR] DSN %3 does not exist." ).arg(
__FILE__ ).arg( __LINE__ ).arg( getDSN() ) );
+ MYODBCDbgReturn3( "%d", false );
+ }
- /*!
- \internal ODBC RULE
+ /* read data source... */
+ MYODBCInsDataSource datasource;
- The driver uses any information it retrieves from the system information
- to augment the information passed to it in the connection string. If the
- information in the system information duplicates information in the
- connection string, the driver uses the information in the connection
- string.
- */
- if ( stringEntryNameUpper != "DRIVER" )
- {
- if ( hashAttributes.contains( stringEntryNameUpper ) &&
hashAttributes[stringEntryNameUpper].isNull() )
- hashAttributes[stringEntryNameUpper] = stringValue.trimmed();
- else
- MYODBCDbgError( "Unknown attribute (%s).", psEntryName );
- }
- }
- else
- MYODBCDbgWarning( "Failed to get value for attribute (%s).", psEntryName );
+ datasource.setMode( MYODBCInsDataSource::DATASOURCE_MODE_DSN_VIEW );
+ datasource.setScope( MYODBCInsDataSource::DATASOURCE_SCOPE_BOTH );
+ if ( !datasource.doRead( getDSN() ) )
+ MYODBCDbgReturn3( "%d", false );
- psEntryName += MYODBCC::getStrLen( psEntryName, SQL_MAX_DSN_LENGTH *
MYODBC_INS_MAX_DSN_NAMES ) + 1;
- } /* while */
-
- bReturn = true;
-
-doReadExit1:
- /* lets not loose the error message while we restore our scope */
+ /* merge... */
+ QHash<QString, QString>::const_iterator i =
datasource.hashAttributes.constBegin();
+ while ( i != datasource.hashAttributes.constEnd() )
{
- QString stringError;
- DWORD nError = 0;
-
- if ( !bReturn )
- MYODBCIns::getError( 1, &nError, stringError );
-
- SQLSetConfigMode( nScopeToRestore );
-
- if ( !bReturn && !stringError.isEmpty() )
- MYODBCIns::setError( stringError, nError );
+ if ( !hashAttributes.contains( i.key() ) )
+ hashAttributes[i.key()] = i.value();
+ ++i;
}
- MYODBCDbgReturn3( "%d", bReturn );
+ MYODBCDbgReturn3( "%d", true );
}
Modified: trunk/SDK/Installer/include/MYODBCInsDataSource.h
===================================================================
--- trunk/SDK/Installer/include/MYODBCInsDataSource.h 2006-09-30 23:34:17 UTC (rev 566)
+++ trunk/SDK/Installer/include/MYODBCInsDataSource.h 2006-10-02 01:38:06 UTC (rev 567)
@@ -36,7 +36,10 @@
#include <QStringList>
#include <QTextStream>
#include <QHash>
+#include <QVector>
+class MYODBCInsDriverConnect;
+
/*!
\brief Data Source Name (DSN).
@@ -66,6 +69,7 @@
*/
class MYODBCInsDataSource
{
+ friend class MYODBCInsDriverConnect;
public:
/*!
\brief DSN edit mode.
Modified: trunk/SDK/Installer/include/MYODBCInsDriverConnect.h
===================================================================
--- trunk/SDK/Installer/include/MYODBCInsDriverConnect.h 2006-09-30 23:34:17 UTC (rev 566)
+++ trunk/SDK/Installer/include/MYODBCInsDriverConnect.h 2006-10-02 01:38:06 UTC (rev 567)
@@ -43,7 +43,8 @@
enum DRIVERCONNECT_METHOD
{
DRIVERCONNECT_METHOD_DRIVER,
- DRIVERCONNECT_METHOD_DSN
+ DRIVERCONNECT_METHOD_DSN,
+ DRIVERCONNECT_METHOD_UNKNOWN
};
/*!
@@ -65,7 +66,7 @@
};
- MYODBCInsDriverConnect( DRIVERCONNECT_METHOD nMethod = DRIVERCONNECT_METHOD_DRIVER,
DRIVERCONNECT_PROMPT nPrompt = DRIVERCONNECT_PROMPT_NOPROMPT );
+ MYODBCInsDriverConnect( DRIVERCONNECT_PROMPT nPrompt = DRIVERCONNECT_PROMPT_NOPROMPT
);
BOOLEAN setAttributes( const QString &stringAttributes ); /*!< Parses and
stores a comma delimited set of key=value attributes. */
BOOLEAN setDSN( const QString &stringDSN );
@@ -108,9 +109,11 @@
BOOLEAN doRead();
protected:
- QHash<QString,QString> hashAttributes; /*!< Attributes. Use hash to avoid
many "if key". We use "contains()" instead. */
- DRIVERCONNECT_METHOD nMethod; /*!< Indicates whether we are to use
DRIVER or DSN based rules for connecting. */
- DRIVERCONNECT_PROMPT nPrompt; /*!< Prompting we need (if any). This
corresponds to DriverCompletion in SQLDriverConnect. */
+ QHash<QString,QString> hashAttributes; /*!< Attributes. Use hash to
avoid many "if key". We use "contains()" instead. */
+ QVector<QString> vectorAttributesValid; /*!< Attributes we
understand in a connection string. */
+ QString stringSETUP; /*!< Path & file name of
drivers setup library. Used to provide plugin prompting. */
+ DRIVERCONNECT_METHOD nMethod; /*!< Indicates whether we are to
use DRIVER or DSN based rules for connecting. */
+ DRIVERCONNECT_PROMPT nPrompt; /*!< Prompting we need (if any).
This corresponds to DriverCompletion in SQLDriverConnect. */
};
Modified: trunk/SDK/MYSQLPlus/Library/MConnection.cpp
===================================================================
--- trunk/SDK/MYSQLPlus/Library/MConnection.cpp 2006-09-30 23:34:17 UTC (rev 566)
+++ trunk/SDK/MYSQLPlus/Library/MConnection.cpp 2006-10-02 01:38:06 UTC (rev 567)
@@ -92,8 +92,11 @@
SQLRETURN MConnection::setConnectAttr( SQLINTEGER nAttribute, SQLPOINTER pValue,
SQLINTEGER nStringLength )
{
MYODBCDbgEnter();
- MYODBCDbgInfo( QString( "%1 > %2" ).arg( nAttribute ).arg(
MYODBCC::getConnectAttrString( nAttribute ) ) );
+#if MYODBC_DBG > 1
+ MYODBCDbgInfo( QString( "nAttribute=%1=%2" ).arg( nAttribute ).arg(
MYODBCC::getConnectAttrString( nAttribute ) ) );
+#endif
+
/*!
\internal ODBC RULE
@@ -280,6 +283,10 @@
{
MYODBCDbgEnter();
+#if MYODBC_DBG > 1
+ MYODBCDbgInfo( QString( "nAttribute=%1=%2" ).arg( nAttribute ).arg(
MYODBCC::getConnectAttrString( nAttribute ) ) );
+#endif
+
BOOLEAN bCopyOk;
/* handle case where we are not provided viable pnStringLength */
@@ -551,9 +558,13 @@
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.
+
+ \todo
+
+ Commented out for testing with MS Access. Need to revisit this.
*/
- if ( getState() < STATE_C4 && (nInfoType != SQL_ODBC_VER &&
nInfoType != SQL_DRIVER_ODBC_VER) )
- MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::DIA_08003 ) );
+// if ( getState() < STATE_C4 && (nInfoType != SQL_ODBC_VER &&
nInfoType != SQL_DRIVER_ODBC_VER) )
+// MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::DIA_08003 ) );
/*!
\internal
@@ -1904,6 +1915,7 @@
MYODBCDbgEnter();
MYODBCInsDriverConnect driverconnect;
+ QString stringInConnectionString;
SQLRETURN nReturn = SQL_SUCCESS;
BOOLEAN bPrompt = false;
MYODBC_C_DLL hModule = NULL;
@@ -1946,6 +1958,12 @@
if ( nBufferLength < 0 )
MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::DIA_HY090 ) );
+ /* convert to QString... */
+ if ( nStringLength1 == SQL_NTS )
+ stringInConnectionString = QString::fromUtf16( pszInConnectionString );
+ else
+ stringInConnectionString = QString::fromUtf16( pszInConnectionString,
nStringLength1 );
+
/*!
\internal MYODBC RULE
\todo
@@ -1953,46 +1971,16 @@
Get any installer errors we may have from problems encountered in MYODBCIns* and
feed that into our diagnostic so as to provide more precise info.
*/
- if ( nStringLength1 == SQL_NTS )
- {
- if ( !driverconnect.setAttributes( QString::fromUtf16( pszInConnectionString ) )
)
- MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::DIA_HY000, 0,
"Failed to apply parsed incoming connect string." ) );
- }
- else
- {
- if ( !driverconnect.setAttributes( QString::fromUtf16( pszInConnectionString,
nStringLength1 ) ) )
- MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::DIA_HY000, 0,
"Failed to apply parsed incoming connect string." ) );
- }
+ if ( !driverconnect.setAttributes( stringInConnectionString ) )
+ MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::DIA_HY000, 0, "Failed
to apply parsed incoming connect string." ) );
- /*!
- \internal ODBC RULE
+#if MYODBC_DBG > 1
+ MYODBCDbgInfo( driverconnect.getAttributes() );
+#endif
- If the connection string contains the DSN keyword, the driver
- retrieves the information for the specified data source (and
- merges it into given connection info with given connection info
- having precedence).
- */
- if ( driverconnect.getMethod() == MYODBCInsDriverConnect::DRIVERCONNECT_METHOD_DSN )
- {
- if ( !driverconnect.doRead() )
- {
- /*!
- \internal ODBC RULE
+ if ( driverconnect.getSETUP().isEmpty() && nDriverCompletion !=
SQL_DRIVER_NOPROMPT )
+ MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::DIA_HY000, 0, "Need
setup library for prompting." ) );
- Establish a connection to a data source that is not defined in the system
- information. If the application supplies a partial connection string, the
- driver can prompt the user for connection information.
-
- \note
-
- In other words; we can ignore a failure to read the DSN.
- */
- }
- }
-
- if ( driverconnect.getDRIVER().isEmpty() && nDriverCompletion !=
SQL_DRIVER_NOPROMPT )
- MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::DIA_HY000, 0, "Need
driver name to lookup setup library." ) );
-
/*!
\internal ODBC Rule
@@ -2063,7 +2051,7 @@
All our user interface stuff is in the setup library. This is good because;
- - avoids introducing dependencies, such as GUI stuff, into the driver
+ - avoids introducing GUI based dependencies into the driver
- a pluggable U.I. means someone can write different U.I. (ncurses, gtk,
XLib, etc)
and it can be customized for business/marketing purposes
*/
Modified: trunk/SDK/MYSQLPlus/Library/MEnvironment.cpp
===================================================================
--- trunk/SDK/MYSQLPlus/Library/MEnvironment.cpp 2006-09-30 23:34:17 UTC (rev 566)
+++ trunk/SDK/MYSQLPlus/Library/MEnvironment.cpp 2006-10-02 01:38:06 UTC (rev 567)
@@ -74,8 +74,11 @@
SQLRETURN MEnvironment::setEnvAttr( SQLINTEGER nAttribute, SQLPOINTER pValue, SQLINTEGER
nStringLength )
{
MYODBCDbgEnter();
- MYODBCDbgInfo( MYODBCC::getEnvAttrString( nAttribute ) );
+#if MYODBC_DBG > 1
+ MYODBCDbgInfo( QString( "nAttribute=%1=%2" ).arg( nAttribute ).arg(
MYODBCC::getEnvAttrString( nAttribute ) ) );
+#endif
+
/*!
\internal ODBC RULE
@@ -450,7 +453,10 @@
SQLRETURN MEnvironment::setODBCVersion( SQLINTEGER nODBCVersion )
{
MYODBCDbgEnter();
+
+#if MYODBC_DBG > 1
MYODBCDbgInfo( QString( "%1" ).arg( nODBCVersion ) );
+#endif
/*!
\internal MYODBC RULE
Modified: trunk/SDK/MYSQLPlus/Library/MStatement.cpp
===================================================================
--- trunk/SDK/MYSQLPlus/Library/MStatement.cpp 2006-09-30 23:34:17 UTC (rev 566)
+++ trunk/SDK/MYSQLPlus/Library/MStatement.cpp 2006-10-02 01:38:06 UTC (rev 567)
@@ -760,14 +760,21 @@
\internal MYSQLPlus RULE
We do not support emulating older driver versions.
+
+ \todo
+
+ Remove code or uncomment.
*/
// if ( nColumnNumber == 0 && nBufferLength < 4 && ODBCVER <
0x0300 && ODBCVER >= 0x0200 )
// MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::DIA_HY090 ) );
+MYODBCDbgInfo( QString( "PAH" ) );
SQLINTEGER nLength;
SQLINTEGER nIndicator;
SQLRETURN nReturn = pResult->getData( nColumnNumber, nTargetType, pTargetValue,
nBufferLength, &nLength, &nIndicator );
+MYODBCDbgInfo( QString( "PAH" ) );
+
if ( !SQL_SUCCEEDED(nReturn) )
MYODBCDbgReturn( nReturn );
| Thread |
|---|
| • Connector/ODBC 5 commit: r567 - in trunk/SDK: Installer/Library Installer/include MYSQLPlus/Library | pharvey | 2 Oct |