23#include <core_resource.hxx>
34#include <com/sun/star/beans/NamedValue.hpp>
35#include <com/sun/star/beans/PropertyAttribute.hpp>
36#include <com/sun/star/beans/PropertyState.hpp>
37#include <com/sun/star/document/XDocumentSubStorageSupplier.hpp>
38#include <com/sun/star/lang/DisposedException.hpp>
39#include <com/sun/star/reflection/ProxyFactory.hpp>
40#include <com/sun/star/sdb/DatabaseContext.hpp>
41#include <com/sun/star/sdb/SQLContext.hpp>
42#include <com/sun/star/sdbc/ConnectionPool.hpp>
43#include <com/sun/star/sdbc/XDriverAccess.hpp>
44#include <com/sun/star/sdbc/XDriverManager.hpp>
45#include <com/sun/star/sdbc/DriverManager.hpp>
46#include <com/sun/star/ucb/AuthenticationRequest.hpp>
47#include <com/sun/star/ucb/XInteractionSupplyAuthentication.hpp>
58#include <officecfg/Office/Common.hxx>
60#include <osl/diagnose.h>
61#include <osl/process.h>
65#include <rtl/digest.h>
71#include <config_firebird.h>
87using namespace ::
cppu;
107class FlushNotificationAdapter :
public ::cppu::WeakImplHelper< XFlushListener >
114 static void installAdapter(
const Reference< XFlushable >& _rxBroadcaster,
const Reference< XFlushListener >& _rxListener )
116 new FlushNotificationAdapter( _rxBroadcaster, _rxListener );
120 FlushNotificationAdapter(
const Reference< XFlushable >& _rxBroadcaster,
const Reference< XFlushListener >& _rxListener );
121 virtual ~FlushNotificationAdapter()
override;
127 virtual void SAL_CALL flushed(
const css::lang::EventObject& rEvent )
override;
129 virtual void SAL_CALL disposing(
const css::lang::EventObject& Source )
override;
134FlushNotificationAdapter::FlushNotificationAdapter(
const Reference< XFlushable >& _rxBroadcaster,
const Reference< XFlushListener >& _rxListener )
138 OSL_ENSURE( _rxBroadcaster.is(),
"FlushNotificationAdapter::FlushNotificationAdapter: invalid flushable!" );
140 osl_atomic_increment( &m_refCount );
142 if ( _rxBroadcaster.is() )
143 _rxBroadcaster->addFlushListener(
this );
145 osl_atomic_decrement( &m_refCount );
146 OSL_ENSURE( m_refCount == 1,
"FlushNotificationAdapter::FlushNotificationAdapter: broadcaster isn't holding by hard ref!?" );
149FlushNotificationAdapter::~FlushNotificationAdapter()
153void FlushNotificationAdapter::impl_dispose()
155 Reference< XFlushListener > xKeepAlive(
this );
158 if ( xFlushable.is() )
159 xFlushable->removeFlushListener(
this );
165void SAL_CALL FlushNotificationAdapter::flushed(
const EventObject& rEvent )
167 Reference< XFlushListener > xListener(
m_aListener );
168 if ( xListener.is() )
169 xListener->flushed( rEvent );
174void SAL_CALL FlushNotificationAdapter::disposing(
const EventObject& Source )
176 Reference< XFlushListener > xListener(
m_aListener );
177 if ( xListener.is() )
178 xListener->disposing( Source );
183OAuthenticationContinuation::OAuthenticationContinuation()
184 :m_bRememberPassword(true),
185 m_bCanSetUserName(true)
196 SAL_WARN(
"dbaccess",
"OAuthenticationContinuation::setRealm: not supported!");
223 _reDefault = RememberAuthentication_SESSION;
224 return { _reDefault };
239 SAL_WARN(
"dbaccess",
"OAuthenticationContinuation::setAccount: not supported!");
244 _reDefault = RememberAuthentication_NO;
245 return { RememberAuthentication_NO };
250 SAL_WARN(
"dbaccess",
"OAuthenticationContinuation::setRememberAccount: not supported!");
287 for(
i=0;
i < RTL_DIGEST_LENGTH_SHA1 && (
x.m_pBuffer[
i] >=
y.m_pBuffer[
i]); ++
i)
289 return i < RTL_DIGEST_LENGTH_SHA1;
307 void SAL_CALL
disposing(
const css::lang::EventObject& Source )
override;
309 const OUString& user,
310 const OUString& password,
311 const Sequence< PropertyValue >& _aInfo,
313 void addEventListener(
const Reference<XConnection>& _rxConnection, TConnectionMap::iterator
const & _rIter);
328 Reference<XConnection> xConnection(
Source.Source,UNO_QUERY);
332 osl_atomic_decrement(&aFind->second->second.nALiveCount);
333 if ( !aFind->second->second.nALiveCount )
335 ::comphelper::disposeComponent(aFind->second->second.xMasterConnection);
343 const OUString& user,
344 const OUString& password,
345 const Sequence< PropertyValue >& _aInfo,
349 TConnectionMap::key_type
nId;
350 Sequence< PropertyValue > aInfoCopy(_aInfo);
351 sal_Int32
nPos = aInfoCopy.getLength();
352 aInfoCopy.realloc(
nPos + 2 );
353 auto pInfoCopy = aInfoCopy.getArray();
354 pInfoCopy[
nPos].Name =
"TableFilter";
355 pInfoCopy[
nPos++].Value <<= _pDataSource->
m_pImpl->m_aTableFilter;
356 pInfoCopy[
nPos].Name =
"TableTypeFilter";
357 pInfoCopy[
nPos++].Value <<= _pDataSource->
m_pImpl->m_aTableTypeFilter;
359 OUString sUser = user;
360 OUString sPassword = password;
361 if ((sUser.isEmpty()) && (sPassword.isEmpty()) && (!_pDataSource->
m_pImpl->m_sUser.isEmpty()))
364 sUser = _pDataSource->
m_pImpl->m_sUser;
365 if (!_pDataSource->
m_pImpl->m_aPassword.isEmpty())
366 sPassword = _pDataSource->
m_pImpl->m_aPassword;
380 Reference<XConnection> xRet;
381 if ( aIter->second.xMasterConnection.is() )
383 Reference< XAggregation > xConProxy =
m_xProxyFactory->createProxy(aIter->second.xMasterConnection);
394 Reference<XComponent> xComp(_rxConnection,UNO_QUERY);
395 xComp->addEventListener(
this);
397 osl_atomic_increment(&_rIter->second.nALiveCount);
402 Sequence< PropertyValue > lcl_filterDriverProperties(
const Reference< XDriver >& _xDriver,
const OUString& _sUrl,
403 const Sequence< PropertyValue >& _rDataSourceSettings,
const AsciiPropertyValue* _pKnownSettings )
407 Sequence< DriverPropertyInfo > aDriverInfo(_xDriver->getPropertyInfo(_sUrl,_rDataSourceSettings));
409 const PropertyValue* pDataSourceSetting = _rDataSourceSettings.getConstArray();
410 const PropertyValue* pEnd = pDataSourceSetting + _rDataSourceSettings.getLength();
412 std::vector< PropertyValue > aRet;
414 for ( ; pDataSourceSetting != pEnd ; ++pDataSourceSetting )
416 bool bAllowSetting =
false;
418 for ( ; pSetting->
AsciiName; ++pSetting )
420 if ( pDataSourceSetting->Name.equalsAscii( pSetting->
AsciiName ) )
423 const DriverPropertyInfo* pAllowedDriverSetting = aDriverInfo.getConstArray();
424 const DriverPropertyInfo* pDriverSettingsEnd = pAllowedDriverSetting + aDriverInfo.getLength();
425 for ( ; pAllowedDriverSetting != pDriverSettingsEnd; ++pAllowedDriverSetting )
427 if ( pAllowedDriverSetting->Name.equalsAscii( pSetting->
AsciiName ) )
429 bAllowSetting =
true;
436 if ( bAllowSetting || !pSetting->
AsciiName )
439 aRet.push_back( *pDataSourceSetting );
445 return Sequence< PropertyValue >();
448 typedef std::map< OUString, sal_Int32 > PropertyAttributeCache;
450 struct IsDefaultAndNotRemoveable
456 explicit IsDefaultAndNotRemoveable(
const PropertyAttributeCache& _rAttribs ) :
m_rAttribs( _rAttribs ) { }
458 bool operator()(
const PropertyValue& _rProp )
460 if ( _rProp.State != PropertyState_DEFAULT_VALUE )
463 bool bRemoveable =
true;
465 PropertyAttributeCache::const_iterator
pos =
m_rAttribs.find( _rProp.Name );
466 OSL_ENSURE( pos !=
m_rAttribs.end(),
"IsDefaultAndNotRemoveable: illegal property name!" );
468 bRemoveable = ( (
pos->second & PropertyAttribute::REMOVABLE ) != 0 );
484 SAL_INFO(
"dbaccess",
"DS: ctor: " << std::hex <<
this <<
": " << std::hex <<
m_pImpl.get() );
489 SAL_INFO(
"dbaccess",
"DS: dtor: " << std::hex <<
this <<
": " << std::hex <<
m_pImpl.get() );
490 if ( !ODatabaseSource_Base::rBHelper.bInDispose && !ODatabaseSource_Base::rBHelper.bDisposed )
503 rModelImpl.
m_pImpl->m_sName = _rNewName;
513 return ::comphelper::concatSequences(
514 ODatabaseSource_Base::getTypes(),
515 aPropertyHelperTypes.getTypes()
521 return css::uno::Sequence<sal_Int8>();
527 Any aIface = ODatabaseSource_Base::queryInterface( rType );
528 if ( !aIface.hasValue() )
535 ODatabaseSource_Base::acquire();
540 ODatabaseSource_Base::release();
552 return "com.sun.star.comp.dba.ODatabaseSource";
568 SAL_INFO(
"dbaccess",
"DS: disp: " << std::hex <<
this <<
", " << std::hex <<
m_pImpl.get() );
569 ODatabaseSource_Base::WeakComponentImplHelperBase::disposing();
572 EventObject aDisposeEvent(
static_cast<XWeak*
>(
this));
594 Reference<css::awt::XWindow> xWindow(
xFrame->getContainerWindow());
600 Reference< XConnection > xReturn;
602 Reference< XDriverManager > xManager;
604#if ENABLE_FIREBIRD_SDBC
605 bool bIgnoreMigration =
false;
606 bool bNeedMigration =
false;
616 bIgnoreMigration =
true;
619 if (!officecfg::Office::Common::Misc::ExperimentalMode::get())
620 bIgnoreMigration =
true;
622 if(!bIgnoreMigration &&
m_pImpl->m_sConnectURL ==
"sdbc:embedded:hsqldb")
624 Reference<XStorage>
const xRootStorage =
m_pImpl->getOrCreateRootStorage();
625 OUString sMigrEnvVal;
626 osl_getEnvironment(OUString(
"DBACCESS_HSQL_MIGRATION").
pData,
628 if(!sMigrEnvVal.isEmpty())
629 bNeedMigration =
true;
632 Reference<XPropertySet>
const xPropSet(xRootStorage, UNO_QUERY_THROW);
633 sal_Int32 nOpenMode(0);
634 if ((xPropSet->getPropertyValue(
"OpenMode") >>= nOpenMode)
635 && (nOpenMode & css::embed::ElementModes::WRITE)
639 bNeedMigration = aWarnDlg.
run() ==
RET_OK;
645 static constexpr OUStringLiteral BACKUP_XML_NAME =
u"content_before_migration.xml";
648 if(xRootStorage->isStreamElement(BACKUP_XML_NAME))
649 xRootStorage->removeElement(BACKUP_XML_NAME);
651 catch (NoSuchElementException&)
653 SAL_INFO(
"dbaccess",
"No file content_before_migration.xml found" );
655 xRootStorage->copyElementTo(
"content.xml", xRootStorage,
658 m_pImpl->m_sConnectURL =
"sdbc:embedded:firebird";
664 xManager.set( ConnectionPool::create(
m_pImpl->m_aContext ), UNO_QUERY_THROW );
666 if ( !xManager.is() )
668 xManager.set( DriverManager::create(
m_pImpl->m_aContext ), UNO_QUERY_THROW );
670 OUString sUser(_rUid);
671 OUString sPwd(_rPwd);
672 if ((sUser.isEmpty()) && (sPwd.isEmpty()) && (!
m_pImpl->m_sUser.isEmpty()))
676 if (!
m_pImpl->m_aPassword.isEmpty())
680 TranslateId pExceptionMessageId = RID_STR_COULDNOTCONNECT_UNSPECIFIED;
683 sal_Int32 nAdditionalArgs(0);
684 if (!sUser.isEmpty()) ++nAdditionalArgs;
685 if (!sPwd.isEmpty()) ++nAdditionalArgs;
687 Sequence< PropertyValue > aUserPwd(nAdditionalArgs);
688 auto aUserPwdRange = asNonConstRange(aUserPwd);
689 sal_Int32 nArgPos = 0;
690 if (!sUser.isEmpty())
692 aUserPwdRange[ nArgPos ].Name =
"user";
693 aUserPwdRange[ nArgPos ].Value <<= sUser;
698 aUserPwdRange[ nArgPos ].Name =
"password";
699 aUserPwdRange[ nArgPos ].Value <<= sPwd;
701 Reference< XDriver > xDriver;
706 Reference< XDriverAccess > xAccessDrivers( xManager, UNO_QUERY );
707 if ( xAccessDrivers.is() )
708 xDriver = xAccessDrivers->getDriverByURL(
m_pImpl->m_sConnectURL );
712 TOOLS_WARN_EXCEPTION(
"dbaccess",
"ODatabaseSource::buildLowLevelConnection: got a strange exception while analyzing the error" );
714 if ( !xDriver.is() || !xDriver->acceptsURL(
m_pImpl->m_sConnectURL ) )
719 pExceptionMessageId = RID_STR_COULDNOTCONNECT_NODRIVER;
723 Sequence< PropertyValue > aDriverInfo = lcl_filterDriverProperties(
726 m_pImpl->m_xSettings->getPropertyValues(),
730 if (
m_pImpl->isEmbeddedDatabase() )
732 sal_Int32
nCount = aDriverInfo.getLength();
733 aDriverInfo.realloc(
nCount + 3 );
734 auto pDriverInfo = aDriverInfo.getArray();
736 pDriverInfo[
nCount].Name =
"URL";
739 pDriverInfo[
nCount].Name =
"Storage";
740 Reference< css::document::XDocumentSubStorageSupplier> xDocSup(
m_pImpl->getDocumentSubStorageSupplier() );
741 pDriverInfo[
nCount++].Value <<= xDocSup->getDocumentSubStorage(
"database",ElementModes::READWRITE);
743 pDriverInfo[
nCount].Name =
"Document";
747 xReturn = xManager->getConnectionWithInfo(
m_pImpl->m_sConnectURL, ::comphelper::concatSequences(aUserPwd,aDriverInfo));
749 xReturn = xManager->getConnectionWithInfo(
m_pImpl->m_sConnectURL,aDriverInfo);
751 if (
m_pImpl->isEmbeddedDatabase() )
755 Reference< XFlushable > xFlushable( xReturn, UNO_QUERY );
756 if ( xFlushable.is() )
757 FlushNotificationAdapter::installAdapter( xFlushable,
this );
762 pExceptionMessageId = RID_STR_COULDNOTLOAD_MANAGER;
767 .replaceAll(
"$name$",
m_pImpl->m_sConnectURL);
770 aContext.Message =
DBA_RES(RID_STR_CONNECTION_REQUEST).
771 replaceFirst(
"$name$",
m_pImpl->m_sConnectURL);
776#if ENABLE_FIREBIRD_SDBC
779 Reference< css::document::XDocumentSubStorageSupplier> xDocSup(
780 m_pImpl->getDocumentSubStorageSupplier() );
782 xDocSup->getDocumentSubStorage(
"database",ElementModes::READWRITE) );
799 return new ::cppu::OPropertyArrayHelper
808 css::beans::PropertyAttribute::READONLY | css::beans::PropertyAttribute::TRANSIENT },
828 bool bModified(
false);
834 bModified = ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue,
m_pImpl->m_aTableFilter);
837 bModified = ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue,
m_pImpl->m_aTableTypeFilter);
840 bModified = ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue,
m_pImpl->m_sUser);
843 bModified = ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue,
m_pImpl->m_aPassword);
846 bModified = ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue,
m_pImpl->m_bPasswordRequired);
849 bModified = ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue,
m_pImpl->m_bSuppressVersionColumns);
852 bModified = ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue,
m_pImpl->m_aLayoutInformation);
856 bModified = ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue,
m_pImpl->m_sConnectURL);
860 Sequence<PropertyValue> aValues;
861 if (!(rValue >>= aValues))
862 throw IllegalArgumentException();
864 for (
auto const & checkName : std::as_const(aValues) )
866 if ( checkName.Name.isEmpty() )
867 throw IllegalArgumentException();
870 Sequence< PropertyValue > aSettings =
m_pImpl->m_xSettings->getPropertyValues();
871 bModified = aSettings.getLength() != aValues.getLength();
874 const PropertyValue* pInfoIter = aSettings.getConstArray();
875 const PropertyValue* checkValue = aValues.getConstArray();
876 for ( ;!bModified && checkValue != std::cend(aValues) ; ++checkValue,++pInfoIter)
878 bModified = checkValue->Name != pInfoIter->Name;
881 bModified = checkValue->Value != pInfoIter->Value;
886 rConvertedValue = rValue;
887 rOldValue <<= aSettings;
891 SAL_WARN(
"dbaccess",
"ODatabaseSource::convertFastPropertyValue: unknown or readonly Property!" );
899 struct SelectPropertyName
902 const OUString& operator()(
const PropertyValue& _lhs )
921 void lcl_setPropertyValues_resetOrRemoveOther(
const Reference< XPropertyBag >& _rxPropertyBag,
const Sequence< PropertyValue >& _rAllNewPropertyValues )
924 std::set<OUString> aToBeSetPropertyNames;
926 _rAllNewPropertyValues.begin(),
927 _rAllNewPropertyValues.end(),
928 std::inserter( aToBeSetPropertyNames, aToBeSetPropertyNames.end() ),
935 Reference< XPropertySetInfo > xPSI( _rxPropertyBag->getPropertySetInfo(), UNO_SET_THROW );
936 const Sequence< Property > aAllExistentProperties( xPSI->getProperties() );
938 Reference< XPropertyState > xPropertyState( _rxPropertyBag, UNO_QUERY_THROW );
941 for (
auto const & existentProperty : aAllExistentProperties )
943 if ( aToBeSetPropertyNames.find( existentProperty.Name ) != aToBeSetPropertyNames.end() )
948 if ( ( existentProperty.Attributes & PropertyAttribute::REMOVABLE ) != 0 )
949 _rxPropertyBag->removeProperty( existentProperty.Name );
951 xPropertyState->setPropertyToDefault( existentProperty.Name );
955 _rxPropertyBag->setPropertyValues( _rAllNewPropertyValues );
957 catch(
const Exception& )
972 rValue >>=
m_pImpl->m_aTableFilter;
975 rValue >>=
m_pImpl->m_aTableTypeFilter;
983 rValue >>=
m_pImpl->m_aPassword;
992 rValue >>=
m_pImpl->m_sConnectURL;
996 Sequence< PropertyValue > aInfo;
997 OSL_VERIFY( rValue >>= aInfo );
998 lcl_setPropertyValues_resetOrRemoveOther(
m_pImpl->m_xSettings, aInfo );
1002 rValue >>=
m_pImpl->m_aLayoutInformation;
1016 rValue <<=
m_pImpl->m_aTableFilter;
1019 rValue <<=
m_pImpl->m_aTableTypeFilter;
1025 rValue <<=
m_pImpl->m_aPassword;
1028 rValue <<=
m_pImpl->m_bPasswordRequired;
1031 rValue <<=
m_pImpl->m_bSuppressVersionColumns;
1034 rValue <<=
m_pImpl->m_bReadOnly;
1041 Reference< XPropertySet > xSettingsAsProps(
m_pImpl->m_xSettings, UNO_QUERY_THROW );
1042 Reference< XPropertySetInfo > xPST( xSettingsAsProps->getPropertySetInfo(), UNO_SET_THROW );
1043 const Sequence< Property > aSettings( xPST->getProperties() );
1044 std::map< OUString, sal_Int32 > aPropertyAttributes;
1045 for (
auto const & setting : aSettings )
1047 aPropertyAttributes[ setting.Name ] = setting.Attributes;
1051 Sequence< PropertyValue > aValues(
m_pImpl->m_xSettings->getPropertyValues() );
1055 Sequence< PropertyValue > aNonDefaultOrUserDefined( aValues.getLength() );
1056 auto [
begin,
end] = asNonConstRange(aValues);
1057 auto pCopyStart = aNonDefaultOrUserDefined.getArray();
1058 const PropertyValue* pCopyEnd = std::remove_copy_if(
1062 IsDefaultAndNotRemoveable( aPropertyAttributes )
1064 aNonDefaultOrUserDefined.realloc( pCopyEnd - pCopyStart );
1065 rValue <<= aNonDefaultOrUserDefined;
1074 rValue <<=
m_pImpl->m_xSettings;
1077 rValue <<=
m_pImpl->m_sConnectURL;
1080 rValue <<=
m_pImpl->getNumberFormatsSupplier();
1086 rValue <<=
m_pImpl->m_aLayoutInformation;
1089 SAL_WARN(
"dbaccess",
"unknown Property");
1097 m_pImpl->m_nLoginTimeout = seconds;
1103 return m_pImpl->m_nLoginTimeout;
1131 if (!_rxHandler.is())
1133 SAL_WARN(
"dbaccess",
"ODatabaseSource::connectWithCompletion: invalid interaction handler!");
1137 OUString sUser(
m_pImpl->m_sUser), sPassword(
m_pImpl->m_aPassword);
1138 bool bNewPasswordGiven =
false;
1140 if (
m_pImpl->m_bPasswordRequired && sPassword.isEmpty())
1150 OUString sServerName(
m_pImpl->m_sName );
1152 if ( aURLCheck.GetProtocol() != INetProtocol::NotValid )
1156 AuthenticationRequest aRequest;
1157 aRequest.ServerName = sServerName;
1158 aRequest.HasRealm = aRequest.HasAccount =
false;
1159 aRequest.HasUserName = aRequest.HasPassword =
true;
1160 aRequest.UserName =
m_pImpl->m_sUser;
1161 aRequest.Password =
m_pImpl->m_sFailedPassword.isEmpty() ?
m_pImpl->m_aPassword :
m_pImpl->m_sFailedPassword;
1164 pRequest->addContinuation(pAbort);
1165 pRequest->addContinuation(pAuthenticate);
1170 _rxHandler->handle(pRequest);
1177 if (!pAuthenticate->wasSelected())
1178 return Reference< XConnection >();
1181 sUser =
m_pImpl->m_sUser = pAuthenticate->getUser();
1182 sPassword = pAuthenticate->getPassword();
1184 if (pAuthenticate->getRememberPassword())
1186 m_pImpl->m_aPassword = pAuthenticate->getPassword();
1187 bNewPasswordGiven =
true;
1189 m_pImpl->m_sFailedPassword.clear();
1198 if (bNewPasswordGiven)
1212 Reference< XConnection > xConn;
1214 OSL_ENSURE( xSdbcConn.is(),
"ODatabaseSource::buildIsolatedConnection: invalid return value of buildLowLevelConnection!" );
1216 if ( xSdbcConn.is() )
1228 Reference< XConnection > xConn;
1235 if ( !
m_pImpl->m_xSharedConnectionManager.is() )
1242 m_pImpl->m_xSharedConnectionManager =
m_pImpl->m_pSharedConnectionManager;
1244 xConn =
m_pImpl->m_pSharedConnectionManager->getConnection(
1245 m_pImpl->m_sConnectURL, user, password,
m_pImpl->m_xSettings->getPropertyValues(),
this );
1250 Reference< XComponent> xComp(xConn,UNO_QUERY);
1252 xComp->addEventListener(
static_cast< XContainerListener*
>(
this ) );
1253 m_pImpl->m_aConnections.emplace_back(xConn);
1263 return static_cast<XNameContainer*
>(&
m_Bookmarks);
1270 Reference< XNameAccess > xContainer =
m_pImpl->m_xCommandDefinitions;
1271 if ( !xContainer.is() )
1274 css::uno::Reference< css::uno::XInterface > xMy(*
this);
1277 OUString sSupportService;
1278 aValue >>= sSupportService;
1279 if ( !sSupportService.isEmpty() )
1281 Sequence<Any> aArgs{
Any(NamedValue(
"DataSource",
Any(xMy))) };
1282 xContainer.set(
m_pImpl->m_aContext->getServiceManager()->createInstanceWithArgumentsAndContext(sSupportService, aArgs,
m_pImpl->m_aContext), UNO_QUERY);
1285 if ( !xContainer.is() )
1290 m_pImpl->m_xCommandDefinitions = xContainer;
1300 Reference< XNameAccess > xContainer =
m_pImpl->m_xTableDefinitions;
1301 if ( !xContainer.is() )
1305 m_pImpl->m_xTableDefinitions = xContainer;
1318 typedef ::utl::SharedUNOComponent< XModel, ::utl::CloseableComponent > SharedModel;
1319 SharedModel
xModel(
m_pImpl->getModel_noCreate(), SharedModel::NoTakeOwnership );
1322 xModel.reset(
m_pImpl->createNewModel_deliverOwnership(), SharedModel::TakeOwnership );
1324 Reference< css::frame::XStorable> xStorable(
xModel, UNO_QUERY_THROW );
1329 css::lang::EventObject aFlushedEvent(*
this);
1364 OSL_ENSURE(
m_pImpl->isEmbeddedDatabase(),
"ODatabaseSource::flushed: no embedded database?!" );
1365 bool bWasModified =
m_pImpl->m_bModified;
1366 m_pImpl->commitEmbeddedStorage();
1367 m_pImpl->setModified( bWasModified );
1410 return Reference< XOfficeDatabaseDocument >(
xModel, UNO_QUERY_THROW );
1427extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
1429 css::uno::Sequence<css::uno::Any>
const &)
1431 css::uno::Reference<XInterface> inst(
PropertiesInfo aProperties
HRESULT createInstance(REFIID iid, Ifc **ppIfc)
static weld::Window * GetFrameWeld(const css::uno::Reference< css::awt::XWindow > &rWindow)
static bool IsHeadlessModeEnabled()
const css::uno::Any & get(const OUString &_rValueName) const
sal_Int32 addInterface(const css::uno::Reference< ListenerT > &rxIFace)
void disposeAndClear(const css::lang::EventObject &rEvt)
sal_Int32 removeInterface(const css::uno::Reference< ListenerT > &rxIFace)
void notifyEach(void(SAL_CALL ListenerT::*NotificationMethod)(const EventT &), const EventT &Event)
::cppu::IPropertyArrayHelper * getArrayHelper()
void disposing(std::unique_lock< std::mutex > &rGuard)
static void createUniqueId(const OUString &_rURL, css::uno::Sequence< css::beans::PropertyValue > &_rInfo, sal_uInt8 *_pBuffer, const OUString &_rUserName=OUString(), const OUString &_rPassword=OUString())
static css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL createPropertySetInfo(IPropertyArrayHelper &rProperties)
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type &rType) SAL_OVERRIDE
css::uno::Type const & get()
a small base class for UNO components whose functionality depends on an ODatabaseModelImpl
::rtl::Reference< ODatabaseModelImpl > m_pImpl
a guard for public methods of objects dependent on an ODatabaseModelImpl instance
void SAL_CALL setRememberPassword(css::ucb::RememberAuthentication Remember) override
css::uno::Sequence< css::ucb::RememberAuthentication > SAL_CALL getRememberAccountModes(css::ucb::RememberAuthentication &Default) override
sal_Bool SAL_CALL canSetPassword() override
void SAL_CALL setPassword(const OUString &Password) override
void SAL_CALL setAccount(const OUString &Account) override
void SAL_CALL setRememberAccount(css::ucb::RememberAuthentication Remember) override
sal_Bool SAL_CALL canSetAccount() override
sal_Bool SAL_CALL canSetUserName() override
sal_Bool SAL_CALL canSetRealm() override
void SAL_CALL setUserName(const OUString &UserName) override
css::uno::Sequence< css::ucb::RememberAuthentication > SAL_CALL getRememberPasswordModes(css::ucb::RememberAuthentication &Default) override
void SAL_CALL setRealm(const OUString &Realm) override
static void clearObjectContainer(css::uno::WeakReference< css::container::XNameAccess > &_rxContainer)
clears the given object container
static const AsciiPropertyValue * getDefaultDataSourceSettings()
returns all known data source settings, including their default values
css::uno::Reference< css::awt::XWindow > m_xDialogParent
weld::Window * GetFrameWeld()
css::uno::Reference< css::frame::XModel > getModel_noCreate() const
returns the model, if there already exists one
virtual void SAL_CALL getFastPropertyValue(css::uno::Any &rValue, sal_Int32 nHandle) const override
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getTables() override
virtual css::uno::Reference< css::sdb::XOfficeDatabaseDocument > SAL_CALL getDatabaseDocument() override
virtual css::uno::Reference< css::sdbc::XConnection > SAL_CALL getIsolatedConnection(const OUString &user, const OUString &password) override
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type &rType) override
virtual css::uno::Reference< css::sdbc::XConnection > SAL_CALL getIsolatedConnectionWithCompletion(const css::uno::Reference< css::task::XInteractionHandler > &handler) override
virtual void SAL_CALL addFlushListener(const css::uno::Reference< css::util::XFlushListener > &l) override
virtual OUString SAL_CALL getImplementationName() override
virtual void SAL_CALL disposing() override
virtual sal_Bool SAL_CALL convertFastPropertyValue(css::uno::Any &rConvertedValue, css::uno::Any &rOldValue, sal_Int32 nHandle, const css::uno::Any &rValue) override
css::uno::Reference< css::sdbc::XConnection > buildLowLevelConnection(const OUString &_rUid, const OUString &_rPwd)
open a connection for the current settings.
virtual void SAL_CALL setFastPropertyValue_NoBroadcast(sal_Int32 nHandle, const css::uno::Any &rValue) override
virtual void SAL_CALL elementRemoved(const css::container::ContainerEvent &Event) override
virtual void SAL_CALL elementInserted(const css::container::ContainerEvent &Event) override
virtual void SAL_CALL flushed(const css::lang::EventObject &rEvent) override
virtual void SAL_CALL acquire() noexcept override
virtual void SAL_CALL initialize(const css::uno::Sequence< css::uno::Any > &aArguments) override
virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getBookmarks() override
virtual void SAL_CALL removeFlushListener(const css::uno::Reference< css::util::XFlushListener > &l) override
virtual ::cppu::IPropertyArrayHelper * createArrayHelper() const override
virtual sal_Int32 SAL_CALL getLoginTimeout() override
virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getQueryDefinitions() override
virtual void SAL_CALL release() noexcept override
friend class OSharedConnectionManager
ODatabaseSource(const ::rtl::Reference< ODatabaseModelImpl > &_pImpl)
virtual css::uno::Reference< css::sdbc::XConnection > SAL_CALL getConnection(const OUString &user, const OUString &password) override
::comphelper::OInterfaceContainerHelper3< css::util::XFlushListener > m_aFlushListeners
virtual css::uno::Reference< css::sdbc::XConnection > SAL_CALL connectWithCompletion(const css::uno::Reference< css::task::XInteractionHandler > &handler) override
virtual css::uno::Reference< css::uno::XInterface > getThis() const override
returns the component itself
virtual ::cppu::IPropertyArrayHelper &SAL_CALL getInfoHelper() override
virtual ~ODatabaseSource() override
OBookmarkContainer m_Bookmarks
virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override
virtual void SAL_CALL elementReplaced(const css::container::ContainerEvent &Event) override
virtual void SAL_CALL flush() override
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
virtual void SAL_CALL setLoginTimeout(sal_Int32 seconds) override
css::uno::Reference< css::sdbc::XConnection > buildIsolatedConnection(const OUString &user, const OUString &password)
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
static void setName(const css::uno::Reference< css::sdb::XDocumentDataSource > &_rxDocument, const OUString &_rNewName, DBContextAccess)
sets a new name for the data source
TSharedConnectionMap m_aSharedConnection
std::map< Reference< XConnection >, TConnectionMap::iterator > TSharedConnectionMap
virtual ~OSharedConnectionManager() override
void addEventListener(const Reference< XConnection > &_rxConnection, TConnectionMap::iterator const &_rIter)
std::map< TDigestHolder, TConnectionHolder, TDigestLess > TConnectionMap
OSharedConnectionManager(const Reference< XComponentContext > &_rxContext)
void SAL_CALL disposing(const css::lang::EventObject &Source) override
TConnectionMap m_aConnections
Reference< XProxyFactory > m_xProxyFactory
Reference< XConnection > getConnection(const OUString &url, const OUString &user, const OUString &password, const Sequence< PropertyValue > &_aInfo, ODatabaseSource *_pDataSource)
rtl::Reference< ParseManager > manager
const PropertyAttributeCache & m_rAttribs
WeakReference< XFlushListener > m_aListener
WeakReference< XFlushable > m_aBroadcaster
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * com_sun_star_comp_dba_ODatabaseSource(css::uno::XComponentContext *context, css::uno::Sequence< css::uno::Any > const &)
#define TOOLS_WARN_EXCEPTION(area, stream)
#define DBG_UNHANDLED_EXCEPTION(...)
#define SAL_WARN(area, stream)
#define SAL_INFO(area, stream)
std::unique_ptr< sal_Int32[]> pData
css::uno::Sequence< DstElementType > containerToSequence(const SrcType &i_Container)
OInteraction< css::task::XInteractionAbort > OInteractionAbort
bool any2bool(const css::uno::Any &rAny)
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
std::shared_ptr< OContentHelper_Impl > TContentPtr
::cppu::WeakComponentImplHelper< css::lang::XServiceInfo, css::sdbc::XDataSource, css::sdb::XBookmarksSupplier, css::sdb::XQueryDefinitionsSupplier, css::sdb::XCompletedConnection, css::container::XContainerListener, css::sdbc::XIsolatedConnection, css::sdbcx::XTablesSupplier, css::util::XFlushable, css::util::XFlushListener, css::sdb::XDocumentDataSource, css::lang::XInitialization > ODatabaseSource_Base
::osl::Mutex & getMutex()
enumrange< T >::Iterator begin(enumrange< T >)
#define PROPERTY_ID_ISREADONLY
#define PROPERTY_ID_TABLEFILTER
#define PROPERTY_ID_PASSWORD
#define PROPERTY_ID_TABLETYPEFILTER
#define PROPERTY_ID_SETTINGS
#define PROPERTY_ID_ISPASSWORDREQUIRED
#define PROPERTY_ID_LAYOUTINFORMATION
#define PROPERTY_ID_NUMBERFORMATSSUPPLIER
#define PROPERTY_ID_SUPPRESSVERSIONCL
constexpr OUStringLiteral PROPERTY_TABLEFILTER(u"TableFilter")
constexpr OUStringLiteral PROPERTY_USER(u"User")
constexpr OUStringLiteral PROPERTY_URL(u"URL")
constexpr OUStringLiteral PROPERTY_INFO(u"Info")
constexpr OUStringLiteral PROPERTY_ISREADONLY(u"IsReadOnly")
constexpr OUStringLiteral PROPERTY_NUMBERFORMATSSUPPLIER(u"NumberFormatsSupplier")
constexpr OUStringLiteral PROPERTY_SETTINGS(u"Settings")
constexpr OUStringLiteral PROPERTY_PASSWORD(u"Password")
constexpr OUStringLiteral PROPERTY_TABLETYPEFILTER(u"TableTypeFilter")
constexpr OUStringLiteral SERVICE_SDB_DATASOURCE
constexpr OUStringLiteral PROPERTY_SUPPRESSVERSIONCL(u"SuppressVersionColumns")
constexpr OUStringLiteral PROPERTY_NAME(u"Name")
constexpr OUStringLiteral PROPERTY_LAYOUTINFORMATION(u"LayoutInformation")
constexpr OUStringLiteral PROPERTY_ISPASSWORDREQUIRED(u"IsPasswordRequired")
sal_uInt8 m_pBuffer[RTL_DIGEST_LENGTH_SHA1]
oslInterlockedCount nALiveCount
Reference< XConnection > xMasterConnection
bool operator()(const TDigestHolder &x, const TDigestHolder &y) const
Reference< XController > xController
the controller of the sub component. Must not be <NULL>
Reference< XFrame > xFrame
the frame which the component resides in. Must not be <NULL>
Reference< XModel > xModel
the model of the sub component. Might be <NULL>