Modified:
MYODBCIns/MYODBCInsLib/MYODBCIns.cpp
MYODBCIns/MYODBCInsLib/MYODBCInsDataSource.cpp
MYODBCIns/include/MYODBCInsDataSource.h
Log:
Modified: MYODBCIns/MYODBCInsLib/MYODBCIns.cpp
===================================================================
--- MYODBCIns/MYODBCInsLib/MYODBCIns.cpp 2006-04-17 05:54:30 UTC (rev 77)
+++ MYODBCIns/MYODBCInsLib/MYODBCIns.cpp 2006-04-17 12:53:05 UTC (rev 78)
@@ -222,7 +222,7 @@
MYODBCDbgReturn3( "%d", false );
}
- QString stringNameAttributes = stringName + ";" + stringAttributes + " "; //
extra space at end needed to expand buffer for extra null term
+ QString stringNameAttributes = stringName + ";" + stringAttributes + " "; //
extra space at end needed for extra null term
QChar * pData = stringNameAttributes.data();
QChar * pChar;
SQLWCHAR sLocation[FILENAME_MAX];
@@ -241,7 +241,6 @@
*pChar = cNull;
}
- /*! \todo throwing pData down the pipe like this may be asking for trouble? */
if ( !SQLInstallDriverEx( stringNameAttributes.utf16(), 0, sLocation, FILENAME_MAX,
&nLocationLength, ODBC_INSTALL_COMPLETE, &nUsageCount ) )
MYODBCDbgReturn3( "%d", false );
@@ -273,6 +272,31 @@
{
MYODBCDbgEnter();
+ if ( stringName.isNull() )
+ {
+ setError( QString( "[%1][%2][ERROR] Data source name NULL." ).arg( __FILE__
).arg( __LINE__ ) );
+ MYODBCDbgReturn3( "%d", false );
+ }
+
+ if ( stringAttributes.isNull() )
+ {
+ setError( QString( "[%1][%2][ERROR] Data source attributes NULL." ).arg( __FILE__
).arg( __LINE__ ) );
+ MYODBCDbgReturn3( "%d", false );
+ }
+
+ if ( isExistsDataSourceName( stringName, nScope ) )
+ {
+ setError( QString( "[%1][%2][ERROR] Data source name exists." ).arg( __FILE__
).arg( __LINE__ ) );
+ MYODBCDbgReturn3( "%d", false );
+ }
+
+ //
+ MYODBCInsDataSource datasource( MYODBC_INS_DATASOURCE_MODE_DSN_VIEW );
+
+ if ( !datasource.doWrite( nScope ) )
+ MYODBCDbgReturn3( "%d", false );
+
+
MYODBCDbgReturn3( "%d", true );
}
Modified: MYODBCIns/MYODBCInsLib/MYODBCInsDataSource.cpp
===================================================================
--- MYODBCIns/MYODBCInsLib/MYODBCInsDataSource.cpp 2006-04-17 05:54:30 UTC (rev 77)
+++ MYODBCIns/MYODBCInsLib/MYODBCInsDataSource.cpp 2006-04-17 12:53:05 UTC (rev 78)
@@ -40,14 +40,37 @@
nScope = MYODBC_INS_DATASOURCE_SCOPE_BOTH;
SQLGetConfigMode( &n );
nScope = (MYODBC_INS_DATASOURCE_SCOPE)n;
+
+ MYODBCDbgReturn2();
}
+bool MYODBCInsDataSource::setAttributes( const QString &stringAttributes, bool
bReplace )
+{
+ MYODBCDbgEnter();
+
+ if ( stringAttributes.isEmpty() )
+ {
+ MYODBCIns::setError( QString( "[%1][%2][ERROR] Data source attributes empty."
).arg( __FILE__ ).arg( __LINE__ ) );
+ MYODBCDbgReturn3( "%d", false );
+ }
+
+ /*! \todo redo this so as to handle use of {} */
+ QStringList stringlistKeywordValue = stringAttributes.split( ";" );
+ QStringList::const_iterator i;
+
+ for ( i = stringlistDriverNames.constBegin(); i != stringlistDriverNames.constEnd();
++i )
+ (*pstreamStdOut) << (*i) << endl;
+
+ MYODBCDbgReturn3( "%d", true )
+}
+
bool MYODBCInsDataSource::setDriverFileName( const QString &stringDriverFileName )
{
MYODBCDbgEnter();
this->stringDriverFileName = stringDriverFileName;
- return true;
+
+ MYODBCDbgReturn3( "%d", true )
}
bool MYODBCInsDataSource::setDSN( const QString &stringDSN )
@@ -55,7 +78,8 @@
MYODBCDbgEnter();
this->stringDSN = stringDSN;
- return true;
+
+ MYODBCDbgReturn3( "%d", true )
}
bool MYODBCInsDataSource::setDRIVER( const QString &stringDRIVER )
@@ -63,7 +87,8 @@
MYODBCDbgEnter();
this->stringDRIVER = stringDRIVER;
- return true;
+
+ MYODBCDbgReturn3( "%d", true )
}
bool MYODBCInsDataSource::setDESCRIPTION( const QString &stringDESCRIPTION )
@@ -71,7 +96,8 @@
MYODBCDbgEnter();
this->stringDESCRIPTION = stringDESCRIPTION;
- return true;
+
+ MYODBCDbgReturn3( "%d", true )
}
bool MYODBCInsDataSource::setSERVER( const QString &stringSERVER )
@@ -79,7 +105,8 @@
MYODBCDbgEnter();
this->stringSERVER = stringSERVER;
- return true;
+
+ MYODBCDbgReturn3( "%d", true )
}
bool MYODBCInsDataSource::setUSER( const QString &stringUSER )
@@ -87,7 +114,8 @@
MYODBCDbgEnter();
this->stringUSER = stringUSER;
- return true;
+
+ MYODBCDbgReturn3( "%d", true )
}
bool MYODBCInsDataSource::setPASSWORD( const QString &stringPASSWORD )
@@ -95,7 +123,8 @@
MYODBCDbgEnter();
this->stringPASSWORD = stringPASSWORD;
- return true;
+
+ MYODBCDbgReturn3( "%d", true )
}
bool MYODBCInsDataSource::setDATABASE( const QString &stringDATABASE )
@@ -103,7 +132,8 @@
MYODBCDbgEnter();
this->stringDATABASE = stringDATABASE;
- return true;
+
+ MYODBCDbgReturn3( "%d", true )
}
bool MYODBCInsDataSource::setPORT( const QString &stringPORT )
@@ -111,7 +141,8 @@
MYODBCDbgEnter();
this->stringPORT = stringPORT;
- return true;
+
+ MYODBCDbgReturn3( "%d", true )
}
bool MYODBCInsDataSource::setSOCKET( const QString &stringSOCKET )
@@ -119,7 +150,8 @@
MYODBCDbgEnter();
this->stringSOCKET = stringSOCKET;
- return true;
+
+ MYODBCDbgReturn3( "%d", true )
}
bool MYODBCInsDataSource::setSTMT( const QString &stringSTMT )
@@ -127,7 +159,8 @@
MYODBCDbgEnter();
this->stringSTMT = stringSTMT;
- return true;
+
+ MYODBCDbgReturn3( "%d", true )
}
bool MYODBCInsDataSource::setOPTION( const QString &stringOPTION )
@@ -135,7 +168,8 @@
MYODBCDbgEnter();
this->stringOPTION = stringOPTION;
- return true;
+
+ MYODBCDbgReturn3( "%d", true )
}
bool MYODBCInsDataSource::setMode( MYODBC_INS_DATASOURCE_MODE nMode )
@@ -143,7 +177,8 @@
MYODBCDbgEnter();
this->nMode = nMode;
- return true;
+
+ MYODBCDbgReturn3( "%d", true )
}
bool MYODBCInsDataSource::setScope( MYODBC_INS_DATASOURCE_SCOPE nScope )
@@ -151,7 +186,8 @@
MYODBCDbgEnter();
this->nScope = nScope;
- return true;
+
+ MYODBCDbgReturn3( "%d", true )
}
QString MYODBCInsDataSource::getDriverFileName()
@@ -264,10 +300,10 @@
bool bReturn = false;
if ( stringDataSourceName.isEmpty() )
- return false;
+ MYODBCDbgReturn3( "%d", false )
if ( !SQLGetConfigMode( &nScopeToRestore ) )
- return false;
+ MYODBCDbgReturn3( "%d", false )
SQLSetConfigMode( (UWORD)nScope );
@@ -470,7 +506,7 @@
UWORD nScopeToRestore = ODBC_BOTH_DSN;
if ( !SQLGetConfigMode( &nScopeToRestore ) )
- return false;
+ MYODBCDbgReturn3( "%d", false )
SQLSetConfigMode( (UWORD)nScope );
Modified: MYODBCIns/include/MYODBCInsDataSource.h
===================================================================
--- MYODBCIns/include/MYODBCInsDataSource.h 2006-04-17 05:54:30 UTC (rev 77)
+++ MYODBCIns/include/MYODBCInsDataSource.h 2006-04-17 12:53:05 UTC (rev 78)
@@ -35,6 +35,7 @@
public:
MYODBCInsDataSource( MYODBC_INS_DATASOURCE_MODE nMode =
MYODBC_INS_DATASOURCE_MODE_CONNECT );
+ bool setAttributes( const QString &stringAttributes, bool bReplace = true );
bool setDriverFileName( const QString &stringDriverFileName );
bool setDSN( const QString &stringDSN );
bool setDRIVER( const QString &stringDRIVER );
| Thread |
|---|
| • Connector/ODBC 5 commit: r78 - in MYODBCIns: MYODBCInsLib include | pharvey | 17 Apr |