LibreOffice Module dbaccess (master) 1
connection.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 <sal/config.h>
21
22#include <iterator>
23
24#include "connection.hxx"
25#include "datasource.hxx"
26#include <strings.hrc>
27#include <strings.hxx>
28#include <core_resource.hxx>
29#include <statement.hxx>
30#include <preparedstatement.hxx>
31#include <callablestatement.hxx>
33#include <querycomposer.hxx>
34
35#include <com/sun/star/lang/NoSupportException.hpp>
36#include <com/sun/star/sdb/CommandType.hpp>
37#include <com/sun/star/sdb/tools/ConnectionTools.hpp>
38#include <com/sun/star/reflection/ProxyFactory.hpp>
39#include <com/sun/star/beans/NamedValue.hpp>
43#include <osl/diagnose.h>
45#include <comphelper/types.hxx>
47
48using namespace ::com::sun::star::uno;
49using namespace ::com::sun::star::lang;
50using namespace ::com::sun::star::util;
51using namespace ::com::sun::star::sdb;
52using namespace ::com::sun::star::sdb::application;
53using namespace ::com::sun::star::sdbc;
54using namespace ::com::sun::star::sdbcx;
55using namespace ::com::sun::star::beans;
56using namespace ::com::sun::star::reflection;
57using namespace ::com::sun::star::container;
58using namespace ::com::sun::star::graphic;
59using namespace ::osl;
60using namespace ::comphelper;
61using namespace ::cppu;
62using namespace ::dbtools;
63
64using ::com::sun::star::sdb::tools::XTableName;
65using ::com::sun::star::sdb::tools::XObjectNames;
66using ::com::sun::star::sdb::tools::XDataSourceMetaData;
67
68namespace dbaccess
69{
70
71// XServiceInfo
73{
74 return "com.sun.star.comp.dbaccess.Connection";
75}
76
77sal_Bool OConnection::supportsService( const OUString& _rServiceName )
78{
79 return cppu::supportsService(this, _rServiceName);
80}
81
83{
84 Sequence< OUString > aSupported = OConnectionWrapper::getSupportedServiceNames();
85
86 if ( comphelper::findValue( aSupported, SERVICE_SDB_CONNECTION ) == -1 )
87 {
88 sal_Int32 nLen = aSupported.getLength();
89 aSupported.realloc( nLen + 1 );
90 aSupported.getArray()[ nLen ] = SERVICE_SDB_CONNECTION;
91 }
92
93 return aSupported;
94}
95
96// XCloseable
98{
99 // being closed is the same as being disposed
100 dispose();
101}
102
104{
105 MutexGuard aGuard(m_aMutex);
106 return !m_xMasterConnection.is();
107}
108
109// XConnection
110Reference< XStatement > OConnection::createStatement()
111{
112 MutexGuard aGuard(m_aMutex);
114
115 Reference< XStatement > xStatement;
116 Reference< XStatement > xMasterStatement = m_xMasterConnection->createStatement();
117 if ( xMasterStatement.is() )
118 {
119 xStatement = new OStatement(this, xMasterStatement);
120 m_aStatements.emplace_back(xStatement);
121 }
122 return xStatement;
123}
124
125Reference< XPreparedStatement > OConnection::prepareStatement(const OUString& sql)
126{
127 MutexGuard aGuard(m_aMutex);
129
130 // TODO convert the SQL to SQL the driver understands
131 Reference< XPreparedStatement > xStatement;
132 Reference< XPreparedStatement > xMasterStatement = m_xMasterConnection->prepareStatement(sql);
133 if ( xMasterStatement.is() )
134 {
135 xStatement = new OPreparedStatement(this, xMasterStatement);
136 m_aStatements.emplace_back(xStatement);
137 }
138 return xStatement;
139}
140
141Reference< XPreparedStatement > OConnection::prepareCall(const OUString& sql)
142{
143 MutexGuard aGuard(m_aMutex);
145
146 Reference< XPreparedStatement > xStatement;
147 Reference< XPreparedStatement > xMasterStatement = m_xMasterConnection->prepareCall(sql);
148 if ( xMasterStatement.is() )
149 {
150 xStatement = new OCallableStatement(this, xMasterStatement);
151 m_aStatements.emplace_back(xStatement);
152 }
153 return xStatement;
154}
155
156OUString OConnection::nativeSQL(const OUString& sql)
157{
158 MutexGuard aGuard(m_aMutex);
160 return m_xMasterConnection->nativeSQL(sql);
161}
162
164{
165 MutexGuard aGuard(m_aMutex);
167 m_xMasterConnection->setAutoCommit(autoCommit);
168}
169
171{
172 MutexGuard aGuard(m_aMutex);
174 return m_xMasterConnection->getAutoCommit();
175}
176
178{
179 MutexGuard aGuard(m_aMutex);
181 m_xMasterConnection->commit();
182}
183
185{
186 MutexGuard aGuard(m_aMutex);
188 m_xMasterConnection->rollback();
189}
190
191Reference< XDatabaseMetaData > OConnection::getMetaData()
192{
193 MutexGuard aGuard(m_aMutex);
195 return m_xMasterConnection->getMetaData();
196}
197
199{
200 MutexGuard aGuard(m_aMutex);
202 m_xMasterConnection->setReadOnly(readOnly);
203}
204
206{
207 MutexGuard aGuard(m_aMutex);
209 return m_xMasterConnection->isReadOnly();
210}
211
212void OConnection::setCatalog(const OUString& catalog)
213{
214 MutexGuard aGuard(m_aMutex);
216 m_xMasterConnection->setCatalog(catalog);
217}
218
220{
221 MutexGuard aGuard(m_aMutex);
223 return m_xMasterConnection->getCatalog();
224}
225
227{
228 MutexGuard aGuard(m_aMutex);
230 m_xMasterConnection->setTransactionIsolation(level);
231}
232
234{
235 MutexGuard aGuard(m_aMutex);
237 return m_xMasterConnection->getTransactionIsolation();
238}
239
240Reference< XNameAccess > OConnection::getTypeMap()
241{
242 MutexGuard aGuard(m_aMutex);
244 return m_xMasterConnection->getTypeMap();
245}
246
247void OConnection::setTypeMap(const Reference< XNameAccess > & typeMap)
248{
249 MutexGuard aGuard(m_aMutex);
251 m_xMasterConnection->setTypeMap(typeMap);
252}
253
254// OConnection
255
256OConnection::OConnection(ODatabaseSource& _rDB
257 , Reference< XConnection > const & _rxMaster
258 , const Reference< XComponentContext >& _rxORB)
259 :OSubComponent(m_aMutex, static_cast< OWeakObject* >(&_rDB))
260 // as the queries reroute their refcounting to us, this m_aMutex is okey. If the queries
261 // container would do its own refcounting, it would have to acquire m_pMutex
262 // same for tables
263 ,m_aTableFilter(_rDB.m_pImpl->m_aTableFilter)
264 ,m_aTableTypeFilter(_rDB.m_pImpl->m_aTableTypeFilter)
265 ,m_aContext( _rxORB )
266 ,m_xMasterConnection(_rxMaster)
267 ,m_aWarnings( Reference< XWarningsSupplier >( _rxMaster, UNO_QUERY ) )
268 ,m_nInAppend(0)
269 ,m_bSupportsViews(false)
270 ,m_bSupportsUsers(false)
271 ,m_bSupportsGroups(false)
272{
273 osl_atomic_increment(&m_refCount);
274
275 try
276 {
277 Reference< XProxyFactory > xProxyFactory = ProxyFactory::create( m_aContext );
278 Reference<XAggregation> xAgg = xProxyFactory->createProxy(_rxMaster);
279 setDelegation(xAgg,m_refCount);
280 OSL_ENSURE(m_xConnection.is(), "OConnection::OConnection : invalid master connection !");
281 }
282 catch(const Exception&)
283 {
284 DBG_UNHANDLED_EXCEPTION("dbaccess");
285 }
286
287 m_xTableUIProvider.set(m_xMasterConnection, css::uno::UNO_QUERY);
288
289 try
290 {
291 m_xQueries = OQueryContainer::create(Reference< XNameContainer >(_rDB.getQueryDefinitions(), UNO_QUERY), this, _rxORB, &m_aWarnings).get();
292
293 bool bCase = true;
294 Reference<XDatabaseMetaData> xMeta;
295 try
296 {
297 xMeta = getMetaData();
298 bCase = xMeta.is() && xMeta->supportsMixedCaseQuotedIdentifiers();
299 }
300 catch(const SQLException&)
301 {
302 }
303 Reference< XNameContainer > xTableDefinitions(_rDB.getTables(),UNO_QUERY);
304 m_pTables.reset( new OTableContainer( *this, m_aMutex, this, bCase, xTableDefinitions, this, m_nInAppend ) );
305
306 // check if we support types
307 if ( xMeta.is() )
308 {
309 Reference<XResultSet> xRes = xMeta->getTableTypes();
310 if(xRes.is())
311 {
312 Reference<XRow> xRow(xRes,UNO_QUERY);
313 while(xRes->next())
314 {
315 OUString sValue = xRow->getString(1);
316 if( !xRow->wasNull() && sValue == "VIEW")
317 {
318 m_bSupportsViews = true;
319 break;
320 }
321 }
322 }
323 // some dbs don't support this type so we should ask if a XViewsSupplier is supported
325 {
326 Reference< XViewsSupplier > xMaster(getMasterTables(),UNO_QUERY);
327
328 if (xMaster.is() && xMaster->getViews().is())
329 m_bSupportsViews = true;
330 }
332 {
333 m_pViews.reset( new OViewContainer(*this, m_aMutex, this, bCase, this, m_nInAppend) );
334 m_pViews->addContainerListener(m_pTables.get());
335 m_pTables->addContainerListener(m_pViews.get());
336 }
337 m_bSupportsUsers = Reference< XUsersSupplier> (getMasterTables(),UNO_QUERY).is();
338 m_bSupportsGroups = Reference< XGroupsSupplier> (getMasterTables(),UNO_QUERY).is();
339
341 }
342 }
343 catch(const Exception& )
344 {
345 DBG_UNHANDLED_EXCEPTION("dbaccess");
346 }
347 osl_atomic_decrement( &m_refCount );
348}
349
351{
352}
353
354// XWarningsSupplier
356{
357 MutexGuard aGuard(m_aMutex);
359 return m_aWarnings.getWarnings();
360}
361
363{
364 MutexGuard aGuard(m_aMutex);
367}
368
369namespace
370{
371 struct CompareTypeByName
372 {
373 bool operator() ( const Type& _rLHS, const Type& _rRHS ) const
374 {
375 return _rLHS.getTypeName() < _rRHS.getTypeName();
376 }
377 };
378 typedef std::set< Type, CompareTypeByName > TypeBag;
379
380 void lcl_copyTypes( TypeBag& _out_rTypes, const Sequence< Type >& _rTypes )
381 {
382 std::copy( _rTypes.begin(), _rTypes.end(),
383 std::insert_iterator< TypeBag >( _out_rTypes, _out_rTypes.begin() ) );
384 }
385}
386
387// css::lang::XTypeProvider
388Sequence< Type > OConnection::getTypes()
389{
390 TypeBag aNormalizedTypes;
391
392 lcl_copyTypes( aNormalizedTypes, OSubComponent::getTypes() );
393 lcl_copyTypes( aNormalizedTypes, OConnection_Base::getTypes() );
394 lcl_copyTypes( aNormalizedTypes, ::connectivity::OConnectionWrapper::getTypes() );
395
396 if ( !m_bSupportsViews )
397 aNormalizedTypes.erase( cppu::UnoType<XViewsSupplier>::get() );
398 if ( !m_bSupportsUsers )
399 aNormalizedTypes.erase( cppu::UnoType<XUsersSupplier>::get() );
400 if ( !m_bSupportsGroups )
401 aNormalizedTypes.erase( cppu::UnoType<XGroupsSupplier>::get() );
402
403 return comphelper::containerToSequence(aNormalizedTypes);
404}
405
407{
408 return css::uno::Sequence<sal_Int8>();
409}
410
411// css::uno::XInterface
413{
414 if ( !m_bSupportsViews && rType.equals( cppu::UnoType<XViewsSupplier>::get() ) )
415 return Any();
416 else if ( !m_bSupportsUsers && rType.equals( cppu::UnoType<XUsersSupplier>::get() ) )
417 return Any();
418 else if ( !m_bSupportsGroups && rType.equals( cppu::UnoType<XGroupsSupplier>::get() ) )
419 return Any();
420 Any aReturn = OSubComponent::queryInterface( rType );
421 if (!aReturn.hasValue())
422 {
423 aReturn = OConnection_Base::queryInterface( rType );
424 if (!aReturn.hasValue())
425 aReturn = OConnectionWrapper::queryInterface( rType );
426 }
427 return aReturn;
428}
429
430void OConnection::acquire() noexcept
431{
432 // include this one when you want to see who calls it (call graph)
433 OSubComponent::acquire();
434}
435
436void OConnection::release() noexcept
437{
438 // include this one when you want to see who calls it (call graph)
440}
441
442// OSubComponent
444{
445 MutexGuard aGuard(m_aMutex);
446
447 OSubComponent::disposing();
449
450 for (auto const& statement : m_aStatements)
451 {
452 Reference<XComponent> xComp(statement.get(),UNO_QUERY);
453 ::comphelper::disposeComponent(xComp);
454 }
455 m_aStatements.clear();
456 m_xMasterTables = nullptr;
457
458 if(m_pTables)
459 m_pTables->dispose();
460 if(m_pViews)
461 m_pViews->dispose();
462
463 ::comphelper::disposeComponent(m_xQueries);
464
465 for (auto const& composer : m_aComposers)
466 {
467 Reference<XComponent> xComp(composer.get(),UNO_QUERY);
468 ::comphelper::disposeComponent(xComp);
469 }
470
471 m_aComposers.clear();
472
473 try
474 {
475 if (m_xMasterConnection.is())
476 m_xMasterConnection->close();
477 }
478 catch(const Exception&)
479 {
480 }
481 m_xMasterConnection = nullptr;
482}
483
484// XChild
485Reference< XInterface > OConnection::getParent()
486{
487 MutexGuard aGuard(m_aMutex);
489 return m_xParent;
490}
491
492void OConnection::setParent(const Reference< XInterface > & /*Parent*/)
493{
494 throw NoSupportException();
495}
496
497// XSQLQueryComposerFactory
498Reference< XSQLQueryComposer > OConnection::createQueryComposer()
499{
500 MutexGuard aGuard(m_aMutex);
502
503 // Reference< XNumberFormatsSupplier > xSupplier = pParent->getNumberFormatsSupplier();
504 Reference< XSQLQueryComposer > xComposer( new OQueryComposer( this ) );
505 m_aComposers.emplace_back(xComposer);
506 return xComposer;
507}
508
510{
511 Reference<XPropertySet> xProp(getParent(),UNO_QUERY);
512 if ( xProp.is() )
513 {
514 xProp->getPropertyValue(PROPERTY_TABLEFILTER) >>= m_aTableFilter;
515 xProp->getPropertyValue(PROPERTY_TABLETYPEFILTER) >>= m_aTableTypeFilter;
516 }
517}
518
519void OConnection::refresh(const Reference< XNameAccess >& _rToBeRefreshed)
520{
521 if ( _rToBeRefreshed == Reference< XNameAccess >(m_pTables.get()) )
522 {
523 if (m_pTables && !m_pTables->isInitialized())
524 {
526 // check if our "master connection" can supply tables
528
529 if (m_xMasterTables.is() && m_xMasterTables->getTables().is())
530 { // yes -> wrap them
532 }
533 else
534 { // no -> use an own container
536 }
537 }
538 }
539 else if ( _rToBeRefreshed == Reference< XNameAccess >(m_pViews.get()) )
540 {
541 if (m_pViews && !m_pViews->isInitialized())
542 {
544 // check if our "master connection" can supply tables
545 Reference< XViewsSupplier > xMaster(getMasterTables(),UNO_QUERY);
546
547 if (xMaster.is() && xMaster->getViews().is())
548 m_pViews->construct(xMaster->getViews(),m_aTableFilter, m_aTableTypeFilter);
549 else
551 }
552 }
553}
554
555// XTablesSupplier
556Reference< XNameAccess > OConnection::getTables()
557{
558 MutexGuard aGuard(m_aMutex);
560
561 refresh(m_pTables.get());
562
563 return m_pTables.get();
564}
565
566Reference< XNameAccess > SAL_CALL OConnection::getViews( )
567{
568 MutexGuard aGuard(m_aMutex);
570
571 refresh(m_pViews.get());
572
573 return m_pViews.get();
574}
575
576// XQueriesSupplier
577Reference< XNameAccess > OConnection::getQueries()
578{
579 MutexGuard aGuard(m_aMutex);
581
582 return m_xQueries;
583}
584
585// css::sdb::XCommandPreparation
586Reference< XPreparedStatement > SAL_CALL OConnection::prepareCommand( const OUString& command, sal_Int32 commandType )
587{
588 MutexGuard aGuard(m_aMutex);
590
591 OUString aStatement;
592 switch (commandType)
593 {
595 {
596 aStatement = "SELECT * FROM ";
597
598 OUString sCatalog, sSchema, sTable;
599 ::dbtools::qualifiedNameComponents( getMetaData(), command, sCatalog, sSchema, sTable, ::dbtools::EComposeRule::InDataManipulation );
600 aStatement += ::dbtools::composeTableNameForSelect( this, sCatalog, sSchema, sTable );
601 }
602 break;
604 if ( m_xQueries->hasByName(command) )
605 {
606 Reference< XPropertySet > xQuery(m_xQueries->getByName(command),UNO_QUERY);
607 xQuery->getPropertyValue(PROPERTY_COMMAND) >>= aStatement;
608 }
609 break;
610 default:
611 aStatement = command;
612 }
613 // TODO EscapeProcessing
614 return prepareStatement(aStatement);
615}
616
617Reference< XInterface > SAL_CALL OConnection::createInstance( const OUString& _sServiceSpecifier )
618{
619 Reference< XServiceInfo > xRet;
620 if ( SERVICE_NAME_SINGLESELECTQUERYCOMPOSER == _sServiceSpecifier || _sServiceSpecifier == "com.sun.star.sdb.SingleSelectQueryAnalyzer" )
621 {
622 xRet = new OSingleSelectQueryComposer( getTables(),this, m_aContext );
623 m_aComposers.emplace_back(xRet);
624 }
625 else
626 {
627 if ( !_sServiceSpecifier.isEmpty() )
628 {
629 TSupportServices::const_iterator aFind = m_aSupportServices.find(_sServiceSpecifier);
630 if ( aFind == m_aSupportServices.end() )
631 {
632 Reference<XConnection> xMy(this);
633 Sequence<Any> aArgs{ Any(NamedValue("ActiveConnection",Any(xMy))) };
634 aFind = m_aSupportServices.emplace(
635 _sServiceSpecifier,
636 m_aContext->getServiceManager()->createInstanceWithArgumentsAndContext(_sServiceSpecifier, aArgs, m_aContext)
637 ).first;
638 }
639 return aFind->second;
640 }
641 }
642 return Reference<XInterface>(xRet, UNO_QUERY);
643}
644
645Reference< XInterface > SAL_CALL OConnection::createInstanceWithArguments( const OUString& _sServiceSpecifier, const Sequence< Any >& /*Arguments*/ )
646{
647 return createInstance(_sServiceSpecifier);
648}
649
650Sequence< OUString > SAL_CALL OConnection::getAvailableServiceNames( )
651{
652 Sequence< OUString > aRet { SERVICE_NAME_SINGLESELECTQUERYCOMPOSER };
653 return aRet;
654}
655
656Reference< XTablesSupplier > const & OConnection::getMasterTables()
657{
658// check if out "master connection" can supply tables
659 if(!m_xMasterTables.is())
660 {
661 try
662 {
663 Reference<XDatabaseMetaData> xMeta = getMetaData();
664 if ( xMeta.is() )
665 m_xMasterTables = ::dbtools::getDataDefinitionByURLAndConnection( xMeta->getURL(), m_xMasterConnection, m_aContext );
666 }
667 catch(const SQLException&)
668 {
669 }
670 }
671 return m_xMasterTables;
672}
673
674// XUsersSupplier
675Reference< XNameAccess > SAL_CALL OConnection::getUsers( )
676{
677 MutexGuard aGuard(m_aMutex);
679
680 Reference<XUsersSupplier> xUsr(getMasterTables(),UNO_QUERY);
681 return xUsr.is() ? xUsr->getUsers() : Reference< XNameAccess >();
682}
683
684// XGroupsSupplier
685Reference< XNameAccess > SAL_CALL OConnection::getGroups( )
686{
687 MutexGuard aGuard(m_aMutex);
689 Reference<XGroupsSupplier> xGrp(getMasterTables(),UNO_QUERY);
690 return xGrp.is() ? xGrp->getGroups() : Reference< XNameAccess >();
691}
692
694{
695 m_xConnectionTools = css::sdb::tools::ConnectionTools::createWithConnection( m_aContext, this );
696}
697
698Reference< XTableName > SAL_CALL OConnection::createTableName( )
699{
700 MutexGuard aGuard(m_aMutex);
703
704 return m_xConnectionTools->createTableName();
705}
706
707Reference< XObjectNames > SAL_CALL OConnection::getObjectNames( )
708{
709 MutexGuard aGuard(m_aMutex);
712
713 return m_xConnectionTools->getObjectNames();
714}
715
716Reference< XDataSourceMetaData > SAL_CALL OConnection::getDataSourceMetaData( )
717{
718 MutexGuard aGuard(m_aMutex);
721
722 return m_xConnectionTools->getDataSourceMetaData();
723}
724
725Reference< css::container::XNameAccess > SAL_CALL OConnection::getFieldsByCommandDescriptor( ::sal_Int32 commandType, const OUString& command, css::uno::Reference< css::lang::XComponent >& keepFieldsAlive )
726{
727 MutexGuard aGuard(m_aMutex);
730
731 return m_xConnectionTools->getFieldsByCommandDescriptor(commandType,command,keepFieldsAlive);
732}
733
734Reference< XSingleSelectQueryComposer > SAL_CALL OConnection::getComposer( ::sal_Int32 commandType, const OUString& command )
735{
736 MutexGuard aGuard(m_aMutex);
739
740 return m_xConnectionTools->getComposer(commandType,command);
741}
742
744{
745 DatabaseMetaData aMeta( static_cast< XConnection* >( this ) );
746 if ( !aMeta.supportsSubqueriesInFrom() )
747 // nothing to do
748 return;
749
750 try
751 {
752 Reference< XNameAccess > xTables( getTables() );
753 const Sequence< OUString > aTableNames( xTables->getElementNames() );
754 std::set< OUString > aSortedTableNames( aTableNames.begin(), aTableNames.end() );
755
756 Reference< XNameAccess > xQueries( getQueries() );
757 const Sequence< OUString > aQueryNames( xQueries->getElementNames() );
758
759 for ( auto const & queryName : aQueryNames )
760 {
761 if ( aSortedTableNames.find( queryName ) != aSortedTableNames.end() )
762 {
763 OUString sConflictWarning( DBA_RES( RID_STR_CONFLICTING_NAMES ) );
764 m_aWarnings.appendWarning( sConflictWarning, "01SB0", *this );
765 }
766 }
767 }
768 catch( const Exception& )
769 {
770 DBG_UNHANDLED_EXCEPTION("dbaccess");
771 }
772}
773
774Reference< XGraphic > SAL_CALL OConnection::getTableIcon( const OUString& TableName, ::sal_Int32 ColorMode )
775{
776 Reference< XGraphic > xReturn;
777
778 // ask our aggregate
779 if ( m_xTableUIProvider.is() )
780 xReturn = m_xTableUIProvider->getTableIcon( TableName, ColorMode );
781
782 // ask ourself
783 // well, we don't have own functionality here ...
784 // In the future, we might decide to delegate the complete handling to this interface.
785 // In this case, we would need to load the icon here.
786
787 return xReturn;
788}
789
790Reference< XInterface > SAL_CALL OConnection::getTableEditor( const Reference< XDatabaseDocumentUI >& DocumentUI, const OUString& TableName )
791{
792 Reference< XInterface > xReturn;
793
794 // ask our aggregate
795 if ( m_xTableUIProvider.is() )
796 xReturn = m_xTableUIProvider->getTableEditor( DocumentUI, TableName );
797
798 // ask ourself
799 // well, we don't have own functionality here ...
800 // In the future, we might decide to delegate the complete handling to this interface.
801 // In this case, we would need to instantiate a css.sdb.TableDesign here.
802
803 return xReturn;
804}
805
806} // namespace dbaccess
807
808/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
OptionalString sSchema
OptionalString sCatalog
::std::unique_ptr< XmlIdRegistry_Impl > m_pImpl
css::uno::Reference< css::uno::XInterface > m_xParent
Definition: apitools.hxx:33
virtual void SAL_CALL release() noexcept override
Definition: apitools.cxx:46
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type &_rType) override
void setDelegation(css::uno::Reference< css::uno::XAggregation > &_rxProxyConnection, oslInterlockedCount &_rRefCount)
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override
css::uno::Reference< css::sdbc::XConnection > m_xConnection
mutable::osl::Mutex m_aMutex
virtual css::uno::Any SAL_CALL queryInterface(css::uno::Type const &rType) SAL_OVERRIDE
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE
virtual css::uno::Reference< css::sdb::tools::XDataSourceMetaData > SAL_CALL getDataSourceMetaData() override
Definition: connection.cxx:716
virtual void SAL_CALL setParent(const css::uno::Reference< css::uno::XInterface > &Parent) override
Definition: connection.cxx:492
virtual void SAL_CALL close() override
Definition: connection.cxx:97
virtual void SAL_CALL release() noexcept override
Definition: connection.cxx:436
virtual void SAL_CALL disposing() override
Definition: connection.cxx:443
virtual css::uno::Reference< css::uno::XInterface > SAL_CALL createInstance(const OUString &aServiceSpecifier) override
Definition: connection.cxx:617
virtual void SAL_CALL setReadOnly(sal_Bool readOnly) override
Definition: connection.cxx:198
virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getUsers() override
Definition: connection.cxx:675
css::uno::Reference< css::sdbcx::XTablesSupplier > const & getMasterTables()
Definition: connection.cxx:656
virtual css::uno::Reference< css::sdbc::XPreparedStatement > SAL_CALL prepareCall(const OUString &sql) override
Definition: connection.cxx:141
void impl_loadConnectionTools_throw()
loads the XConnectionTools implementation which we forward the respective functionality to
Definition: connection.cxx:693
virtual css::uno::Reference< css::sdb::tools::XTableName > SAL_CALL createTableName() override
Definition: connection.cxx:698
OConnection(ODatabaseSource &_rDB, css::uno::Reference< css::sdbc::XConnection > const &_rxMaster, const css::uno::Reference< css::uno::XComponentContext > &_rxORB)
virtual void SAL_CALL setAutoCommit(sal_Bool autoCommit) override
Definition: connection.cxx:163
virtual css::uno::Reference< css::sdb::XSingleSelectQueryComposer > SAL_CALL getComposer(::sal_Int32 commandType, const OUString &command) override
Definition: connection.cxx:734
virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getFieldsByCommandDescriptor(::sal_Int32 commandType, const OUString &command, css::uno::Reference< css::lang::XComponent > &keepFieldsAlive) override
Definition: connection.cxx:725
::dbtools::WarningsContainer m_aWarnings
Definition: connection.hxx:100
virtual void SAL_CALL setCatalog(const OUString &catalog) override
Definition: connection.cxx:212
void impl_checkTableQueryNames_nothrow()
checks whether or not there are naming conflicts between tables and queries
Definition: connection.cxx:743
virtual sal_Int32 SAL_CALL getTransactionIsolation() override
Definition: connection.cxx:233
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type &rType) override
Definition: connection.cxx:412
virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getTypeMap() override
Definition: connection.cxx:240
virtual css::uno::Reference< css::sdb::XSQLQueryComposer > SAL_CALL createQueryComposer() override
Definition: connection.cxx:498
virtual css::uno::Reference< css::sdbc::XDatabaseMetaData > SAL_CALL getMetaData() override
Definition: connection.cxx:191
css::uno::Reference< css::container::XNameAccess > m_xQueries
Definition: connection.hxx:82
virtual void SAL_CALL commit() override
Definition: connection.cxx:177
css::uno::Reference< css::sdbc::XConnection > m_xMasterConnection
Definition: connection.hxx:89
virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getViews() override
Definition: connection.cxx:566
css::uno::Sequence< OUString > m_aTableTypeFilter
Definition: connection.hxx:87
connectivity::OWeakRefArray m_aComposers
Definition: connection.hxx:83
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
Definition: connection.cxx:77
virtual void SAL_CALL rollback() override
Definition: connection.cxx:184
virtual ~OConnection() override
Definition: connection.cxx:350
virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getParent() override
Definition: connection.cxx:485
virtual void refresh(const css::uno::Reference< css::container::XNameAccess > &_rToBeRefreshed) override
Definition: connection.cxx:519
css::uno::Reference< css::sdb::tools::XConnectionTools > m_xConnectionTools
Definition: connection.hxx:90
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: connection.cxx:82
virtual void SAL_CALL setTypeMap(const css::uno::Reference< css::container::XNameAccess > &typeMap) override
virtual void SAL_CALL clearWarnings() override
Definition: connection.cxx:362
css::uno::Reference< css::sdb::application::XTableUIProvider > m_xTableUIProvider
Definition: connection.hxx:91
std::unique_ptr< OTableContainer > m_pTables
Definition: connection.hxx:98
virtual css::uno::Reference< css::graphic::XGraphic > SAL_CALL getTableIcon(const OUString &TableName, ::sal_Int32 ColorMode) override
Definition: connection.cxx:774
virtual css::uno::Reference< css::sdb::tools::XObjectNames > SAL_CALL getObjectNames() override
Definition: connection.cxx:707
virtual css::uno::Reference< css::sdbc::XPreparedStatement > SAL_CALL prepareCommand(const OUString &command, sal_Int32 commandType) override
Definition: connection.cxx:586
virtual OUString SAL_CALL getCatalog() override
Definition: connection.cxx:219
virtual sal_Bool SAL_CALL getAutoCommit() override
Definition: connection.cxx:170
virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getGroups() override
Definition: connection.cxx:685
TSupportServices m_aSupportServices
Definition: connection.hxx:96
void impl_fillTableFilter()
reads the table filter and table type filter from the datasource
Definition: connection.cxx:509
css::uno::Reference< css::uno::XComponentContext > m_aContext
Definition: connection.hxx:88
virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override
Definition: connection.cxx:406
virtual sal_Bool SAL_CALL isReadOnly() override
Definition: connection.cxx:205
virtual css::uno::Reference< css::sdbc::XStatement > SAL_CALL createStatement() override
Definition: connection.cxx:110
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override
Definition: connection.cxx:388
virtual css::uno::Reference< css::sdbc::XPreparedStatement > SAL_CALL prepareStatement(const OUString &sql) override
Definition: connection.cxx:125
virtual void SAL_CALL acquire() noexcept override
Definition: connection.cxx:430
connectivity::OWeakRefArray m_aStatements
Definition: connection.hxx:80
virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getTables() override
Definition: connection.cxx:556
std::atomic< std::size_t > m_nInAppend
Definition: connection.hxx:101
virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getTableEditor(const css::uno::Reference< css::sdb::application::XDatabaseDocumentUI > &DocumentUI, const OUString &TableName) override
Definition: connection.cxx:790
virtual OUString SAL_CALL getImplementationName() override
Definition: connection.cxx:72
virtual OUString SAL_CALL nativeSQL(const OUString &sql) override
Definition: connection.cxx:156
virtual sal_Bool SAL_CALL isClosed() override
Definition: connection.cxx:103
virtual css::uno::Sequence< OUString > SAL_CALL getAvailableServiceNames() override
Definition: connection.cxx:650
std::unique_ptr< OViewContainer > m_pViews
Definition: connection.hxx:99
virtual css::uno::Reference< css::uno::XInterface > SAL_CALL createInstanceWithArguments(const OUString &ServiceSpecifier, const css::uno::Sequence< css::uno::Any > &Arguments) override
Definition: connection.cxx:645
virtual css::uno::Any SAL_CALL getWarnings() override
Definition: connection.cxx:355
virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getQueries() override
Definition: connection.cxx:577
css::uno::Reference< css::sdbcx::XTablesSupplier > m_xMasterTables
Definition: connection.hxx:79
virtual void SAL_CALL setTransactionIsolation(sal_Int32 level) override
Definition: connection.cxx:226
css::uno::Sequence< OUString > m_aTableFilter
Definition: connection.hxx:86
static rtl::Reference< OQueryContainer > create(const css::uno::Reference< css::container::XNameContainer > &_rxCommandDefinitions, const css::uno::Reference< css::sdbc::XConnection > &_rxConn, const css::uno::Reference< css::uno::XComponentContext > &_rxORB, ::dbtools::WarningsContainer *_pWarnings)
bool supportsSubqueriesInFrom() const
void appendWarning(const OUString &_rWarning, const char *_pAsciiSQLState, const css::uno::Reference< css::uno::XInterface > &_rxContext)
css::uno::Any getWarnings() const
#define DBA_RES(id)
Reference< XComponentContext > m_aContext
#define DBG_UNHANDLED_EXCEPTION(...)
std::mutex m_aMutex
@ Exception
sal_Int32 findValue(const css::uno::Sequence< T1 > &_rList, const T2 &_rValue)
css::uno::Sequence< DstElementType > containerToSequence(const SrcType &i_Container)
std::set< css::uno::Type, UnoTypeLess > TypeBag
Type
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
Reference
void dispose()
constexpr OUStringLiteral PROPERTY_COMMAND(u"Command")
constexpr OUStringLiteral PROPERTY_TABLEFILTER(u"TableFilter")
constexpr OUStringLiteral SERVICE_SDB_CONNECTION
Definition: strings.hxx:174
constexpr OUStringLiteral SERVICE_NAME_SINGLESELECTQUERYCOMPOSER
Definition: strings.hxx:201
constexpr OUStringLiteral PROPERTY_TABLETYPEFILTER(u"TableTypeFilter")
unsigned char sal_Bool