LibreOffice Module dbaccess (master) 1
DbAdminImpl.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
20#include "DbAdminImpl.hxx"
21#include <dsmeta.hxx>
22
23#include <svl/poolitem.hxx>
24#include <svl/itempool.hxx>
25#include <svl/stritem.hxx>
26#include <svl/intitem.hxx>
27#include <svl/eitem.hxx>
28#include <IItemSetHelper.hxx>
29#include <UITools.hxx>
30#include <core_resource.hxx>
31#include <strings.hrc>
32#include <strings.hxx>
33#include <dsitems.hxx>
34#include "dsnItem.hxx"
35#include "optionalboolitem.hxx"
36#include <stringlistitem.hxx>
38
39#include <com/sun/star/beans/PropertyAttribute.hpp>
40#include <com/sun/star/frame/XStorable.hpp>
41#include <com/sun/star/sdb/DatabaseContext.hpp>
42#include <com/sun/star/sdb/SQLContext.hpp>
43#include <com/sun/star/sdbc/ConnectionPool.hpp>
44#include <com/sun/star/sdbc/XDriver.hpp>
45#include <com/sun/star/task/InteractionHandler.hpp>
46#include <com/sun/star/ucb/AuthenticationRequest.hpp>
47
52#include <osl/file.hxx>
54#include <osl/diagnose.h>
55#include <sal/log.hxx>
56#include <typelib/typedescription.hxx>
57#include <vcl/svapp.hxx>
58#include <vcl/stdtext.hxx>
59#include <vcl/weld.hxx>
60
61#include <algorithm>
62#include <iterator>
63#include <functional>
64#include <o3tl/functional.hxx>
65#include <comphelper/string.hxx>
66
67namespace dbaui
68{
69using namespace ::dbtools;
70using namespace com::sun::star::uno;
71using namespace com::sun::star;
72using namespace com::sun::star::ucb;
73using namespace com::sun::star::task;
74using namespace com::sun::star::sdbc;
75using namespace com::sun::star::sdb;
76using namespace com::sun::star::lang;
77using namespace com::sun::star::beans;
78using namespace com::sun::star::util;
79using namespace com::sun::star::container;
80using namespace com::sun::star::frame;
81
82namespace
83{
84 bool implCheckItemType( SfxItemSet const & _rSet, const sal_uInt16 _nId, const std::function<bool ( const SfxPoolItem* )>& isItemType )
85 {
86 bool bCorrectType = false;
87
88 SfxItemPool* pPool = _rSet.GetPool();
89 OSL_ENSURE( pPool, "implCheckItemType: invalid item pool!" );
90 if ( pPool )
91 {
92 const SfxPoolItem& rDefItem = pPool->GetDefaultItem( _nId );
93 bCorrectType = isItemType(&rDefItem);
94 }
95 return bCorrectType;
96 }
97
98 void lcl_putProperty(const Reference< XPropertySet >& _rxSet, const OUString& _rName, const Any& _rValue)
99 {
100 try
101 {
102 if ( _rxSet.is() )
103 _rxSet->setPropertyValue(_rName, _rValue);
104 }
105 catch(Exception&)
106 {
107 SAL_WARN("dbaccess", "ODbAdminDialog::implTranslateProperty: could not set the property "
108 << _rName);
109 }
110
111 }
112
113 OUString lcl_createHostWithPort(const SfxStringItem* _pHostName,const SfxInt32Item* _pPortNumber)
114 {
115 OUString sNewUrl;
116
117 if ( _pHostName && _pHostName->GetValue().getLength() )
118 sNewUrl = _pHostName->GetValue();
119
120 if ( _pPortNumber )
121 {
122 sNewUrl += ":" + OUString::number(_pPortNumber->GetValue());
123 }
124
125 return sNewUrl;
126 }
127}
128
129 // ODbDataSourceAdministrationHelper
131 : m_xContext(_xORB)
132 , m_pParent(pParent)
133 , m_pItemSetHelper(_pItemSetHelper)
134{
136 // direct properties of a data source
145
146 // implicit properties, to be found in the direct property "Info"
166 m_aIndirectPropTranslator.emplace( DSID_PRIMARY_KEY_SUPPORT, OUString("PrimaryKeySupport") );
173 m_aIndirectPropTranslator.emplace( DSID_INDEXAPPENDIX, OUString("AddIndexAppendix") );
174 m_aIndirectPropTranslator.emplace( DSID_DOSLINEENDS, OUString("PreferDosLikeLineEnds") );
175 m_aIndirectPropTranslator.emplace( DSID_CONN_SOCKET, OUString("LocalSocket") );
176 m_aIndirectPropTranslator.emplace( DSID_NAMED_PIPE, OUString("NamedPipe") );
177 m_aIndirectPropTranslator.emplace( DSID_RESPECTRESULTSETTYPE, OUString("RespectDriverResultSetType") );
178 m_aIndirectPropTranslator.emplace( DSID_MAX_ROW_SCAN, OUString("MaxRowScan") );
179
180 // extra settings for ODBC
182 // extra settings for an LDAP address book
185 m_aIndirectPropTranslator.emplace( DSID_CONN_LDAP_USESSL, OUString("UseSSL") );
187
188 // Oracle
189 m_aIndirectPropTranslator.emplace( DSID_IGNORECURRENCY, OUString("IgnoreCurrency") );
190
191 try
192 {
193 m_xDatabaseContext = DatabaseContext::create(m_xContext);
194 }
195 catch(const Exception&)
196 {
197 ShowServiceNotAvailableError(pTopParent, u"com.sun.star.sdb.DatabaseContext", true);
198 }
199}
200
202{
203 OSL_ENSURE(m_pItemSetHelper->getOutputSet(), "ODbDataSourceAdministrationHelper::getCurrentSettings : not to be called without an example set!");
205 return false;
206
207 std::vector< PropertyValue > aReturn;
208 // collecting this in a vector because it has a push_back, in opposite to sequences
209
210 // user: DSID_USER -> "user"
212 if (pUser && pUser->GetValue().getLength())
213 aReturn.emplace_back( "user", 0,
214 Any(pUser->GetValue()), PropertyState_DIRECT_VALUE);
215
216 // check if the connection type requires a password
218 {
219 // password: DSID_PASSWORD -> password
221 OUString sPassword = pPassword ? pPassword->GetValue() : OUString();
223 // if the set does not contain a password, but the item set says it requires one, ask the user
224 if ((!pPassword || !pPassword->GetValue().getLength()) && (pPasswordRequired && pPasswordRequired->GetValue()))
225 {
227
229 ::comphelper::NamedValueCollection aArgs( xModel->getArgs() );
230 Reference< XInteractionHandler > xHandler( aArgs.getOrDefault( "InteractionHandler", Reference< XInteractionHandler >() ) );
231
232 if ( !xHandler.is() )
233 {
234 // instantiate the default SDB interaction handler
235 xHandler = task::InteractionHandler::createWithParent(m_xContext, m_pParent->GetXWindow());
236 }
237
238 OUString sName = pName ? pName->GetValue() : OUString();
239 OUString sLoginRequest(DBA_RES(STR_ENTER_CONNECTION_PASSWORD));
240 OUString sTemp = sName;
242 if ( !sName.isEmpty() )
243 sLoginRequest = sLoginRequest.replaceAll("$name$", sName);
244 else
245 {
246 sLoginRequest = sLoginRequest.replaceAll("\"$name$\"", "");
247 // ensure that in other languages the string will be deleted
248 sLoginRequest = sLoginRequest.replaceAll("$name$", "");
249 }
250
251 // the request
252 AuthenticationRequest aRequest;
253 aRequest.ServerName = sName;
254 aRequest.Diagnostic = sLoginRequest;
255 aRequest.HasRealm = false;
256 // aRequest.Realm
257 aRequest.HasUserName = pUser != nullptr;
258 aRequest.UserName = pUser ? pUser->GetValue() : OUString();
259 aRequest.HasPassword = true;
260 //aRequest.Password
261 aRequest.HasAccount = false;
262 // aRequest.Account
263
265
266 // build an interaction request
267 // two continuations (Ok and Cancel)
270 pAuthenticate->setCanChangeUserName( false );
271 pAuthenticate->setRememberPassword( RememberAuthentication_SESSION );
272
273 // some knittings
274 pRequest->addContinuation(pAbort);
275 pRequest->addContinuation(pAuthenticate);
276
277 // handle the request
278 try
279 {
280 SolarMutexGuard aSolarGuard;
281 // release the mutex when calling the handler, it may need to lock the SolarMutex
282 xHandler->handle(pRequest);
283 }
284 catch(Exception&)
285 {
286 DBG_UNHANDLED_EXCEPTION("dbaccess");
287 }
288 if (!pAuthenticate->wasSelected())
289 return false;
290
291 sPassword = pAuthenticate->getPassword();
292 if (pAuthenticate->getRememberPassword())
294 }
295
296 if (!sPassword.isEmpty())
297 aReturn.emplace_back( "password", 0,
298 Any(sPassword), PropertyState_DIRECT_VALUE);
299 }
300
301 if ( !aReturn.empty() )
302 _rDriverParam = comphelper::containerToSequence(aReturn);
303
304 // append all the other stuff (charset etc.)
306
307 return true;
308}
309
311{
312 OSL_ENSURE(m_pItemSetHelper->getOutputSet(), "ODbDataSourceAdministrationHelper::successfullyConnected: not to be called without an example set!");
314 return;
315
317 {
319 if (pPassword && (0 != pPassword->GetValue().getLength()))
320 {
321 OUString sPassword = pPassword->GetValue();
322
323 Reference< XPropertySet > xCurrentDatasource = getCurrentDataSource();
324 lcl_putProperty(xCurrentDatasource,m_aDirectPropTranslator[DSID_PASSWORD], Any(sPassword));
325 }
326 }
327}
328
330{
333}
334
335std::pair< Reference<XConnection>,bool> ODbDataSourceAdministrationHelper::createConnection()
336{
337 std::pair< Reference<XConnection>,bool> aRet;
338 aRet.second = false;
339 Sequence< PropertyValue > aConnectionParams;
340 if ( getCurrentSettings(aConnectionParams) )
341 {
342 // the current DSN
343 // fill the table list with this connection information
344 SQLExceptionInfo aErrorInfo;
345 try
346 {
347 weld::WaitObject aWaitCursor(m_pParent);
348 aRet.first = getDriver()->connect(getConnectionURL(), aConnectionParams);
349 aRet.second = true;
350 }
351 catch (const SQLContext& e) { aErrorInfo = SQLExceptionInfo(e); }
352 catch (const SQLWarning& e) { aErrorInfo = SQLExceptionInfo(e); }
353 catch (const SQLException& e) { aErrorInfo = SQLExceptionInfo(e); }
354
355 showError(aErrorInfo,m_pParent->GetXWindow(),getORB());
356 }
357 if ( aRet.first.is() )
358 successfullyConnected();// notify the admindlg to save the password
359
360 return aRet;
361}
362
364{
365 return getDriver(getConnectionURL());
366}
367
369{
370 // get the global DriverManager
371 Reference< XConnectionPool > xDriverManager;
372
373 OUString sCurrentActionError = DBA_RES(STR_COULDNOTCREATE_DRIVERMANAGER);
374 sCurrentActionError = sCurrentActionError.replaceFirst("#servicename#", "com.sun.star.sdbc.ConnectionPool");
375
376 try
377 {
378 xDriverManager.set( ConnectionPool::create( getORB() ) );
379 }
380 catch (const Exception&)
381 {
382 css::uno::Any anyEx = cppu::getCaughtException();
383 // wrap the exception into an SQLException
384 throw SQLException(sCurrentActionError, getORB(), "S1000", 0, anyEx);
385 }
386
387 Reference< XDriver > xDriver = xDriverManager->getDriverByURL(_sURL);
388 if (!xDriver.is())
389 {
390 sCurrentActionError = DBA_RES(STR_NOREGISTEREDDRIVER);
391 sCurrentActionError = sCurrentActionError.replaceFirst("#connurl#", _sURL);
392 // will be caught and translated into an SQLContext exception
393 throw SQLException(sCurrentActionError, getORB(), "S1000", 0, Any());
394 }
395 return xDriver;
396}
397
399{
400 if ( !m_xDatasource.is() )
401 {
403 if ( !xIn.is() )
404 {
405 OUString sCurrentDatasource;
406 m_aDataSourceOrName >>= sCurrentDatasource;
407 OSL_ENSURE(!sCurrentDatasource.isEmpty(),"No datasource name given!");
408 try
409 {
410 if ( m_xDatabaseContext.is() )
411 m_xDatasource.set(m_xDatabaseContext->getByName(sCurrentDatasource),UNO_QUERY);
412 xIn = m_xDatasource;
413 }
414 catch(const Exception&)
415 {
416 }
417 }
418 m_xModel.set(getDataSourceOrModel(xIn),UNO_QUERY);
419 if ( m_xModel.is() )
420 m_xDatasource.set(xIn,UNO_QUERY);
421 else
422 {
423 m_xDatasource.set(getDataSourceOrModel(xIn),UNO_QUERY);
424 m_xModel.set(xIn,UNO_QUERY);
425 }
426 }
427
428 OSL_ENSURE(m_xDatasource.is(), "ODbDataSourceAdministrationHelper::getCurrentDataSource: no data source!");
429 return m_xDatasource;
430}
431
433{
434 const SfxStringItem* pConnectURL = _rSet.GetItem<SfxStringItem>(DSID_CONNECTURL);
435 OSL_ENSURE( pConnectURL , "ODbDataSourceAdministrationHelper::getDatasourceType: invalid items in the source set!" );
437 OSL_ENSURE(pTypeCollection, "ODbDataSourceAdministrationHelper::getDatasourceType: invalid items in the source set!");
438 ::dbaccess::ODsnTypeCollection* pCollection = pTypeCollection->getCollection();
439 return pCollection->getType(pConnectURL->GetValue());
440}
441
443{
445}
446
448{
449 OUString sNewUrl;
450
452
455
456 OSL_ENSURE(pUrlItem,"Connection URL is NULL. -> GPF!");
457 OSL_ENSURE(pTypeCollection, "ODbDataSourceAdministrationHelper::getDatasourceType: invalid items in the source set!");
458 ::dbaccess::ODsnTypeCollection* pCollection = pTypeCollection->getCollection();
459 OSL_ENSURE(pCollection, "ODbDataSourceAdministrationHelper::getDatasourceType: invalid type collection!");
460
461 switch( pCollection->determineType(eType) )
462 {
467 break;
470 {
471 OUString sFileName = pCollection->cutPrefix(pUrlItem->GetValue());
472 OUString sNewFileName;
473 if ( ::osl::FileBase::getSystemPathFromFileURL( sFileName, sNewFileName ) == ::osl::FileBase::E_None )
474 {
475 sNewUrl += sNewFileName;
476 }
477 }
478 break;
481 {
485 sNewUrl = lcl_createHostWithPort(pHostName,pPortNumber);
486 OUString sDatabaseName = pDatabaseName ? pDatabaseName->GetValue() : OUString();
487 if ( !sDatabaseName.getLength() && pUrlItem )
488 sDatabaseName = pCollection->cutPrefix( pUrlItem->GetValue() );
489 // TODO: what's that? Why is the database name transported via the URL Item?
490 // Huh? Anybody there?
491 // OJ: It is needed when the connection properties are changed. There the URL is used for every type.
492
493 if ( !sDatabaseName.isEmpty() )
494 {
495 sNewUrl += "/" + sDatabaseName;
496 }
497 }
498 break;
500 {
504 if ( pHostName && pHostName->GetValue().getLength() )
505 {
506 sNewUrl = "@" + lcl_createHostWithPort(pHostName,pPortNumber);
507 OUString sDatabaseName = pDatabaseName ? pDatabaseName->GetValue() : OUString();
508 if ( sDatabaseName.isEmpty() && pUrlItem )
509 sDatabaseName = pCollection->cutPrefix( pUrlItem->GetValue() );
510 if ( !sDatabaseName.isEmpty() )
511 {
512 sNewUrl += ":" + sDatabaseName;
513 }
514 }
515 else
516 { // here someone entered a JDBC url which looks like oracle, so we have to use the url property
517
518 }
519 }
520 break;
522 {
524 sNewUrl = pCollection->cutPrefix(pUrlItem->GetValue()) + lcl_createHostWithPort(nullptr,pPortNumber);
525 }
526 break;
528 {
529 sNewUrl = pCollection->cutPrefix(pUrlItem->GetValue());
530 OUString rURL(comphelper::string::stripEnd(pUrlItem->GetValue(), '*'));
534 if (pHostName && pHostName->GetValue().getLength())
535 {
536 OUString hostname( pHostName->GetValue() );
537 hostname = hostname.replaceAll( "\\", "\\\\");
538 hostname = hostname.replaceAll( "\'", "\\'");
539 hostname = "'" + hostname + "'";
540 rURL += " host=" + hostname;
541 }
542 if (pPortNumber && pPortNumber->GetValue())
543 {
544 OUString port = "'" + OUString::number(pPortNumber->GetValue()) + "'";
545 rURL += " port=" + port;
546 }
547 if (pDatabaseName && pDatabaseName->GetValue().getLength())
548 {
549 OUString dbname( pDatabaseName->GetValue() );
550 dbname = dbname.replaceAll( "\\", "\\\\");
551 dbname = dbname.replaceAll( "\'", "\\'");
552 dbname = "'" + dbname + "'";
553 rURL += " dbname=" + dbname;
554 }
555 sNewUrl = rURL;
556 return sNewUrl;
557 }
558 break;
560 // run through
561 default:
562 break;
563 }
564 if ( !sNewUrl.isEmpty() )
565 sNewUrl = pCollection->getPrefix(eType) + sNewUrl;
566 else if (pUrlItem)
567 sNewUrl = pUrlItem->GetValue();
568
569 return sNewUrl;
570}
571
572namespace {
573
574struct PropertyValueLess
575{
576 bool operator() (const PropertyValue& x, const PropertyValue& y) const
577 { return x.Name < y.Name; } // construct prevents a MSVC6 warning
578};
579
580}
581
582typedef std::set<PropertyValue, PropertyValueLess> PropertyValueSet;
583
585{
586 if (_rxSource.is())
587 {
588 for (auto const& elem : m_aDirectPropTranslator)
589 {
590 // get the property value
591 Any aValue;
592 try
593 {
594 aValue = _rxSource->getPropertyValue(elem.second);
595 }
596 catch(Exception&)
597 {
598 SAL_WARN("dbaccess", "ODbDataSourceAdministrationHelper::translateProperties: could not extract the property "
599 << elem.second);
600 }
601 // transfer it into an item
602 implTranslateProperty(_rDest, elem.first, aValue);
603 }
604
605 // get the additional information
606 Sequence< PropertyValue > aAdditionalInfo;
607 try
608 {
609 _rxSource->getPropertyValue(PROPERTY_INFO) >>= aAdditionalInfo;
610 }
611 catch(Exception&) { }
612
613 // collect the names of the additional settings
615 for (const PropertyValue& rAdditionalInfo : std::as_const(aAdditionalInfo))
616 {
617 if( rAdditionalInfo.Name == "JDBCDRV" )
618 { // compatibility
619 PropertyValue aCompatibility(rAdditionalInfo);
620 aCompatibility.Name = "JavaDriverClass";
621 aInfos.insert(aCompatibility);
622 }
623 else
624 aInfos.insert(rAdditionalInfo);
625 }
626
627 // go through all known translations and check if we have such a setting
628 if ( !aInfos.empty() )
629 {
630 PropertyValue aSearchFor;
631 for (auto const& elem : m_aIndirectPropTranslator)
632 {
633 aSearchFor.Name = elem.second;
634 PropertyValueSet::const_iterator aInfoPos = aInfos.find(aSearchFor);
635 if (aInfos.end() != aInfoPos)
636 // the property is contained in the info sequence
637 // -> transfer it into an item
638 implTranslateProperty(_rDest, elem.first, aInfoPos->Value);
639 }
640 }
641
642 convertUrl(_rDest);
643 }
644
645 try
646 {
647 Reference<XStorable> xStore(getDataSourceOrModel(_rxSource),UNO_QUERY);
648 _rDest.Put(SfxBoolItem(DSID_READONLY, !xStore.is() || xStore->isReadonly() ));
649 }
650 catch(Exception&)
651 {
652 TOOLS_WARN_EXCEPTION("dbaccess", "IsReadOnly throws");
653 }
654}
655
657{
658 OSL_ENSURE(_rxDest.is(), "ODbDataSourceAdministrationHelper::translateProperties: invalid property set!");
659 if (!_rxDest.is())
660 return;
661
662 // the property set info
664 try { xInfo = _rxDest->getPropertySetInfo(); }
665 catch(Exception&) { }
666
667 static constexpr OUStringLiteral sUrlProp(u"URL");
668 // transfer the direct properties
669 for (auto const& elem : m_aDirectPropTranslator)
670 {
671 const SfxPoolItem* pCurrentItem = _rSource.GetItem(static_cast<sal_uInt16>(elem.first));
672 if (pCurrentItem)
673 {
674 sal_Int16 nAttributes = PropertyAttribute::READONLY;
675 if (xInfo.is())
676 {
677 try { nAttributes = xInfo->getPropertyByName(elem.second).Attributes; }
678 catch(Exception&) { }
679 }
680 if ((nAttributes & PropertyAttribute::READONLY) == 0)
681 {
682 if ( sUrlProp == elem.second )
683 {
684 Any aValue(getConnectionURL());
685 // aValue <<= OUString();
686 lcl_putProperty(_rxDest, elem.second,aValue);
687 }
688 else
689 implTranslateProperty(_rxDest, elem.second, pCurrentItem);
690 }
691 }
692 }
693
694 // now for the indirect properties
695
697 // the original properties
698 try
699 {
700 _rxDest->getPropertyValue(PROPERTY_INFO) >>= aInfo;
701 }
702 catch(Exception&) { }
703
704 // overwrite and extend them
705 fillDatasourceInfo(_rSource, aInfo);
706 // and propagate the (newly composed) sequence to the set
707 lcl_putProperty(_rxDest,PROPERTY_INFO, Any(aInfo));
708}
709
711{
712 // within the current "Info" sequence, replace the ones we can examine from the item set
713 // (we don't just fill a completely new sequence with our own items, but we preserve any properties unknown to
714 // us)
715
716 // first determine which of all the items are relevant for the data source (depends on the connection url)
717 const OUString eType = getDatasourceType(_rSource);
718 const ::connectivity::DriversConfig aDriverConfig(getORB());
719 const ::comphelper::NamedValueCollection& aProperties = aDriverConfig.getProperties(eType);
720
721 // collect the translated property values for the relevant items
722 PropertyValueSet aRelevantSettings;
723 MapInt2String::const_iterator aTranslation;
724 for (ItemID detailId = DSID_FIRST_ITEM_ID ; detailId <= DSID_LAST_ITEM_ID; ++detailId)
725 {
726 const SfxPoolItem* pCurrent = _rSource.GetItem(static_cast<sal_uInt16>(detailId));
727 aTranslation = m_aIndirectPropTranslator.find(detailId);
728 if ( pCurrent && (m_aIndirectPropTranslator.end() != aTranslation) &&
729 aProperties.has(aTranslation->second) )
730 {
731 if ( aTranslation->second == INFO_CHARSET )
732 {
733 OUString sCharSet;
734 implTranslateProperty(pCurrent) >>= sCharSet;
735 if ( !sCharSet.isEmpty() )
736 aRelevantSettings.insert(PropertyValue(aTranslation->second, 0, Any(sCharSet), PropertyState_DIRECT_VALUE));
737 }
738 else
739 aRelevantSettings.insert(PropertyValue(aTranslation->second, 0, implTranslateProperty(pCurrent), PropertyState_DIRECT_VALUE));
740 }
741 }
742
743 // settings to preserve
744 MapInt2String aPreservedSettings;
745
746 // now aRelevantSettings contains all the property values relevant for the current data source type,
747 // check the original sequence if it already contains any of these values (which have to be overwritten, then)
748 PropertyValue* pInfo = _rInfo.getArray();
749 PropertyValue aSearchFor;
750 sal_Int32 nObsoleteSetting = -1;
751 sal_Int32 nCount = _rInfo.getLength();
752 for (sal_Int32 i = 0; i < nCount; ++i, ++pInfo)
753 {
754 aSearchFor.Name = pInfo->Name;
755 PropertyValueSet::const_iterator aOverwrittenSetting = aRelevantSettings.find(aSearchFor);
756 if (aRelevantSettings.end() != aOverwrittenSetting)
757 { // the setting was present in the original sequence, and it is to be overwritten -> replace it
758 if ( pInfo->Value != aOverwrittenSetting->Value )
759 *pInfo = *aOverwrittenSetting;
760 aRelevantSettings.erase(aOverwrittenSetting);
761 }
762 else if( pInfo->Name == "JDBCDRV" )
763 { // this is a compatibility setting, remove it from the sequence (it's replaced by JavaDriverClass)
764 nObsoleteSetting = i;
765 }
766 else
767 aPreservedSettings[i] = pInfo->Name;
768 }
769 if (-1 != nObsoleteSetting)
770 ::comphelper::removeElementAt(_rInfo, nObsoleteSetting);
771
772 if ( !aPreservedSettings.empty() )
773 { // check if there are settings which
774 // * are known as indirect properties
775 // * but not relevant for the current data source type
776 // These settings have to be removed: If they're not relevant, we have no UI for changing them.
777
778 // for this, we need a string-controlled quick access to m_aIndirectPropTranslator
779 std::set<OUString> aIndirectProps;
780 std::transform(m_aIndirectPropTranslator.begin(),
782 std::inserter(aIndirectProps,aIndirectProps.begin()),
784
785 // now check the to-be-preserved props
786 std::vector< sal_Int32 > aRemoveIndexes;
787 sal_Int32 nPositionCorrector = 0;
788 for (auto const& preservedSetting : aPreservedSettings)
789 {
790 if (aIndirectProps.end() != aIndirectProps.find(preservedSetting.second))
791 {
792 aRemoveIndexes.push_back(preservedSetting.first - nPositionCorrector);
793 ++nPositionCorrector;
794 }
795 }
796 // now finally remove all such props
797 for (auto const& removeIndex : aRemoveIndexes)
798 ::comphelper::removeElementAt(_rInfo, removeIndex);
799 }
800
801 Sequence< Any> aTypeSettings;
802 aTypeSettings = aProperties.getOrDefault("TypeInfoSettings",aTypeSettings);
803 // here we have a special entry for types from oracle
804 if ( aTypeSettings.hasElements() )
805 {
806 aRelevantSettings.insert(PropertyValue("TypeInfoSettings", 0, Any(aTypeSettings), PropertyState_DIRECT_VALUE));
807 }
808
809 // check which values are still left ('cause they were not present in the original sequence, but are to be set)
810 if ( aRelevantSettings.empty() )
811 return;
812
813 sal_Int32 nOldLength = _rInfo.getLength();
814 _rInfo.realloc(nOldLength + aRelevantSettings.size());
815 PropertyValue* pAppendValues = _rInfo.getArray() + nOldLength;
816 for (auto const& relevantSetting : aRelevantSettings)
817 {
818 if ( relevantSetting.Name == INFO_CHARSET )
819 {
820 OUString sCharSet;
821 relevantSetting.Value >>= sCharSet;
822 if ( !sCharSet.isEmpty() )
823 *pAppendValues = relevantSetting;
824 }
825 else
826 *pAppendValues = relevantSetting;
827 ++pAppendValues;
828 }
829}
830
832{
833 // translate the SfxPoolItem
834 Any aValue;
835
836 const SfxStringItem* pStringItem = dynamic_cast<const SfxStringItem*>( _pItem );
837 const SfxBoolItem* pBoolItem = dynamic_cast<const SfxBoolItem*>( _pItem );
838 const OptionalBoolItem* pOptBoolItem = dynamic_cast<const OptionalBoolItem*>( _pItem );
839 const SfxInt32Item* pInt32Item = dynamic_cast< const SfxInt32Item* >( _pItem );
840 const OStringListItem* pStringListItem = dynamic_cast<const OStringListItem*>( _pItem );
841
842 if ( pStringItem )
843 {
844 aValue <<= pStringItem->GetValue();
845 }
846 else if ( pBoolItem )
847 {
848 aValue <<= pBoolItem->GetValue();
849 }
850 else if ( pOptBoolItem )
851 {
852 if ( !pOptBoolItem->HasValue() )
853 aValue.clear();
854 else
855 aValue <<= pOptBoolItem->GetValue();
856 }
857 else if ( pInt32Item )
858 {
859 aValue <<= pInt32Item->GetValue();
860 }
861 else if ( pStringListItem )
862 {
863 aValue <<= pStringListItem->getList();
864 }
865 else
866 {
867 OSL_FAIL("ODbDataSourceAdministrationHelper::implTranslateProperty: unsupported item type!");
868 return aValue;
869 }
870
871 return aValue;
872}
873
874void ODbDataSourceAdministrationHelper::implTranslateProperty(const Reference< XPropertySet >& _rxSet, const OUString& _rName, const SfxPoolItem* _pItem)
875{
876 Any aValue = implTranslateProperty(_pItem);
877 lcl_putProperty(_rxSet, _rName,aValue);
878}
879
881{
882 OUString aString;
883
884 MapInt2String::const_iterator aPos = m_aDirectPropTranslator.find( _nId );
885 if ( m_aDirectPropTranslator.end() != aPos )
886 {
887 aString = aPos->second;
888 }
889 else
890 {
891 MapInt2String::const_iterator indirectPos = m_aIndirectPropTranslator.find( _nId );
892 if ( m_aIndirectPropTranslator.end() != indirectPos )
893 aString = indirectPos->second;
894 }
895
896 return OUStringToOString( aString, RTL_TEXTENCODING_ASCII_US );
897}
898template<class T> static bool checkItemType(const SfxPoolItem* pItem){ return dynamic_cast<const T*>(pItem) != nullptr;}
899
900void ODbDataSourceAdministrationHelper::implTranslateProperty( SfxItemSet& _rSet, sal_Int32 _nId, const Any& _rValue )
901{
902 switch ( _rValue.getValueType().getTypeClass() )
903 {
904 case TypeClass_STRING:
905 if ( implCheckItemType( _rSet, _nId, checkItemType<SfxStringItem> ) )
906 {
907 OUString sValue;
908 _rValue >>= sValue;
909 _rSet.Put(SfxStringItem(_nId, sValue));
910 }
911 else {
912 SAL_WARN( "dbaccess", "ODbDataSourceAdministrationHelper::implTranslateProperty: invalid property value ("
913 << translatePropertyId(_nId) << " should be no string)!");
914 }
915 break;
916
917 case TypeClass_BOOLEAN:
918 if ( implCheckItemType( _rSet, _nId, checkItemType<SfxBoolItem> ) )
919 {
920 bool bVal = false;
921 _rValue >>= bVal;
922 _rSet.Put(SfxBoolItem(_nId, bVal));
923 }
924 else if ( implCheckItemType( _rSet, _nId, checkItemType<OptionalBoolItem> ) )
925 {
926 OptionalBoolItem aItem( _nId );
927 if ( _rValue.hasValue() )
928 {
929 bool bValue = false;
930 _rValue >>= bValue;
931 aItem.SetValue( bValue );
932 }
933 else
934 aItem.ClearValue();
935 _rSet.Put( aItem );
936 }
937 else {
938 SAL_WARN( "dbaccess", "ODbDataSourceAdministrationHelper::implTranslateProperty: invalid property value ("
939 << translatePropertyId(_nId)
940 << " should be no boolean)!");
941 }
942 break;
943
944 case TypeClass_LONG:
945 if ( implCheckItemType( _rSet, _nId, checkItemType<SfxInt32Item> ) )
946 {
947 sal_Int32 nValue = 0;
948 _rValue >>= nValue;
949 _rSet.Put( SfxInt32Item( TypedWhichId<SfxInt32Item>(_nId), nValue ) );
950 }
951 else {
952 SAL_WARN( "dbaccess", "ODbDataSourceAdministrationHelper::implTranslateProperty: invalid property value ("
953 << translatePropertyId(_nId)
954 << " should be no int)!");
955 }
956 break;
957
958 case TypeClass_SEQUENCE:
959 if ( implCheckItemType( _rSet, _nId, checkItemType<OStringListItem> ) )
960 {
961 // determine the element type
962 TypeDescription aTD(_rValue.getValueType());
963 typelib_IndirectTypeDescription* pSequenceTD =
964 reinterpret_cast< typelib_IndirectTypeDescription* >(aTD.get());
965 OSL_ENSURE(pSequenceTD && pSequenceTD->pType, "ODbDataSourceAdministrationHelper::implTranslateProperty: invalid sequence type!");
966
967 Type aElementType(pSequenceTD->pType);
968 switch (aElementType.getTypeClass())
969 {
970 case TypeClass_STRING:
971 {
973 _rValue >>= aStringList;
974 _rSet.Put(OStringListItem(_nId, aStringList));
975 }
976 break;
977 default:
978 OSL_FAIL("ODbDataSourceAdministrationHelper::implTranslateProperty: unsupported property value type!");
979 }
980 }
981 else {
982 SAL_WARN( "dbaccess", "ODbDataSourceAdministrationHelper::implTranslateProperty: invalid property value ("
983 << translatePropertyId(_nId)
984 << " should be no string sequence)!");
985 }
986 break;
987
988 case TypeClass_VOID:
989 _rSet.ClearItem(_nId);
990 break;
991
992 default:
993 OSL_FAIL("ODbDataSourceAdministrationHelper::implTranslateProperty: unsupported property value type!");
994 }
995}
996
998{
999 const SfxStringItem* pUrlItem = _rDest.GetItem<SfxStringItem>(DSID_DOCUMENT_URL);
1000 OSL_ENSURE(pUrlItem,"Document URL is NULL. -> GPF!");
1001 return pUrlItem->GetValue();
1002}
1003
1005{
1006 OUString eType = getDatasourceType(_rDest);
1007
1008 const SfxStringItem* pUrlItem = _rDest.GetItem<SfxStringItem>(DSID_CONNECTURL);
1010
1011 OSL_ENSURE(pUrlItem,"Connection URL is NULL. -> GPF!");
1012 OSL_ENSURE(pTypeCollection, "ODbAdminDialog::getDatasourceType: invalid items in the source set!");
1013 ::dbaccess::ODsnTypeCollection* pCollection = pTypeCollection->getCollection();
1014 OSL_ENSURE(pCollection, "ODbAdminDialog::getDatasourceType: invalid type collection!");
1015
1016 TypedWhichId<SfxInt32Item> nPortNumberId(0);
1017 sal_Int32 nPortNumber = -1;
1018 OUString sNewHostName;
1019 OUString sUrlPart;
1020
1021 pCollection->extractHostNamePort(pUrlItem->GetValue(),sUrlPart,sNewHostName,nPortNumber);
1023
1024 switch( eTy )
1025 {
1028 nPortNumberId = DSID_MYSQL_PORTNUMBER;
1029 break;
1031 nPortNumberId = DSID_ORACLE_PORTNUMBER;
1032 break;
1034 nPortNumberId = DSID_CONN_LDAP_PORTNUMBER;
1035 break;
1037 nPortNumberId = DSID_POSTGRES_PORTNUMBER;
1038 break;
1039 default:
1040 break;
1041 }
1042
1043 if ( !sUrlPart.isEmpty() )
1044 {
1045 if ( eTy == ::dbaccess::DST_MYSQL_NATIVE )
1046 {
1047 _rDest.Put( SfxStringItem( DSID_DATABASENAME, sUrlPart ) );
1048 }
1049 else
1050 {
1051 OUString sNewUrl = pCollection->getPrefix(eType) + sUrlPart;
1052 _rDest.Put( SfxStringItem( DSID_CONNECTURL, sNewUrl ) );
1053 }
1054 }
1055
1056 if ( !sNewHostName.isEmpty() )
1057 _rDest.Put(SfxStringItem(DSID_CONN_HOSTNAME, sNewHostName));
1058
1059 if ( nPortNumber != -1 && nPortNumberId != TypedWhichId<SfxInt32Item>(0) )
1060 _rDest.Put(SfxInt32Item(nPortNumberId, nPortNumber));
1061
1062}
1063
1065{
1066 // put the remembered settings into the property set
1068 if ( !xDatasource.is() )
1069 return false;
1070
1071 translateProperties(_rSource,xDatasource );
1072
1073 return true;
1074}
1075
1077{
1078 OSL_ENSURE( !m_aDataSourceOrName.hasValue(), "ODbDataSourceAdministrationHelper::setDataSourceOrName: already have one!" );
1079 // hmm. We could reset m_xDatasource/m_xModel, probably, and continue working
1080 m_aDataSourceOrName = _rDataSourceOrName;
1081}
1082
1083// DbuTypeCollectionItem
1085 :SfxPoolItem(_nWhich)
1086 ,m_pCollection(_pCollection)
1087{
1088}
1089
1091 :SfxPoolItem(_rSource)
1092 ,m_pCollection(_rSource.getCollection())
1093{
1094}
1095
1097{
1098 return SfxPoolItem::operator==(_rItem) &&
1099 static_cast<const DbuTypeCollectionItem&>( _rItem ).getCollection() == getCollection();
1100}
1101
1103{
1104 return new DbuTypeCollectionItem(*this);
1105}
1106
1107} // namespace dbaui
1108
1109/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
OptionalString sName
PropertiesInfo aProperties
const char * pName
sal_Int32 GetValue() const
const OUString & GetValue() const
bool GetValue() const
const SfxPoolItem & GetDefaultItem(sal_uInt16 nWhich) const
SfxItemPool * GetPool() const
sal_uInt16 ClearItem(sal_uInt16 nWhich=0)
const SfxPoolItem * GetItem(sal_uInt16 nWhich, bool bSearchInParent=true) const
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
virtual bool operator==(const SfxPoolItem &) const=0
VALUE_TYPE getOrDefault(const OUString &_rValueName, const VALUE_TYPE &_rDefault) const
OUString getType(std::u16string_view _sURL) const
Definition: dsntypes.cxx:481
DATASOURCE_TYPE determineType(std::u16string_view _rDsn) const
Definition: dsntypes.cxx:299
OUString cutPrefix(std::u16string_view _sURL) const
on a given string, cut the type prefix and return the result
Definition: dsntypes.cxx:84
OUString getPrefix(std::u16string_view _sURL) const
on a given string, return the type prefix
Definition: dsntypes.cxx:110
void extractHostNamePort(const OUString &_rDsn, OUString &_sDatabaseName, OUString &_rHostname, sal_Int32 &_nPortNumber) const
Definition: dsntypes.cxx:202
static AuthenticationMode getAuthentication(const OUString &_sURL)
determines whether or not the data source requires authentication
Definition: dsmeta.cxx:158
allows an ODsnTypeCollection to be transported in an SfxItemSet
Definition: dsnItem.hxx:34
::dbaccess::ODsnTypeCollection * getCollection() const
Definition: dsnItem.hxx:44
virtual DbuTypeCollectionItem * Clone(SfxItemPool *_pPool=nullptr) const override
DbuTypeCollectionItem(sal_Int16 nWhich, ::dbaccess::ODsnTypeCollection *_pCollection)
virtual bool operator==(const SfxPoolItem &_rItem) const override
virtual SfxItemSet * getWriteOutputSet()=0
virtual const SfxItemSet * getOutputSet() const =0
bool getCurrentSettings(css::uno::Sequence< css::beans::PropertyValue > &_rDriverParams)
translate the current dialog SfxItems into driver relevant PropertyValues
std::pair< css::uno::Reference< css::sdbc::XConnection >, bool > createConnection()
creates a new connection.
OString translatePropertyId(sal_Int32 _nId)
css::uno::Reference< css::uno::XComponentContext > m_xContext
Definition: DbAdminImpl.hxx:56
css::uno::Reference< css::sdbc::XDriver > getDriver()
return the corresponding driver for the selected URL
const css::uno::Reference< css::uno::XComponentContext > & getORB() const
Definition: DbAdminImpl.hxx:87
std::map< sal_Int32, OUString > MapInt2String
Definition: DbAdminImpl.hxx:52
css::uno::Reference< css::beans::XPropertySet > m_xDatasource
database context we're working in
Definition: DbAdminImpl.hxx:59
void successfullyConnected()
to be called if the settings got from getCurrentSettings have been used for successfully connecting
void clearPassword()
clear the password in the current data source's item set
static OUString getDocumentUrl(SfxItemSet const &_rDest)
weld::Window * m_pParent
translating property id's into names (indirect properties of a data source)
Definition: DbAdminImpl.hxx:66
static void convertUrl(SfxItemSet &_rDest)
fill the necessary information from the url line
void setDataSourceOrName(const css::uno::Any &_rDataSourceOrName)
css::uno::Reference< css::beans::XPropertySet > const & getCurrentDataSource()
returns the data source the dialog is currently working with
static OUString getDatasourceType(const SfxItemSet &_rSet)
extracts the connection type from the given setThe connection type is determined by the value of the ...
void implTranslateProperty(SfxItemSet &_rSet, sal_Int32 _nId, const css::uno::Any &_rValue)
translate the given value into an SfxPoolItem, put this into the given set under the given id
ODbDataSourceAdministrationHelper(const css::uno::Reference< css::uno::XComponentContext > &_xORB, weld::Window *pParent, weld::Window *pTopParent, IItemSetHelper *_pItemSetHelper)
OUString getConnectionURL() const
returns the connection URL
void translateProperties(const css::uno::Reference< css::beans::XPropertySet > &_rxSource, SfxItemSet &_rDest)
translates properties of a UNO data source into SfxItems
void fillDatasourceInfo(const SfxItemSet &_rSource, css::uno::Sequence< css::beans::PropertyValue > &_rInfo)
fill a data source info array with the settings from a given item set
css::uno::Reference< css::sdb::XDatabaseContext > m_xDatabaseContext
service factory
Definition: DbAdminImpl.hxx:58
static bool hasAuthentication(const SfxItemSet &_rSet)
check if the data source described by the given set needs authenticationThe return value depends on t...
bool saveChanges(const SfxItemSet &_rSource)
MapInt2String m_aIndirectPropTranslator
translating property id's into names (direct properties of a data source)
Definition: DbAdminImpl.hxx:65
css::uno::Reference< css::frame::XModel > m_xModel
Definition: DbAdminImpl.hxx:60
<type>SfxPoolItem</type> which transports a sequence of <type scope="rtl">OUString</type>'s
const css::uno::Sequence< OUString > & getList() const
virtual css::uno::Reference< css::awt::XWindow > GetXWindow()=0
Reference< XComponentContext > m_xContext
#define DBA_RES(id)
int nCount
#define TOOLS_WARN_EXCEPTION(area, stream)
#define DBG_UNHANDLED_EXCEPTION(...)
#define DSID_CHARSET
Definition: dsitems.hxx:44
#define DSID_CONN_LDAP_BASEDN
Definition: dsitems.hxx:65
#define DSID_DECIMALDELIMITER
Definition: dsitems.hxx:51
#define DSID_PASSWORD
Definition: dsitems.hxx:42
#define DSID_RESPECTRESULTSETTYPE
Definition: dsitems.hxx:93
#define DSID_SCHEMA
Definition: dsitems.hxx:79
#define DSID_CONN_LDAP_PORTNUMBER
Definition: dsitems.hxx:66
#define DSID_ESCAPE_DATETIME
Definition: dsitems.hxx:89
#define DSID_ENABLEOUTERJOIN
Definition: dsitems.hxx:77
#define DSID_DOCUMENT_URL
Definition: dsitems.hxx:82
#define DSID_NAME
Definition: dsitems.hxx:34
#define DSID_THOUSANDSDELIMITER
Definition: dsitems.hxx:52
#define DSID_SHOWDELETEDROWS
Definition: dsitems.hxx:46
#define DSID_READONLY
Definition: dsitems.hxx:40
#define DSID_DATABASENAME
Definition: dsitems.hxx:84
#define DSID_CONN_LDAP_USESSL
Definition: dsitems.hxx:81
#define DSID_CONNECTURL
Definition: dsitems.hxx:36
#define DSID_AS_BEFORE_CORRNAME
Definition: dsitems.hxx:85
#define DSID_INDEXAPPENDIX
Definition: dsitems.hxx:80
#define DSID_CONN_SOCKET
Definition: dsitems.hxx:88
#define DSID_CONN_LDAP_ROWCOUNT
Definition: dsitems.hxx:67
#define DSID_MAX_ROW_SCAN
Definition: dsitems.hxx:92
#define DSID_TEXTFILEEXTENSION
Definition: dsitems.hxx:53
#define DSID_BOOLEANCOMPARISON
Definition: dsitems.hxx:75
#define DSID_TYPECOLLECTION
Definition: dsitems.hxx:38
sal_Int32 ItemID
Definition: dsitems.hxx:28
#define DSID_DOSLINEENDS
Definition: dsitems.hxx:83
#define DSID_CONN_HOSTNAME
Definition: dsitems.hxx:64
#define DSID_NAMED_PIPE
Definition: dsitems.hxx:90
#define DSID_PARAMETERNAMESUBST
Definition: dsitems.hxx:55
#define DSID_MYSQL_PORTNUMBER
Definition: dsitems.hxx:73
#define DSID_CHECK_REQUIRED_FIELDS
Definition: dsitems.hxx:86
#define DSID_FIELDDELIMITER
Definition: dsitems.hxx:49
#define DSID_AUTOINCREMENTVALUE
Definition: dsitems.hxx:69
#define DSID_PRIMARY_KEY_SUPPORT
Definition: dsitems.hxx:91
#define DSID_IGNOREDRIVER_PRIV
Definition: dsitems.hxx:74
#define DSID_POSTGRES_PORTNUMBER
Definition: dsitems.hxx:94
#define DSID_AUTORETRIEVEENABLED
Definition: dsitems.hxx:71
#define DSID_CATALOG
Definition: dsitems.hxx:78
#define DSID_TEXTFILEHEADER
Definition: dsitems.hxx:54
#define DSID_IGNORECURRENCY
Definition: dsitems.hxx:87
#define DSID_TABLEFILTER
Definition: dsitems.hxx:37
#define DSID_ADDITIONALOPTIONS
Definition: dsitems.hxx:43
#define DSID_SUPPRESSVERSIONCL
Definition: dsitems.hxx:57
#define DSID_USECATALOG
Definition: dsitems.hxx:63
#define DSID_JDBCDRIVERCLASS
Definition: dsitems.hxx:48
#define DSID_USER
Definition: dsitems.hxx:41
#define DSID_APPEND_TABLE_ALIAS
Definition: dsitems.hxx:72
#define DSID_ALLOWLONGTABLENAMES
Definition: dsitems.hxx:47
#define DSID_SQL92CHECK
Definition: dsitems.hxx:68
#define DSID_FIRST_ITEM_ID
Definition: dsitems.hxx:99
#define DSID_ORACLE_PORTNUMBER
Definition: dsitems.hxx:76
#define DSID_TEXTDELIMITER
Definition: dsitems.hxx:50
#define DSID_AUTORETRIEVEVALUE
Definition: dsitems.hxx:70
#define DSID_PASSWORDREQUIRED
Definition: dsitems.hxx:45
#define DSID_LAST_ITEM_ID
Definition: dsitems.hxx:100
float u
float y
float x
sal_Int16 nValue
OUString eType
Definition: generalpage.cxx:78
#define SAL_WARN(area, stream)
@ Exception
OString stripEnd(const OString &rIn, char c)
css::uno::Sequence< DstElementType > containerToSequence(const SrcType &i_Container)
OInteraction< css::task::XInteractionAbort > OInteractionAbort
Type
Any SAL_CALL getCaughtException()
DATASOURCE_TYPE
known datasource types
Definition: dsntypes.hxx:36
@ DST_MSACCESS_2007
Definition: dsntypes.hxx:58
@ DST_MYSQL_JDBC
Definition: dsntypes.hxx:39
@ DST_CALC
Definition: dsntypes.hxx:42
@ DST_WRITER
Definition: dsntypes.hxx:65
@ DST_MSACCESS
Definition: dsntypes.hxx:37
@ DST_JDBC
Definition: dsntypes.hxx:45
@ DST_MYSQL_NATIVE
Definition: dsntypes.hxx:60
@ DST_LDAP
Definition: dsntypes.hxx:50
@ DST_DBASE
Definition: dsntypes.hxx:43
@ DST_FLAT
Definition: dsntypes.hxx:44
@ DST_ORACLE_JDBC
Definition: dsntypes.hxx:40
@ DST_POSTGRES
Definition: dsntypes.hxx:64
@ AuthNone
Definition: dsmeta.hxx:38
static bool checkItemType(const SfxPoolItem *pItem)
css::uno::Reference< css::uno::XInterface > getDataSourceOrModel(const css::uno::Reference< css::uno::XInterface > &_xObject)
returns either the model when data source is given as parameter, or returns a data source when a mode...
OUString getStrippedDatabaseName(const css::uno::Reference< css::beans::XPropertySet > &_xDataSource, OUString &_rsDatabaseName)
returns the stripped database name.
std::set< PropertyValue, PropertyValueLess > PropertyValueSet
void showError(const SQLExceptionInfo &_rInfo, const Reference< XWindow > &_xParent, const Reference< XComponentContext > &_rxContext)
int i
OString OUStringToOString(std::u16string_view str, ConnectionSettings const *settings)
Sequence< Property > aInfos
sal_Int16 nAttributes
void VCL_DLLPUBLIC ShowServiceNotAvailableError(weld::Widget *pParent, std::u16string_view rServiceName, bool bError)
constexpr OUStringLiteral INFO_JDBCDRIVERCLASS
Definition: strings.hxx:206
constexpr OUStringLiteral INFO_AS_BEFORE_CORRELATION_NAME
Definition: strings.hxx:221
constexpr OUStringLiteral INFO_FORMS_CHECK_REQUIRED_FIELDS
Definition: strings.hxx:222
constexpr OUStringLiteral PROPERTY_TABLEFILTER(u"TableFilter")
constexpr OUStringLiteral INFO_TEXTFILEEXTENSION
Definition: strings.hxx:207
constexpr OUStringLiteral PROPERTY_USER(u"User")
constexpr OUStringLiteral INFO_SHOWDELETEDROWS
Definition: strings.hxx:214
constexpr OUStringLiteral PROPERTY_URL(u"URL")
constexpr OUStringLiteral PROPERTY_INFO(u"Info")
constexpr OUStringLiteral PROPERTY_USESCHEMAINSELECT(u"UseSchemaInSelect")
constexpr OUStringLiteral INFO_AUTORETRIEVEVALUE
Definition: strings.hxx:217
constexpr OUStringLiteral PROPERTY_ENABLEOUTERJOIN(u"EnableOuterJoinEscape")
constexpr OUStringLiteral PROPERTY_USECATALOGINSELECT(u"UseCatalogInSelect")
constexpr OUStringLiteral PROPERTY_ISREADONLY(u"IsReadOnly")
constexpr OUStringLiteral PROPERTY_ENABLESQL92CHECK(u"EnableSQL92Check")
constexpr OUStringLiteral INFO_DECIMALDELIMITER
Definition: strings.hxx:212
constexpr OUStringLiteral INFO_APPEND_TABLE_ALIAS
Definition: strings.hxx:219
constexpr OUStringLiteral INFO_TEXTFILEHEADER
Definition: strings.hxx:209
constexpr OUStringLiteral INFO_CONN_LDAP_ROWCOUNT
Definition: strings.hxx:227
constexpr OUStringLiteral INFO_PARAMETERNAMESUBST
Definition: strings.hxx:223
constexpr OUStringLiteral INFO_IGNOREDRIVER_PRIV
Definition: strings.hxx:224
constexpr OUStringLiteral PROPERTY_PASSWORD(u"Password")
constexpr OUStringLiteral INFO_TEXTDELIMITER
Definition: strings.hxx:211
constexpr OUStringLiteral PROPERTY_BOOLEANCOMPARISONMODE(u"BooleanComparisonMode")
constexpr OUStringLiteral INFO_AUTORETRIEVEENABLED
Definition: strings.hxx:218
constexpr OUStringLiteral INFO_CHARSET
Definition: strings.hxx:208
constexpr OUStringLiteral INFO_ADDITIONALOPTIONS
Definition: strings.hxx:216
constexpr OUStringLiteral PROPERTY_SUPPRESSVERSIONCL(u"SuppressVersionColumns")
constexpr OUStringLiteral INFO_ALLOWLONGTABLENAMES
Definition: strings.hxx:215
constexpr OUStringLiteral PROPERTY_NAME(u"Name")
constexpr OUStringLiteral INFO_FIELDDELIMITER
Definition: strings.hxx:210
constexpr OUStringLiteral INFO_THOUSANDSDELIMITER
Definition: strings.hxx:213
constexpr OUStringLiteral PROPERTY_AUTOINCREMENTCREATION(u"AutoIncrementCreation")
constexpr OUStringLiteral INFO_CONN_LDAP_BASEDN
Definition: strings.hxx:226
constexpr OUStringLiteral INFO_ESCAPE_DATETIME
Definition: strings.hxx:230
constexpr OUStringLiteral PROPERTY_ISPASSWORDREQUIRED(u"IsPasswordRequired")
constexpr OUStringLiteral INFO_USECATALOG
Definition: strings.hxx:225
Reference< XModel > xModel
the model of the sub component. Might be <NULL>
const std::u16string_view aStringList[]