diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2016-11-07 10:47:55 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2016-11-07 11:00:47 +0000 |
commit | fae35e535d2757244eccf4b5f5555293a24180b3 (patch) | |
tree | 0253f7d409c4e49bcd20d6604495b45a2354d1cc /connectivity | |
parent | 0f96b3f33f98ecd56f0fe55a65315d6762ff978a (diff) |
loplugin:oncevar in cui..connectivity
Change-Id: Ibe9d04932b0a57040db4fee11886dc1701f6ea17
Reviewed-on: https://gerrit.libreoffice.org/30653
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'connectivity')
-rw-r--r-- | connectivity/source/commontools/AutoRetrievingBase.cxx | 3 | ||||
-rw-r--r-- | connectivity/source/commontools/DriversConfig.cxx | 7 | ||||
-rw-r--r-- | connectivity/source/commontools/predicateinput.cxx | 7 | ||||
-rw-r--r-- | connectivity/source/drivers/dbase/DTable.cxx | 3 | ||||
-rw-r--r-- | connectivity/source/drivers/flat/ETable.cxx | 3 | ||||
-rw-r--r-- | connectivity/source/drivers/hsqldb/HCatalog.cxx | 6 | ||||
-rw-r--r-- | connectivity/source/drivers/hsqldb/HTables.cxx | 10 | ||||
-rw-r--r-- | connectivity/source/drivers/hsqldb/HUser.cxx | 27 | ||||
-rw-r--r-- | connectivity/source/drivers/mysql/YCatalog.cxx | 9 | ||||
-rw-r--r-- | connectivity/source/drivers/mysql/YTables.cxx | 13 | ||||
-rw-r--r-- | connectivity/source/drivers/mysql/YUser.cxx | 27 | ||||
-rw-r--r-- | connectivity/source/parse/sqliterator.cxx | 6 |
12 files changed, 40 insertions, 81 deletions
diff --git a/connectivity/source/commontools/AutoRetrievingBase.cxx b/connectivity/source/commontools/AutoRetrievingBase.cxx index ac573acfce80..f64d4417ad1d 100644 --- a/connectivity/source/commontools/AutoRetrievingBase.cxx +++ b/connectivity/source/commontools/AutoRetrievingBase.cxx @@ -31,10 +31,9 @@ namespace connectivity if ( sStmt.startsWith("INSERT") ) { sStatement = m_sGeneratedValueStatement; - static const char sColumn[] = "$column"; static const char sTable[] = "$table"; sal_Int32 nIndex = 0; - nIndex = sStatement.indexOf(sColumn,nIndex); + nIndex = sStatement.indexOf("$column",nIndex); if ( -1 != nIndex ) { // we need a column } diff --git a/connectivity/source/commontools/DriversConfig.cxx b/connectivity/source/commontools/DriversConfig.cxx index f7b544105b01..c40ed479177b 100644 --- a/connectivity/source/commontools/DriversConfig.cxx +++ b/connectivity/source/commontools/DriversConfig.cxx @@ -45,13 +45,12 @@ namespace if ( aPropertiesNode.isValid() ) { uno::Sequence< OUString > aStringSeq; - static const char s_sValue[] = "/Value"; const uno::Sequence< OUString > aProperties = aPropertiesNode.getNodeNames(); const OUString* pPropertiesIter = aProperties.getConstArray(); const OUString* pPropertiesEnd = pPropertiesIter + aProperties.getLength(); for (;pPropertiesIter != pPropertiesEnd ; ++pPropertiesIter) { - uno::Any aValue = aPropertiesNode.getNodeValue(*pPropertiesIter + s_sValue); + uno::Any aValue = aPropertiesNode.getNodeValue(*pPropertiesIter + "/Value"); if ( aValue >>= aStringSeq ) { lcl_convert(aStringSeq,aValue); @@ -98,8 +97,8 @@ void DriversConfigImpl::Load(const uno::Reference< uno::XComponentContext >& _rx { if ( !m_aInstalled.isValid() ) { - static const char s_sNodeName[] = "org.openoffice.Office.DataAccess.Drivers/Installed"; ///Installed - m_aInstalled = ::utl::OConfigurationTreeRoot::createWithComponentContext(_rxORB, s_sNodeName, -1, ::utl::OConfigurationTreeRoot::CM_READONLY); + m_aInstalled = ::utl::OConfigurationTreeRoot::createWithComponentContext(_rxORB, + "org.openoffice.Office.DataAccess.Drivers/Installed", -1, ::utl::OConfigurationTreeRoot::CM_READONLY); } if ( m_aInstalled.isValid() ) diff --git a/connectivity/source/commontools/predicateinput.cxx b/connectivity/source/commontools/predicateinput.cxx index c32f225c0436..c3c91fad6972 100644 --- a/connectivity/source/commontools/predicateinput.cxx +++ b/connectivity/source/commontools/predicateinput.cxx @@ -146,19 +146,16 @@ namespace dbtools ) { static const char sSingleQuote[] = "'"; - static const char sDoubleQuote[] = "''"; sal_Int32 nIndex = -1; sal_Int32 nTemp = 0; while ( -1 != ( nIndex = sQuoted.indexOf( '\'',nTemp ) ) ) { - sQuoted = sQuoted.replaceAt( nIndex, 1, sDoubleQuote ); + sQuoted = sQuoted.replaceAt( nIndex, 1, "''" ); nTemp = nIndex+2; } - OUString sTemp( sSingleQuote ); - ( sTemp += sQuoted ) += sSingleQuote; - sQuoted = sTemp; + sQuoted = sSingleQuote + sQuoted + sSingleQuote; } pReturn = const_cast< OSQLParser& >( m_aParser ).predicateTree( _rErrorMessage, sQuoted, m_xFormatter, _rxField ); } diff --git a/connectivity/source/drivers/dbase/DTable.cxx b/connectivity/source/drivers/dbase/DTable.cxx index 858de8e37678..11d35d1359a1 100644 --- a/connectivity/source/drivers/dbase/DTable.cxx +++ b/connectivity/source/drivers/dbase/DTable.cxx @@ -628,13 +628,12 @@ OUString ODbaseTable::getEntry(OConnection* _pConnection,const OUString& _sName OUString sName; OUString sExt; INetURLObject aURL; - static const char s_sSeparator[] = "/"; xDir->beforeFirst(); while(xDir->next()) { sName = xRow->getString(1); aURL.SetSmartProtocol(INetProtocol::File); - OUString sUrl = _pConnection->getURL() + s_sSeparator + sName; + OUString sUrl = _pConnection->getURL() + "/" + sName; aURL.SetSmartURL( sUrl ); // cut the extension diff --git a/connectivity/source/drivers/flat/ETable.cxx b/connectivity/source/drivers/flat/ETable.cxx index b40c7f97fd28..034aa77487ee 100644 --- a/connectivity/source/drivers/flat/ETable.cxx +++ b/connectivity/source/drivers/flat/ETable.cxx @@ -460,12 +460,11 @@ OUString OFlatTable::getEntry() INetURLObject aURL; xDir->beforeFirst(); - static const char s_sSeparator[] = "/"; while(xDir->next()) { sName = xRow->getString(1); aURL.SetSmartProtocol(INetProtocol::File); - OUString sUrl = m_pConnection->getURL() + s_sSeparator + sName; + OUString sUrl = m_pConnection->getURL() + "/" + sName; aURL.SetSmartURL( sUrl ); // cut the extension diff --git a/connectivity/source/drivers/hsqldb/HCatalog.cxx b/connectivity/source/drivers/hsqldb/HCatalog.cxx index 13cc609cfb8a..a3baf0f021d5 100644 --- a/connectivity/source/drivers/hsqldb/HCatalog.cxx +++ b/connectivity/source/drivers/hsqldb/HCatalog.cxx @@ -52,12 +52,10 @@ void OHCatalog::refreshObjects(const Sequence< OUString >& _sKindOfObject,TStrin void OHCatalog::refreshTables() { TStringVector aVector; - static const char s_sTableTypeView[] = "VIEW"; - static const char s_sTableTypeTable[] = "TABLE"; Sequence< OUString > sTableTypes(2); - sTableTypes[0] = s_sTableTypeView; - sTableTypes[1] = s_sTableTypeTable; + sTableTypes[0] = "VIEW"; + sTableTypes[1] = "TABLE"; refreshObjects(sTableTypes,aVector); diff --git a/connectivity/source/drivers/hsqldb/HTables.cxx b/connectivity/source/drivers/hsqldb/HTables.cxx index 0175f6745387..30ff90cea020 100644 --- a/connectivity/source/drivers/hsqldb/HTables.cxx +++ b/connectivity/source/drivers/hsqldb/HTables.cxx @@ -51,14 +51,10 @@ sdbcx::ObjectType OTables::createObject(const OUString& _rName) OUString sCatalog,sSchema,sTable; ::dbtools::qualifiedNameComponents(m_xMetaData,_rName,sCatalog,sSchema,sTable,::dbtools::EComposeRule::InDataManipulation); - static const char s_sTableTypeView[] = "VIEW"; - static const char s_sTableTypeTable[] = "TABLE"; - static const char s_sAll[] = "%"; - Sequence< OUString > sTableTypes(3); - sTableTypes[0] = s_sTableTypeView; - sTableTypes[1] = s_sTableTypeTable; - sTableTypes[2] = s_sAll; // just to be sure to include anything else .... + sTableTypes[0] = "VIEW"; + sTableTypes[1] = "TABLE"; + sTableTypes[2] = "%"; // just to be sure to include anything else .... Any aCatalog; if ( !sCatalog.isEmpty() ) diff --git a/connectivity/source/drivers/hsqldb/HUser.cxx b/connectivity/source/drivers/hsqldb/HUser.cxx index dc7f20087aa8..e736830af6be 100644 --- a/connectivity/source/drivers/hsqldb/HUser.cxx +++ b/connectivity/source/drivers/hsqldb/HUser.cxx @@ -119,15 +119,6 @@ void OHSQLUser::findPrivilegesAndGrantPrivileges(const OUString& objName, sal_In if ( xRes.is() ) { - static const char sSELECT [] = "SELECT"; - static const char sINSERT [] = "INSERT"; - static const char sUPDATE [] = "UPDATE"; - static const char sDELETE [] = "DELETE"; - static const char sREAD [] = "READ"; - static const char sCREATE [] = "CREATE"; - static const char sALTER [] = "ALTER"; - static const char sREFERENCE[] = "REFERENCE"; - static const char sDROP [] = "DROP"; static const char sYes [] = "YES"; nRightsWithGrant = nRights = 0; @@ -142,55 +133,55 @@ void OHSQLUser::findPrivilegesAndGrantPrivileges(const OUString& objName, sal_In if (!m_Name.equalsIgnoreAsciiCase(sGrantee)) continue; - if (sPrivilege.equalsIgnoreAsciiCase(sSELECT)) + if (sPrivilege.equalsIgnoreAsciiCase("SELECT")) { nRights |= Privilege::SELECT; if ( sGrantable.equalsIgnoreAsciiCase(sYes) ) nRightsWithGrant |= Privilege::SELECT; } - else if (sPrivilege.equalsIgnoreAsciiCase(sINSERT)) + else if (sPrivilege.equalsIgnoreAsciiCase("INSERT")) { nRights |= Privilege::INSERT; if ( sGrantable.equalsIgnoreAsciiCase(sYes) ) nRightsWithGrant |= Privilege::INSERT; } - else if (sPrivilege.equalsIgnoreAsciiCase(sUPDATE)) + else if (sPrivilege.equalsIgnoreAsciiCase("UPDATE")) { nRights |= Privilege::UPDATE; if ( sGrantable.equalsIgnoreAsciiCase(sYes) ) nRightsWithGrant |= Privilege::UPDATE; } - else if (sPrivilege.equalsIgnoreAsciiCase(sDELETE)) + else if (sPrivilege.equalsIgnoreAsciiCase("DELETE")) { nRights |= Privilege::DELETE; if ( sGrantable.equalsIgnoreAsciiCase(sYes) ) nRightsWithGrant |= Privilege::DELETE; } - else if (sPrivilege.equalsIgnoreAsciiCase(sREAD)) + else if (sPrivilege.equalsIgnoreAsciiCase("READ")) { nRights |= Privilege::READ; if ( sGrantable.equalsIgnoreAsciiCase(sYes) ) nRightsWithGrant |= Privilege::READ; } - else if (sPrivilege.equalsIgnoreAsciiCase(sCREATE)) + else if (sPrivilege.equalsIgnoreAsciiCase("CREATE")) { nRights |= Privilege::CREATE; if ( sGrantable.equalsIgnoreAsciiCase(sYes) ) nRightsWithGrant |= Privilege::CREATE; } - else if (sPrivilege.equalsIgnoreAsciiCase(sALTER)) + else if (sPrivilege.equalsIgnoreAsciiCase("ALTER")) { nRights |= Privilege::ALTER; if ( sGrantable.equalsIgnoreAsciiCase(sYes) ) nRightsWithGrant |= Privilege::ALTER; } - else if (sPrivilege.equalsIgnoreAsciiCase(sREFERENCE)) + else if (sPrivilege.equalsIgnoreAsciiCase("REFERENCE")) { nRights |= Privilege::REFERENCE; if ( sGrantable.equalsIgnoreAsciiCase(sYes) ) nRightsWithGrant |= Privilege::REFERENCE; } - else if (sPrivilege.equalsIgnoreAsciiCase(sDROP)) + else if (sPrivilege.equalsIgnoreAsciiCase("DROP")) { nRights |= Privilege::DROP; if ( sGrantable.equalsIgnoreAsciiCase(sYes) ) diff --git a/connectivity/source/drivers/mysql/YCatalog.cxx b/connectivity/source/drivers/mysql/YCatalog.cxx index 6c98d12ea94e..c98890c5f6d3 100644 --- a/connectivity/source/drivers/mysql/YCatalog.cxx +++ b/connectivity/source/drivers/mysql/YCatalog.cxx @@ -53,14 +53,11 @@ void OMySQLCatalog::refreshObjects(const Sequence< OUString >& _sKindOfObject,TS void OMySQLCatalog::refreshTables() { TStringVector aVector; - static const char s_sTableTypeView[] = "VIEW"; - static const char s_sTableTypeTable[] = "TABLE"; - static const char s_sAll[] = "%"; Sequence< OUString > sTableTypes(3); - sTableTypes[0] = s_sTableTypeView; - sTableTypes[1] = s_sTableTypeTable; - sTableTypes[2] = s_sAll; // just to be sure to include anything else .... + sTableTypes[0] = "VIEW"; + sTableTypes[1] = "TABLE"; + sTableTypes[2] = "%"; // just to be sure to include anything else .... refreshObjects(sTableTypes,aVector); diff --git a/connectivity/source/drivers/mysql/YTables.cxx b/connectivity/source/drivers/mysql/YTables.cxx index 7d12bf82cf19..3cad5360c033 100644 --- a/connectivity/source/drivers/mysql/YTables.cxx +++ b/connectivity/source/drivers/mysql/YTables.cxx @@ -51,14 +51,10 @@ sdbcx::ObjectType OTables::createObject(const OUString& _rName) OUString sCatalog,sSchema,sTable; ::dbtools::qualifiedNameComponents(m_xMetaData,_rName,sCatalog,sSchema,sTable,::dbtools::EComposeRule::InDataManipulation); - static const char s_sTableTypeView[] = "VIEW"; - static const char s_sTableTypeTable[] = "TABLE"; - static const char s_sAll[] = "%"; - Sequence< OUString > sTableTypes(3); - sTableTypes[0] = s_sTableTypeView; - sTableTypes[1] = s_sTableTypeTable; - sTableTypes[2] = s_sAll; // just to be sure to include anything else .... + sTableTypes[0] = "VIEW"; + sTableTypes[1] = "TABLE"; + sTableTypes[2] = "%"; // just to be sure to include anything else .... Any aCatalog; if ( !sCatalog.isEmpty() ) @@ -180,8 +176,7 @@ OUString OTables::adjustSQL(const OUString& _sSql) void OTables::createTable( const Reference< XPropertySet >& descriptor ) { const Reference< XConnection > xConnection = static_cast<OMySQLCatalog&>(m_rParent).getConnection(); - static const char s_sCreatePattern[] = "(M,D)"; - const OUString aSql = adjustSQL(::dbtools::createSqlCreateTableStatement(descriptor,xConnection,this,s_sCreatePattern)); + const OUString aSql = adjustSQL(::dbtools::createSqlCreateTableStatement(descriptor,xConnection, this, "(M,D)")); Reference< XStatement > xStmt = xConnection->createStatement( ); if ( xStmt.is() ) { diff --git a/connectivity/source/drivers/mysql/YUser.cxx b/connectivity/source/drivers/mysql/YUser.cxx index 0cd8d5ad341a..e386d9b385ed 100644 --- a/connectivity/source/drivers/mysql/YUser.cxx +++ b/connectivity/source/drivers/mysql/YUser.cxx @@ -119,15 +119,6 @@ void OMySQLUser::findPrivilegesAndGrantPrivileges(const OUString& objName, sal_I if ( xRes.is() ) { - static const char sSELECT [] = "SELECT"; - static const char sINSERT [] = "INSERT"; - static const char sUPDATE [] = "UPDATE"; - static const char sDELETE [] = "DELETE"; - static const char sREAD [] = "READ"; - static const char sCREATE [] = "CREATE"; - static const char sALTER [] = "ALTER"; - static const char sREFERENCE[] = "REFERENCES"; - static const char sDROP [] = "DROP"; static const char sYes [] = "YES"; nRightsWithGrant = nRights = 0; @@ -142,55 +133,55 @@ void OMySQLUser::findPrivilegesAndGrantPrivileges(const OUString& objName, sal_I if (!m_Name.equalsIgnoreAsciiCase(sGrantee)) continue; - if (sPrivilege.equalsIgnoreAsciiCase(sSELECT)) + if (sPrivilege.equalsIgnoreAsciiCase("SELECT")) { nRights |= Privilege::SELECT; if ( sGrantable.equalsIgnoreAsciiCase(sYes) ) nRightsWithGrant |= Privilege::SELECT; } - else if (sPrivilege.equalsIgnoreAsciiCase(sINSERT)) + else if (sPrivilege.equalsIgnoreAsciiCase("INSERT")) { nRights |= Privilege::INSERT; if ( sGrantable.equalsIgnoreAsciiCase(sYes) ) nRightsWithGrant |= Privilege::INSERT; } - else if (sPrivilege.equalsIgnoreAsciiCase(sUPDATE)) + else if (sPrivilege.equalsIgnoreAsciiCase("UPDATE")) { nRights |= Privilege::UPDATE; if ( sGrantable.equalsIgnoreAsciiCase(sYes) ) nRightsWithGrant |= Privilege::UPDATE; } - else if (sPrivilege.equalsIgnoreAsciiCase(sDELETE)) + else if (sPrivilege.equalsIgnoreAsciiCase("DELETE")) { nRights |= Privilege::DELETE; if ( sGrantable.equalsIgnoreAsciiCase(sYes) ) nRightsWithGrant |= Privilege::DELETE; } - else if (sPrivilege.equalsIgnoreAsciiCase(sREAD)) + else if (sPrivilege.equalsIgnoreAsciiCase("READ")) { nRights |= Privilege::READ; if ( sGrantable.equalsIgnoreAsciiCase(sYes) ) nRightsWithGrant |= Privilege::READ; } - else if (sPrivilege.equalsIgnoreAsciiCase(sCREATE)) + else if (sPrivilege.equalsIgnoreAsciiCase("CREATE")) { nRights |= Privilege::CREATE; if ( sGrantable.equalsIgnoreAsciiCase(sYes) ) nRightsWithGrant |= Privilege::CREATE; } - else if (sPrivilege.equalsIgnoreAsciiCase(sALTER)) + else if (sPrivilege.equalsIgnoreAsciiCase("ALTER")) { nRights |= Privilege::ALTER; if ( sGrantable.equalsIgnoreAsciiCase(sYes) ) nRightsWithGrant |= Privilege::ALTER; } - else if (sPrivilege.equalsIgnoreAsciiCase(sREFERENCE)) + else if (sPrivilege.equalsIgnoreAsciiCase("REFERENCES")) { nRights |= Privilege::REFERENCE; if ( sGrantable.equalsIgnoreAsciiCase(sYes) ) nRightsWithGrant |= Privilege::REFERENCE; } - else if (sPrivilege.equalsIgnoreAsciiCase(sDROP)) + else if (sPrivilege.equalsIgnoreAsciiCase("DROP")) { nRights |= Privilege::DROP; if ( sGrantable.equalsIgnoreAsciiCase(sYes) ) diff --git a/connectivity/source/parse/sqliterator.cxx b/connectivity/source/parse/sqliterator.cxx index 4ace9f0ba354..0f0e0d3cc1de 100644 --- a/connectivity/source/parse/sqliterator.cxx +++ b/connectivity/source/parse/sqliterator.cxx @@ -261,14 +261,12 @@ namespace { OUString sComposedName; - static const char s_sTableTypeView[] = "VIEW"; - static const char s_sTableTypeTable[] = "TABLE"; static const char s_sWildcard[] = "%" ; // we want all catalogues, all schemas, all tables Sequence< OUString > sTableTypes(3); - sTableTypes[0] = s_sTableTypeView; - sTableTypes[1] = s_sTableTypeTable; + sTableTypes[0] = "VIEW"; + sTableTypes[1] = "TABLE"; sTableTypes[2] = s_sWildcard; // just to be sure to include anything else .... if ( _rxDBMeta.is() ) |