diff options
Diffstat (limited to 'connectivity/source/commontools/dbtools.cxx')
-rw-r--r-- | connectivity/source/commontools/dbtools.cxx | 75 |
1 files changed, 38 insertions, 37 deletions
diff --git a/connectivity/source/commontools/dbtools.cxx b/connectivity/source/commontools/dbtools.cxx index ce6f3a6a03ba..885e28c751f5 100644 --- a/connectivity/source/commontools/dbtools.cxx +++ b/connectivity/source/commontools/dbtools.cxx @@ -78,7 +78,7 @@ #include <osl/diagnose.h> #include <rtl/ustrbuf.hxx> #include <sal/log.hxx> -#include <tools/diagnose_ex.h> +#include <comphelper/diagnose_ex.hxx> #include <tools/stream.hxx> #include <cppuhelper/implbase.hxx> #include <strings.hrc> @@ -278,7 +278,7 @@ static Reference< XConnection > getConnection_allowException( Reference<XInitialization> xIni(xDataSource, UNO_QUERY); if (xIni.is()) { - Sequence< Any > aArgs{ Any(NamedValue( "ParentWindow", makeAny(_rxParent) )) }; + Sequence< Any > aArgs{ Any(NamedValue( "ParentWindow", Any(_rxParent) )) }; xIni->initialize(aArgs); } @@ -316,7 +316,7 @@ static Reference< XConnection > getConnection_allowException( if (xIni.is()) { - Sequence< Any > aArgs{ Any(NamedValue( "ParentWindow", makeAny(Reference<XWindow>()) )) }; + Sequence< Any > aArgs{ Any(NamedValue( "ParentWindow", Any(Reference<XWindow>()) )) }; xIni->initialize(aArgs); } @@ -380,7 +380,7 @@ static SharedConnection lcl_connectRowSet(const Reference< XRowSet>& _rxRowSet, || ( xExistingConn = findConnection( _rxRowSet ) ).is() ) { - xRowSetProps->setPropertyValue("ActiveConnection", makeAny( xExistingConn ) ); + xRowSetProps->setPropertyValue("ActiveConnection", Any( xExistingConn ) ); // no auto disposer needed, since we did not create the connection xConnection.reset( xExistingConn, SharedConnection::NoTakeOwnership ); @@ -389,7 +389,7 @@ static SharedConnection lcl_connectRowSet(const Reference< XRowSet>& _rxRowSet, // build a connection with its current settings (4. data source name, or 5. URL) - static const OUStringLiteral sUserProp( u"User" ); + static constexpr OUString sUserProp( u"User"_ustr ); OUString sDataSourceName; xRowSetProps->getPropertyValue("DataSourceName") >>= sDataSourceName; OUString sURL; @@ -425,8 +425,8 @@ static SharedConnection lcl_connectRowSet(const Reference< XRowSet>& _rxRowSet, if (!sUser.isEmpty()) { // use user and pwd together with the url auto aInfo(::comphelper::InitPropertySequence({ - { "user", makeAny(sUser) }, - { "password", makeAny(sPwd) } + { "user", Any(sUser) }, + { "password", Any(sPwd) } })); xPureConnection = xDriverManager->getConnectionWithInfo( sURL, aInfo ); } @@ -453,7 +453,7 @@ static SharedConnection lcl_connectRowSet(const Reference< XRowSet>& _rxRowSet, else xRowSetProps->setPropertyValue( "ActiveConnection", - makeAny( xConnection.getTyped() ) + Any( xConnection.getTyped() ) ); } catch(Exception&) @@ -683,7 +683,7 @@ Reference< XNameAccess > getFieldsByCommandDescriptor( const Reference< XConnect try { if ( xStatementProps.is() ) - xStatementProps->setPropertyValue( "MaxRows", makeAny( sal_Int32( 0 ) ) ); + xStatementProps->setPropertyValue( "MaxRows", Any( sal_Int32( 0 ) ) ); } catch( const Exception& ) { @@ -743,7 +743,7 @@ SQLException prependErrorInfo( const SQLException& _rChainedException, const Ref { return SQLException( _rAdditionalError, _rxContext, _eSQLState == StandardSQLState::ERROR_UNSPECIFIED ? OUString() : getStandardSQLState( _eSQLState ), - 0, makeAny( _rChainedException ) ); + 0, Any( _rChainedException ) ); } namespace @@ -815,13 +815,13 @@ static OUString impl_doComposeTableName( const Reference< XDatabaseMetaData >& _ OUStringBuffer aComposedName; OUString sCatalogSep; - bool bCatlogAtStart = true; + bool bCatalogAtStart = true; if ( !_rCatalog.isEmpty() && aNameComps.bCatalogs ) { sCatalogSep = _rxMetaData->getCatalogSeparator(); - bCatlogAtStart = _rxMetaData->isCatalogAtStart(); + bCatalogAtStart = _rxMetaData->isCatalogAtStart(); - if ( bCatlogAtStart && !sCatalogSep.isEmpty()) + if ( bCatalogAtStart && !sCatalogSep.isEmpty()) { aComposedName.append( _bQuote ? quoteName( sQuoteString, _rCatalog ) : _rCatalog ); aComposedName.append( sCatalogSep ); @@ -830,14 +830,15 @@ static OUString impl_doComposeTableName( const Reference< XDatabaseMetaData >& _ if ( !_rSchema.isEmpty() && aNameComps.bSchemas ) { - aComposedName.append( _bQuote ? quoteName( sQuoteString, _rSchema ) : _rSchema ); - aComposedName.append( "." ); + aComposedName.append( + (_bQuote ? quoteName( sQuoteString, _rSchema ) : _rSchema ) + + "." ); } aComposedName.append( _bQuote ? quoteName( sQuoteString, _rName ) : _rName ); if ( !_rCatalog.isEmpty() - && !bCatlogAtStart + && !bCatalogAtStart && !sCatalogSep.isEmpty() && aNameComps.bCatalogs ) @@ -912,7 +913,7 @@ Reference< XNumberFormatsSupplier> getNumberFormats( // ask the parent of the connection (should be a DatabaseAccess) Reference< XNumberFormatsSupplier> xReturn; Reference< XChild> xConnAsChild(_rxConn, UNO_QUERY); - static constexpr OUStringLiteral sPropFormatsSupplier( u"NumberFormatsSupplier" ); + static constexpr OUString sPropFormatsSupplier( u"NumberFormatsSupplier"_ustr ); if (xConnAsChild.is()) { Reference< XPropertySet> xConnParentProps(xConnAsChild->getParent(), UNO_QUERY); @@ -944,20 +945,20 @@ try const Sequence< Property> aOldProperties = xOldInfo->getProperties(); const Sequence< Property> aNewProperties = xNewInfo->getProperties(); - static constexpr OUStringLiteral sPropFormatsSupplier(u"FormatsSupplier"); - static constexpr OUStringLiteral sPropCurrencySymbol(u"CurrencySymbol"); - static constexpr OUStringLiteral sPropDecimals(u"Decimals"); - static constexpr OUStringLiteral sPropEffectiveMin(u"EffectiveMin"); - static constexpr OUStringLiteral sPropEffectiveMax(u"EffectiveMax"); - static constexpr OUStringLiteral sPropEffectiveDefault(u"EffectiveDefault"); - static constexpr OUStringLiteral sPropDefaultText(u"DefaultText"); - static constexpr OUStringLiteral sPropDefaultDate(u"DefaultDate"); - static constexpr OUStringLiteral sPropDefaultTime(u"DefaultTime"); - static constexpr OUStringLiteral sPropValueMin(u"ValueMin"); - static constexpr OUStringLiteral sPropValueMax(u"ValueMax"); - static constexpr OUStringLiteral sPropDecimalAccuracy(u"DecimalAccuracy"); - static constexpr OUStringLiteral sPropClassId(u"ClassId"); - static constexpr OUStringLiteral sFormattedServiceName( u"com.sun.star.form.component.FormattedField" ); + static constexpr OUString sPropFormatsSupplier(u"FormatsSupplier"_ustr); + static constexpr OUString sPropCurrencySymbol(u"CurrencySymbol"_ustr); + static constexpr OUString sPropDecimals(u"Decimals"_ustr); + static constexpr OUString sPropEffectiveMin(u"EffectiveMin"_ustr); + static constexpr OUString sPropEffectiveMax(u"EffectiveMax"_ustr); + static constexpr OUString sPropEffectiveDefault(u"EffectiveDefault"_ustr); + static constexpr OUString sPropDefaultText(u"DefaultText"_ustr); + static constexpr OUString sPropDefaultDate(u"DefaultDate"_ustr); + static constexpr OUString sPropDefaultTime(u"DefaultTime"_ustr); + static constexpr OUString sPropValueMin(u"ValueMin"_ustr); + static constexpr OUString sPropValueMax(u"ValueMax"_ustr); + static constexpr OUString sPropDecimalAccuracy(u"DecimalAccuracy"_ustr); + static constexpr OUString sPropClassId(u"ClassId"_ustr); + static constexpr OUString sFormattedServiceName( u"com.sun.star.form.component.FormattedField"_ustr ); for (const Property& rOldProp : aOldProperties) { @@ -1058,13 +1059,13 @@ try { // (to convert an OUString into a date will not always succeed, because it might be bound to a text-column, // but we can work with a double) Date aDate = DBTypeConversion::toDate(getDouble(aEffectiveDefault)); - xNewProps->setPropertyValue(sPropDefaultDate, makeAny(aDate)); + xNewProps->setPropertyValue(sPropDefaultDate, Any(aDate)); } if (hasProperty(sPropDefaultTime, xNewProps) && !bIsString) { // Completely analogous to time css::util::Time aTime = DBTypeConversion::toTime(getDouble(aEffectiveDefault)); - xNewProps->setPropertyValue(sPropDefaultTime, makeAny(aTime)); + xNewProps->setPropertyValue(sPropDefaultTime, Any(aTime)); } if (hasProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_DEFAULTVALUE), xNewProps) && !bIsString) @@ -1134,7 +1135,7 @@ try nKey = xFormats->addNew(sNewFormat, _rLocale); } - xNewProps->setPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_FORMATKEY), makeAny(nKey)); + xNewProps->setPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_FORMATKEY), Any(nKey)); } // min-/max-Value @@ -1713,7 +1714,7 @@ void askForParameters(const Reference< XSingleSelectQueryComposer >& _xComposer, Reference<XIndexAccess> xWrappedParameters = new OParameterWrapper(std::move(aNewParameterSet),xParamsAsIndicies); aRequest.Parameters = xWrappedParameters; aRequest.Connection = _xConnection; - rtl::Reference<OInteractionRequest> pRequest = new OInteractionRequest(makeAny(aRequest)); + rtl::Reference<OInteractionRequest> pRequest = new OInteractionRequest(Any(aRequest)); // some knittings pRequest->addContinuation(pAbort); pRequest->addContinuation(pParams); @@ -2016,8 +2017,8 @@ namespace dbase case 0x65: eEncoding = RTL_TEXTENCODING_IBM_866; break; // Russian MS-DOS code page 866 case 0x66: eEncoding = RTL_TEXTENCODING_IBM_865; break; // Nordic MS-DOS code page 865 case 0x67: eEncoding = RTL_TEXTENCODING_IBM_861; break; // Icelandic MS-DOS - //case 0x68: eEncoding = ; break; // Kamenicky (Czech) MS-DOS - //case 0x69: eEncoding = ; break; // Mazovia (Polish) MS-DOS + case 0x68: eEncoding = RTL_TEXTENCODING_KAMENICKY; break; // Kamenicky (Czech) MS-DOS + case 0x69: eEncoding = RTL_TEXTENCODING_MAZOVIA; break; // Mazovia (Polish) MS-DOS case 0x6A: eEncoding = RTL_TEXTENCODING_IBM_737; break; // Greek MS-DOS (437G) case 0x6B: eEncoding = RTL_TEXTENCODING_IBM_857; break; // Turkish MS-DOS case 0x6C: eEncoding = RTL_TEXTENCODING_IBM_863; break; // MS-DOS, Canada |