Modified:
trunk/Driver/Driver/Library/MYODBCDriverMain.cpp
trunk/Driver/Setup/Library/ConfigDSN.cpp
trunk/Driver/Setup/Library/ConfigDSNW.cpp
trunk/SDK/C/Library/MYODBCC.cpp
trunk/SDK/C/include/MYODBCC.h
trunk/SDK/Installer/Library/MYODBCIns.cpp
trunk/SDK/Installer/Library/MYODBCInsDataSource.cpp
trunk/SDK/Installer/Library/MYODBCInsDriver.cpp
trunk/SDK/Installer/Tests/MYODBCInsTest.cpp
trunk/SDK/MYSQLPlus/Library/MConnection.cpp
trunk/SDK/MYSQLPlus/Library/MConnection_props.cpp
trunk/SDK/MYSQLPlus/Library/MDataConvert.cpp
trunk/SDK/MYSQLPlus/Library/MDescriptorRecord.cpp
trunk/SDK/MYSQLPlus/Library/MDiagnostic.cpp
trunk/SDK/MYSQLPlus/Library/MDiagnosticRecord.cpp
trunk/SDK/MYSQLPlus/Library/MStatement.cpp
trunk/SDK/MYSQLPlus/Library/MStatement_catalog.cpp
trunk/SDK/MYSQLPlus/Library/MStatement_props.cpp
trunk/SDK/MYSQLPlus/Tests/MYSQLPlusTest.cpp
Log:
Extract some methods out of MYODBCC class to MYODBCCString.
At least a bit easier to maintain.
Simplified some - seems a lot of code is copy-pasted, and
probably can be made more generic.
Moved some typedefs which are for internal usage from MYODBCC.h
to MYODBCC.cpp
Modified: trunk/Driver/Driver/Library/MYODBCDriverMain.cpp
===================================================================
--- trunk/Driver/Driver/Library/MYODBCDriverMain.cpp 2007-04-02 21:21:52 UTC (rev 829)
+++ trunk/Driver/Driver/Library/MYODBCDriverMain.cpp 2007-04-03 09:29:16 UTC (rev 830)
@@ -66,7 +66,7 @@
}
else
{
- gMYODBCTraceFile.setFileName( MYODBCC::QString_fromWCharArray( dest ) );
+ gMYODBCTraceFile.setFileName(MYODBCCString::QString_fromWCharArray(dest));
if ( gMYODBCTraceFile.open( QFile::WriteOnly ) )
{
MYODBCDbgInit( &gMYODBCTraceFile );
Modified: trunk/Driver/Setup/Library/ConfigDSN.cpp
===================================================================
--- trunk/Driver/Setup/Library/ConfigDSN.cpp 2007-04-02 21:21:52 UTC (rev 829)
+++ trunk/Driver/Setup/Library/ConfigDSN.cpp 2007-04-03 09:29:16 UTC (rev 830)
@@ -45,8 +45,8 @@
{
MYODBCDbgEnter();
- QString stringDriver( pszDriver );
- QString stringAttributes;
+ QString stringDriver(pszDriver);
+ QString stringAttributes;
/*
\todo Here we use QString_toWString() to avoid issue of how many bytes are in a
char
@@ -64,11 +64,11 @@
std::wstring wstringDriver;
std::wstring wstringAttributes;
- MYODBCC::QString_toWString( stringDriver, &wstringDriver, 0 );
- MYODBCC::QString_toWString( stringAttributes, &wstringAttributes, 0 );
+ MYODBCCString::QString_toWString( stringDriver, &wstringDriver, 0 );
+ MYODBCCString::QString_toWString( stringAttributes, &wstringAttributes, 0 );
- BOOL bReturn = ConfigDSNW( hWnd, nRequest,
- wstringDriver.c_str(), wstringAttributes.c_str() );
+ BOOL bReturn = ConfigDSNW(hWnd, nRequest, wstringDriver.c_str(),
+ wstringAttributes.c_str());
MYODBCDbgReturn3( "%d", bReturn );
}
Modified: trunk/Driver/Setup/Library/ConfigDSNW.cpp
===================================================================
--- trunk/Driver/Setup/Library/ConfigDSNW.cpp 2007-04-02 21:21:52 UTC (rev 829)
+++ trunk/Driver/Setup/Library/ConfigDSNW.cpp 2007-04-03 09:29:16 UTC (rev 830)
@@ -72,7 +72,10 @@
null byte, and the entire list is terminated with a null byte.
*/
QHash<QString,QString> hashKeywordValues;
- if ( !MYODBCIns::getKeywordValues( &hashKeywordValues,
MYODBCC::QString_fromWCharArray( pszzAttributes, MYODBCC::getKeywordValuesLength(
pszzAttributes ) + 2 ), MYODBCIns::DELIM_NULL ) )
+ if (!MYODBCIns::getKeywordValues(&hashKeywordValues,
+
MYODBCCString::QString_fromWCharArray(pszzAttributes,
+
MYODBCC::getKeywordValuesLength( pszzAttributes ) + 2),
+ MYODBCIns::DELIM_NULL))
{
MYODBCIns::setError( "Data Source string seems invalid.",
ODBC_ERROR_INVALID_KEYWORD_VALUE );
MYODBCDbgReturn3( "%d", false );
@@ -83,7 +86,7 @@
if ( !datasource.setAttributes( hashKeywordValues, true, false ) )
MYODBCDbgReturn3( "%d", false );
- datasource.setDRIVER( MYODBCC::QString_fromWCharArray( pszDriver ) );
+ datasource.setDRIVER(MYODBCCString::QString_fromWCharArray(pszDriver));
/*!
\internal ODBC RULE
Modified: trunk/SDK/C/Library/MYODBCC.cpp
===================================================================
--- trunk/SDK/C/Library/MYODBCC.cpp 2007-04-02 21:21:52 UTC (rev 829)
+++ trunk/SDK/C/Library/MYODBCC.cpp 2007-04-03 09:29:16 UTC (rev 830)
@@ -28,6 +28,15 @@
*/
#include "MYODBCC.h"
+typedef unsigned short UTF16;
+typedef unsigned int UTF32;
+
+const UTF16 HI_SURROGATE_START = 0xD800;
+const UTF16 HI_SURROGATE_END = 0xDBFF;
+const UTF16 LO_SURROGATE_START = 0xDC00;
+const UTF16 LO_SURROGATE_END = 0xDFFF;
+
+
MDIAGNOSTIC_STATE MDiagnosticStatesV2[]=
{ /* ClassOrigin,SubClassOrigin,Description,ReturnCode */
{"SQL-92","SQL-92","01000","General warning",SQL_SUCCESS_WITH_INFO},
@@ -495,7 +504,7 @@
};
-size_t MYODBCC::getStrLen( const SQLWCHAR *psz, size_t nMaxChars )
+size_t MYODBCCString::getStrLen( const SQLWCHAR *psz, size_t nMaxChars )
{
size_t i = 0;
for( ; (i < nMaxChars || nMaxChars < 0) && psz[i]; ++i);
@@ -526,7 +535,7 @@
return (pc - pszzKeywordValues);
}
-QByteArray MYODBCC::getEscaped( QByteArray data )
+QByteArray MYODBCCString::getEscaped( QByteArray data )
{
QByteArray stringEscaped;
@@ -2544,7 +2553,7 @@
\retval true Copy completed with no warnings/errors
false Copy completed but result was truncated due to lack of space in
dest buffer
*/
-BOOL MYODBCC::doStringCopyOut( SQLCHAR *pszDest, SQLINTEGER nDestMaxChars, SQLCHAR
*pszSrc )
+BOOL MYODBCCString::doStringCopyOut( SQLCHAR *pszDest, SQLINTEGER nDestMaxChars, SQLCHAR
*pszSrc )
{
SQLINTEGER nIndex = 0;
@@ -2596,7 +2605,7 @@
\retval true Copy completed with no warnings/errors
false Copy completed but result was truncated due to lack of space in
dest buffer
*/
-BOOL MYODBCC::doStringCopyOut( SQLWCHAR *pszDest, SQLINTEGER nDestMaxChars, SQLWCHAR
*pszSrc, SQLINTEGER *pnSrcLenCharsPtr )
+BOOL MYODBCCString::doStringCopyOut( SQLWCHAR *pszDest, SQLINTEGER nDestMaxChars,
SQLWCHAR *pszSrc, SQLINTEGER *pnSrcLenCharsPtr )
{
SQLINTEGER nSrcLenChars = 0;
SQLINTEGER *pnSrcLenChars = pnSrcLenCharsPtr;
@@ -2645,7 +2654,7 @@
\retval true Copy completed with no warnings/errors
false Copy completed but result was truncated due to lack of space in
dest buffer
*/
-BOOL MYODBCC::doStringCopyOut( SQLWCHAR *pszDest, SQLINTEGER nDestMaxChars,
+BOOL MYODBCCString::doStringCopyOut( SQLWCHAR *pszDest, SQLINTEGER nDestMaxChars,
QString src, SQLINTEGER *pnSrcLenCharsPtr )
{
int r = QString_toWCharArray(src, pszDest, nDestMaxChars);
@@ -2679,7 +2688,7 @@
return false;
}
-int MYODBCC::QString_toWString( QString qs, std::wstring *st, int ws_max_chars )
+int MYODBCCString::QString_toWString( QString qs, std::wstring *st, int ws_max_chars )
{
int size = qs.length();
int i,j; /* i = Position(qs); j = Position(st) */
@@ -2713,7 +2722,7 @@
return j;
}
-int MYODBCC::QString_toWCharArray( QString qs, wchar_t *array, int nLenChars )
+int MYODBCCString::QString_toWCharArray( QString qs, wchar_t *array, int nLenChars )
{
std::wstring st;
/* convert to the WString and save a spot for null-term */
@@ -2730,7 +2739,7 @@
return r;
}
-QString MYODBCC::QString_fromWCharArray( const wchar_t *pwsString, int nLenChars )
+QString MYODBCCString::QString_fromWCharArray( const wchar_t *pwsString, int nLenChars )
{
int i;
QString str;
Modified: trunk/SDK/C/include/MYODBCC.h
===================================================================
--- trunk/SDK/C/include/MYODBCC.h 2007-04-02 21:21:52 UTC (rev 829)
+++ trunk/SDK/C/include/MYODBCC.h 2007-04-03 09:29:16 UTC (rev 830)
@@ -75,20 +75,7 @@
#include <string>
#include <cctype>
-/*!
- \internal
- \todo
- Better to prefix these to preserve namespace.
-*/
-typedef unsigned short UTF16;
-typedef unsigned int UTF32;
-
-const UTF16 HI_SURROGATE_START = 0xD800;
-const UTF16 HI_SURROGATE_END = 0xDBFF;
-const UTF16 LO_SURROGATE_START = 0xDC00;
-const UTF16 LO_SURROGATE_END = 0xDFFF;
-
/* standard ODBC includes */
#include <sqltypes.h>
#include <odbcinst.h>
@@ -437,14 +424,12 @@
*/
extern int MDiagnosticStatesXRef[2][120];
+
/*!
- \brief C API portability and convenience.
+ \brief C String API portability and convenience.
- This class is basically just a namespace for us to play in. From
- within this class we can safely provide C portability and some
- convenience features.
*/
-class MYODBCC
+class MYODBCCString
{
public:
/*!
@@ -467,26 +452,47 @@
*/
static size_t getStrLen( const SQLWCHAR *psz, size_t nMaxChars );
+ static QByteArray getEscaped( QByteArray data );
+
/*!
- \brief Get string length.
+ \name QString (utf16 internally) to/from wchar string conversions.
- Use this to get the number of characters in a wide character
- string where the delimiter is two null wchars.
+ Faciliate the conversions between wchar string and QString.
- The length will NOT include the two null wchar terminators but
- will include any other nulls.
+ For details of the implementation see http://unicode.org/faq/utf_bom.html#35
- \param pszKeywordValues A wide character string appropriately delimited.
+ \note
- \return int
-
- \retval n The number of wide characters found (could be 0).
+ These features will be available in the QString class as of Qt 4.2.
*/
+ /*@{*/
+ static int QString_toWString( QString qs, std::wstring *ws, int ws_max_chars = -1 );
+ static int QString_toWCharArray( QString qs, wchar_t *array, int nLenChars = -1 );
+ static QString QString_fromWCharArray( const wchar_t *pwsString, int nLenChars = -1
);
+ /*@}*/
+
+ static BOOL doStringCopyOut( SQLCHAR *pszDest, SQLINTEGER nDestMaxChars, SQLCHAR
*pszSrc );
+ static BOOL doStringCopyOut( SQLWCHAR *pszDest, SQLINTEGER nDestMaxChars,
+ SQLWCHAR *pszSrc, SQLINTEGER *pnSrcLenCharsPtr = NULL
);
+ static BOOL doStringCopyOut( SQLWCHAR *pszDest, SQLINTEGER nDestMaxChars,
+ QString src, SQLINTEGER *pnSrcLenCharsPtr = NULL );
+};
+
+
+/*!
+ \brief C API portability and convenience.
+
+ This class is basically just a namespace for us to play in. From
+ within this class we can safely provide C portability and some
+ convenience features.
+*/
+class MYODBCC
+{
+public:
static int getKeywordValuesLength( LPCWSTR pszKeywordValues );
static int getKeywordValuesLength( LPCSTR pszKeywordValues );
- static QByteArray getEscaped( QByteArray data );
/*!
\name Get string version of a numeric "#define"
@@ -535,31 +541,10 @@
static SQLINTEGER getStmtAttrFromOption( SQLUSMALLINT nOption );
- static BOOL doStringCopyOut( SQLCHAR *pszDest, SQLINTEGER nDestMaxChars, SQLCHAR
*pszSrc );
- static BOOL doStringCopyOut( SQLWCHAR *pszDest, SQLINTEGER nDestMaxChars,
- SQLWCHAR *pszSrc, SQLINTEGER *pnSrcLenCharsPtr = NULL );
- static BOOL doStringCopyOut( SQLWCHAR *pszDest, SQLINTEGER nDestMaxChars,
- QString src, SQLINTEGER *pnSrcLenCharsPtr = NULL );
static BOOL isQuoteNeededSQL( SQLSMALLINT nType );
- /*!
- \name QString (utf16 internally) to/from wchar string conversions.
- Faciliate the conversions between wchar string and QString.
-
- For details of the implementation see http://unicode.org/faq/utf_bom.html#35
-
- \note
-
- These features will be available in the QString class as of Qt 4.2.
- */
- /*@{*/
- static int QString_toWString( QString qs, std::wstring *ws, int ws_max_chars = -1 );
- static int QString_toWCharArray( QString qs, wchar_t *array, int nLenChars = -1 );
- static QString QString_fromWCharArray( const wchar_t *pwsString, int nLenChars = -1
);
- /*@}*/
-
/*!
\brief Pack an 'int' into a char buffer.
Modified: trunk/SDK/Installer/Library/MYODBCIns.cpp
===================================================================
--- trunk/SDK/Installer/Library/MYODBCIns.cpp 2007-04-02 21:21:52 UTC (rev 829)
+++ trunk/SDK/Installer/Library/MYODBCIns.cpp 2007-04-03 09:29:16 UTC (rev 830)
@@ -37,7 +37,7 @@
if ( stringError.isNull() )
MYODBCDbgReturn3( "%d", false );
- MYODBCC::QString_toWString( stringError, &msg );
+ MYODBCCString::QString_toWString( stringError, &msg );
if ( !SQL_SUCCEEDED( SQLPostInstallerError( (DWORD)nError, const_cast<wchar_t
*>( msg.c_str() ) ) ) )
MYODBCDbgReturn3( "%d", false );
@@ -128,7 +128,7 @@
nReturn = SQLDataSources( hEnvironment, nDirection, sDataSourceName,
sizeof(sDataSourceName) / sizeof(SQLWCHAR), &nDataSourceNameLength, sDescription,
sizeof(sDescription) / sizeof(SQLWCHAR), &nDescriptionLength );
while ( SQL_SUCCEEDED( nReturn ) )
{
- stringlistDataSourceNames += MYODBCC::QString_fromWCharArray( sDataSourceName );
+ stringlistDataSourceNames += MYODBCCString::QString_fromWCharArray(
sDataSourceName );
nReturn = SQLDataSources( hEnvironment, SQL_FETCH_NEXT, sDataSourceName,
sizeof(sDataSourceName) / sizeof(SQLWCHAR), &nDataSourceNameLength, sDescription,
sizeof(sDescription) / sizeof(SQLWCHAR), &nDescriptionLength );
}
@@ -151,7 +151,7 @@
free(pszAttributes);
if ( bRetCode )
- stringDefaultInstallLocation = MYODBCC::QString_fromWCharArray( szPathOut );
+ stringDefaultInstallLocation = MYODBCCString::QString_fromWCharArray( szPathOut
);
MYODBCDbgReturn1( stringDefaultInstallLocation );
}
@@ -300,7 +300,7 @@
RETCODE nRetCode = SQLInstallerError( nError, pnErrorCode, szMessage,
sizeof(szMessage) / sizeof(SQLWCHAR), &nMessageLen );
if ( SQL_SUCCEEDED(nRetCode) )
- stringMessage = MYODBCC::QString_fromWCharArray( szMessage );
+ stringMessage = MYODBCCString::QString_fromWCharArray( szMessage );
MYODBCDbgReturn( nRetCode );
}
@@ -379,7 +379,7 @@
*pChar = cNull;
}
- MYODBCC::QString_toWString( stringNameAttributes, &msg );
+ MYODBCCString::QString_toWString( stringNameAttributes, &msg );
if ( !SQLInstallDriverEx( msg.c_str(), 0, sLocation, FILENAME_MAX,
&nLocationLength, ODBC_INSTALL_COMPLETE, pnUsageCount ) )
MYODBCDbgReturn3( "%d", false );
@@ -402,7 +402,7 @@
if ( !pnUsageCount )
pnUsageCount = &nUsageCount;
- MYODBCC::QString_toWString( stringName, &msg );
+ MYODBCCString::QString_toWString( stringName, &msg );
if ( !SQLRemoveDriver( msg.c_str(), bRemoveDSNs, pnUsageCount ) )
MYODBCDbgReturn3( "%d", false );
@@ -509,7 +509,7 @@
so we provide first arg and hope that there is at least one
attribute (its likely anyway).
*/
- MYODBCC::QString_toWString( stringName, &msg );
+ MYODBCCString::QString_toWString( stringName, &msg );
if ( SQLGetPrivateProfileString( msg.c_str(), NULL, L"", szSectionNames,
sizeof(szSectionNames) / sizeof(SQLWCHAR), L"ODBC.INI" ) > 0 )
{
bReturn = true;
@@ -527,14 +527,14 @@
pszSectionName = szSectionNames;
while( *pszSectionName )
{
- QString stringSectionName( MYODBCC::QString_fromWCharArray( pszSectionName ) );
+ QString stringSectionName( MYODBCCString::QString_fromWCharArray( pszSectionName
) );
if ( QString::localeAwareCompare( stringSectionName.toUpper(),
stringName.toUpper() ) == 0 )
{
bReturn = true;
goto isExistsDataSourceNameExit1;
}
- pszSectionName += MYODBCC::getStrLen( pszSectionName, SQL_MAX_DSN_LENGTH *
MYODBC_INS_MAX_DSN_NAMES ) + 1;
+ pszSectionName += MYODBCCString::getStrLen( pszSectionName, SQL_MAX_DSN_LENGTH *
MYODBC_INS_MAX_DSN_NAMES ) + 1;
}
isExistsDataSourceNameExit1:
Modified: trunk/SDK/Installer/Library/MYODBCInsDataSource.cpp
===================================================================
--- trunk/SDK/Installer/Library/MYODBCInsDataSource.cpp 2007-04-02 21:21:52 UTC (rev 829)
+++ trunk/SDK/Installer/Library/MYODBCInsDataSource.cpp 2007-04-03 09:29:16 UTC (rev 830)
@@ -308,13 +308,13 @@
SQLSetConfigMode( (UWORD)nScope );
*sEntryNames = '\0';
- MYODBCC::QString_toWString( stringDataSourceName, &msg );
+ MYODBCCString::QString_toWString( stringDataSourceName, &msg );
if ( ( nChars = SQLGetPrivateProfileString( msg.c_str(), NULL, L"", sEntryNames,
sizeof(sEntryNames) / sizeof(SQLWCHAR), L"ODBC.INI" ) ) < 1 )
goto doReadExit1;
#if defined(WIN32)
{
- int nLen = MYODBCC::getStrLen( sEntryNames, SQL_MAX_DSN_LENGTH *
MYODBC_INS_MAX_DSN_NAMES );
+ int nLen = MYODBCCString::getStrLen( sEntryNames, SQL_MAX_DSN_LENGTH *
MYODBC_INS_MAX_DSN_NAMES );
/*!
\note XP
@@ -334,7 +334,7 @@
*sEntryNames = '\0';
SQLSetConfigMode( ODBC_SYSTEM_DSN );
- MYODBCC::QString_toWString( stringDataSourceName, &msg );
+ MYODBCCString::QString_toWString( stringDataSourceName, &msg );
if ( ( nChars = SQLGetPrivateProfileString( msg.c_str(), NULL, NULL,
sEntryNames, sizeof(sEntryNames) / sizeof(SQLWCHAR), L"ODBC.INI" ) ) < 1 )
goto doReadExit1;
}
@@ -353,12 +353,12 @@
while ( *psEntryName )
{
*sValue = '\0';
- MYODBCC::QString_toWString( stringDataSourceName, &msg );
+ MYODBCCString::QString_toWString( stringDataSourceName, &msg );
if ( SQLGetPrivateProfileString( msg.c_str(), psEntryName, L"", sValue, sizeof(
sValue ) / sizeof(SQLWCHAR), L"ODBC.INI" ) > 0 )
{
- QString stringEntryName( MYODBCC::QString_fromWCharArray( psEntryName ) );
+ QString stringEntryName( MYODBCCString::QString_fromWCharArray( psEntryName )
);
QString stringEntryNameUpper = stringEntryName.toUpper();
- QString stringValue( MYODBCC::QString_fromWCharArray( sValue ) );
+ QString stringValue( MYODBCCString::QString_fromWCharArray( sValue ) );
/*!
\internal ODBC Rule
@@ -378,7 +378,7 @@
else
MYODBCDbgWarning( "Failed to get value for attribute (%ls).", psEntryName );
- psEntryName += MYODBCC::getStrLen( psEntryName, SQL_MAX_DSN_LENGTH *
MYODBC_INS_MAX_DSN_NAMES ) + 1;
+ psEntryName += MYODBCCString::getStrLen( psEntryName, SQL_MAX_DSN_LENGTH *
MYODBC_INS_MAX_DSN_NAMES ) + 1;
} /* while */
bReturn = true;
@@ -441,12 +441,12 @@
This is particularly important when saving attributes which have an empty value
but used
to have a non-empty value as empty value attributes are ignored during save.
*/
- MYODBCC::QString_toWString( stringName, &msg1 );
+ MYODBCCString::QString_toWString( stringName, &msg1 );
if ( !SQLRemoveDSNFromIni( msg1.c_str() ) )
goto doWriteExit1;
/* create/replace data source name */
- MYODBCC::QString_toWString( hashAttributes["DRIVER"], &msg2 );
+ MYODBCCString::QString_toWString( hashAttributes["DRIVER"], &msg2 );
if ( !SQLWriteDSNToIni( msg1.c_str(), msg2.c_str() ) )
goto doWriteExit1;
@@ -457,8 +457,8 @@
{
if ( !i.value().isEmpty() )
{
- MYODBCC::QString_toWString( i.key(), &msg2 );
- MYODBCC::QString_toWString( i.value(), &msg3 );
+ MYODBCCString::QString_toWString( i.key(), &msg2 );
+ MYODBCCString::QString_toWString( i.value(), &msg3 );
if ( !SQLWritePrivateProfileString( msg1.c_str(), msg2.c_str(),
msg3.c_str(), L"odbc.ini" ) )
goto doWriteExit1;
}
@@ -524,7 +524,7 @@
MYODBCDbgEnter();
std::wstring msg;
- MYODBCC::QString_toWString( stringDataSourceName, &msg );
+ MYODBCCString::QString_toWString( stringDataSourceName, &msg );
BOOL bReturn = SQLRemoveDSNFromIni( msg.c_str() );
MYODBCDbgReturn3( "%d", bReturn );
@@ -542,7 +542,8 @@
{
if ( i.key() != "DSN" || bStrict ) // exception for DSN as we can handle that
by mapping to Name
{
- MYODBCIns::setError( QString( "[%1][%2][ERROR] %3 is an unsupported
attribute." ).arg( __FILE__ ).arg( __LINE__ ).arg( i.key() ) );
+ MYODBCIns::setError( QString( "[%1][%2][ERROR] %3 is an unsupported
attribute." ).
+ arg( __FILE__ ).arg( __LINE__ ).arg( i.key() ) );
MYODBCDbgReturn3( "%d", false );
}
}
Modified: trunk/SDK/Installer/Library/MYODBCInsDriver.cpp
===================================================================
--- trunk/SDK/Installer/Library/MYODBCInsDriver.cpp 2007-04-02 21:21:52 UTC (rev 829)
+++ trunk/SDK/Installer/Library/MYODBCInsDriver.cpp 2007-04-03 09:29:16 UTC (rev 830)
@@ -87,21 +87,21 @@
std::wstring msg;
/* friendly name */
- MYODBCC::QString_toWCharArray( stringFriendlyName, pcInsertPos,
stringFriendlyName.length() + 1 );
+ MYODBCCString::QString_toWCharArray( stringFriendlyName, pcInsertPos,
stringFriendlyName.length() + 1 );
pcInsertPos += stringFriendlyName.length() + 1;
/* DRIVER */
memcpy(pcInsertPos, L"DRIVER=", 7 * sizeof(SQLWCHAR));
pcInsertPos += 7;
- MYODBCC::QString_toWCharArray( stringDRIVER, pcInsertPos, stringDRIVER.length() + 1
);
+ MYODBCCString::QString_toWCharArray( stringDRIVER, pcInsertPos, stringDRIVER.length()
+ 1 );
pcInsertPos += stringDRIVER.length() + 1;
/* SETUP */
memcpy(pcInsertPos, L"SETUP=", 6 * sizeof(SQLWCHAR));
pcInsertPos += 6;
- MYODBCC::QString_toWCharArray( stringSETUP, pcInsertPos, stringSETUP.length() + 1 );
+ MYODBCCString::QString_toWCharArray( stringSETUP, pcInsertPos, stringSETUP.length() +
1 );
pcInsertPos += stringSETUP.length();
/* we have terminated keyword/value pairs with null now extra null to terminate the
whole thing */
@@ -127,7 +127,7 @@
}
*szEntryNames = '\0';
- MYODBCC::QString_toWString( stringFriendlyName, &msg );
+ MYODBCCString::QString_toWString( stringFriendlyName, &msg );
int nChars = SQLGetPrivateProfileString( msg.c_str(), NULL, L"", szEntryNames,
sizeof(szEntryNames) / sizeof(SQLWCHAR), L"ODBCINST.INI" );
if ( nChars < 1 )
{
@@ -147,27 +147,27 @@
while ( *psEntryName )
{
*szValue = '\0';
- MYODBCC::QString_toWString( stringFriendlyName, &msg );
+ MYODBCCString::QString_toWString( stringFriendlyName, &msg );
if ( SQLGetPrivateProfileString( msg.c_str(), psEntryName, L"", szValue,
sizeof(szValue) / sizeof(SQLWCHAR), L"ODBCINST.INI" ) > 0 )
{
- QString stringEntryName = MYODBCC::QString_fromWCharArray( psEntryName );
+ QString stringEntryName = MYODBCCString::QString_fromWCharArray( psEntryName
);
if ( QString::localeAwareCompare( stringEntryName.toUpper(), "DRIVER" ) == 0
)
{
if ( stringDRIVER.isEmpty() )
- stringDRIVER = MYODBCC::QString_fromWCharArray( szValue );
+ stringDRIVER = MYODBCCString::QString_fromWCharArray( szValue );
}
else if ( QString::localeAwareCompare( stringEntryName.toUpper(), "SETUP" )
== 0 )
{
if ( stringSETUP.isEmpty() )
- stringSETUP = MYODBCC::QString_fromWCharArray( szValue );
+ stringSETUP = MYODBCCString::QString_fromWCharArray( szValue );
}
else
{
/* What the ? */
}
}
- psEntryName += MYODBCC::getStrLen( psEntryName, SQL_MAX_DSN_LENGTH *
MYODBC_INS_MAX_DSN_NAMES ) + 1;
+ psEntryName += MYODBCCString::getStrLen( psEntryName, SQL_MAX_DSN_LENGTH *
MYODBC_INS_MAX_DSN_NAMES ) + 1;
} /* while */
MYODBCDbgReturn3( "%d", true );
@@ -204,7 +204,7 @@
MYODBCDbgEnter();
std::wstring msg;
- MYODBCC::QString_toWString( stringDriverName, &msg );
+ MYODBCCString::QString_toWString( stringDriverName, &msg );
BOOL b = SQLRemoveDriver( msg.c_str(), bRemoveDataSourceNames, pnUsageCount );
MYODBCDbgReturn3( "%d", b );
Modified: trunk/SDK/Installer/Tests/MYODBCInsTest.cpp
===================================================================
--- trunk/SDK/Installer/Tests/MYODBCInsTest.cpp 2007-04-02 21:21:52 UTC (rev 829)
+++ trunk/SDK/Installer/Tests/MYODBCInsTest.cpp 2007-04-03 09:29:16 UTC (rev 830)
@@ -65,85 +65,91 @@
}
/*
- Test the MYODBCIns::getKeywordValues parsing of connect strings.
+ Test the MYODBCIns::getKeywordValues parsing of connect strings.
*/
#define INS_VAL_TEST(a,b) QCOMPARE( attrVals.value(a), QString::fromAscii(b))
void MYODBCInsTest::slotAttributeParsing()
{
- /* semi-delimited, end on delimiter, no braces */
+ /* semi-delimited, end on delimiter, no braces */
wchar_t *attrs = L"DSN=NorthwindMyODBC5;UID=myodbctest;PWD=myodbctest;PORT=3306;";
QHash<QString, QString> attrVals;
- if ( !MYODBCIns::getKeywordValues( &attrVals,
- MYODBCC::QString_fromWCharArray( attrs ), MYODBCIns::DELIM_SEMI ) )
+ if (!MYODBCIns::getKeywordValues(&attrVals,
+ MYODBCCString::QString_fromWCharArray(attrs),
+ MYODBCIns::DELIM_SEMI))
QFAIL( "getKeywordValues failed" );
- INS_VAL_TEST("DSN", "NorthwindMyODBC5");
+ INS_VAL_TEST("DSN", "NorthwindMyODBC5");
INS_VAL_TEST("UID", "myodbctest");
INS_VAL_TEST("PWD", "myodbctest");
INS_VAL_TEST("PORT", "3306");
- attrVals.clear();
+ attrVals.clear();
- /* semi-delimited, end on value, no braces */
+ /* semi-delimited, end on value, no braces */
attrs = L"DSN=NorthwindMyODBC5;UID=myodbctest;PWD=myodbctest";
- if ( !MYODBCIns::getKeywordValues( &attrVals,
- MYODBCC::QString_fromWCharArray( attrs ), MYODBCIns::DELIM_SEMI ) )
+ if ( !MYODBCIns::getKeywordValues(&attrVals,
+ MYODBCCString::QString_fromWCharArray(attrs),
+ MYODBCIns::DELIM_SEMI))
QFAIL( "getKeywordValues failed" );
- INS_VAL_TEST("DSN", "NorthwindMyODBC5");
+ INS_VAL_TEST("DSN", "NorthwindMyODBC5");
INS_VAL_TEST("UID", "myodbctest");
INS_VAL_TEST("PWD", "myodbctest");
- attrVals.clear();
+ attrVals.clear();
/* semi-delimited, end on delimiter, with braces */
attrs = L"DSN={NorthwindMyODBC5};UID={myodbctest};PWD={myodbctest};";
- if ( !MYODBCIns::getKeywordValues( &attrVals,
- MYODBCC::QString_fromWCharArray( attrs ), MYODBCIns::DELIM_SEMI ) )
+ if ( !MYODBCIns::getKeywordValues(&attrVals,
+ MYODBCCString::QString_fromWCharArray(attrs),
+ MYODBCIns::DELIM_SEMI))
QFAIL( "getKeywordValues failed" );
- INS_VAL_TEST("DSN", "NorthwindMyODBC5");
+ INS_VAL_TEST("DSN", "NorthwindMyODBC5");
INS_VAL_TEST("UID", "myodbctest");
INS_VAL_TEST("PWD", "myodbctest");
- attrVals.clear();
+ attrVals.clear();
/* semi-delimited, end on brace, with braces */
attrs = L"DSN={NorthwindMyODBC5};UID={myodbctest};PWD={myodbctest}";
- if ( !MYODBCIns::getKeywordValues( &attrVals,
- MYODBCC::QString_fromWCharArray( attrs ), MYODBCIns::DELIM_SEMI ) )
+ if (!MYODBCIns::getKeywordValues(&attrVals,
+ MYODBCCString::QString_fromWCharArray( attrs ),
+ MYODBCIns::DELIM_SEMI))
QFAIL( "getKeywordValues failed" );
- INS_VAL_TEST("DSN", "NorthwindMyODBC5");
+ INS_VAL_TEST("DSN", "NorthwindMyODBC5");
INS_VAL_TEST("UID", "myodbctest");
INS_VAL_TEST("PWD", "myodbctest");
- attrVals.clear();
+ attrVals.clear();
- /* test error condition, left-open brace */
+ /* test error condition, left-open brace */
attrs = L"DSN={NorthwindMyODBC5;UID={myodbctest};PWD={myodbctest}";
- if ( MYODBCIns::getKeywordValues( &attrVals,
- MYODBCC::QString_fromWCharArray( attrs ), MYODBCIns::DELIM_SEMI ) )
+ if (MYODBCIns::getKeywordValues(&attrVals,
+ MYODBCCString::QString_fromWCharArray(attrs),
+ MYODBCIns::DELIM_SEMI))
QFAIL( "getKeywordValues succeeded unexpectedly" );
- attrVals.clear();
+ attrVals.clear();
- /* test redundant attributes */
+ /* test redundant attributes */
attrs = L"DSN=dsn1;DSN=dsn2;PWD={myodbctest}";
- if ( !MYODBCIns::getKeywordValues( &attrVals,
- MYODBCC::QString_fromWCharArray( attrs ), MYODBCIns::DELIM_SEMI ) )
+ if (!MYODBCIns::getKeywordValues(&attrVals,
+ MYODBCCString::QString_fromWCharArray( attrs ),
+ MYODBCIns::DELIM_SEMI))
QFAIL( "getKeywordValues failed" );
- INS_VAL_TEST("DSN", "dsn1");
+ INS_VAL_TEST("DSN", "dsn1");
INS_VAL_TEST("PWD", "myodbctest");
- attrVals.clear();
+ attrVals.clear();
}
@@ -173,17 +179,20 @@
QCOMPARE( nLength, nActualLength );
if ( !MYODBCIns::getKeywordValues( &hashKeywordValues,
- MYODBCC::QString_fromWCharArray( szzAttributes, nLength + 1 ),
+ MYODBCCString::QString_fromWCharArray( szzAttributes, nLength + 1 ),
MYODBCIns::DELIM_NULL ) )
QFAIL( "getKeywordValues failed" );
- QCOMPARE( hashKeywordValues.count(), 3 );
- QCOMPARE( hashKeywordValues.value( "DRIVER" ),
- QString::fromAscii( "my driver" ) );
- QCOMPARE( hashKeywordValues.value( "DSN" ),
- QString::fromAscii( "my dsn" ) );
- QCOMPARE( hashKeywordValues.value( "DATABASE" ),
- QString::fromAscii( "my database" ) );
+ QCOMPARE(hashKeywordValues.count(), 3 );
+ QCOMPARE(hashKeywordValues.value( "DRIVER" ),
+ QString::fromAscii( "my driver" ));
+
+ QCOMPARE(hashKeywordValues.value( "DSN" ),
+ QString::fromAscii( "my dsn" ) );
+
+ QCOMPARE(hashKeywordValues.value( "DATABASE" ),
+ QString::fromAscii( "my database" ) );
+
/* does MYODBCInsDataSource load ok? */
{
MYODBCInsDataSource datasource;
@@ -226,7 +235,7 @@
QCOMPARE( driverconnect.getDSN(), QString( "MyDSN" ) );
QCOMPARE( driverconnect.getDRIVER(), QString( "My Driver" ) );
QCOMPARE( driverconnect.getAttributes(),
- QString( "DRIVER=My Driver;DATABASE=MyDB;DSN=MyDSN" ) );
+ QString( "DRIVER=My Driver;DATABASE=MyDB;DSN=MyDSN" ) );
}
}
@@ -291,7 +300,7 @@
driver.getSETUP() != stringDefaultInstallLocation + FILE_SEP + TEST_SETUP )
{
MYODBCDbgError1( "Have prepended path to file names but driver information "
- "is not the same: " + stringDefaultInstallLocation );
+ "is not the same: " + stringDefaultInstallLocation );
MYODBCDbgError1( "\nWrote...\n" + stringOutput );
MYODBCDbgError1( "\nRead...\n" + stringResult );
QFAIL( "Failed to verify that driver was registered." );
Modified: trunk/SDK/MYSQLPlus/Library/MConnection.cpp
===================================================================
--- trunk/SDK/MYSQLPlus/Library/MConnection.cpp 2007-04-02 21:21:52 UTC (rev 829)
+++ trunk/SDK/MYSQLPlus/Library/MConnection.cpp 2007-04-03 09:29:16 UTC (rev 830)
@@ -444,7 +444,7 @@
datasource.setScope( MYODBCInsDataSource::DATASOURCE_SCOPE_BOTH );
/* parse incoming attributes */
- QString stringConnection = MYODBCC::QString_fromWCharArray( psInConnectionString,
+ QString stringConnection = MYODBCCString::QString_fromWCharArray(
psInConnectionString,
nStringLength1 == SQL_NTS ? wcslen( psInConnectionString ) : nStringLength1
);
QString stringConnectionMissing;
@@ -578,7 +578,8 @@
*/
SQLRETURN nReturn = SQL_NEED_DATA;
- if ( !MYODBCC::doStringCopyOut( psOutConnectionString, nBufferLength /
sizeof(SQLWCHAR), stringConnectionMissing, (SQLINTEGER*)pnStringLength2Ptr ) )
+ if ( !MYODBCCString::doStringCopyOut( psOutConnectionString, nBufferLength /
sizeof(SQLWCHAR),
+ stringConnectionMissing,
(SQLINTEGER*)pnStringLength2Ptr ) )
{
if ( !pnStringLength2Ptr )
{
@@ -662,15 +663,15 @@
QString stringAuthentication;
if ( psServerName )
- stringServerName = MYODBCC::QString_fromWCharArray( psServerName,
+ stringServerName = MYODBCCString::QString_fromWCharArray( psServerName,
nNameLength1 == SQL_NTS ? wcslen( psServerName ) : nNameLength1 );
if ( psUserName )
- stringUserName = MYODBCC::QString_fromWCharArray( psUserName,
+ stringUserName = MYODBCCString::QString_fromWCharArray( psUserName,
nNameLength2 == SQL_NTS ? wcslen( psUserName ) : nNameLength2 );
if ( psAuthentication )
- stringAuthentication = MYODBCC::QString_fromWCharArray( psAuthentication,
+ stringAuthentication = MYODBCCString::QString_fromWCharArray( psAuthentication,
nNameLength3 == SQL_NTS ? wcslen( psAuthentication ) : nNameLength3 );
/*!
@@ -912,9 +913,9 @@
/* convert to QString... */
if ( nStringLength1 == SQL_NTS )
- stringInConnectionString = MYODBCC::QString_fromWCharArray( pszInConnectionString
);
+ stringInConnectionString = MYODBCCString::QString_fromWCharArray(
pszInConnectionString );
else
- stringInConnectionString = MYODBCC::QString_fromWCharArray(
pszInConnectionString, nStringLength1 );
+ stringInConnectionString = MYODBCCString::QString_fromWCharArray(
pszInConnectionString, nStringLength1 );
/*!
\internal MYODBC RULE
@@ -1042,7 +1043,7 @@
(LPTSTR)&pszMsg,
0,
NULL );
- nReturn = getDiagnostic()->doAppend( MDiagnostic::STATE_HY000, 0,
MYODBCC::QString_fromWCharArray( (SQLWCHAR*)pszMsg ) );
+ nReturn = getDiagnostic()->doAppend( MDiagnostic::STATE_HY000, 0,
MYODBCCString::QString_fromWCharArray( (SQLWCHAR*)pszMsg ) );
LocalFree( pszMsg );
#else
nReturn = getDiagnostic()->doAppend( MDiagnostic::STATE_HY000, 0, "Could
not find MYODBCSetupDataSourceConfig in setup library." );
@@ -1099,7 +1100,7 @@
the untruncated connection string is returned in *StringLength2Ptr.
(Function returns SQL_SUCCESS_WITH_INFO.)
*/
- if ( !MYODBCC::doStringCopyOut( pszOutConnectionString, nCharsMax,
driverconnect.getAttributes(), &nOutLength ) )
+ if ( !MYODBCCString::doStringCopyOut( pszOutConnectionString, nCharsMax,
driverconnect.getAttributes(), &nOutLength ) )
{
getDiagnostic()->doAppend( MDiagnostic::STATE_01004 );
nReturn = SQL_SUCCESS_WITH_INFO;
Modified: trunk/SDK/MYSQLPlus/Library/MConnection_props.cpp
===================================================================
--- trunk/SDK/MYSQLPlus/Library/MConnection_props.cpp 2007-04-02 21:21:52 UTC (rev 829)
+++ trunk/SDK/MYSQLPlus/Library/MConnection_props.cpp 2007-04-03 09:29:16 UTC (rev 830)
@@ -109,9 +109,9 @@
QString stringCurrentCatalog;
if ( nStringLength == SQL_NTS )
- stringCurrentCatalog = MYODBCC::QString_fromWCharArray(
(SQLWCHAR*)pValue );
+ stringCurrentCatalog = MYODBCCString::QString_fromWCharArray(
(SQLWCHAR*)pValue );
else
- stringCurrentCatalog = MYODBCC::QString_fromWCharArray(
(SQLWCHAR*)pValue, nStringLength );
+ stringCurrentCatalog = MYODBCCString::QString_fromWCharArray(
(SQLWCHAR*)pValue, nStringLength );
MYODBCDbgReturn( setCurrentCatalog( stringCurrentCatalog ) );
}
@@ -147,9 +147,9 @@
QString stringTracefile;
if ( nStringLength == SQL_NTS )
- stringTracefile = MYODBCC::QString_fromWCharArray( (SQLWCHAR*)pValue
);
+ stringTracefile = MYODBCCString::QString_fromWCharArray(
(SQLWCHAR*)pValue );
else
- stringTracefile = MYODBCC::QString_fromWCharArray( (SQLWCHAR*)pValue,
nStringLength );
+ stringTracefile = MYODBCCString::QString_fromWCharArray(
(SQLWCHAR*)pValue, nStringLength );
MYODBCDbgReturn( setTracefile( stringTracefile ) );
}
@@ -167,9 +167,9 @@
QString stringTranslateLib;
if ( nStringLength == SQL_NTS )
- stringTranslateLib = MYODBCC::QString_fromWCharArray(
(SQLWCHAR*)pValue );
+ stringTranslateLib = MYODBCCString::QString_fromWCharArray(
(SQLWCHAR*)pValue );
else
- stringTranslateLib = MYODBCC::QString_fromWCharArray(
(SQLWCHAR*)pValue, nStringLength );
+ stringTranslateLib = MYODBCCString::QString_fromWCharArray(
(SQLWCHAR*)pValue, nStringLength );
MYODBCDbgReturn( setTranslateLib( stringTranslateLib ) );
}
@@ -379,7 +379,8 @@
MYODBCDbgReturn( SQL_NO_DATA );
/* copy string */
- bCopyOk = MYODBCC::doStringCopyOut( (SQLWCHAR*)pValue, nBufferLength /
sizeof(SQLWCHAR), getTracefile(), pnLen );
+ bCopyOk = MYODBCCString::doStringCopyOut((SQLWCHAR*)pValue, nBufferLength /
sizeof(SQLWCHAR),
+ getTracefile(), pnLen );
/* because we have char len but we want byte len */
*pnLen = *pnLen * sizeof(SQLWCHAR);
if ( !bCopyOk )
@@ -401,7 +402,8 @@
MYODBCDbgReturn( SQL_NO_DATA );
/* copy string */
- bCopyOk = MYODBCC::doStringCopyOut( (SQLWCHAR*)pValue, nBufferLength /
sizeof(SQLWCHAR), getTranslateLib(), pnLen );
+ bCopyOk = MYODBCCString::doStringCopyOut((SQLWCHAR*)pValue, nBufferLength /
sizeof(SQLWCHAR),
+ getTranslateLib(), pnLen );
/* because we have char len but we want byte len */
*pnLen = *pnLen * sizeof(SQLWCHAR);
if ( !bCopyOk )
@@ -1268,12 +1270,11 @@
if ( pszSQLWCHAR )
{
- BOOL bCopyOk = MYODBCC::doStringCopyOut( pszSQLWCHAR,
- nBufferLength / sizeof(SQLWCHAR),
- val, &nStringLengthChars );
+ BOOL bCopyOk = MYODBCCString::doStringCopyOut( pszSQLWCHAR,
+ nBufferLength / sizeof(SQLWCHAR),
+ val, &nStringLengthChars );
if ( !bCopyOk )
- MYODBCDbgReturn( getDiagnostic()->
- doAppend( MDiagnostic::STATE_01004 ) );
+ MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_01004 ) );
}
*pnStringLengthBytes = val.size() * sizeof(SQLWCHAR);
Modified: trunk/SDK/MYSQLPlus/Library/MDataConvert.cpp
===================================================================
--- trunk/SDK/MYSQLPlus/Library/MDataConvert.cpp 2007-04-02 21:21:52 UTC (rev 829)
+++ trunk/SDK/MYSQLPlus/Library/MDataConvert.cpp 2007-04-03 09:29:16 UTC (rev 830)
@@ -12,9 +12,8 @@
v.setValue( QString::fromUtf8( (const char *)data, len ) );
break;
case SQL_C_WCHAR:
- v.setValue( MYODBCC::QString_fromWCharArray(
- (const SQLWCHAR *)data,
- len > 0 ? len / sizeof(SQLWCHAR) : len ) );
+ v.setValue( MYODBCCString::QString_fromWCharArray((const SQLWCHAR *)data,
+ len > 0 ? len /
sizeof(SQLWCHAR) : len ) );
break;
case SQL_C_TINYINT:
case SQL_C_STINYINT:
@@ -271,7 +270,7 @@
case SQL_WVARCHAR:
case SQL_WLONGVARCHAR:
{
- QByteArray escaped = MYODBCC::getEscaped( v.toString().toUtf8() );
+ QByteArray escaped = MYODBCCString::getEscaped( v.toString().toUtf8() );
escaped.prepend( "'" );
escaped.append( "'" );
v.setValue( escaped );
@@ -281,7 +280,7 @@
case SQL_VARBINARY:
case SQL_LONGVARBINARY:
{
- QByteArray escaped = MYODBCC::getEscaped( v.toByteArray() );
+ QByteArray escaped = MYODBCCString::getEscaped( v.toByteArray() );
escaped.prepend( "_BINARY'" );
escaped.append( "'" );
v.setValue( escaped );
Modified: trunk/SDK/MYSQLPlus/Library/MDescriptorRecord.cpp
===================================================================
--- trunk/SDK/MYSQLPlus/Library/MDescriptorRecord.cpp 2007-04-02 21:21:52 UTC (rev 829)
+++ trunk/SDK/MYSQLPlus/Library/MDescriptorRecord.cpp 2007-04-03 09:29:16 UTC (rev 830)
@@ -953,7 +953,7 @@
SQLRETURN MDescriptorRecord::getDescField( SQLSMALLINT nFieldIdentifier, SQLPOINTER
pValuePtr, SQLINTEGER nBufferLength, SQLINTEGER *pnStringLengthPtr )
{
SQLINTEGER nStringLength;
-
+ SQLINTEGER nBufferCharLength = nBufferLength / sizeof(SQLWCHAR);
MYODBCDbgEnter();
/* use a dummy str len if we must */
@@ -984,13 +984,15 @@
case SQL_DESC_BASE_COLUMN_NAME:
*pnStringLengthPtr = getBaseColumnName().length() * sizeof(SQLWCHAR);
- if ( !MYODBCC::doStringCopyOut( (SQLWCHAR*)pValuePtr, nBufferLength /
sizeof(SQLWCHAR), getBaseColumnName() ) )
+
+ if (!MYODBCCString::doStringCopyOut((SQLWCHAR*)pValuePtr, nBufferCharLength,
getBaseColumnName()))
MYODBCDbgReturn( getDescriptor()->getDiagnostic()->doAppend(
MDiagnostic::STATE_01004 ) );
break;
case SQL_DESC_BASE_TABLE_NAME:
*pnStringLengthPtr = getBaseTableName().length() * sizeof(SQLWCHAR);
- if ( !MYODBCC::doStringCopyOut( (SQLWCHAR*)pValuePtr, nBufferLength /
sizeof(SQLWCHAR), getBaseTableName() ) )
+
+ if (!MYODBCCString::doStringCopyOut((SQLWCHAR*)pValuePtr, nBufferCharLength,
getBaseTableName()))
MYODBCDbgReturn( getDescriptor()->getDiagnostic()->doAppend(
MDiagnostic::STATE_01004 ) );
break;
@@ -1000,7 +1002,8 @@
case SQL_DESC_CATALOG_NAME:
*pnStringLengthPtr = getCatalogName().length() * sizeof(SQLWCHAR);
- if ( !MYODBCC::doStringCopyOut( (SQLWCHAR*)pValuePtr, nBufferLength /
sizeof(SQLWCHAR), getCatalogName() ) )
+
+ if (!MYODBCCString::doStringCopyOut((SQLWCHAR*)pValuePtr, nBufferCharLength,
getCatalogName()))
MYODBCDbgReturn( getDescriptor()->getDiagnostic()->doAppend(
MDiagnostic::STATE_01004 ) );
break;
@@ -1046,7 +1049,8 @@
case SQL_DESC_LABEL:
*pnStringLengthPtr = getLabel().length() * sizeof(SQLWCHAR);
- if ( !MYODBCC::doStringCopyOut( (SQLWCHAR*)pValuePtr, nBufferLength /
sizeof(SQLWCHAR), getLabel() ) )
+
+ if (!MYODBCCString::doStringCopyOut((SQLWCHAR*)pValuePtr, nBufferCharLength,
getLabel()))
MYODBCDbgReturn( getDescriptor()->getDiagnostic()->doAppend(
MDiagnostic::STATE_01004 ) );
break;
@@ -1056,26 +1060,30 @@
case SQL_DESC_LITERAL_PREFIX:
*pnStringLengthPtr = getLiteralPrefix().length() * sizeof(SQLWCHAR);
- if ( !MYODBCC::doStringCopyOut( (SQLWCHAR*)pValuePtr, nBufferLength /
sizeof(SQLWCHAR), getLiteralPrefix() ) )
+
+ if (!MYODBCCString::doStringCopyOut((SQLWCHAR*)pValuePtr, nBufferCharLength,
getLiteralPrefix()))
MYODBCDbgReturn( getDescriptor()->getDiagnostic()->doAppend(
MDiagnostic::STATE_01004 ) );
break;
case SQL_DESC_LITERAL_SUFFIX:
*pnStringLengthPtr = getLiteralSuffix().length() * sizeof(SQLWCHAR);
- if ( !MYODBCC::doStringCopyOut( (SQLWCHAR*)pValuePtr, nBufferLength /
sizeof(SQLWCHAR), getLiteralSuffix() ) )
+
+ if (!MYODBCCString::doStringCopyOut((SQLWCHAR*)pValuePtr, nBufferCharLength,
getLiteralSuffix()))
MYODBCDbgReturn( getDescriptor()->getDiagnostic()->doAppend(
MDiagnostic::STATE_01004 ) );
break;
case SQL_DESC_LOCAL_TYPE_NAME:
*pnStringLengthPtr = getLocalTypeName().length() * sizeof(SQLWCHAR);
- if ( !MYODBCC::doStringCopyOut( (SQLWCHAR*)pValuePtr, nBufferLength /
sizeof(SQLWCHAR), getLocalTypeName() ) )
+
+ if (!MYODBCCString::doStringCopyOut((SQLWCHAR*)pValuePtr, nBufferCharLength,
getLocalTypeName()))
MYODBCDbgReturn( getDescriptor()->getDiagnostic()->doAppend(
MDiagnostic::STATE_01004 ) );
break;
case SQL_DESC_NAME:
if(pnStringLengthPtr)
*pnStringLengthPtr = getName().length() * sizeof(SQLWCHAR);
- if ( pValuePtr && !MYODBCC::doStringCopyOut( (SQLWCHAR*)pValuePtr,
nBufferLength / sizeof(SQLWCHAR), getName() ) )
+
+ if (pValuePtr &&
!MYODBCCString::doStringCopyOut((SQLWCHAR*)pValuePtr, nBufferCharLength, getName()))
MYODBCDbgReturn( getDescriptor()->getDiagnostic()->doAppend(
MDiagnostic::STATE_01004 ) );
break;
@@ -1109,7 +1117,7 @@
case SQL_DESC_SCHEMA_NAME:
*pnStringLengthPtr = getSchemaName().length() * sizeof(SQLWCHAR);
- if ( !MYODBCC::doStringCopyOut( (SQLWCHAR*)pValuePtr, nBufferLength /
sizeof(SQLWCHAR), getSchemaName() ) )
+ if (!MYODBCCString::doStringCopyOut((SQLWCHAR*)pValuePtr, nBufferCharLength,
getSchemaName()))
MYODBCDbgReturn( getDescriptor()->getDiagnostic()->doAppend(
MDiagnostic::STATE_01004 ) );
break;
@@ -1119,7 +1127,7 @@
case SQL_DESC_TABLE_NAME:
*pnStringLengthPtr = getTableName().length() * sizeof(SQLWCHAR);
- if ( !MYODBCC::doStringCopyOut( (SQLWCHAR*)pValuePtr, nBufferLength /
sizeof(SQLWCHAR), getTableName() ) )
+ if (!MYODBCCString::doStringCopyOut( (SQLWCHAR*)pValuePtr, nBufferCharLength,
getTableName()))
MYODBCDbgReturn( getDescriptor()->getDiagnostic()->doAppend(
MDiagnostic::STATE_01004 ) );
break;
@@ -1129,7 +1137,7 @@
case SQL_DESC_TYPE_NAME:
*pnStringLengthPtr = getTypeName().length() * sizeof(SQLWCHAR);
- if ( !MYODBCC::doStringCopyOut( (SQLWCHAR*)pValuePtr, nBufferLength /
sizeof(SQLWCHAR), getTypeName() ) )
+ if (!MYODBCCString::doStringCopyOut((SQLWCHAR*)pValuePtr, nBufferCharLength,
getTypeName()))
MYODBCDbgReturn( getDescriptor()->getDiagnostic()->doAppend(
MDiagnostic::STATE_01004 ) );
break;
Modified: trunk/SDK/MYSQLPlus/Library/MDiagnostic.cpp
===================================================================
--- trunk/SDK/MYSQLPlus/Library/MDiagnostic.cpp 2007-04-02 21:21:52 UTC (rev 829)
+++ trunk/SDK/MYSQLPlus/Library/MDiagnostic.cpp 2007-04-03 09:29:16 UTC (rev 830)
@@ -266,14 +266,16 @@
case SQL_DIAG_DYNAMIC_FUNCTION:
{
QString stringDynamicFunction = getDynamicFunction();
+ SQLSMALLINT nBufferLength = nBufferLength / sizeof(SQLWCHAR);
+
if ( stringDynamicFunction.isNull() )
MYODBCDbgReturn( SQL_ERROR );
*pnStringLengthPtr = stringDynamicFunction.length() * sizeof(SQLWCHAR);
- if ( pDiagInfoPtr &&
- !MYODBCC::doStringCopyOut( (SQLWCHAR*)pDiagInfoPtr,
- nBufferLength / sizeof(SQLWCHAR),
- stringDynamicFunction ) )
+ if (pDiagInfoPtr &&
+ !MYODBCCString::doStringCopyOut((SQLWCHAR*)pDiagInfoPtr,
+ nBufferLength,
+ stringDynamicFunction))
MYODBCDbgReturn( SQL_SUCCESS_WITH_INFO );
}
break;
@@ -333,7 +335,7 @@
SQL_SUCCEEDED( getDiagRec( nRecord, sSqlstate, &nNativeError,
szMessageText, sizeof(szMessageText), &nTextLength ) );
nRecord++ )
{
- stringlist += MYODBCC::QString_fromWCharArray( szMessageText );
+ stringlist += MYODBCCString::QString_fromWCharArray(szMessageText);
}
MYODBCDbgReturnSList( stringlist );
Modified: trunk/SDK/MYSQLPlus/Library/MDiagnosticRecord.cpp
===================================================================
--- trunk/SDK/MYSQLPlus/Library/MDiagnosticRecord.cpp 2007-04-02 21:21:52 UTC (rev 829)
+++ trunk/SDK/MYSQLPlus/Library/MDiagnosticRecord.cpp 2007-04-03 09:29:16 UTC (rev 830)
@@ -153,10 +153,12 @@
MYODBCDbgReturn( SQL_ERROR );
*pnStringByteLength = stringClassOrigin.length() * sizeof(SQLWCHAR);
- if ( pDiagInfoPtr && !MYODBCC::doStringCopyOut(
- (SQLWCHAR*)pDiagInfoPtr, nBufferLength,
- stringClassOrigin ) )
+ if (pDiagInfoPtr &&
+ !MYODBCCString::doStringCopyOut((SQLWCHAR*)pDiagInfoPtr,
nBufferLength,
+ stringClassOrigin))
+ {
MYODBCDbgReturn( SQL_SUCCESS_WITH_INFO );
+ }
}
break;
@@ -171,10 +173,12 @@
MYODBCDbgReturn( SQL_ERROR );
*pnStringByteLength = stringConnectionName.length() * sizeof(SQLWCHAR);
- if ( pDiagInfoPtr && !MYODBCC::doStringCopyOut(
- (SQLWCHAR*)pDiagInfoPtr, nBufferLength,
- stringConnectionName ) )
+ if (pDiagInfoPtr &&
+ !MYODBCCString::doStringCopyOut((SQLWCHAR*)pDiagInfoPtr,
nBufferLength,
+ stringConnectionName))
+ {
MYODBCDbgReturn( SQL_SUCCESS_WITH_INFO );
+ }
}
break;
@@ -185,10 +189,12 @@
MYODBCDbgReturn( SQL_ERROR );
*pnStringByteLength = stringMessageText.length() * sizeof(SQLWCHAR);
- if ( pDiagInfoPtr && !MYODBCC::doStringCopyOut(
- (SQLWCHAR*)pDiagInfoPtr, nBufferLength,
- stringMessageText ) )
+ if (pDiagInfoPtr &&
+ !MYODBCCString::doStringCopyOut((SQLWCHAR*)pDiagInfoPtr,
nBufferLength,
+ stringMessageText))
+ {
MYODBCDbgReturn( SQL_SUCCESS_WITH_INFO );
+ }
}
break;
@@ -207,10 +213,12 @@
MYODBCDbgReturn( SQL_ERROR );
*pnStringByteLength = stringServerName.length() * sizeof(SQLWCHAR);
- if ( pDiagInfoPtr && !MYODBCC::doStringCopyOut(
- (SQLWCHAR*)pDiagInfoPtr, nBufferLength,
- stringServerName ) )
+ if (pDiagInfoPtr &&
+ !MYODBCCString::doStringCopyOut((SQLWCHAR*)pDiagInfoPtr,
nBufferLength,
+ stringServerName))
+ {
MYODBCDbgReturn( SQL_SUCCESS_WITH_INFO );
+ }
}
break;
@@ -218,7 +226,7 @@
{
QString stringSQLState = getSQLState();
std::wstring msg;
- MYODBCC::QString_toWString( stringSQLState, &msg );
+ MYODBCCString::QString_toWString( stringSQLState, &msg );
LPCWSTR p = msg.c_str();
if ( !pDiagInfoPtr )
@@ -248,9 +256,9 @@
MYODBCDbgReturn( SQL_ERROR );
*pnStringByteLength = stringSubClassOrigin.length() * sizeof(SQLWCHAR);
- if ( pDiagInfoPtr && !MYODBCC::doStringCopyOut(
- (SQLWCHAR*)pDiagInfoPtr, nBufferLength,
- stringSubClassOrigin ) )
+ if (pDiagInfoPtr &&
+ !MYODBCCString::doStringCopyOut((SQLWCHAR*)pDiagInfoPtr,
nBufferLength,
+ stringSubClassOrigin ) )
MYODBCDbgReturn( SQL_SUCCESS_WITH_INFO );
}
break;
Modified: trunk/SDK/MYSQLPlus/Library/MStatement.cpp
===================================================================
--- trunk/SDK/MYSQLPlus/Library/MStatement.cpp 2007-04-02 21:21:52 UTC (rev 829)
+++ trunk/SDK/MYSQLPlus/Library/MStatement.cpp 2007-04-03 09:29:16 UTC (rev 830)
@@ -292,7 +292,8 @@
#if MYODBC_DBG > 1
MYODBCDbgInfo( QString( "nColumnNumber=%1" ).arg( nColumnNumber ) );
- MYODBCDbgInfo( QString( "nTargetType=%1=%2" ).arg( nTargetType ).arg(
MYODBCC::getConciseTypeStringC( nTargetType, getEnvironment()->getODBCVersion() ) ) );
+ MYODBCDbgInfo( QString( "nTargetType=%1=%2" ).arg( nTargetType ).
+ arg( MYODBCC::getConciseTypeStringC( nTargetType,
getEnvironment()->getODBCVersion() ) ) );
MYODBCDbgInfo( QString( "pTargetValue=%1" ).arg( (qulonglong)pTargetValue ) );
MYODBCDbgInfo( QString( "nBufferLength=%1" ).arg( nBufferLength ) );
MYODBCDbgInfo( QString( "pnStrLenOrInd=%1" ).arg( (qulonglong)pnStrLenOrInd ) );
@@ -914,8 +915,12 @@
SQL_PARAM_OUTPUT, where the argument ParameterValuePtr was a null pointer, the
C-type was char or binary, and the BufferLength (cbValueMax) was greater than 0.
*/
- if ( nInputOutputType == SQL_PARAM_OUTPUT && !pParameterValue && (
MYODBCC::isCharTypeC( nValueType ) || MYODBCC::isBinTypeC( nValueType ) ) &&
nBufferLength > 0 )
+ if (nInputOutputType == SQL_PARAM_OUTPUT && !pParameterValue &&
+ (MYODBCC::isCharTypeC( nValueType ) || MYODBCC::isBinTypeC( nValueType ))
&&
+ nBufferLength > 0 )
+ {
MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_HY009 ) );
+ }
/*!
\internal ODBC RULE (DM)
@@ -1820,13 +1825,15 @@
SQLINTEGER nCharsOut = 0;
- if ( pszColumn && !MYODBCC::doStringCopyOut( pszColumn, nBufferLength,
- pDescriptorRecord->getName(), &nCharsOut ) )
+ if (pszColumn && !MYODBCCString::doStringCopyOut(pszColumn, nBufferLength,
+ pDescriptorRecord->getName(),
&nCharsOut ))
+ {
nReturn = getDiagnostic()->doAppend( MDiagnostic::STATE_01004 );
+ }
if ( pszColumn && pnNameLength )
*pnNameLength = nCharsOut;
- else if( pnNameLength )
+ else if ( pnNameLength )
*pnNameLength = pDescriptorRecord->getName().length();
if ( pnDataType )
@@ -2599,9 +2606,9 @@
QString stringText;
if ( nBufferLength == SQL_NTS )
- stringText = MYODBCC::QString_fromWCharArray( psInStatementText );
+ stringText = MYODBCCString::QString_fromWCharArray( psInStatementText );
else
- stringText = MYODBCC::QString_fromWCharArray( psInStatementText, nTextLength1 );
+ stringText = MYODBCCString::QString_fromWCharArray( psInStatementText,
nTextLength1 );
SQLRETURN nReturn = doPrepare( psInStatementText, nTextLength1 );
@@ -2612,7 +2619,7 @@
SQLINTEGER nCharsMaxOut = nBufferLength / sizeof(SQLWCHAR);
BOOL bTruncated = false;
- bTruncated = !MYODBCC::doStringCopyOut( psOutStatementText, nCharsMaxOut, stringText,
&nCharsOut );
+ bTruncated = !MYODBCCString::doStringCopyOut( psOutStatementText, nCharsMaxOut,
stringText, &nCharsOut );
if ( pnTextLength2 )
*pnTextLength2 = nCharsOut * sizeof(SQLWCHAR);
@@ -2930,9 +2937,9 @@
/* get our statement text into a friendly QString */
QString stringStatement;
if ( nLength1 == SQL_NTS )
- stringStatement = MYODBCC::QString_fromWCharArray( psStatementText );
+ stringStatement = MYODBCCString::QString_fromWCharArray( psStatementText );
else
- stringStatement = MYODBCC::QString_fromWCharArray( psStatementText, nLength1 );
+ stringStatement = MYODBCCString::QString_fromWCharArray( psStatementText,
nLength1 );
/* Get MCommands... */
MCommands *pCommands = getCommands();
Modified: trunk/SDK/MYSQLPlus/Library/MStatement_catalog.cpp
===================================================================
--- trunk/SDK/MYSQLPlus/Library/MStatement_catalog.cpp 2007-04-02 21:21:52 UTC (rev 829)
+++ trunk/SDK/MYSQLPlus/Library/MStatement_catalog.cpp 2007-04-03 09:29:16 UTC (rev 830)
@@ -95,19 +95,23 @@
QString stringTable;
QString stringColumn;
- if ( psCatalog && nLength1 != 0 )
- stringCatalog = MYODBCC::QString_fromWCharArray( psCatalog,
- ( nLength1 == SQL_NTS ? -1 : nLength1 ) );
- if ( psSchema && nLength2 != 0 )
- stringSchema = MYODBCC::QString_fromWCharArray( psSchema,
- ( nLength2 == SQL_NTS ? -1 : nLength2 ) );
- if ( psTable && nLength3 != 0 )
- stringTable = MYODBCC::QString_fromWCharArray( psTable,
- ( nLength3 == SQL_NTS ? -1 : nLength3 ) );
- if ( psColumn && nLength4 != 0 )
- stringColumn = MYODBCC::QString_fromWCharArray( psColumn,
- ( nLength4 == SQL_NTS ? -1 : nLength4 ) );
+ nLength1 = (nLength1 == SQL_NTS) ? -1 : nLength1;
+ nLength2 = (nLength2 == SQL_NTS) ? -1 : nLength2;
+ nLength3 = (nLength3 == SQL_NTS) ? -1 : nLength3;
+ nLength4 = (nLength4 == SQL_NTS) ? -1 : nLength4;
+ if (psCatalog && nLength1 != 0)
+ stringCatalog = MYODBCCString::QString_fromWCharArray(psCatalog, nLength1);
+
+ if (psSchema && nLength2 != 0)
+ stringSchema = MYODBCCString::QString_fromWCharArray(psSchema, nLength2);
+
+ if (psTable && nLength3 != 0)
+ stringTable = MYODBCCString::QString_fromWCharArray( psTable, nLength3);
+
+ if (psColumn && nLength4 != 0)
+ stringColumn = MYODBCCString::QString_fromWCharArray( psColumn, nLength4);
+
/*!
\internal ODBC RULE
@@ -115,6 +119,7 @@
*/
if ( stringCatalog.isNull() )
stringCatalog = "";
+
if ( getConnection()->getInfoCatalogUsage() == 0 &&
!stringCatalog.isEmpty() )
MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_HYC00 ) );
@@ -125,6 +130,7 @@
*/
if ( stringSchema.isNull() )
stringSchema = "";
+
if ( getConnection()->getInfoSchemaUsage() == 0 && !stringSchema.isEmpty()
&& stringSchema != SQL_ALL_SCHEMAS )
MYODBCDbgReturn( getDiagnostic()->doAppend( MDiagnostic::STATE_HYC00 ) );
@@ -249,19 +255,23 @@
QString stringTable;
QString stringColumn;
- if ( psCatalog && nLength1 != 0 )
- stringCatalog = MYODBCC::QString_fromWCharArray( psCatalog,
- ( nLength1 == SQL_NTS ? -1 : nLength1 ) );
- if ( psSchema && nLength2 != 0 )
- stringSchema = MYODBCC::QString_fromWCharArray( psSchema,
- ( nLength2 == SQL_NTS ? -1 : nLength2 ) );
- if ( psTable && nLength3 != 0 )
- stringTable = MYODBCC::QString_fromWCharArray( psTable,
- ( nLength3 == SQL_NTS ? -1 : nLength3 ) );
- if ( psColumn && nLength4 != 0 )
- stringColumn = MYODBCC::QString_fromWCharArray( psColumn,
- ( nLength4 == SQL_NTS ? -1 : nLength4 ) );
+ nLength1 = (nLength1 == SQL_NTS) ? -1 : nLength1;
+ nLength2 = (nLength2 == SQL_NTS) ? -1 : nLength2;
+ nLength3 = (nLength3 == SQL_NTS) ? -1 : nLength3;
+ nLength4 = (nLength4 == SQL_NTS) ? -1 : nLength4;
+ if (psCatalog && nLength1 != 0)
+ stringCatalog = MYODBCCString::QString_fromWCharArray( psCatalog, nLength1);
+
+ if (psSchema && nLength2 != 0)
+ stringSchema = MYODBCCString::QString_fromWCharArray( psSchema, nLength2);
+
+ if (psTable && nLength3 != 0)
+ stringTable = MYODBCCString::QString_fromWCharArray( psTable, nLength3);
+
+ if (psColumn && nLength4 != 0)
+ stringColumn = MYODBCCString::QString_fromWCharArray( psColumn, nLength4);
+
/*!
\internal ODBC RULE
@@ -417,25 +427,31 @@
QString stringFKSchema;
QString stringFKTable;
- if ( psPKCatalog && nLength1 != 0 )
- stringPKCatalog = MYODBCC::QString_fromWCharArray( psPKCatalog,
- ( nLength1 == SQL_NTS ? -1 : nLength1 ) );
- if ( psPKSchema && nLength2 != 0 )
- stringPKSchema = MYODBCC::QString_fromWCharArray( psPKSchema,
- ( nLength2 == SQL_NTS ? -1 : nLength2 ) );
- if ( psPKTable && nLength3 != 0 )
- stringPKTable = MYODBCC::QString_fromWCharArray( psPKTable,
- ( nLength3 == SQL_NTS ? -1 : nLength3 ) );
- if ( psFKCatalog && nLength4 != 0 )
- stringFKCatalog = MYODBCC::QString_fromWCharArray( psFKCatalog,
- ( nLength4 == SQL_NTS ? -1 : nLength4 ) );
- if ( psFKSchema && nLength5 != 0 )
- stringFKSchema = MYODBCC::QString_fromWCharArray( psFKSchema,
- ( nLength5 == SQL_NTS ? -1 : nLength5 ) );
- if ( psFKTable && nLength6 != 0 )
- stringFKTable = MYODBCC::QString_fromWCharArray( psFKTable,
- ( nLength6 == SQL_NTS ? -1 : nLength6 ) );
+ nLength1 = (nLength1 == SQL_NTS) ? -1 : nLength1;
+ nLength2 = (nLength2 == SQL_NTS) ? -1 : nLength2;
+ nLength3 = (nLength3 == SQL_NTS) ? -1 : nLength3;
+ nLength4 = (nLength4 == SQL_NTS) ? -1 : nLength4;
+ nLength5 = (nLength5 == SQL_NTS) ? -1 : nLength5;
+ nLength6 = (nLength6 == SQL_NTS) ? -1 : nLength6;
+ if (psPKCatalog && nLength1 != 0)
+ stringPKCatalog = MYODBCCString::QString_fromWCharArray(psPKCatalog, nLength1);
+
+ if (psPKSchema && nLength2 != 0)
+ stringPKSchema = MYODBCCString::QString_fromWCharArray(psPKSchema, nLength2);
+
+ if (psPKTable && nLength3 != 0)
+ stringPKTable = MYODBCCString::QString_fromWCharArray(psPKTable, nLength3);
+
+ if (psFKCatalog && nLength4 != 0)
+ stringFKCatalog = MYODBCCString::QString_fromWCharArray(psFKCatalog, nLength4);
+
+ if (psFKSchema && nLength5 != 0)
+ stringFKSchema = MYODBCCString::QString_fromWCharArray(psFKSchema, nLength5);
+
+ if (psFKTable && nLength6 != 0)
+ stringFKTable = MYODBCCString::QString_fromWCharArray(psFKTable, nLength6);
+
if ( getMetadataID() == SQL_TRUE )
{
SQLRETURN nReturn;
@@ -632,16 +648,19 @@
QString stringSchema;
QString stringTable;
- if ( psCatalog && nLength1 != 0 )
- stringCatalog = MYODBCC::QString_fromWCharArray( psCatalog,
- ( nLength1 == SQL_NTS ? -1 : nLength1 ) );
- if ( psSchema && nLength2 != 0 )
- stringSchema = MYODBCC::QString_fromWCharArray( psSchema,
- ( nLength2 == SQL_NTS ? -1 : nLength2 ) );
- if ( psTable && nLength3 != 0 )
- stringTable = MYODBCC::QString_fromWCharArray( psTable,
- ( nLength3 == SQL_NTS ? -1 : nLength3 ) );
+ nLength1 = (nLength1 == SQL_NTS) ? -1 : nLength1;
+ nLength2 = (nLength2 == SQL_NTS) ? -1 : nLength2;
+ nLength3 = (nLength3 == SQL_NTS) ? -1 : nLength3;
+ if (psCatalog && nLength1 != 0)
+ stringCatalog = MYODBCCString::QString_fromWCharArray(psCatalog, nLength1);
+
+ if (psSchema && nLength2 != 0)
+ stringSchema = MYODBCCString::QString_fromWCharArray(psSchema, nLength2);
+
+ if (psTable && nLength3 != 0)
+ stringTable = MYODBCCString::QString_fromWCharArray(psTable, nLength3);
+
if ( getMetadataID() == SQL_TRUE )
{
SQLRETURN nReturn;
@@ -864,19 +883,24 @@
QString stringProcedure;
QString stringColumn;
- if ( psCatalog && nLength1 != 0 )
- stringCatalog = MYODBCC::QString_fromWCharArray( psCatalog,
- ( nLength1 == SQL_NTS ? -1 : nLength1 ) );
- if ( psSchema && nLength2 != 0 )
- stringSchema = MYODBCC::QString_fromWCharArray( psSchema,
- ( nLength2 == SQL_NTS ? -1 : nLength2 ) );
- if ( psProcedure && nLength3 != 0 )
- stringProcedure = MYODBCC::QString_fromWCharArray( psProcedure,
- ( nLength3 == SQL_NTS ? -1 : nLength3 ) );
- if ( psColumn && nLength4 != 0 )
- stringColumn = MYODBCC::QString_fromWCharArray( psColumn,
- ( nLength4 == SQL_NTS ? -1 : nLength4 ) );
+ nLength1 = (nLength1 == SQL_NTS) ? -1 : nLength1;
+ nLength2 = (nLength2 == SQL_NTS) ? -1 : nLength2;
+ nLength3 = (nLength3 == SQL_NTS) ? -1 : nLength3;
+ nLength4 = (nLength4 == SQL_NTS) ? -1 : nLength4;
+ if (psCatalog && nLength1 != 0)
+ stringCatalog = MYODBCCString::QString_fromWCharArray(psCatalog, nLength1);
+
+ if (psSchema && nLength2 != 0)
+ stringSchema = MYODBCCString::QString_fromWCharArray(psSchema, nLength2);
+
+ if (psProcedure && nLength3 != 0)
+ stringProcedure = MYODBCCString::QString_fromWCharArray(psProcedure, nLength3);
+
+ if (psColumn && nLength4 != 0)
+ stringColumn = MYODBCCString::QString_fromWCharArray(psColumn, nLength4);
+
+
/*!
\internal ODBC RULE
@@ -1014,16 +1038,20 @@
QString stringSchema;
QString stringProcedure;
- if ( psCatalog && nLength1 != 0 )
- stringCatalog = MYODBCC::QString_fromWCharArray( psCatalog,
- ( nLength1 == SQL_NTS ? -1 : nLength1 ) );
- if ( psSchema && nLength2 != 0 )
- stringSchema = MYODBCC::QString_fromWCharArray( psSchema,
- ( nLength2 == SQL_NTS ? -1 : nLength2 ) );
- if ( psProcedure && nLength3 != 0 )
- stringProcedure = MYODBCC::QString_fromWCharArray( psProcedure,
- ( nLength3 == SQL_NTS ? -1 : nLength3 ) );
+ nLength1 = (nLength1 == SQL_NTS) ? -1 : nLength1;
+ nLength2 = (nLength2 == SQL_NTS) ? -1 : nLength2;
+ nLength3 = (nLength3 == SQL_NTS) ? -1 : nLength3;
+ if (psCatalog && nLength1 != 0)
+ stringCatalog = MYODBCCString::QString_fromWCharArray(psCatalog, nLength1);
+
+ if (psSchema && nLength2 != 0)
+ stringSchema = MYODBCCString::QString_fromWCharArray(psSchema, nLength2);
+
+ if (psProcedure && nLength3 != 0)
+ stringProcedure = MYODBCCString::QString_fromWCharArray(psProcedure, nLength3);
+
+
/*!
\internal ODBC RULE
@@ -1292,16 +1320,19 @@
QString stringSchema;
QString stringTable;
- if ( psCatalog && nLength1 != 0 )
- stringCatalog = MYODBCC::QString_fromWCharArray( psCatalog,
- ( nLength1 == SQL_NTS ? -1 : nLength1 ) );
- if ( psSchema && nLength2 != 0 )
- stringSchema = MYODBCC::QString_fromWCharArray( psSchema,
- ( nLength2 == SQL_NTS ? -1 : nLength2 ) );
- if ( psTable && nLength3 != 0 )
- stringTable = MYODBCC::QString_fromWCharArray( psTable,
- ( nLength3 == SQL_NTS ? -1 : nLength3 ) );
+ nLength1 = (nLength1 == SQL_NTS) ? -1 : nLength1;
+ nLength2 = (nLength2 == SQL_NTS) ? -1 : nLength2;
+ nLength3 = (nLength3 == SQL_NTS) ? -1 : nLength3;
+ if (psCatalog && nLength1 != 0)
+ stringCatalog = MYODBCCString::QString_fromWCharArray(psCatalog, nLength1);
+
+ if (psSchema && nLength2 != 0)
+ stringSchema = MYODBCCString::QString_fromWCharArray(psSchema, nLength2);
+
+ if (psTable && nLength3 != 0)
+ stringTable = MYODBCCString::QString_fromWCharArray(psTable, nLength3);
+
if ( getMetadataID() == SQL_TRUE )
{
SQLRETURN nReturn;
@@ -1542,16 +1573,19 @@
QString stringSchema;
QString stringTable;
- if ( psCatalog && nLength1 != 0 )
- stringCatalog = MYODBCC::QString_fromWCharArray( psCatalog,
- ( nLength1 == SQL_NTS ? -1 : nLength1 ) );
- if ( psSchema && nLength2 != 0 )
- stringSchema = MYODBCC::QString_fromWCharArray( psSchema,
- ( nLength2 == SQL_NTS ? -1 : nLength2 ) );
- if ( psTable && nLength3 != 0 )
- stringTable = MYODBCC::QString_fromWCharArray( psTable,
- ( nLength3 == SQL_NTS ? -1 : nLength3 ) );
+ nLength1 = (nLength1 == SQL_NTS) ? -1 : nLength1;
+ nLength2 = (nLength2 == SQL_NTS) ? -1 : nLength2;
+ nLength3 = (nLength3 == SQL_NTS) ? -1 : nLength3;
+ if (psCatalog && nLength1 != 0)
+ stringCatalog = MYODBCCString::QString_fromWCharArray(psCatalog, nLength1);
+
+ if (psSchema && nLength2 != 0)
+ stringSchema = MYODBCCString::QString_fromWCharArray(psSchema, nLength2);
+
+ if (psTable && nLength3 != 0)
+ stringTable = MYODBCCString::QString_fromWCharArray( psTable, nLength3);
+
if ( getMetadataID() == SQL_TRUE )
{
SQLRETURN nReturn;
@@ -1769,16 +1803,19 @@
QString stringSchema;
QString stringTable;
- if ( psCatalog && nLength1 != 0 )
- stringCatalog = MYODBCC::QString_fromWCharArray( psCatalog,
- ( nLength1 == SQL_NTS ? -1 : nLength1 ) );
- if ( psSchema && nLength2 != 0 )
- stringSchema = MYODBCC::QString_fromWCharArray( psSchema,
- ( nLength2 == SQL_NTS ? -1 : nLength2 ) );
- if ( psTable && nLength3 != 0 )
- stringTable = MYODBCC::QString_fromWCharArray( psTable,
- ( nLength3 == SQL_NTS ? -1 : nLength3 ) );
+ nLength1 = (nLength1 == SQL_NTS) ? -1 : nLength1;
+ nLength2 = (nLength2 == SQL_NTS) ? -1 : nLength2;
+ nLength3 = (nLength3 == SQL_NTS) ? -1 : nLength3;
+ if (psCatalog && nLength1 != 0)
+ stringCatalog = MYODBCCString::QString_fromWCharArray(psCatalog, nLength1);
+
+ if (psSchema && nLength2 != 0)
+ stringSchema = MYODBCCString::QString_fromWCharArray(psSchema, nLength2);
+
+ if (psTable && nLength3 != 0)
+ stringTable = MYODBCCString::QString_fromWCharArray( psTable, nLength3);
+
/*!
\internal ODBC RULE
@@ -1917,19 +1954,23 @@
QString stringTable;
QString stringTableType;
- if ( psCatalog && nLength1 != 0 )
- stringCatalog = MYODBCC::QString_fromWCharArray( psCatalog,
- ( nLength1 == SQL_NTS ? -1 : nLength1 ) );
- if ( psSchema && nLength2 != 0 )
- stringSchema = MYODBCC::QString_fromWCharArray( psSchema,
- ( nLength2 == SQL_NTS ? -1 : nLength2 ) );
- if ( psTable && nLength3 != 0 )
- stringTable = MYODBCC::QString_fromWCharArray( psTable,
- ( nLength3 == SQL_NTS ? -1 : nLength3 ) );
- if ( psTableType && nLength4 != 0 )
- stringTableType = MYODBCC::QString_fromWCharArray( psTableType,
- ( nLength4 == SQL_NTS ? -1 : nLength4 ) );
+ nLength1 = (nLength1 == SQL_NTS) ? -1 : nLength1;
+ nLength2 = (nLength2 == SQL_NTS) ? -1 : nLength2;
+ nLength3 = (nLength3 == SQL_NTS) ? -1 : nLength3;
+ nLength4 = (nLength4 == SQL_NTS) ? -1 : nLength4;
+ if (psCatalog && nLength1 != 0)
+ stringCatalog = MYODBCCString::QString_fromWCharArray(psCatalog, nLength1);
+
+ if (psSchema && nLength2 != 0)
+ stringSchema = MYODBCCString::QString_fromWCharArray(psSchema, nLength2);
+
+ if (psTable && nLength3 != 0)
+ stringTable = MYODBCCString::QString_fromWCharArray(psTable, nLength3);
+
+ if (psTableType && nLength4 != 0)
+ stringTableType = MYODBCCString::QString_fromWCharArray(psTableType, nLength4);
+
/*!
\internal ODBC RULE
Modified: trunk/SDK/MYSQLPlus/Library/MStatement_props.cpp
===================================================================
--- trunk/SDK/MYSQLPlus/Library/MStatement_props.cpp 2007-04-02 21:21:52 UTC (rev 829)
+++ trunk/SDK/MYSQLPlus/Library/MStatement_props.cpp 2007-04-03 09:29:16 UTC (rev 830)
@@ -63,9 +63,9 @@
QString stringCursorName;
if ( nNameLength == SQL_NTS )
- stringCursorName = MYODBCC::QString_fromWCharArray( pszCursorName );
+ stringCursorName = MYODBCCString::QString_fromWCharArray( pszCursorName );
else
- stringCursorName = MYODBCC::QString_fromWCharArray( pszCursorName, nNameLength );
+ stringCursorName = MYODBCCString::QString_fromWCharArray( pszCursorName,
nNameLength );
/*!
\internal ODBC RULE
@@ -334,7 +334,8 @@
name was truncated. The length of the untruncated cursor name is returned in
*NameLengthPtr.
(Function returns SQL_SUCCESS_WITH_INFO.)
*/
- if ( !MYODBCC::doStringCopyOut( pszCursorName, nBufferLength / sizeof(SQLWCHAR),
getCursorName(), (SQLINTEGER*)pnNameLengthPtr ) )
+ if (!MYODBCCString::doStringCopyOut(pszCursorName, nBufferLength / sizeof(SQLWCHAR),
+ getCursorName(), (SQLINTEGER*)pnNameLengthPtr))
{
getDiagnostic()->doAppend( MDiagnostic::STATE_01004 );
MYODBCDbgReturn( SQL_SUCCESS_WITH_INFO );
@@ -416,8 +417,7 @@
/* handle odbc v2 mappings of SQLSetStmtOption */
if ( getEnvironment()->getODBCVersion() == SQL_OV_ODBC2 )
{
- nAttribute = MYODBCC::getStmtAttrFromOption(
- (SQLUSMALLINT)nAttribute );
+ nAttribute = MYODBCC::getStmtAttrFromOption((SQLUSMALLINT)nAttribute );
}
/* known statement nAttributes */
Modified: trunk/SDK/MYSQLPlus/Tests/MYSQLPlusTest.cpp
===================================================================
--- trunk/SDK/MYSQLPlus/Tests/MYSQLPlusTest.cpp 2007-04-02 21:21:52 UTC (rev 829)
+++ trunk/SDK/MYSQLPlus/Tests/MYSQLPlusTest.cpp 2007-04-03 09:29:16 UTC (rev 830)
@@ -679,7 +679,7 @@
const char *charString = (const char *)"char string";
const wchar_t *wcharString = (const wchar_t *)L"wide-char string";
- QString wcharQString = MYODBCC::QString_fromWCharArray(wcharString);
+ QString wcharQString = MYODBCCString::QString_fromWCharArray(wcharString);
/* basic conversions */
QVERIFY(!MDataConvert::cToQVariant(
@@ -714,7 +714,7 @@
wcharString =
(const wchar_t *)L"\x062c" L"c" L"\x0639" L"d" L"\x0669\x06a5";
- wcharQString = MYODBCC::QString_fromWCharArray(wcharString);
+ wcharQString = MYODBCCString::QString_fromWCharArray(wcharString);
QVERIFY(!MDataConvert::cToQVariant(
SQL_C_CHAR, (SQLPOINTER)charString, -1, v));
@@ -836,7 +836,7 @@
SQLUBIGINT ui;
QVariant v;
- /* TODO fix for unix, need to differentiate between native and struct? */
+ /* TODO fix for unix, need to differentiate between native and struct? */
#ifdef _WIN32
/* outside 4-byte range */
i = -999888777666;
| Thread |
|---|
| • Connector/ODBC 5 commit: r830 - in trunk: Driver/Driver/Library Driver/Setup/Library SDK/C/Library SDK/C/include SDK/Installer/Library SDK/Installer/T... | ahristov | 3 Apr |