From 544cf2e9b71e18973fd64376791fbc2a6cf2f88f Mon Sep 17 00:00:00 2001 From: Julien Nabet Date: Sat, 22 Jan 2022 11:08:19 +0100 Subject: Mysql/MariaDB: Clean mysqlc_views + remove using Change-Id: I11e1284f9e7589cf4770d723e36c91a84b9b36b3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128761 Tested-by: Jenkins Reviewed-by: Julien Nabet --- .../source/drivers/mysqlc/mysqlc_views.cxx | 55 +++++++++------------- 1 file changed, 23 insertions(+), 32 deletions(-) (limited to 'connectivity') diff --git a/connectivity/source/drivers/mysqlc/mysqlc_views.cxx b/connectivity/source/drivers/mysqlc/mysqlc_views.cxx index 5db17db83c85..53d23235ea29 100644 --- a/connectivity/source/drivers/mysqlc/mysqlc_views.cxx +++ b/connectivity/source/drivers/mysqlc/mysqlc_views.cxx @@ -17,7 +17,6 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include "mysqlc_tables.hxx" #include "mysqlc_views.hxx" #include "mysqlc_view.hxx" #include "mysqlc_catalog.hxx" @@ -25,21 +24,9 @@ #include #include -using namespace ::comphelper; - -using namespace ::cppu; -using namespace connectivity; -using namespace connectivity::mysqlc; -using namespace css::uno; -using namespace css::beans; -using namespace css::sdbcx; -using namespace css::sdbc; -using namespace css::container; -using namespace css::lang; -typedef connectivity::sdbcx::OCollection OCollection_TYPE; - -Views::Views(const Reference& _rxConnection, ::cppu::OWeakObject& _rParent, - ::osl::Mutex& _rMutex, const ::std::vector& _rVector) +connectivity::mysqlc::Views::Views(const css::uno::Reference& _rxConnection, + ::cppu::OWeakObject& _rParent, ::osl::Mutex& _rMutex, + const ::std::vector& _rVector) : sdbcx::OCollection(_rParent, true, _rMutex, _rVector) , m_xConnection(_rxConnection) , m_xMetaData(_rxConnection->getMetaData()) @@ -47,7 +34,7 @@ Views::Views(const Reference& _rxConnection, ::cppu::OWeakObject& _ { } -sdbcx::ObjectType Views::createObject(const OUString& _rName) +connectivity::sdbcx::ObjectType connectivity::mysqlc::Views::createObject(const OUString& _rName) { OUString sCatalog, sSchema, sTable; ::dbtools::qualifiedNameComponents(m_xMetaData, _rName, sCatalog, sSchema, sTable, @@ -55,60 +42,64 @@ sdbcx::ObjectType Views::createObject(const OUString& _rName) return new View(m_xConnection, isCaseSensitive(), sSchema, sTable); } -void Views::impl_refresh() { static_cast(m_rParent).refreshViews(); } +void connectivity::mysqlc::Views::impl_refresh() +{ + static_cast(m_rParent).refreshViews(); +} -void Views::disposing() +void connectivity::mysqlc::Views::disposing() { m_xMetaData.clear(); OCollection::disposing(); } -Reference Views::createDescriptor() +css::uno::Reference connectivity::mysqlc::Views::createDescriptor() { return new connectivity::sdbcx::OView(true, m_xMetaData); } // XAppend -sdbcx::ObjectType Views::appendObject(const OUString& _rForName, - const Reference& descriptor) +connectivity::sdbcx::ObjectType connectivity::mysqlc::Views::appendObject( + const OUString& _rForName, const css::uno::Reference& descriptor) { createView(descriptor); return createObject(_rForName); } // XDrop -void Views::dropObject(sal_Int32 _nPos, const OUString& /*_sElementName*/) +void connectivity::mysqlc::Views::dropObject(sal_Int32 _nPos, const OUString& /*_sElementName*/) { if (m_bInDrop) return; - Reference xObject(getObject(_nPos)); + css::uno::Reference xObject(getObject(_nPos)); bool bIsNew = connectivity::sdbcx::ODescriptor::isNew(xObject); if (!bIsNew) { OUString aSql("DROP VIEW"); - Reference xProp(xObject, UNO_QUERY); + css::uno::Reference xProp(xObject, css::uno::UNO_QUERY); aSql += ::dbtools::composeTableName(m_xMetaData, xProp, ::dbtools::EComposeRule::InTableDefinitions, true); - Reference xConnection = m_xMetaData->getConnection(); - Reference xStmt = xConnection->createStatement(); + css::uno::Reference xConnection = m_xMetaData->getConnection(); + css::uno::Reference xStmt = xConnection->createStatement(); xStmt->execute(aSql); ::comphelper::disposeComponent(xStmt); } } -void Views::dropByNameImpl(const OUString& elementName) +void connectivity::mysqlc::Views::dropByNameImpl(const OUString& elementName) { m_bInDrop = true; - OCollection_TYPE::dropByName(elementName); + connectivity::sdbcx::OCollection::dropByName(elementName); m_bInDrop = false; } -void Views::createView(const Reference& descriptor) +void connectivity::mysqlc::Views::createView( + const css::uno::Reference& descriptor) { - Reference xConnection = m_xMetaData->getConnection(); + css::uno::Reference xConnection = m_xMetaData->getConnection(); OUString sCommand; descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_COMMAND)) @@ -119,7 +110,7 @@ void Views::createView(const Reference& descriptor) ::dbtools::EComposeRule::InTableDefinitions, true) + " AS " + sCommand; - Reference xStmt = xConnection->createStatement(); + css::uno::Reference xStmt = xConnection->createStatement(); if (xStmt.is()) { xStmt->execute(aSql); -- cgit