28#include <com/sun/star/beans/XPropertySet.hpp>
29#include <com/sun/star/sdbc/XConnection.hpp>
43using namespace ::
cppu;
49 ,::osl::Mutex& _rMutex
50 ,
const Reference< XConnection >& _xCon
53 ,std::atomic<std::size_t>& _nInAppend)
55 ,m_bInElementRemoved(false)
64OUString SAL_CALL OViewContainer::getImplementationName()
66 return "com.sun.star.sdb.dbaccess.OViewContainer";
68sal_Bool SAL_CALL OViewContainer::supportsService(
const OUString& _rServiceName)
71 for (
const OUString& s : aSupported)
72 if (s == _rServiceName)
77css::uno::Sequence< OUString > SAL_CALL OViewContainer::getSupportedServiceNames()
97 ::dbtools::EComposeRule::InDataManipulation);
111 Reference< XPropertySet > xRet;
115 if(xDataFactory.is())
116 xRet = xDataFactory->createDataDescriptor();
130 Reference< XPropertySet > xProp = descriptor;
135 xAppend->appendByDescriptor(descriptor);
141 OUString
sComposedName = ::dbtools::composeTableName(
m_xMetaData, descriptor, ::dbtools::EComposeRule::InTableDefinitions,
true );
143 ::dbtools::throwFunctionSequenceException(
static_cast<XTypeProvider*
>(
static_cast<OFilteredContainer*
>(
this)));
148 OUString aSQL =
"CREATE VIEW " +
sComposedName +
" AS " + sCommand;
151 OSL_ENSURE(xCon.is(),
"Connection is null!");
156 xStmt->execute( aSQL );
171 xDrop->dropByName(_sElementName);
188 ::dbtools::throwFunctionSequenceException(
static_cast<XTypeProvider*
>(
static_cast<OFilteredContainer*
>(
this)));
192 OSL_ENSURE(xCon.is(),
"Connection is null!");
195 Reference< XStatement > xStmt = xCon->createStatement( );
197 xStmt->execute(aSql);
198 ::comphelper::disposeComponent(xStmt);
207 if ( ( Event.Accessor >>=
sName )
212 Reference<XPropertySet> xProp(Event.Element,UNO_QUERY);
215 if (
sType ==
"VIEW" )
OptionalString sComposedName
void insertElement(const OUString &_sElementName, const ObjectType &_xElement)
virtual void SAL_CALL dropByName(const OUString &elementName) override
bool isCaseSensitive() const
ObjectType getObject(sal_Int32 _nIndex)
virtual sal_Bool SAL_CALL hasByName(const OUString &aName) override
css::uno::Reference< css::container::XNameAccess > m_xMasterContainer
std::atomic< std::size_t > & m_nInAppend
css::uno::WeakReference< css::sdbc::XConnection > m_xConnection
css::uno::Reference< css::sdbc::XDatabaseMetaData > m_xMetaData
virtual OUString getTableTypeRestriction() const override
returns a string denoting the only type of tables allowed in this container, or an empty string if th...
virtual ::connectivity::sdbcx::ObjectType createObject(const OUString &_rName) override
virtual void SAL_CALL elementReplaced(const css::container::ContainerEvent &Event) override
virtual void dropObject(sal_Int32 _nPos, const OUString &_sElementName) override
virtual void disposing() override
tell the container to free all elements and all additional resources.
virtual connectivity::sdbcx::ObjectType appendObject(const OUString &_rForName, const css::uno::Reference< css::beans::XPropertySet > &descriptor) override
virtual void SAL_CALL elementRemoved(const css::container::ContainerEvent &Event) override
virtual ~OViewContainer() override
virtual void SAL_CALL elementInserted(const css::container::ContainerEvent &Event) override
virtual css::uno::Reference< css::beans::XPropertySet > createDescriptor() override
OUString getString(const Any &_rAny)
css::uno::Sequence< OUString > getSupportedServiceNames()
constexpr OUStringLiteral PROPERTY_COMMAND(u"Command")
constexpr OUStringLiteral SERVICE_SDBCX_CONTAINER
constexpr OUStringLiteral PROPERTY_SCHEMANAME(u"SchemaName")
constexpr OUStringLiteral PROPERTY_CATALOGNAME(u"CatalogName")
constexpr OUStringLiteral PROPERTY_TYPE(u"Type")
constexpr OUStringLiteral PROPERTY_NAME(u"Name")
constexpr OUStringLiteral SERVICE_SDBCX_TABLES