Use string literals directly

Change-Id: Ia4ae5c01ae7eb976a0e9638f8bc8fe7ebab8e2cb
This commit is contained in:
Stephan Bergmann
2017-01-06 10:53:34 +01:00
parent 060c2b9b1b
commit c2b24cd6fb

View File

@@ -191,68 +191,55 @@ SQLRETURN OConnection::Construct(const OUString& url,const Sequence< PropertyVal
OUString aDSN("DSN="), aUID, aPWD, aSysDrvSettings; OUString aDSN("DSN="), aUID, aPWD, aSysDrvSettings;
aDSN += url.copy(nLen+1); aDSN += url.copy(nLen+1);
const char* pUser = "user";
const char* pTimeout = "Timeout";
const char* pSilent = "Silent";
const char* pPwd = "password";
const char* pUseCatalog = "UseCatalog";
const char* pSysDrv = "SystemDriverSettings";
const char* pCharSet = "CharSet";
const char* pParaName = "ParameterNameSubstitution";
const char* pPrivName = "IgnoreDriverPrivileges";
const char* pVerColName = "PreventGetVersionColumns"; // #i60273#
const char* pRetrieving = "IsAutoRetrievingEnabled";
const char* pRetriStmt = "AutoRetrievingStatement";
sal_Int32 nTimeout = 20; sal_Int32 nTimeout = 20;
bool bSilent = true; bool bSilent = true;
const PropertyValue *pBegin = info.getConstArray(); const PropertyValue *pBegin = info.getConstArray();
const PropertyValue *pEnd = pBegin + info.getLength(); const PropertyValue *pEnd = pBegin + info.getLength();
for(;pBegin != pEnd;++pBegin) for(;pBegin != pEnd;++pBegin)
{ {
if( pBegin->Name.equalsAscii(pTimeout)) if( pBegin->Name == "Timeout")
OSL_VERIFY( pBegin->Value >>= nTimeout ); OSL_VERIFY( pBegin->Value >>= nTimeout );
else if( pBegin->Name.equalsAscii(pSilent)) else if( pBegin->Name == "Silent")
OSL_VERIFY( pBegin->Value >>= bSilent ); OSL_VERIFY( pBegin->Value >>= bSilent );
else if( pBegin->Name.equalsAscii(pPrivName)) else if( pBegin->Name == "IgnoreDriverPrivileges")
OSL_VERIFY( pBegin->Value >>= m_bIgnoreDriverPrivileges ); OSL_VERIFY( pBegin->Value >>= m_bIgnoreDriverPrivileges );
else if( pBegin->Name.equalsAscii(pVerColName)) else if( pBegin->Name == "PreventGetVersionColumns")
OSL_VERIFY( pBegin->Value >>= m_bPreventGetVersionColumns ); OSL_VERIFY( pBegin->Value >>= m_bPreventGetVersionColumns );
else if( pBegin->Name.equalsAscii(pParaName)) else if( pBegin->Name == "ParameterNameSubstitution")
OSL_VERIFY( pBegin->Value >>= m_bParameterSubstitution ); OSL_VERIFY( pBegin->Value >>= m_bParameterSubstitution );
else if( pBegin->Name.equalsAscii(pRetrieving)) else if( pBegin->Name == "IsAutoRetrievingEnabled")
{ {
bool bAutoRetrievingEnabled = false; bool bAutoRetrievingEnabled = false;
OSL_VERIFY( pBegin->Value >>= bAutoRetrievingEnabled ); OSL_VERIFY( pBegin->Value >>= bAutoRetrievingEnabled );
enableAutoRetrievingEnabled(bAutoRetrievingEnabled); enableAutoRetrievingEnabled(bAutoRetrievingEnabled);
} }
else if( pBegin->Name.equalsAscii(pRetriStmt)) else if( pBegin->Name == "AutoRetrievingStatement")
{ {
OUString sGeneratedValueStatement; OUString sGeneratedValueStatement;
OSL_VERIFY( pBegin->Value >>= sGeneratedValueStatement ); OSL_VERIFY( pBegin->Value >>= sGeneratedValueStatement );
setAutoRetrievingStatement(sGeneratedValueStatement); setAutoRetrievingStatement(sGeneratedValueStatement);
} }
else if( pBegin->Name.equalsAscii(pUser)) else if( pBegin->Name == "user")
{ {
OSL_VERIFY( pBegin->Value >>= aUID ); OSL_VERIFY( pBegin->Value >>= aUID );
aDSN = aDSN + ";UID=" + aUID; aDSN = aDSN + ";UID=" + aUID;
} }
else if( pBegin->Name.equalsAscii(pPwd)) else if( pBegin->Name == "password")
{ {
OSL_VERIFY( pBegin->Value >>= aPWD ); OSL_VERIFY( pBegin->Value >>= aPWD );
aDSN = aDSN + ";PWD=" + aPWD; aDSN = aDSN + ";PWD=" + aPWD;
} }
else if( pBegin->Name.equalsAscii(pUseCatalog)) else if( pBegin->Name == "UseCatalog")
{ {
OSL_VERIFY( pBegin->Value >>= m_bUseCatalog ); OSL_VERIFY( pBegin->Value >>= m_bUseCatalog );
} }
else if( pBegin->Name.equalsAscii(pSysDrv)) else if( pBegin->Name == "SystemDriverSettings")
{ {
OSL_VERIFY( pBegin->Value >>= aSysDrvSettings ); OSL_VERIFY( pBegin->Value >>= aSysDrvSettings );
aDSN += ";"; aDSN += ";";
aDSN += aSysDrvSettings; aDSN += aSysDrvSettings;
} }
else if( pBegin->Name.equalsAscii(pCharSet)) else if( pBegin->Name == "CharSet")
{ {
OUString sIanaName; OUString sIanaName;
OSL_VERIFY( pBegin->Value >>= sIanaName ); OSL_VERIFY( pBegin->Value >>= sIanaName );