diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-10-31 12:57:08 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-11-01 07:12:36 +0100 |
commit | 8c9b5a901dcbb430bbf225ed0a2d7a286b1d5185 (patch) | |
tree | edf76ea7647609264260d20d86dca9357aa662db /connectivity/source/commontools | |
parent | loplugin:constantparam in d* (diff) | |
download | core-8c9b5a901dcbb430bbf225ed0a2d7a286b1d5185.tar.gz core-8c9b5a901dcbb430bbf225ed0a2d7a286b1d5185.zip |
loplugin:constantparam in connectivity
Change-Id: Ia13d0931bbdf642fe04119ea1112788fb143eba8
Reviewed-on: https://gerrit.libreoffice.org/44110
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'connectivity/source/commontools')
-rw-r--r-- | connectivity/source/commontools/DateConversion.cxx | 26 | ||||
-rw-r--r-- | connectivity/source/commontools/TColumnsHelper.cxx | 4 | ||||
-rw-r--r-- | connectivity/source/commontools/TIndexes.cxx | 2 | ||||
-rw-r--r-- | connectivity/source/commontools/TKeys.cxx | 4 | ||||
-rw-r--r-- | connectivity/source/commontools/dbexception.cxx | 4 | ||||
-rw-r--r-- | connectivity/source/commontools/dbtools.cxx | 18 | ||||
-rw-r--r-- | connectivity/source/commontools/dbtools2.cxx | 4 |
7 files changed, 25 insertions, 37 deletions
diff --git a/connectivity/source/commontools/DateConversion.cxx b/connectivity/source/commontools/DateConversion.cxx index e51339378526..39acab5c1092 100644 --- a/connectivity/source/commontools/DateConversion.cxx +++ b/connectivity/source/commontools/DateConversion.cxx @@ -44,7 +44,7 @@ using namespace ::com::sun::star::beans; using namespace ::com::sun::star::util; using namespace ::com::sun::star::uno; -OUString DBTypeConversion::toSQLString(sal_Int32 eType, const Any& _rVal, bool bQuote, +OUString DBTypeConversion::toSQLString(sal_Int32 eType, const Any& _rVal, const Reference< XTypeConverter >& _rxTypeConverter) { OUStringBuffer aRet; @@ -76,8 +76,7 @@ OUString DBTypeConversion::toSQLString(sal_Int32 eType, const Any& _rVal, bool b case DataType::CHAR: case DataType::VARCHAR: case DataType::LONGVARCHAR: - if (bQuote) - aRet.append("'"); + aRet.append("'"); { OUString aTemp; _rxTypeConverter->convertToSimpleType(_rVal, TypeClass_STRING) >>= aTemp; @@ -93,8 +92,7 @@ OUString DBTypeConversion::toSQLString(sal_Int32 eType, const Any& _rVal, bool b aRet.append(aTemp); } - if (bQuote) - aRet.append("'"); + aRet.append("'"); break; case DataType::REAL: case DataType::DOUBLE: @@ -133,11 +131,9 @@ OUString DBTypeConversion::toSQLString(sal_Int32 eType, const Any& _rVal, bool b // check if this is really a timestamp or only a date if ( bOk ) { - if (bQuote) - aRet.append("{ts '"); + aRet.append("{ts '"); aRet.append(DBTypeConversion::toDateTimeString(aDateTime)); - if (bQuote) - aRet.append("'}"); + aRet.append("'}"); break; } break; @@ -163,11 +159,9 @@ OUString DBTypeConversion::toSQLString(sal_Int32 eType, const Any& _rVal, bool b else bOk = _rVal >>= aDate; OSL_ENSURE( bOk, "DBTypeConversion::toSQLString: _rVal is not date!"); - if (bQuote) - aRet.append("{d '"); + aRet.append("{d '"); aRet.append(DBTypeConversion::toDateString(aDate)); - if (bQuote) - aRet.append("'}"); + aRet.append("'}"); } break; case DataType::TIME: { @@ -190,11 +184,9 @@ OUString DBTypeConversion::toSQLString(sal_Int32 eType, const Any& _rVal, bool b else bOk = _rVal >>= aTime; OSL_ENSURE( bOk,"DBTypeConversion::toSQLString: _rVal is not time!"); - if (bQuote) - aRet.append("{t '"); + aRet.append("{t '"); aRet.append(DBTypeConversion::toTimeString(aTime)); - if (bQuote) - aRet.append("'}"); + aRet.append("'}"); } break; } } diff --git a/connectivity/source/commontools/TColumnsHelper.cxx b/connectivity/source/commontools/TColumnsHelper.cxx index 2f347da63946..ff585a6e4993 100644 --- a/connectivity/source/commontools/TColumnsHelper.cxx +++ b/connectivity/source/commontools/TColumnsHelper.cxx @@ -175,7 +175,7 @@ sdbcx::ObjectType OColumnsHelper::appendObject( const OUString& _rForName, const Reference<XDatabaseMetaData> xMetaData = m_pTable->getConnection()->getMetaData(); OUString aSql = "ALTER TABLE " + - ::dbtools::composeTableName( xMetaData, m_pTable, ::dbtools::EComposeRule::InTableDefinitions, false, false, true ) + + ::dbtools::composeTableName( xMetaData, m_pTable, ::dbtools::EComposeRule::InTableDefinitions, true ) + " ADD " + ::dbtools::createStandardColumnPart(descriptor,m_pTable->getConnection(),nullptr,m_pTable->getTypeCreatePattern()); @@ -197,7 +197,7 @@ void OColumnsHelper::dropObject(sal_Int32 /*_nPos*/, const OUString& _sElementNa Reference<XDatabaseMetaData> xMetaData = m_pTable->getConnection()->getMetaData(); OUString aQuote = xMetaData->getIdentifierQuoteString( ); OUString aSql = "ALTER TABLE " + - ::dbtools::composeTableName( xMetaData, m_pTable, ::dbtools::EComposeRule::InTableDefinitions, false, false, true ) + + ::dbtools::composeTableName( xMetaData, m_pTable, ::dbtools::EComposeRule::InTableDefinitions, true ) + " DROP " + ::dbtools::quoteName( aQuote,_sElementName); diff --git a/connectivity/source/commontools/TIndexes.cxx b/connectivity/source/commontools/TIndexes.cxx index 85e90bd94ddc..33dabdd76a23 100644 --- a/connectivity/source/commontools/TIndexes.cxx +++ b/connectivity/source/commontools/TIndexes.cxx @@ -227,7 +227,7 @@ void OIndexesHelper::dropObject(sal_Int32 /*_nPos*/,const OUString& _sElementNam OUString aSql( "DROP INDEX " ); - OUString aComposedName = dbtools::composeTableName( m_pTable->getMetaData(), m_pTable, ::dbtools::EComposeRule::InIndexDefinitions, false, false, true ); + OUString aComposedName = dbtools::composeTableName( m_pTable->getMetaData(), m_pTable, ::dbtools::EComposeRule::InIndexDefinitions, true ); OUString sIndexName; sIndexName = dbtools::composeTableName( m_pTable->getMetaData(), OUString(), aSchema, aName, true, ::dbtools::EComposeRule::InIndexDefinitions ); diff --git a/connectivity/source/commontools/TKeys.cxx b/connectivity/source/commontools/TKeys.cxx index c7419c47c7cf..6b3b8dae0e7a 100644 --- a/connectivity/source/commontools/TKeys.cxx +++ b/connectivity/source/commontools/TKeys.cxx @@ -159,7 +159,7 @@ sdbcx::ObjectType OKeysHelper::appendObject( const OUString& _rForName, const Re aSql.append("ALTER TABLE "); OUString aQuote = m_pTable->getConnection()->getMetaData()->getIdentifierQuoteString( ); - aSql.append(composeTableName( m_pTable->getConnection()->getMetaData(), m_pTable, ::dbtools::EComposeRule::InTableDefinitions, false, false, true )); + aSql.append(composeTableName( m_pTable->getConnection()->getMetaData(), m_pTable, ::dbtools::EComposeRule::InTableDefinitions, true )); aSql.append(" ADD "); if ( nKeyType == KeyType::PRIMARY ) @@ -274,7 +274,7 @@ void OKeysHelper::dropObject(sal_Int32 _nPos, const OUString& _sElementName) OUStringBuffer aSql; aSql.append("ALTER TABLE "); - aSql.append( composeTableName( m_pTable->getConnection()->getMetaData(), m_pTable,::dbtools::EComposeRule::InTableDefinitions, false, false, true )); + aSql.append( composeTableName( m_pTable->getConnection()->getMetaData(), m_pTable,::dbtools::EComposeRule::InTableDefinitions, true )); sal_Int32 nKeyType = KeyType::PRIMARY; if ( xKey.is() ) diff --git a/connectivity/source/commontools/dbexception.cxx b/connectivity/source/commontools/dbexception.cxx index da88206cc7d8..961720f4bc59 100644 --- a/connectivity/source/commontools/dbexception.cxx +++ b/connectivity/source/commontools/dbexception.cxx @@ -446,14 +446,14 @@ void throwInvalidColumnException( const OUString& _rColumnName, const Reference< } void throwSQLException( const OUString& _rMessage, const OUString& _rSQLState, - const Reference< XInterface >& _rxContext, const sal_Int32 _nErrorCode, const Any* _pNextException ) + const Reference< XInterface >& _rxContext, const sal_Int32 _nErrorCode ) { throw SQLException( _rMessage, _rxContext, _rSQLState, _nErrorCode, - _pNextException ? *_pNextException : Any() + Any() ); } diff --git a/connectivity/source/commontools/dbtools.cxx b/connectivity/source/commontools/dbtools.cxx index 547aea048041..861419a5c283 100644 --- a/connectivity/source/commontools/dbtools.cxx +++ b/connectivity/source/commontools/dbtools.cxx @@ -450,17 +450,15 @@ SharedConnection lcl_connectRowSet(const Reference< XRowSet>& _rxRowSet, const R return xConnection; } -Reference< XConnection> connectRowset(const Reference< XRowSet>& _rxRowSet, const Reference< XComponentContext >& _rxContext, - bool _bSetAsActiveConnection ) +Reference< XConnection> connectRowset(const Reference< XRowSet>& _rxRowSet, const Reference< XComponentContext >& _rxContext ) { - SharedConnection xConnection = lcl_connectRowSet( _rxRowSet, _rxContext, _bSetAsActiveConnection, true ); + SharedConnection xConnection = lcl_connectRowSet( _rxRowSet, _rxContext, true/*bSetAsActiveConnection*/, true ); return xConnection.getTyped(); } -SharedConnection ensureRowSetConnection(const Reference< XRowSet>& _rxRowSet, const Reference< XComponentContext>& _rxContext, - bool _bUseAutoConnectionDisposer ) +SharedConnection ensureRowSetConnection(const Reference< XRowSet>& _rxRowSet, const Reference< XComponentContext>& _rxContext ) { - return lcl_connectRowSet( _rxRowSet, _rxContext, true, _bUseAutoConnectionDisposer ); + return lcl_connectRowSet( _rxRowSet, _rxContext, true, false/*bUseAutoConnectionDisposer*/ ); } Reference< XNameAccess> getTableFields(const Reference< XConnection>& _rxConn,const OUString& _rName) @@ -1210,7 +1208,7 @@ Reference< XSingleSelectQueryComposer > getComposedRowSetStatement( const Refere Reference< XSingleSelectQueryComposer > xComposer; try { - Reference< XConnection> xConn = connectRowset( Reference< XRowSet >( _rxRowSet, UNO_QUERY ), _rxContext, true ); + Reference< XConnection> xConn = connectRowset( Reference< XRowSet >( _rxRowSet, UNO_QUERY ), _rxContext ); if ( xConn.is() ) // implies _rxRowSet.is() { // build the statement the row set is based on (can't use the ActiveCommand property of the set @@ -1335,8 +1333,6 @@ OUString composeTableNameForSelect( const Reference< XConnection >& _rxConnectio OUString composeTableName(const Reference<XDatabaseMetaData>& _xMetaData, const Reference<XPropertySet>& _xTable, EComposeRule _eComposeRule, - bool _bSuppressCatalog, - bool _bSuppressSchema, bool _bQuote ) { OUString sCatalog, sSchema, sName; @@ -1344,8 +1340,8 @@ OUString composeTableName(const Reference<XDatabaseMetaData>& _xMetaData, return impl_doComposeTableName( _xMetaData, - _bSuppressCatalog ? OUString() : sCatalog, - _bSuppressSchema ? OUString() : sSchema, + sCatalog, + sSchema, sName, _bQuote, _eComposeRule diff --git a/connectivity/source/commontools/dbtools2.cxx b/connectivity/source/commontools/dbtools2.cxx index 942d9ac60278..efff523d800d 100644 --- a/connectivity/source/commontools/dbtools2.cxx +++ b/connectivity/source/commontools/dbtools2.cxx @@ -987,7 +987,7 @@ OUString getDefaultReportEngineServiceName(const Reference< XComponentContext >& return OUString(); } -bool isAggregateColumn(const Reference< XSingleSelectQueryComposer > &_xParser, const Reference< XPropertySet > &_xField, bool whenNotFound) +bool isAggregateColumn(const Reference< XSingleSelectQueryComposer > &_xParser, const Reference< XPropertySet > &_xField) { OUString sName; _xField->getPropertyValue("Name") >>= sName; @@ -996,7 +996,7 @@ bool isAggregateColumn(const Reference< XSingleSelectQueryComposer > &_xParser, if (xColumnsSupplier.is()) xCols = xColumnsSupplier->getColumns(); - return isAggregateColumn(xCols, sName, whenNotFound); + return isAggregateColumn(xCols, sName, false/*whenNotFound*/); } bool isAggregateColumn(const Reference< XNameAccess > &_xColumns, const OUString &_sName, bool whenNotFound) |