diff options
author | Noel Grandin <noel@peralex.com> | 2013-10-25 17:17:50 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2013-11-04 10:11:07 +0200 |
commit | aeb41c9b9b7559c6d87bf92807acdc0df9e104cc (patch) | |
tree | 5a36bcd5af873c2b597fcda5fbd7e2f76f997669 /connectivity/source/drivers/mysql | |
parent | 57c2de08ddf14c0da80de06736d99382ad036539 (diff) |
remove redundant calls to OUString constructor
Change code like this:
aStr = OUString("xxxx");
into this:
aStr = "xxxx";
Change-Id: I31cb92e21658d57bb9e14b65c179536eae8096f6
Diffstat (limited to 'connectivity/source/drivers/mysql')
-rw-r--r-- | connectivity/source/drivers/mysql/YDriver.cxx | 6 | ||||
-rw-r--r-- | connectivity/source/drivers/mysql/YTable.cxx | 34 | ||||
-rw-r--r-- | connectivity/source/drivers/mysql/YTables.cxx | 4 | ||||
-rw-r--r-- | connectivity/source/drivers/mysql/YUser.cxx | 51 | ||||
-rw-r--r-- | connectivity/source/drivers/mysql/YUsers.cxx | 4 | ||||
-rw-r--r-- | connectivity/source/drivers/mysql/YViews.cxx | 2 |
6 files changed, 41 insertions, 60 deletions
diff --git a/connectivity/source/drivers/mysql/YDriver.cxx b/connectivity/source/drivers/mysql/YDriver.cxx index 51e5a114fc9a..cb005e9e7363 100644 --- a/connectivity/source/drivers/mysql/YDriver.cxx +++ b/connectivity/source/drivers/mysql/YDriver.cxx @@ -290,11 +290,11 @@ namespace connectivity } // if ( !sCuttedUrl.matchIgnoreAsciiCase(s_sCharSetOp) ) } // if ( RTL_TEXTENCODING_UTF8 == (*aLookup).getEncoding() ) if ( sCuttedUrl.indexOf('?') == -1 ) - sCuttedUrl += OUString("?"); + sCuttedUrl += "?"; else - sCuttedUrl += OUString("&"); + sCuttedUrl += "&"; sCuttedUrl += sAdd; - sCuttedUrl += OUString("characterEncoding="); + sCuttedUrl += "characterEncoding="; sCuttedUrl += sIanaName; } } diff --git a/connectivity/source/drivers/mysql/YTable.cxx b/connectivity/source/drivers/mysql/YTable.cxx index 4938b724fc34..decb437b75bb 100644 --- a/connectivity/source/drivers/mysql/YTable.cxx +++ b/connectivity/source/drivers/mysql/YTable.cxx @@ -234,7 +234,7 @@ void SAL_CALL OMySQLTable::alterColumnByName( const OUString& colName, const Ref { if ( sTypeName.indexOf(s_sAutoIncrement) == -1 ) { - sTypeName += OUString(" "); + sTypeName += " "; sTypeName += s_sAutoIncrement; } } @@ -271,12 +271,10 @@ void SAL_CALL OMySQLTable::alterColumnByName( const OUString& colName, const Ref descriptor->getPropertyValue(rProp.getNameByIndex(PROPERTY_ID_NAME)) >>= sNewColumnName; if ( !sNewColumnName.equalsIgnoreAsciiCase(colName) && !bColumnNameChanged ) { - OUString sSql = getAlterTableColumnPart(); - sSql += OUString(" CHANGE "); const OUString sQuote = getMetaData()->getIdentifierQuoteString( ); - sSql += ::dbtools::quoteName(sQuote,colName); - sSql += OUString(" "); - sSql += OTables::adjustSQL(::dbtools::createStandardColumnPart(descriptor,getConnection(),static_cast<OTables*>(m_pTables),getTypeCreatePattern())); + OUString sSql = getAlterTableColumnPart() + + " CHANGE " + ::dbtools::quoteName(sQuote,colName) + + " " + OTables::adjustSQL(::dbtools::createStandardColumnPart(descriptor,getConnection(),static_cast<OTables*>(m_pTables),getTypeCreatePattern())); executeStatement(sSql); } m_pColumns->refresh(); @@ -294,11 +292,10 @@ void SAL_CALL OMySQLTable::alterColumnByName( const OUString& colName, const Ref // ----------------------------------------------------------------------------- void OMySQLTable::alterColumnType(sal_Int32 nNewType,const OUString& _rColName, const Reference<XPropertySet>& _xDescriptor) { - OUString sSql = getAlterTableColumnPart(); - sSql += OUString(" CHANGE "); const OUString sQuote = getMetaData()->getIdentifierQuoteString( ); - sSql += ::dbtools::quoteName(sQuote,_rColName); - sSql += OUString(" "); + OUString sSql = getAlterTableColumnPart() + + " CHANGE " + ::dbtools::quoteName(sQuote,_rColName) + + " "; OColumn* pColumn = new OColumn(sal_True); Reference<XPropertySet> xProp = pColumn; @@ -317,25 +314,20 @@ OUString OMySQLTable::getTypeCreatePattern() const // ----------------------------------------------------------------------------- void OMySQLTable::alterDefaultValue(const OUString& _sNewDefault,const OUString& _rColName) { - OUString sSql = getAlterTableColumnPart(); - sSql += OUString(" ALTER "); - const OUString sQuote = getMetaData()->getIdentifierQuoteString( ); - sSql += ::dbtools::quoteName(sQuote,_rColName); - sSql += OUString(" SET DEFAULT '") + _sNewDefault; - sSql += OUString("'"); + OUString sSql = getAlterTableColumnPart() + + " ALTER " + ::dbtools::quoteName(sQuote,_rColName) + + " SET DEFAULT '" + _sNewDefault + "'"; executeStatement(sSql); } // ----------------------------------------------------------------------------- void OMySQLTable::dropDefaultValue(const OUString& _rColName) { - OUString sSql = getAlterTableColumnPart(); - sSql += OUString(" ALTER "); - const OUString sQuote = getMetaData()->getIdentifierQuoteString( ); - sSql += ::dbtools::quoteName(sQuote,_rColName); - sSql += OUString(" DROP DEFAULT"); + OUString sSql = getAlterTableColumnPart() + + " ALTER " + ::dbtools::quoteName(sQuote,_rColName) + + " DROP DEFAULT"; executeStatement(sSql); } diff --git a/connectivity/source/drivers/mysql/YTables.cxx b/connectivity/source/drivers/mysql/YTables.cxx index 776c260671ef..25fbf73ff712 100644 --- a/connectivity/source/drivers/mysql/YTables.cxx +++ b/connectivity/source/drivers/mysql/YTables.cxx @@ -138,9 +138,9 @@ void OTables::dropObject(sal_Int32 _nPos,const OUString _sElementName) Reference<XPropertySet> xProp(xObject,UNO_QUERY); sal_Bool bIsView = xProp.is() && ::comphelper::getString(xProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE))) == OUString("VIEW"); if(bIsView) // here we have a view - aSql += OUString("VIEW "); + aSql += "VIEW "; else - aSql += OUString("TABLE "); + aSql += "TABLE "; OUString sComposedName( ::dbtools::composeTableName( m_xMetaData, sCatalog, sSchema, sTable, sal_True, ::dbtools::eInDataManipulation ) ); diff --git a/connectivity/source/drivers/mysql/YUser.cxx b/connectivity/source/drivers/mysql/YUser.cxx index 5f300a3b0672..d44c34541a8e 100644 --- a/connectivity/source/drivers/mysql/YUser.cxx +++ b/connectivity/source/drivers/mysql/YUser.cxx @@ -225,14 +225,10 @@ void SAL_CALL OMySQLUser::grantPrivileges( const OUString& objName, sal_Int32 ob OUString sPrivs = getPrivilegeString(objPrivileges); if(!sPrivs.isEmpty()) { - OUString sGrant; - sGrant += OUString("GRANT "); - sGrant += sPrivs; - sGrant += OUString(" ON "); Reference<XDatabaseMetaData> xMeta = m_xConnection->getMetaData(); - sGrant += ::dbtools::quoteTableName(xMeta,objName,::dbtools::eInDataManipulation); - sGrant += OUString(" TO "); - sGrant += m_Name; + OUString sGrant = "GRANT " + sPrivs + + " ON " + ::dbtools::quoteTableName(xMeta,objName,::dbtools::eInDataManipulation) + + " TO " + m_Name; Reference<XStatement> xStmt = m_xConnection->createStatement(); if(xStmt.is()) @@ -255,14 +251,10 @@ void SAL_CALL OMySQLUser::revokePrivileges( const OUString& objName, sal_Int32 o OUString sPrivs = getPrivilegeString(objPrivileges); if(!sPrivs.isEmpty()) { - OUString sGrant; - sGrant += OUString("REVOKE "); - sGrant += sPrivs; - sGrant += OUString(" ON "); Reference<XDatabaseMetaData> xMeta = m_xConnection->getMetaData(); - sGrant += ::dbtools::quoteTableName(xMeta,objName,::dbtools::eInDataManipulation); - sGrant += OUString(" FROM "); - sGrant += m_Name; + OUString sGrant = "REVOKE " + sPrivs + + " ON " + ::dbtools::quoteTableName(xMeta,objName,::dbtools::eInDataManipulation) + + " FROM " + m_Name; Reference<XStatement> xStmt = m_xConnection->createStatement(); if(xStmt.is()) @@ -276,12 +268,9 @@ void SAL_CALL OMySQLUser::changePassword( const OUString& /*oldPassword*/, const { ::osl::MutexGuard aGuard(m_aMutex); checkDisposed(OUser_BASE_RBHELPER::rBHelper.bDisposed); - OUString sAlterPwd; - sAlterPwd = OUString("SET PASSWORD FOR "); - sAlterPwd += m_Name; - sAlterPwd += OUString("@\"%\" = PASSWORD('") ; - sAlterPwd += newPassword; - sAlterPwd += OUString("')") ; + OUString sAlterPwd = "SET PASSWORD FOR " + + m_Name + "@\"%\" = PASSWORD('" + + newPassword + "')"; Reference<XStatement> xStmt = m_xConnection->createStatement(); @@ -296,41 +285,41 @@ OUString OMySQLUser::getPrivilegeString(sal_Int32 nRights) const { OUString sPrivs; if((nRights & Privilege::INSERT) == Privilege::INSERT) - sPrivs += OUString("INSERT"); + sPrivs += "INSERT"; if((nRights & Privilege::DELETE) == Privilege::DELETE) { if(!sPrivs.isEmpty()) - sPrivs += OUString(","); - sPrivs += OUString("DELETE"); + sPrivs += ","; + sPrivs += "DELETE"; } if((nRights & Privilege::UPDATE) == Privilege::UPDATE) { if(!sPrivs.isEmpty()) - sPrivs += OUString(","); - sPrivs += OUString("UPDATE"); + sPrivs += ","; + sPrivs += "UPDATE"; } if((nRights & Privilege::ALTER) == Privilege::ALTER) { if(!sPrivs.isEmpty()) - sPrivs += OUString(","); - sPrivs += OUString("ALTER"); + sPrivs += ","; + sPrivs += "ALTER"; } if((nRights & Privilege::SELECT) == Privilege::SELECT) { if(!sPrivs.isEmpty()) - sPrivs += OUString(","); - sPrivs += OUString("SELECT"); + sPrivs += ","; + sPrivs += "SELECT"; } if((nRights & Privilege::REFERENCE) == Privilege::REFERENCE) { if(!sPrivs.isEmpty()) - sPrivs += OUString(","); - sPrivs += OUString("REFERENCES"); + sPrivs += ","; + sPrivs += "REFERENCES"; } return sPrivs; diff --git a/connectivity/source/drivers/mysql/YUsers.cxx b/connectivity/source/drivers/mysql/YUsers.cxx index e2e54e85d0f3..90ee347294dd 100644 --- a/connectivity/source/drivers/mysql/YUsers.cxx +++ b/connectivity/source/drivers/mysql/YUsers.cxx @@ -77,9 +77,9 @@ sdbcx::ObjectType OUsers::appendObject( const OUString& _rForName, const Referen descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PASSWORD)) >>= sPassword; if ( !sPassword.isEmpty() ) { - aSql += OUString(" IDENTIFIED BY '"); + aSql += " IDENTIFIED BY '"; aSql += sPassword; - aSql += OUString("'"); + aSql += "'"; } Reference< XStatement > xStmt = m_xConnection->createStatement( ); diff --git a/connectivity/source/drivers/mysql/YViews.cxx b/connectivity/source/drivers/mysql/YViews.cxx index 8ff2a1b971aa..a2378d1382cb 100644 --- a/connectivity/source/drivers/mysql/YViews.cxx +++ b/connectivity/source/drivers/mysql/YViews.cxx @@ -130,7 +130,7 @@ void OViews::createView( const Reference< XPropertySet >& descriptor ) aSql += ::dbtools::composeTableName( m_xMetaData, descriptor, ::dbtools::eInTableDefinitions, false, false, true ); - aSql += OUString(" AS "); + aSql += " AS "; descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_COMMAND)) >>= sCommand; aSql += sCommand; |