Modified:
trunk/MYSQLPlus/MYSQLPlusLib/MConnection.cpp
Log:
- more work for SQLBrowseConnect
Modified: trunk/MYSQLPlus/MYSQLPlusLib/MConnection.cpp
===================================================================
--- trunk/MYSQLPlus/MYSQLPlusLib/MConnection.cpp 2006-08-10 20:10:20 UTC (rev 483)
+++ trunk/MYSQLPlus/MYSQLPlusLib/MConnection.cpp 2006-08-11 04:12:32 UTC (rev 484)
@@ -1395,6 +1395,22 @@
if ( isConnected() )
MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::DIA_08002 ) );
+ /*!
+ \internal ODBC RULE (DM)
+
+ The value specified for argument StringLength1 was less than 0 and was not equal
to SQL_NTS.
+ */
+ if ( nStringLength1 < 0 && nStringLength1 != SQL_NTS) )
+ MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::DIA_HY090 ) );
+
+ /*!
+ \internal ODBC RULE (DM)
+
+ The value specified for argument BufferLength was less than 0.
+ */
+ if ( nBufferLength < 0 )
+ MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::DIA_HY090 ) );
+
/*!
\internal MYODBC RULE
@@ -1420,20 +1436,43 @@
if ( !MYODBCIns::getKeywordValues( &hashKeywordValues, stringInConnection,
MYODBCIns::DELIM_SEMI ) )
MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::DIA_HY000, 0,
stringInConnection ) );
+
+ /* if we have a DSN then look it up... */
+ MYODBCInsDataSource datasource;
+
+ datasource.setMode( MYODBCInsDataSource::DATASOURCE_MODE_DSN_VIEW );
+ datasource.setScope( MYODBCInsDataSource::DATASOURCE_SCOPE_BOTH );
+
+ if ( !hashKeywordValues.contains( "DSN" ) )
+ {
+ if ( !datasource.doRead( hashKeywordValues.value( "DSN" ) ) )
+ MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::DIA_IM002 ) );
+ }
+
+ if ( !hashKeywordValues.contains( "DSN" ) )
+ {
+ if ( !datasource.doRead( hashKeywordValues.value( "DSN" ) ) )
+ MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::DIA_IM002 ) );
+ }
+
+ /* do we have a SERVER attribute? */
if ( !hashKeywordValues.contains( "SERVER" ) )
stringOutConnection = "SERVER:" + tr("Server") + "=?";
+ /* do we have a UID attribute? */
if ( !hashKeywordValues.contains( "UID" ) )
{
if ( !stringOutConnection.isEmpty() )
stringOutConnection += ";";
stringOutConnection = "UID:" + tr("User ID") + "=?";
}
+ /* do we have a PWD attribute? */
if ( !hashKeywordValues.contains( "PWD" ) )
{
if ( !stringOutConnection.isEmpty() )
stringOutConnection += ";";
stringOutConnection = "PWD:" + tr("Password") + "=?";
}
+ /* do we have a DATABASE attribute? */
if ( !hashKeywordValues.contains( "DATABASE" ) )
{
if ( !stringOutConnection.isEmpty() )
@@ -1448,13 +1487,33 @@
stringOutConnection = "DATABASE:" + tr("Database") + "=?";
}
+
+
++++++++++
+ SQLRETURN nReturn = SQL_SUCCESS;
+
if ( !stringOutConnection.isEmpty() )
{
setState( STATE_C3 );
- MYODBCDbgReturn( SQL_NEED_DATA );
+ nReturn = SQL_NEED_DATA;
}
+ else
+ {
+ }
- MYODBCDbgReturn( doConnectInternal( pDataSource ) );
+ /*!
+ \internal ODBC RULE
+
+ The buffer *OutConnectionString was not large enough to return the entire browse
result
+ connection string, so the string was truncated. The buffer *StringLength2Ptr
contains
+ the length of the untruncated browse result connection string. (Function returns
+ SQL_SUCCESS_WITH_INFO.)
+ */
+ psOutConnectionString;
+ nBufferLength;
+ pnStringLength2Ptr;
+
+ MYODBCDbgReturn( nReturn );
}
SQLRETURN MConnection::doConnect( SQLWCHAR *psServerName, SQLSMALLINT nNameLength1,
SQLWCHAR *psUserName, SQLSMALLINT nNameLength2, SQLWCHAR *psAuthentication, SQLSMALLINT
nNameLength3 )
@@ -1552,7 +1611,6 @@
if ( stringServerName.isEmpty() )
stringDSN = "DEFAULT";
-
/* see if we can load a DSN */
MYODBCInsDataSource datasource;
| Thread |
|---|
| • Connector/ODBC 5 commit: r484 - trunk/MYSQLPlus/MYSQLPlusLib | pharvey | 11 Aug |