compilerplugins/clang/constantparam.numbers.results | 8 compilerplugins/clang/unusedenumconstants.writeonly.results | 10 compilerplugins/clang/unusedfields.untouched.results | 2 compilerplugins/clang/unusedfields.writeonly.results | 2 compilerplugins/clang/unusedmethods.results | 2 connectivity/Configuration_mork.mk | 20 connectivity/CppunitTest_connectivity_mork.mk | 56 connectivity/Executable_mork_helper.mk | 30 connectivity/IwyuFilter_connectivity.yaml | 9 connectivity/Library_mork.mk | 62 connectivity/Library_mozbootstrap.mk | 35 connectivity/Module_connectivity.mk | 15 connectivity/qa/connectivity/mork/DriverTest.cxx | 195 - connectivity/qa/connectivity/mork/abook_10_john_does.mab | 159 connectivity/registry/mork/org/openoffice/Office/DataAccess/Drivers.xcu | 51 connectivity/source/drivers/mork/MCatalog.cxx | 104 connectivity/source/drivers/mork/MCatalog.hxx | 50 connectivity/source/drivers/mork/MColumnAlias.cxx | 133 connectivity/source/drivers/mork/MColumnAlias.hxx | 70 connectivity/source/drivers/mork/MColumns.cxx | 80 connectivity/source/drivers/mork/MColumns.hxx | 46 connectivity/source/drivers/mork/MConnection.cxx | 377 -- connectivity/source/drivers/mork/MConnection.hxx | 98 connectivity/source/drivers/mork/MDatabaseMetaData.cxx | 959 ----- connectivity/source/drivers/mork/MDatabaseMetaData.hxx | 189 - connectivity/source/drivers/mork/MDatabaseMetaDataHelper.cxx | 123 connectivity/source/drivers/mork/MDatabaseMetaDataHelper.hxx | 37 connectivity/source/drivers/mork/MDriver.cxx | 133 connectivity/source/drivers/mork/MDriver.hxx | 79 connectivity/source/drivers/mork/MErrorResource.hxx | 54 connectivity/source/drivers/mork/MPreparedStatement.cxx | 486 -- connectivity/source/drivers/mork/MPreparedStatement.hxx | 132 connectivity/source/drivers/mork/MQueryHelper.cxx | 321 - connectivity/source/drivers/mork/MQueryHelper.hxx | 182 - connectivity/source/drivers/mork/MResultSet.cxx | 1711 ---------- connectivity/source/drivers/mork/MResultSet.hxx | 347 -- connectivity/source/drivers/mork/MResultSetMetaData.cxx | 192 - connectivity/source/drivers/mork/MResultSetMetaData.hxx | 86 connectivity/source/drivers/mork/MStatement.cxx | 471 -- connectivity/source/drivers/mork/MStatement.hxx | 182 - connectivity/source/drivers/mork/MTable.cxx | 57 connectivity/source/drivers/mork/MTable.hxx | 59 connectivity/source/drivers/mork/MTables.cxx | 66 connectivity/source/drivers/mork/MTables.hxx | 45 connectivity/source/drivers/mork/MorkParser.cxx | 757 ---- connectivity/source/drivers/mork/MorkParser.hxx | 152 connectivity/source/drivers/mork/README | 41 connectivity/source/drivers/mork/dllapi.h | 25 connectivity/source/drivers/mork/license.txt | 31 connectivity/source/drivers/mork/mork.component | 17 connectivity/source/drivers/mork/mork_helper.cxx | 54 connectivity/source/drivers/mozab/bootstrap/MMozillaBootstrap.cxx | 139 connectivity/source/drivers/mozab/bootstrap/MMozillaBootstrap.hxx | 81 connectivity/source/drivers/mozab/bootstrap/MNSFolders.cxx | 159 connectivity/source/drivers/mozab/bootstrap/MNSFolders.hxx | 31 connectivity/source/drivers/mozab/bootstrap/MNSINIParser.cxx | 93 connectivity/source/drivers/mozab/bootstrap/MNSINIParser.hxx | 57 connectivity/source/drivers/mozab/bootstrap/MNSProfileDiscover.cxx | 209 - connectivity/source/drivers/mozab/bootstrap/MNSProfileDiscover.hxx | 80 connectivity/source/drivers/mozab/bootstrap/mozbootstrap.component | 26 extensions/source/abpilot/typeselectionpage.cxx | 3 postprocess/CustomTarget_registry.mk | 6 postprocess/Rdb_services.mk | 7 solenv/clang-format/excludelist | 39 64 files changed, 9532 deletions(-)
New commits: commit ee9ed2192b56c98e5b8ee9890ddb4c533117332a Author: Rene Engelhard <r...@debian.org> AuthorDate: Thu Dec 10 18:39:26 2020 +0100 Commit: Julien Nabet <serval2...@yahoo.fr> CommitDate: Sun Dec 13 17:29:09 2020 +0100 tdf#138715 remove mork driver since TB moved to sqlite Change-Id: Ifddf1a6c9783a294ee9ccfac667c7e798674d7a0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107574 Tested-by: Jenkins Reviewed-by: Tor Lillqvist <t...@collabora.com> Reviewed-by: Julien Nabet <serval2...@yahoo.fr> diff --git a/compilerplugins/clang/constantparam.numbers.results b/compilerplugins/clang/constantparam.numbers.results index 6d9d11c8e5a0..07016070b487 100644 --- a/compilerplugins/clang/constantparam.numbers.results +++ b/compilerplugins/clang/constantparam.numbers.results @@ -102,14 +102,6 @@ connectivity/source/drivers/firebird/Util.hxx:122 class rtl::OUString escapeWith(const class rtl::OUString &,const char,const char) const char aKey 39 -connectivity/source/drivers/mork/MorkParser.hxx:79 - struct MorkTableMap * MorkParser::getTables(int) - int tableScope - 128 -connectivity/source/drivers/mork/MQueryHelper.hxx:169 - _Bool connectivity::mork::MQueryHelper::getRowValue(class connectivity::ORowSetValue &,int,const class rtl::OUString &,int) - int nType - 12 connectivity/source/inc/java/sql/ConnectionLog.hxx:106 void connectivity::java::sql::ConnectionLog::log(const int,const class rtl::OUString &,type-parameter-?-?,type-parameter-?-?,type-parameter-?-?) const const int _nLogLevel diff --git a/compilerplugins/clang/unusedenumconstants.writeonly.results b/compilerplugins/clang/unusedenumconstants.writeonly.results index b8ff65f99e98..3465277daf9a 100644 --- a/compilerplugins/clang/unusedenumconstants.writeonly.results +++ b/compilerplugins/clang/unusedenumconstants.writeonly.results @@ -976,16 +976,6 @@ configmgr/source/access.hxx:442 enum configmgr::Access::(anonymous at /home/noel/libo/configmgr/source/access.hxx:441:5) IS_ANY configmgr/source/partial.hxx:33 enum configmgr::Partial::Containment CONTAINS_SUBNODES -connectivity/source/drivers/mork/MorkParser.hxx:59 - enum MorkErrors NoError -connectivity/source/drivers/mork/MorkParser.hxx:60 - enum MorkErrors FailedToOpen -connectivity/source/drivers/mork/MorkParser.hxx:61 - enum MorkErrors DefectedFormat -connectivity/source/drivers/mork/MorkParser.hxx:143 - enum MorkParser::NP Values -connectivity/source/drivers/mork/MStatement.hxx:99 - enum connectivity::mork::OCommonStatement::StatementType eCreateTable connectivity/source/inc/java/sql/ConnectionLog.hxx:67 enum connectivity::java::sql::ConnectionLog::ObjectType CONNECTION connectivity/source/inc/java/sql/ConnectionLog.hxx:68 diff --git a/compilerplugins/clang/unusedfields.untouched.results b/compilerplugins/clang/unusedfields.untouched.results index ff36b9e4d6b3..17de79de05b5 100644 --- a/compilerplugins/clang/unusedfields.untouched.results +++ b/compilerplugins/clang/unusedfields.untouched.results @@ -12,8 +12,6 @@ chart2/source/inc/ModifyListenerCallBack.hxx:53 chart::ModifyListenerCallBack m_xModifyListener css::uno::Reference<css::util::XModifyListener> comphelper/source/container/enumerablemap.cxx:297 comphelper::(anonymous namespace)::MapEnumeration m_xKeepMapAlive Reference<class com::sun::star::uno::XInterface> -connectivity/source/drivers/mork/MDatabaseMetaData.hxx:28 - connectivity::mork::ODatabaseMetaData m_pMetaDataHelper std::unique_ptr<MDatabaseMetaDataHelper> cppu/source/threadpool/threadpool.cxx:365 _uno_ThreadPool dummy sal_Int32 cppu/source/typelib/typelib.cxx:59 diff --git a/compilerplugins/clang/unusedfields.writeonly.results b/compilerplugins/clang/unusedfields.writeonly.results index 5d16d0717968..2f9e21552c0e 100644 --- a/compilerplugins/clang/unusedfields.writeonly.results +++ b/compilerplugins/clang/unusedfields.writeonly.results @@ -110,8 +110,6 @@ comphelper/source/misc/asyncnotification.cxx:86 comphelper::EventNotifierImpl pKeepThisAlive std::shared_ptr<AsyncEventNotifierAutoJoin> configmgr/source/components.cxx:162 configmgr::Components::WriteThread reference_ rtl::Reference<WriteThread> * -connectivity/source/drivers/mork/MorkParser.hxx:132 - MorkParser error_ enum MorkErrors connectivity/source/inc/calc/CConnection.hxx:51 connectivity::calc::OCalcConnection::CloseVetoButTerminateListener m_pCloseListener std::unique_ptr<utl::CloseVeto> connectivity/source/inc/odbc/OConnection.hxx:54 diff --git a/compilerplugins/clang/unusedmethods.results b/compilerplugins/clang/unusedmethods.results index 34d876877891..83e17844b03d 100644 --- a/compilerplugins/clang/unusedmethods.results +++ b/compilerplugins/clang/unusedmethods.results @@ -56,8 +56,6 @@ connectivity/source/drivers/firebird/Util.hxx:72 short connectivity::firebird::ColumnTypeInfo::getSubType() const connectivity/source/drivers/firebird/Util.hxx:74 const class rtl::OUString & connectivity::firebird::ColumnTypeInfo::getCharacterSet() const -connectivity/source/drivers/mork/mork_helper.cxx:37 - int main(int,char **) connectivity/source/drivers/mysqlc/mysqlc_connection.hxx:176 class rtl::OUString connectivity::mysqlc::OConnection::transFormPreparedStatement(const class rtl::OUString &) connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.hxx:94 diff --git a/connectivity/Configuration_mork.mk b/connectivity/Configuration_mork.mk deleted file mode 100644 index dc36ca83eaa8..000000000000 --- a/connectivity/Configuration_mork.mk +++ /dev/null @@ -1,20 +0,0 @@ -# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- -# -# This file is part of the LibreOffice project. -# -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. -# - -$(eval $(call gb_Configuration_Configuration,driver_mork)) - -$(eval $(call gb_Configuration_add_spool_modules,driver_mork,connectivity/registry/mork,\ - org/openoffice/Office/DataAccess/Drivers-mork.xcu \ -)) - -$(eval $(call gb_Configuration_add_localized_datas,driver_mork,connectivity/registry/mork,\ - org/openoffice/Office/DataAccess/Drivers.xcu \ -)) - -# vim: set noet sw=4 ts=4: diff --git a/connectivity/CppunitTest_connectivity_mork.mk b/connectivity/CppunitTest_connectivity_mork.mk deleted file mode 100644 index 6504adef8d99..000000000000 --- a/connectivity/CppunitTest_connectivity_mork.mk +++ /dev/null @@ -1,56 +0,0 @@ -# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- -# -# This file is part of the LibreOffice project. -# -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. -# - -$(eval $(call gb_CppunitTest_CppunitTest,connectivity_mork)) - -$(eval $(call gb_CppunitTest_set_include,connectivity_mork,\ - -I$(SRCDIR)/connectivity/source/inc \ - -I$(SRCDIR)/connectivity/source/drivers/mork \ - $$(INCLUDE) \ -)) - -$(eval $(call gb_CppunitTest_use_external,connectivity_mork,boost_headers)) - -$(eval $(call gb_CppunitTest_use_sdk_api,connectivity_mork)) - -$(eval $(call gb_CppunitTest_use_ure,connectivity_mork)) -$(eval $(call gb_CppunitTest_use_vcl,connectivity_mork)) - -$(eval $(call gb_CppunitTest_use_sdk_api,connectivity_mork)) - -$(eval $(call gb_CppunitTest_add_exception_objects,connectivity_mork, \ - connectivity/qa/connectivity/mork/DriverTest \ -)) - -$(eval $(call gb_CppunitTest_use_libraries,connectivity_mork, \ - comphelper \ - cppu \ - cppuhelper \ - i18nlangtag \ - mork \ - sal \ - salhelper \ - sb \ - test \ - unotest \ - ucbhelper \ - utl \ -)) - -$(eval $(call gb_CppunitTest_use_components,connectivity_mork,\ - configmgr/source/configmgr \ - i18npool/util/i18npool \ - connectivity/source/drivers/mork/mork \ - ucb/source/core/ucb1 \ - ucb/source/ucp/file/ucpfile1 \ -)) - -$(eval $(call gb_CppunitTest_use_configuration,connectivity_mork)) - -# vim: set noet sw=4 ts=4: diff --git a/connectivity/Executable_mork_helper.mk b/connectivity/Executable_mork_helper.mk deleted file mode 100644 index 2c80a0ad5f4d..000000000000 --- a/connectivity/Executable_mork_helper.mk +++ /dev/null @@ -1,30 +0,0 @@ -# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- -# -# This file is part of the LibreOffice project. -# -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. -# - -$(eval $(call gb_Executable_Executable,mork_helper)) - -$(eval $(call gb_Executable_set_include,mork_helper,\ - -I$(SRCDIR)/connectivity/source/inc \ - $$(INCLUDE) \ -)) - -$(eval $(call gb_Executable_use_sdk_api,mork_helper)) - -$(eval $(call gb_Executable_use_libraries,mork_helper,\ - cppu \ - cppuhelper \ - mork \ - sal \ -)) - -$(eval $(call gb_Executable_add_exception_objects,mork_helper,\ - connectivity/source/drivers/mork/mork_helper \ -)) - -# vim:set noet sw=4 ts=4: diff --git a/connectivity/IwyuFilter_connectivity.yaml b/connectivity/IwyuFilter_connectivity.yaml index 94f4f1d6c1ff..8ce2a6d004bf 100644 --- a/connectivity/IwyuFilter_connectivity.yaml +++ b/connectivity/IwyuFilter_connectivity.yaml @@ -65,15 +65,6 @@ excludelist: - com/sun/star/util/Date.hpp - com/sun/star/util/Time.hpp - com/sun/star/util/DateTime.hpp - connectivity/source/drivers/mork/MorkParser.cxx: - # Needed for std::ifstream - - fstream - connectivity/source/drivers/mork/MDriver.cxx: - # Actually used - - com/sun/star/uno/XComponentContext.hpp - connectivity/source/drivers/mork/MColumnAlias.cxx: - # Needed for indirect dtor - - com/sun/star/container/XHierarchicalNameAccess.hpp connectivity/source/drivers/mysql_jdbc/YDriver.cxx: # Actually used - com/sun/star/uno/XComponentContext.hpp diff --git a/connectivity/Library_mork.mk b/connectivity/Library_mork.mk deleted file mode 100644 index 7c0a89b56a2c..000000000000 --- a/connectivity/Library_mork.mk +++ /dev/null @@ -1,62 +0,0 @@ -# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- -# -# This file is part of the LibreOffice project. -# -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. -# - -$(eval $(call gb_Library_Library,mork)) - -$(eval $(call gb_Library_set_componentfile,mork,connectivity/source/drivers/mork/mork)) - -$(eval $(call gb_Library_add_defs,mork,\ - -DLO_DLLIMPLEMENTATION_MORK \ -)) - -$(eval $(call gb_Library_set_include,mork,\ - -I$(SRCDIR)/connectivity/inc \ - -I$(SRCDIR)/connectivity/source/inc \ - $$(INCLUDE) \ - -I$(WORKDIR)/YaccTarget/connectivity/source/parse \ -)) - -$(eval $(call gb_Library_use_custom_headers,mork,\ - officecfg/registry \ -)) - -$(eval $(call gb_Library_use_external,mork,boost_headers)) - -$(eval $(call gb_Library_use_libraries,mork, \ - comphelper \ - cppu \ - cppuhelper \ - dbtools \ - sal \ - salhelper \ - tl \ - utl \ -)) - -$(eval $(call gb_Library_use_sdk_api,mork)) - -$(eval $(call gb_Library_add_exception_objects,mork, \ - connectivity/source/drivers/mork/MColumns \ - connectivity/source/drivers/mork/MColumnAlias \ - connectivity/source/drivers/mork/MorkParser \ - connectivity/source/drivers/mork/MCatalog \ - connectivity/source/drivers/mork/MConnection \ - connectivity/source/drivers/mork/MDatabaseMetaData \ - connectivity/source/drivers/mork/MDatabaseMetaDataHelper \ - connectivity/source/drivers/mork/MDriver \ - connectivity/source/drivers/mork/MStatement \ - connectivity/source/drivers/mork/MResultSet \ - connectivity/source/drivers/mork/MResultSetMetaData \ - connectivity/source/drivers/mork/MPreparedStatement \ - connectivity/source/drivers/mork/MQueryHelper \ - connectivity/source/drivers/mork/MTable \ - connectivity/source/drivers/mork/MTables \ -)) - -# vim: set noet sw=4 ts=4: diff --git a/connectivity/Library_mozbootstrap.mk b/connectivity/Library_mozbootstrap.mk deleted file mode 100644 index 237726caf8a8..000000000000 --- a/connectivity/Library_mozbootstrap.mk +++ /dev/null @@ -1,35 +0,0 @@ -# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- -# -# This file is part of the LibreOffice project. -# -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. -# - -$(eval $(call gb_Library_Library,mozbootstrap)) - -$(eval $(call gb_Library_set_componentfile,mozbootstrap,connectivity/source/drivers/mozab/bootstrap/mozbootstrap)) - -$(eval $(call gb_Library_set_include,mozbootstrap,\ - -I$(SRCDIR)/connectivity/source/drivers/mozab \ - $$(INCLUDE) \ -)) - -$(eval $(call gb_Library_use_sdk_api,mozbootstrap)) - -$(eval $(call gb_Library_use_libraries,mozbootstrap,\ - comphelper \ - cppu \ - cppuhelper \ - sal \ -)) - -$(eval $(call gb_Library_add_exception_objects,mozbootstrap,\ - connectivity/source/drivers/mozab/bootstrap/MMozillaBootstrap \ - connectivity/source/drivers/mozab/bootstrap/MNSFolders \ - connectivity/source/drivers/mozab/bootstrap/MNSINIParser \ - connectivity/source/drivers/mozab/bootstrap/MNSProfileDiscover \ -)) - -# vim: set noet sw=4 ts=4: diff --git a/connectivity/Module_connectivity.mk b/connectivity/Module_connectivity.mk index 6a5dd926331b..faac5a8827a1 100644 --- a/connectivity/Module_connectivity.mk +++ b/connectivity/Module_connectivity.mk @@ -99,21 +99,6 @@ $(eval $(call gb_Module_add_targets,connectivity,\ )) endif -ifneq (,$(filter DESKTOP,$(BUILD_TYPE))) - -$(eval $(call gb_Module_add_targets,connectivity,\ - Configuration_mork \ - Executable_mork_helper \ - Library_mork \ - Library_mozbootstrap \ -)) - -$(eval $(call gb_Module_add_check_targets,connectivity,\ - CppunitTest_connectivity_mork \ -)) - -endif - ifeq ($(OS),WNT) # "ADO is not available on 64bit" said the commit ifneq ($(CPUNAME),X86_64) diff --git a/connectivity/qa/connectivity/mork/DriverTest.cxx b/connectivity/qa/connectivity/mork/DriverTest.cxx deleted file mode 100644 index bea76fd028dc..000000000000 --- a/connectivity/qa/connectivity/mork/DriverTest.cxx +++ /dev/null @@ -1,195 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - */ - -#include <test/bootstrapfixture.hxx> - -#include <com/sun/star/sdbc/XDriver.hpp> -#include <com/sun/star/sdbc/XRow.hpp> - -using namespace ::com::sun::star::beans; -using namespace ::com::sun::star::sdbc; -using namespace ::com::sun::star::uno; - -namespace connectivity::mork { - - -class MorkDriverTest: public test::BootstrapFixture -{ -public: - MorkDriverTest() : test::BootstrapFixture(false, false) {}; - - void checkAcceptsURL(Reference< XDriver> const & xDriver, const char* url, bool expected); - void test_metadata(); - void test_select_default_all(); - void test_select_list_table_joe_doe_5(); - - virtual void setUp() override; - virtual void tearDown() override; - - CPPUNIT_TEST_SUITE(MorkDriverTest); - - CPPUNIT_TEST(test_metadata); - CPPUNIT_TEST(test_select_default_all); - CPPUNIT_TEST(test_select_list_table_joe_doe_5); - CPPUNIT_TEST_SUITE_END(); - -private: - Reference<XInterface> m_xMorkComponent; - Reference<XConnection> m_xConnection; -}; - -void MorkDriverTest::checkAcceptsURL(Reference< XDriver> const & xDriver, const char* url, bool expected) -{ - bool res = xDriver->acceptsURL(OUString::createFromAscii(url)); - if (res != expected) - { - CPPUNIT_ASSERT_MESSAGE("wrong URL outcome!", true); - } -} - -void MorkDriverTest::setUp() -{ - test::BootstrapFixture::setUp(); - m_xMorkComponent = getMultiServiceFactory()->createInstance("com.sun.star.comp.sdbc.MorkDriver"); - CPPUNIT_ASSERT_MESSAGE("no mork component!", m_xMorkComponent.is()); - - // is this the best way to pass test file through URL? - // may be take a custom Sequence< PropertyValue > route? - OUString url = "sdbc:address:thunderbird:unittest:" + - m_directories.getPathFromSrc("/connectivity/qa/connectivity/mork/abook_10_john_does.mab"); - - Sequence< PropertyValue > info; - Reference< XDriver> xDriver(m_xMorkComponent, UNO_QUERY); - if (!xDriver.is()) - { - CPPUNIT_ASSERT_MESSAGE("cannot connect to mork driver!", xDriver.is()); - } - - // bad - checkAcceptsURL(xDriver, "sdbc:address:macab", false); - checkAcceptsURL(xDriver, "sdbc:mozab:ldap:", false); - checkAcceptsURL(xDriver, "sdbc:mozab:outlook:", false); - checkAcceptsURL(xDriver, "sdbc:mozab:outlookexp:", false); - - // good - checkAcceptsURL(xDriver, "sdbc:mozab:mozilla:", true); - checkAcceptsURL(xDriver, "sdbc:mozab:thunderbird:", true); - checkAcceptsURL(xDriver, "sdbc:address:mozilla:", true); - checkAcceptsURL(xDriver, "sdbc:address:thunderbird:", true); - - m_xConnection = xDriver->connect(url, info); - if (!m_xConnection.is()) - { - CPPUNIT_ASSERT_MESSAGE("cannot connect to address book data source!", m_xConnection.is()); - } -} - -void MorkDriverTest::tearDown() -{ -// how to make dispose() work? -// Reference< css::lang::XComponent >( m_xMorkComponent, UNO_QUERY_THROW )->dispose(); - m_xConnection->close(); - test::BootstrapFixture::tearDown(); -} - -void MorkDriverTest::test_metadata() -{ - Reference< XDatabaseMetaData > xDatabaseMetaData = m_xConnection->getMetaData(); - if (!xDatabaseMetaData.is()) - { - CPPUNIT_ASSERT_MESSAGE("cannot retrieve meta data!", xDatabaseMetaData.is()); - } - - const Any catalog; - const Sequence< OUString > types; - - Reference< XResultSet > xResultSet = - xDatabaseMetaData->getTables(catalog, "%", "%", types); - if (!xResultSet.is()) - { - CPPUNIT_ASSERT_MESSAGE("cannot retrieve tables!", xResultSet.is()); - } - - // TODO: how to access that result set and check the tables? - // it should be 3 tables inside: AddressBook, does_5 and does_10 -} - -void MorkDriverTest::test_select_default_all() -{ - Reference< XPreparedStatement > xStatement = m_xConnection->prepareStatement("select \"E-mail\" from \"AddressBook\" ORDER BY \"E-mail\""); - if (!xStatement.is()) - { - CPPUNIT_ASSERT_MESSAGE("cannot create prepared statement!", xStatement.is()); - } - - Reference< XResultSet > xResultSet = xStatement->executeQuery(); - if (!xResultSet.is()) - { - CPPUNIT_ASSERT_MESSAGE("cannot execute sql statement!", xResultSet.is()); - } - - Reference< XRow > xDelegatorRow(xResultSet, UNO_QUERY); - if (!xDelegatorRow.is()) - { - CPPUNIT_ASSERT_MESSAGE("cannot extract row from result set!", xDelegatorRow.is()); - } - - bool result = xResultSet->first(); - CPPUNIT_ASSERT_MESSAGE("fetch first row failed!", result); - OUString mail = xDelegatorRow->getString(1); - CPPUNIT_ASSERT_EQUAL_MESSAGE("first row is not j...@doe.org!", OUString("j...@doe.org"), mail); - - result = xResultSet->next(); - CPPUNIT_ASSERT_MESSAGE("fetch second row failed!", result); - mail = xDelegatorRow->getString(1); - CPPUNIT_ASSERT_EQUAL_MESSAGE("second row is not j...@doe10.org!", OUString("j...@doe10.org"), mail); - - result = xResultSet->last(); - CPPUNIT_ASSERT_MESSAGE("fetch last row failed!", result); - mail = xDelegatorRow->getString(1); - CPPUNIT_ASSERT_EQUAL_MESSAGE("last row is not j...@doe9.org!", OUString("j...@doe9.org"), mail); - - css::uno::Reference<css::sdbc::XCloseable>( - xStatement, css::uno::UNO_QUERY_THROW)->close(); -} - -void MorkDriverTest::test_select_list_table_joe_doe_5() -{ - Reference< XPreparedStatement > xStatement = m_xConnection->prepareStatement("select \"E-mail\" from \"does_5\" where \"E-mail\" LIKE '%doe5.org' "); - if (!xStatement.is()) - { - CPPUNIT_ASSERT_MESSAGE("cannot create prepared statement!", xStatement.is()); - } - - Reference< XResultSet > xResultSet = xStatement->executeQuery(); - if (!xResultSet.is()) - { - CPPUNIT_ASSERT_MESSAGE("cannot execute sql statement!", xResultSet.is()); - } - - Reference< XRow > xDelegatorRow(xResultSet, UNO_QUERY); - if (!xDelegatorRow.is()) - { - CPPUNIT_ASSERT_MESSAGE("cannot extract row from result set!", xDelegatorRow.is()); - } - - bool result = xResultSet->first(); - CPPUNIT_ASSERT_MESSAGE("fetch first row failed!", result); - OUString mail = xDelegatorRow->getString(1); - CPPUNIT_ASSERT_EQUAL_MESSAGE("last row is not j...@doe5.org!", OUString("j...@doe5.org"), mail); - - css::uno::Reference<css::sdbc::XCloseable>( - xStatement, css::uno::UNO_QUERY_THROW)->close(); -} - -CPPUNIT_TEST_SUITE_REGISTRATION(MorkDriverTest); - -} - -CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/connectivity/qa/connectivity/mork/abook_10_john_does.mab b/connectivity/qa/connectivity/mork/abook_10_john_does.mab deleted file mode 100644 index 41aac4c3e42c..000000000000 --- a/connectivity/qa/connectivity/mork/abook_10_john_does.mab +++ /dev/null @@ -1,159 +0,0 @@ -// <!-- <mdb:mork:z v="1.4"/> --> -< <(a=c)> // (f=iso-8859-1) - (B8=LastModifiedDate)(B9=RecordKey)(BA=AddrCharSet)(BB=LastRecordKey) - (BC=ns:addrbk:db:table:kind:pab)(BD=ListName)(BE=ListNickName) - (BF=ListDescription)(C0=ListTotalAddresses)(C1=LowercaseListName) - (C2=ns:addrbk:db:table:kind:deleted)(C3=_Yahoo)(C4=_MSN) - (C5=_GoogleTalk)(C6=_Skype)(C7=_JabberId)(C8=PreferDisplayName) - (C9=PhotoURI)(CA=PhotoType)(CB=PhotoName)(CC=DbRowID)(CD=_QQ)(CE=_ICQ) - (80=ns:addrbk:db:row:scope:card:all) - (81=ns:addrbk:db:row:scope:list:all) - (82=ns:addrbk:db:row:scope:data:all)(83=FirstName)(84=LastName) - (85=PhoneticFirstName)(86=PhoneticLastName)(87=DisplayName) - (88=NickName)(89=PrimaryEmail)(8A=LowercasePrimaryEmail) - (8B=SecondEmail)(8C=PreferMailFormat)(8D=PopularityIndex) - (8E=AllowRemoteContent)(8F=WorkPhone)(90=HomePhone)(91=FaxNumber) - (92=PagerNumber)(93=CellularNumber)(94=WorkPhoneType)(95=HomePhoneType) - (96=FaxNumberType)(97=PagerNumberType)(98=CellularNumberType) - (99=HomeAddress)(9A=HomeAddress2)(9B=HomeCity)(9C=HomeState) - (9D=HomeZipCode)(9E=HomeCountry)(9F=WorkAddress)(A0=WorkAddress2) - (A1=WorkCity)(A2=WorkState)(A3=WorkZipCode)(A4=WorkCountry) - (A5=JobTitle)(A6=Department)(A7=Company)(A8=_AimScreenName) - (A9=AnniversaryYear)(AA=AnniversaryMonth)(AB=AnniversaryDay) - (AC=SpouseName)(AD=FamilyName)(AE=WebPage1)(AF=WebPage2)(B0=BirthYear) - (B1=BirthMonth)(B2=BirthDay)(B3=Custom1)(B4=Custom2)(B5=Custom3) - (B6=Custom4)(B7=Notes)> - -<(AF=b)(81=John Doe)(82=)(80=0)(83=John)(84=1)(85=Doe)(86=j...@doe.org) - (87=generic)(88=John Doe2)(89=Doe2)(8A=j...@doe2.org)(8B=2)(8C=John Doe3) - (8D=Doe3)(8E=j...@doe3.org)(8F=3)(90=John Doe4)(91=Doe4)(92 - =j...@doe4.org)(93=4)(94=John Doe5)(95=Doe5)(96=j...@doe5.org)(97=5) - (98=John Doe6)(99=Doe6)(9A=j...@doe6.org)(9B=6)(9C=John Doe7)(9D=Doe7) - (9E=j...@doe7.org)(9F=7)(A0=John Doe8)(A1=Doe8)(A2=j...@doe8.org) - (A3=8)(A4=John Doe9)(A5=Doe9)(A6=j...@doe9.org)(A7=9)(A8=John Doe10) - (A9=Doe10)(AA=j...@doe10.org)(AB=10)(AC=a)(AD=Does_5)(AE=does_5)> -{1:^80 {(k^BC:c)(s=9)} - [1:^82(^BB=b)] - [1(^87^81)(^86=)(^C3=)(^A1=)(^AE=)(^C4=)(^C5=)(^B2=)(^A7=)(^9A=)(^B3=) - (^C6=)(^A6=)(^A4=)(^A5=)(^A3=)(^9E=)(^85=)(^B0=)(^8D=0)(^C7=)(^A0=) - (^A2=)(^B7=)(^8C=0)(^B8=0)(^83^83)(^A8=)(^C8=1)(^84^85)(^92=)(^C9=) - (^B6=)(^9D=)(^89^86)(^8E=0)(^AF=)(^CA^87)(^8F=)(^CB=)(^8B=)(^93=) - (^90=)(^CC=1)(^B1=)(^CD=)(^9B=)(^9C=)(^91=)(^B4=)(^9F=)(^99=)(^88=) - (^CE=)(^B5=)(^8A^86)(^B9=1)] - [2(^87^88)(^86=)(^C3=)(^A1=)(^AE=)(^C4=)(^C5=)(^B2=)(^A7=)(^9A=)(^B3=) - (^C6=)(^A6=)(^A4=)(^A5=)(^A3=)(^9E=)(^85=)(^B0=)(^8D=0)(^C7=)(^A0=) - (^A2=)(^B7=)(^8C=0)(^B8=0)(^83^83)(^A8=)(^C8=1)(^84^89)(^92=)(^C9=) - (^B6=)(^9D=)(^89^8A)(^8E=0)(^AF=)(^CA^87)(^8F=)(^CB=)(^8B=)(^93=) - (^90=)(^CC=2)(^B1=)(^CD=)(^9B=)(^9C=)(^91=)(^B4=)(^9F=)(^99=)(^88=) - (^CE=)(^B5=)(^8A^8A)(^B9=2)] - [3(^87^8C)(^86=)(^C3=)(^A1=)(^AE=)(^C4=)(^C5=)(^B2=)(^A7=)(^9A=)(^B3=) - (^C6=)(^A6=)(^A4=)(^A5=)(^A3=)(^9E=)(^85=)(^B0=)(^8D=0)(^C7=)(^A0=) - (^A2=)(^B7=)(^8C=0)(^B8=0)(^83^83)(^A8=)(^C8=1)(^84^8D)(^92=)(^C9=) - (^B6=)(^9D=)(^89^8E)(^8E=0)(^AF=)(^CA^87)(^8F=)(^CB=)(^8B=)(^93=) - (^90=)(^CC=3)(^B1=)(^CD=)(^9B=)(^9C=)(^91=)(^B4=)(^9F=)(^99=)(^88=) - (^CE=)(^B5=)(^8A^8E)(^B9=3)] - [4(^87^90)(^86=)(^C3=)(^A1=)(^AE=)(^C4=)(^C5=)(^B2=)(^A7=)(^9A=)(^B3=) - (^C6=)(^A6=)(^A4=)(^A5=)(^A3=)(^9E=)(^85=)(^B0=)(^8D=0)(^C7=)(^A0=) - (^A2=)(^B7=)(^8C=0)(^B8=0)(^83^83)(^A8=)(^C8=1)(^84^91)(^92=)(^C9=) - (^B6=)(^9D=)(^89^92)(^8E=0)(^AF=)(^CA^87)(^8F=)(^CB=)(^8B=)(^93=) - (^90=)(^CC=4)(^B1=)(^CD=)(^9B=)(^9C=)(^91=)(^B4=)(^9F=)(^99=)(^88=) - (^CE=)(^B5=)(^8A^92)(^B9=4)] - [5(^87^94)(^86=)(^C3=)(^A1=)(^AE=)(^C4=)(^C5=)(^B2=)(^A7=)(^9A=)(^B3=) - (^C6=)(^A6=)(^A4=)(^A5=)(^A3=)(^9E=)(^85=)(^B0=)(^8D=0)(^C7=)(^A0=) - (^A2=)(^B7=)(^8C=0)(^B8=0)(^83^83)(^A8=)(^C8=1)(^84^95)(^92=)(^C9=) - (^B6=)(^9D=)(^89^96)(^8E=0)(^AF=)(^CA^87)(^8F=)(^CB=)(^8B=)(^93=) - (^90=)(^CC=5)(^B1=)(^CD=)(^9B=)(^9C=)(^91=)(^B4=)(^9F=)(^99=)(^88=) - (^CE=)(^B5=)(^8A^96)(^B9=5)] - [6(^87^98)(^86=)(^C3=)(^A1=)(^AE=)(^C4=)(^C5=)(^B2=)(^A7=)(^9A=)(^B3=) - (^C6=)(^A6=)(^A4=)(^A5=)(^A3=)(^9E=)(^85=)(^B0=)(^8D=0)(^C7=)(^A0=) - (^A2=)(^B7=)(^8C=0)(^B8=0)(^83^83)(^A8=)(^C8=1)(^84^99)(^92=)(^C9=) - (^B6=)(^9D=)(^89^9A)(^8E=0)(^AF=)(^CA^87)(^8F=)(^CB=)(^8B=)(^93=) - (^90=)(^CC=6)(^B1=)(^CD=)(^9B=)(^9C=)(^91=)(^B4=)(^9F=)(^99=)(^88=) - (^CE=)(^B5=)(^8A^9A)(^B9=6)] - [7(^87^9C)(^86=)(^C3=)(^A1=)(^AE=)(^C4=)(^C5=)(^B2=)(^A7=)(^9A=)(^B3=) - (^C6=)(^A6=)(^A4=)(^A5=)(^A3=)(^9E=)(^85=)(^B0=)(^8D=0)(^C7=)(^A0=) - (^A2=)(^B7=)(^8C=0)(^B8=0)(^83^83)(^A8=)(^C8=1)(^84^9D)(^92=)(^C9=) - (^B6=)(^9D=)(^89^9E)(^8E=0)(^AF=)(^CA^87)(^8F=)(^CB=)(^8B=)(^93=) - (^90=)(^CC=7)(^B1=)(^CD=)(^9B=)(^9C=)(^91=)(^B4=)(^9F=)(^99=)(^88=) - (^CE=)(^B5=)(^8A^9E)(^B9=7)] - [8(^87^A0)(^86=)(^C3=)(^A1=)(^AE=)(^C4=)(^C5=)(^B2=)(^A7=)(^9A=)(^B3=) - (^C6=)(^A6=)(^A4=)(^A5=)(^A3=)(^9E=)(^85=)(^B0=)(^8D=0)(^C7=)(^A0=) - (^A2=)(^B7=)(^8C=0)(^B8=0)(^83^83)(^A8=)(^C8=1)(^84^A1)(^92=)(^C9=) - (^B6=)(^9D=)(^89^A2)(^8E=0)(^AF=)(^CA^87)(^8F=)(^CB=)(^8B=)(^93=) - (^90=)(^CC=8)(^B1=)(^CD=)(^9B=)(^9C=)(^91=)(^B4=)(^9F=)(^99=)(^88=) - (^CE=)(^B5=)(^8A^A2)(^B9=8)] - [9(^87^A4)(^86=)(^C3=)(^A1=)(^AE=)(^C4=)(^C5=)(^B2=)(^A7=)(^9A=)(^B3=) - (^C6=)(^A6=)(^A4=)(^A5=)(^A3=)(^9E=)(^85=)(^B0=)(^8D=0)(^C7=)(^A0=) - (^A2=)(^B7=)(^8C=0)(^B8=0)(^83^83)(^A8=)(^C8=1)(^84^A5)(^92=)(^C9=) - (^B6=)(^9D=)(^89^A6)(^8E=0)(^AF=)(^CA^87)(^8F=)(^CB=)(^8B=)(^93=) - (^90=)(^CC=9)(^B1=)(^CD=)(^9B=)(^9C=)(^91=)(^B4=)(^9F=)(^99=)(^88=) - (^CE=)(^B5=)(^8A^A6)(^B9=9)] - [A(^87^A8)(^86=)(^C3=)(^A1=)(^AE=)(^C4=)(^C5=)(^B2=)(^A7=)(^9A=)(^B3=) - (^C6=)(^A6=)(^A4=)(^A5=)(^A3=)(^9E=)(^85=)(^B0=)(^8D=0)(^C7=)(^A0=) - (^A2=)(^B7=)(^8C=0)(^B8=0)(^83^83)(^A8=)(^C8=1)(^84^A9)(^92=)(^C9=) - (^B6=)(^9D=)(^89^AA)(^8E=0)(^AF=)(^CA^87)(^8F=)(^CB=)(^8B=)(^93=) - (^90=)(^CC=10)(^B1=)(^CD=)(^9B=)(^9C=)(^91=)(^B4=)(^9F=)(^99=)(^88=) - (^CE=)(^B5=)(^8A^AA)(^B9=a)] - [1:^81(^BD^AD)(^C1^AE)(^BE=)(^BF=)(^C0=0)(^B9=b)]} - -@$${9{@ - -<(B2=c)(B0=Does_10)(B1=does_10)> -{1:^80 {(k^BC:c)(s=9)} - [-2:^81(^BD^B0)(^C1^B1)(^BE=)(^BF=)(^C0=0)(^B9=c)]} -[1:^82(^BB=c)] -@$$}9}@ - -@$${A{@ -< <(a=c)> // (f=iso-8859-1) - (CF=Address1)> -[-1:^81(^BD^AD)(^C1^AE)(^BE=)(^BF=)(^C0=1)(^B9=b)(^CF=1)] -@$$}A}@ - -@$${B{@ -< <(a=c)> // (f=iso-8859-1) - (D0=Address2)> -[-1:^81(^BD^AD)(^C1^AE)(^BE=)(^BF=)(^C0=2)(^B9=b)(^CF=1)(^D0=2)] -@$$}B}@ - -@$${C{@ -< <(a=c)> // (f=iso-8859-1) - (D1=Address3)> -[-1:^81(^BD^AD)(^C1^AE)(^BE=)(^BF=)(^C0=3)(^B9=b)(^CF=1)(^D0=2)(^D1=3)] -@$$}C}@ - -@$${D{@ -< <(a=c)> // (f=iso-8859-1) - (D2=Address4)> -[-1:^81(^BD^AD)(^C1^AE)(^BE=)(^BF=)(^C0=4)(^B9=b)(^CF=1)(^D0=2)(^D1=3) - (^D2=4)] -@$$}D}@ - -@$${E{@ -< <(a=c)> // (f=iso-8859-1) - (D3=Address5)> -[-1:^81(^BD^AD)(^C1^AE)(^BE=)(^BF=)(^C0=5)(^B9=b)(^CF=1)(^D0=2)(^D1=3) - (^D2=4)(^D3=5)] -@$$}E}@ - -@$${F{@ -[-2:^81(^BD^B0)(^C1^B1)(^BE=)(^BF=)(^C0=1)(^B9=c)(^CF=a)] -@$$}F}@ - -@$${10{@ -[-2:^81(^BD^B0)(^C1^B1)(^BE=)(^BF=)(^C0=2)(^B9=c)(^CF=a)(^D0=6)] -@$$}10}@ - -@$${11{@ -[-2:^81(^BD^B0)(^C1^B1)(^BE=)(^BF=)(^C0=3)(^B9=c)(^CF=a)(^D0=6)(^D1=7)] -@$$}11}@ - -@$${12{@ -[-2:^81(^BD^B0)(^C1^B1)(^BE=)(^BF=)(^C0=4)(^B9=c)(^CF=a)(^D0=6)(^D1=7) - (^D2=8)] -@$$}12}@ - -@$${13{@ -[-2:^81(^BD^B0)(^C1^B1)(^BE=)(^BF=)(^C0=5)(^B9=c)(^CF=a)(^D0=6)(^D1=7) - (^D2=8)(^D3=9)] -@$$}13}@ diff --git a/connectivity/registry/mork/org/openoffice/Office/DataAccess/Drivers.xcu b/connectivity/registry/mork/org/openoffice/Office/DataAccess/Drivers.xcu deleted file mode 100644 index 8e559cdf153d..000000000000 --- a/connectivity/registry/mork/org/openoffice/Office/DataAccess/Drivers.xcu +++ /dev/null @@ -1,51 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - --> -<oor:component-data oor:name="Drivers" oor:package="org.openoffice.Office.DataAccess" xmlns:install="http://openoffice.org/2004/installation" xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema"> - <node oor:name="Installed" install:module="mork"> - <node oor:name="sdbc:address:thunderbird:" oor:op="replace"> - <prop oor:name="Driver"> - <value>com.sun.star.comp.sdbc.MorkDriver</value> - </prop> - <prop oor:name="DriverTypeDisplayName" oor:type="xs:string"> - <value xml:lang="en-US">Thunderbird Address Book</value> - </prop> - <node oor:name="Properties"> - <node oor:name="EscapeDateTime" oor:op="replace"> - <prop oor:name="Value" oor:type="xs:boolean"> - <value>true</value> - </prop> - </node> - </node> - <node oor:name="Features"> - <node oor:name="EscapeDateTime" oor:op="replace"> - <prop oor:name="Value" oor:type="xs:boolean"> - <value>true</value> - </prop> - </node> - </node> - <node oor:name="MetaData"> - <node oor:name="SupportsBrowsing" oor:op="replace"> - <prop oor:name="Value" oor:type="xs:boolean"> - <value>true</value> - </prop> - </node> - </node> - </node> - </node> -</oor:component-data> diff --git a/connectivity/source/drivers/mork/MCatalog.cxx b/connectivity/source/drivers/mork/MCatalog.cxx deleted file mode 100644 index 743d1e5ab9c6..000000000000 --- a/connectivity/source/drivers/mork/MCatalog.cxx +++ /dev/null @@ -1,104 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#include "MCatalog.hxx" -#include "MConnection.hxx" -#include "MTables.hxx" - -#include <com/sun/star/sdbc/XRow.hpp> - - -using namespace connectivity::mork; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::sdbc; -using namespace ::com::sun::star::container; - - -OCatalog::OCatalog(OConnection* _pCon) : connectivity::sdbcx::OCatalog(_pCon) - ,m_pConnection(_pCon) -{ -// osl_atomic_increment( &m_refCount ); -// refreshTables(); -// refreshViews(); -// refreshGroups(); -// refreshUsers(); -// osl_atomic_decrement( &m_refCount ); -} - -void OCatalog::refreshTables() -{ - ::std::vector< OUString> aVector; - Sequence< OUString > aTypes { "%" }; - Reference< XResultSet > xResult = m_xMetaData->getTables(Any(), - "%", "%", aTypes); - - if(xResult.is()) - { - Reference< XRow > xRow(xResult,UNO_QUERY); - OUString aName; - while(xResult->next()) - { - aName = xRow->getString(3); - aVector.push_back(aName); - } - } - if(m_pTables) - m_pTables->reFill(aVector); - else - m_pTables.reset( new OTables(m_xMetaData,*this,m_aMutex,aVector) ); -} - -void OCatalog::refreshViews() -{ -} - -void OCatalog::refreshGroups() -{ -} - -void OCatalog::refreshUsers() -{ -} - - -// XTablesSupplier -Reference< XNameAccess > SAL_CALL OCatalog::getTables( ) -{ - ::osl::MutexGuard aGuard(m_aMutex); - checkDisposed(rBHelper.bDisposed); - - try - { - if(!m_pTables || OConnection::getForceLoadTables()) - refreshTables(); - } - catch( const RuntimeException& ) - { - // allowed to leave this method - throw; - } - catch( const Exception& ) - { - // allowed - } - - return m_pTables.get(); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/drivers/mork/MCatalog.hxx b/connectivity/source/drivers/mork/MCatalog.hxx deleted file mode 100644 index 32d6d2b7e216..000000000000 --- a/connectivity/source/drivers/mork/MCatalog.hxx +++ /dev/null @@ -1,50 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ -#ifndef INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_MORK_MCATALOG_HXX -#define INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_MORK_MCATALOG_HXX - -#include <sdbcx/VCatalog.hxx> - -namespace connectivity::mork - { - // please don't name the class the same name as in another namespaces - // some compilers have problems with this task as I noticed on windows - class OConnection; - class OCatalog : public connectivity::sdbcx::OCatalog - { - OConnection* m_pConnection; // used to get the metadata - - public: - // implementation of the pure virtual methods - virtual void refreshTables() override; - virtual void refreshViews() override ; - virtual void refreshGroups() override; - virtual void refreshUsers() override ; - virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getTables( ) override; - public: - explicit OCatalog(OConnection* _pCon); - - OConnection* getConnection() const { return m_pConnection; } - - }; - -} -#endif // INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_MORK_MCATALOG_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/drivers/mork/MColumnAlias.cxx b/connectivity/source/drivers/mork/MColumnAlias.cxx deleted file mode 100644 index b320d8c459e3..000000000000 --- a/connectivity/source/drivers/mork/MColumnAlias.cxx +++ /dev/null @@ -1,133 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#include "MColumnAlias.hxx" - -#include <com/sun/star/container/XHierarchicalNameAccess.hpp> -#include <com/sun/star/container/XNameAccess.hpp> -#include <officecfg/Office/DataAccess.hxx> - -#include <osl/diagnose.h> -#include <sal/log.hxx> - -#include <algorithm> - -using namespace ::connectivity::mork; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::container; - - -OColumnAlias::OColumnAlias( const css::uno::Reference< css::lang::XMultiServiceFactory >& _rxORB ) -{ - static const char* s_pProgrammaticNames[] = - { - "FirstName", - "LastName", - "DisplayName", - "NickName", - "PrimaryEmail", - "SecondEmail", - "PreferMailFormat", - "WorkPhone", - "HomePhone", - "FaxNumber", - "PagerNumber", - "CellularNumber", - "HomeAddress", - "HomeAddress2", - "HomeCity", - "HomeState", - "HomeZipCode", - "HomeCountry", - "WorkAddress", - "WorkAddress2", - "WorkCity", - "WorkState", - "WorkZipCode", - "WorkCountry", - "JobTitle", - "Department", - "Company", - "WebPage1", - "WebPage2", - "BirthYear", - "BirthMonth", - "BirthDay", - "Custom1", - "Custom2", - "Custom3", - "Custom4", - "Notes", - }; - - for ( size_t i = 0; i < SAL_N_ELEMENTS( s_pProgrammaticNames ); ++i ) - m_aAliasMap[ OUString::createFromAscii( s_pProgrammaticNames[i] ) ] = AliasEntry( s_pProgrammaticNames[i], i ); - - initialize( _rxORB ); -} - - -void OColumnAlias::initialize( const css::uno::Reference< css::lang::XMultiServiceFactory >& _rxORB ) -{ - Reference< XNameAccess > xAliasesNode( - officecfg::Office::DataAccess::DriverSettings:: - com_sun_star_comp_sdbc_MozabDriver::ColumnAliases::get( - comphelper::getComponentContext(_rxORB)), - UNO_QUERY_THROW); - const Sequence< OUString > aProgrammaticNames(xAliasesNode->getElementNames()); - for (const auto& rProgrammaticName : aProgrammaticNames) { - OString sAsciiProgrammaticName( - OUStringToOString( - rProgrammaticName, RTL_TEXTENCODING_ASCII_US)); - auto j = std::find_if(m_aAliasMap.begin(), m_aAliasMap.end(), - [&sAsciiProgrammaticName](const AliasMap::value_type& rEntry) { - return rEntry.second.programmaticAsciiName == sAsciiProgrammaticName; }); - if (j != m_aAliasMap.end()) { - OUString sAssignedAlias; - xAliasesNode->getByName(rProgrammaticName) >>= - sAssignedAlias; - if (sAssignedAlias.isEmpty()) { - sAssignedAlias = rProgrammaticName; - } - AliasEntry entry(j->second); - m_aAliasMap.erase(j); - m_aAliasMap[sAssignedAlias] = entry; - } - else { - SAL_WARN( - "connectivity.mork", - "unknown programmatic name " << rProgrammaticName - <<" from configuration"); - } - } -} - - -OString OColumnAlias::getProgrammaticNameOrFallbackToUTF8Alias( const OUString& _rAlias ) const -{ - AliasMap::const_iterator pos = m_aAliasMap.find( _rAlias ); - if ( pos == m_aAliasMap.end() ) - { - OSL_FAIL( "OColumnAlias::getProgrammaticNameOrFallbackToUTF8Alias: no programmatic name for this alias!" ); - return OUStringToOString( _rAlias, RTL_TEXTENCODING_UTF8 ); - } - return pos->second.programmaticAsciiName; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/drivers/mork/MColumnAlias.hxx b/connectivity/source/drivers/mork/MColumnAlias.hxx deleted file mode 100644 index 1482802768ff..000000000000 --- a/connectivity/source/drivers/mork/MColumnAlias.hxx +++ /dev/null @@ -1,70 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - - -#ifndef INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_MORK_MCOLUMNALIAS_HXX -#define INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_MORK_MCOLUMNALIAS_HXX - -#include <unotools/confignode.hxx> - -#include <unordered_map> - -namespace connectivity::mork - { - class OColumnAlias - { - public: - struct AliasEntry - { - OString programmaticAsciiName; - size_t columnPosition; - - AliasEntry() - :programmaticAsciiName() - ,columnPosition( 0 ) - { - } - AliasEntry( const char* _programmaticAsciiName, size_t _columnPosition ) - :programmaticAsciiName( _programmaticAsciiName ) - ,columnPosition( _columnPosition ) - { - } - }; - typedef std::unordered_map< OUString, AliasEntry > AliasMap; - - private: - AliasMap m_aAliasMap; - - public: - explicit OColumnAlias( const css::uno::Reference< css::lang::XMultiServiceFactory > & ); - - OString getProgrammaticNameOrFallbackToUTF8Alias( const OUString& _rAlias ) const; - - AliasMap::const_iterator begin() const { return m_aAliasMap.begin(); } - AliasMap::const_iterator end() const { return m_aAliasMap.end(); } - - - private: - void initialize( const css::uno::Reference< css::lang::XMultiServiceFactory >& _rxORB ); - }; - -} -#endif // INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_MORK_MCOLUMNALIAS_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/drivers/mork/MColumns.cxx b/connectivity/source/drivers/mork/MColumns.cxx deleted file mode 100644 index c9163a6ab96b..000000000000 --- a/connectivity/source/drivers/mork/MColumns.cxx +++ /dev/null @@ -1,80 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#include "MColumns.hxx" -#include <com/sun/star/sdbc/XRow.hpp> -#include <connectivity/sdbcx/VColumn.hxx> - -using namespace connectivity::mork; -using namespace connectivity::sdbcx; -using namespace connectivity; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::sdbc; - - -sdbcx::ObjectType OColumns::createObject(const OUString& _rName) -{ - const Any aCatalog; - const OUString sCatalogName; - const OUString sSchemaName(m_pTable->getSchema()); - const OUString sTableName(m_pTable->getTableName()); - Reference< XResultSet > xResult = m_pTable->getConnection()->getMetaData()->getColumns( - aCatalog, sSchemaName, sTableName, _rName); - - sdbcx::ObjectType xRet; - if(xResult.is()) - { - Reference< XRow > xRow(xResult,UNO_QUERY); - while(xResult->next()) - { - if(xRow->getString(4) == _rName) - { - sal_Int32 nType = xRow->getInt(5); - OUString sTypeName = xRow->getString(6); - sal_Int32 nPrec = xRow->getInt(7); - - OColumn* pRet = new OColumn(_rName, - sTypeName, - xRow->getString(13), - xRow->getString(12), - xRow->getInt(11), - nPrec, - xRow->getInt(9), - nType, - false,false,false,true, - sCatalogName, - sSchemaName, - sTableName); - xRet = pRet; - break; - } - } - } - - return xRet; -} - - -void OColumns::impl_refresh() -{ - m_pTable->refreshColumns(); -} - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/drivers/mork/MColumns.hxx b/connectivity/source/drivers/mork/MColumns.hxx deleted file mode 100644 index fa7a6f03bd8a..000000000000 --- a/connectivity/source/drivers/mork/MColumns.hxx +++ /dev/null @@ -1,46 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#ifndef INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_MORK_MCOLUMNS_HXX -#define INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_MORK_MCOLUMNS_HXX - -#include <connectivity/sdbcx/VCollection.hxx> -#include "MTable.hxx" - -namespace connectivity::mork - { - class OColumns final : public sdbcx::OCollection - { - OTable* m_pTable; - - virtual sdbcx::ObjectType createObject(const OUString& _rName) override; - virtual void impl_refresh() override; - public: - OColumns( OTable* _pTable, - ::osl::Mutex& _rMutex, - const ::std::vector< OUString> &_rVector - ) : sdbcx::OCollection(*_pTable, true, _rMutex, _rVector) - ,m_pTable(_pTable) - {} - }; - -} -#endif // INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_MORK_MCOLUMNS_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/drivers/mork/MConnection.cxx b/connectivity/source/drivers/mork/MConnection.cxx deleted file mode 100644 index 2e1c08d0cdcf..000000000000 --- a/connectivity/source/drivers/mork/MConnection.cxx +++ /dev/null @@ -1,377 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - */ - -#include "MConnection.hxx" -#include "MDriver.hxx" -#include "MDatabaseMetaData.hxx" -#include "MCatalog.hxx" -#include "MPreparedStatement.hxx" -#include "MorkParser.hxx" - -#include <connectivity/dbexception.hxx> -#include <sal/log.hxx> - -#include <strings.hrc> - -#include <com/sun/star/sdbc/TransactionIsolation.hpp> - -using namespace dbtools; - - -using namespace com::sun::star::uno; -using namespace com::sun::star::lang; -using namespace com::sun::star::beans; -using namespace com::sun::star::sdbc; -using namespace com::sun::star::sdbcx; - - -namespace connectivity::mork { - -const int defaultScope = 0x80; - - -OConnection::OConnection(MorkDriver* _pDriver) - :m_xDriver(_pDriver) - ,m_aColumnAlias( _pDriver->getFactory() ) -{ - m_pBook.reset( new MorkParser() ); - m_pHistory.reset( new MorkParser() ); -} - -OConnection::~OConnection() -{ - if(!isClosed()) - close(); - m_pBook.reset(); - m_pHistory.reset(); -} - -void OConnection::construct(const OUString& url) -{ - SAL_INFO("connectivity.mork", "=> OConnection::construct()" ); - // open file - setURL(url); - - // Skip 'sdbc:mozab: part of URL - - sal_Int32 nLen = url.indexOf(':'); - nLen = url.indexOf(':',nLen+1); - OSL_ENSURE( url.startsWith("sdbc:address:"), "OConnection::construct: invalid start of the URI - should never have survived XDriver::acceptsURL!" ); - - OUString aAddrbookURI(url.copy(nLen+1)); - // Get Scheme - nLen = aAddrbookURI.indexOf(':'); - OUString aAddrbookScheme; - if ( nLen == -1 ) - { - // There isn't any subschema: - but could be just subschema - if ( !aAddrbookURI.isEmpty() ) - { - aAddrbookScheme= aAddrbookURI; - } - else - { - SAL_WARN("connectivity.mork", "No subschema given!!!"); - throwGenericSQLException( STR_URI_SYNTAX_ERROR, *this ); - } - } - else - { - aAddrbookScheme = aAddrbookURI.copy(0, nLen); - } - - SAL_INFO("connectivity.mork", "URI = " << aAddrbookURI ); - SAL_INFO("connectivity.mork", "Scheme = " << aAddrbookScheme ); - - OUString abook; - OUString history; - const OUString UNITTEST_URL = "thunderbird:unittest:"; - sal_Int32 unittestIndex = url.indexOf(UNITTEST_URL); - - // production? - if (unittestIndex == -1) - { - OUString path = m_xDriver->getProfilePath(); - SAL_INFO("connectivity.mork", "ProfilePath: " << path); - abook = path + "/abook.mab"; - history = path + "/history.mab"; - SAL_INFO("connectivity.mork", "AdressbookPath (abook): " << abook); - SAL_INFO("connectivity.mork", "AdressbookPath (history): " << history); - } - else - { - abook = aAddrbookURI.replaceFirst(UNITTEST_URL, ""); - SAL_INFO("connectivity.mork", "unit test: " << abook); - } - - OString strPath = OUStringToOString(abook, RTL_TEXTENCODING_UTF8); - - // Open and parse mork file - if (!m_pBook->open(strPath.getStr())) - { - SAL_WARN("connectivity.mork", "Can not parse abook mork file: " << strPath); - const OUString sError( getResources().getResourceStringWithSubstitution( - STR_COULD_NOT_LOAD_FILE, "$filename$", abook)); - ::dbtools::throwGenericSQLException( sError, *this ); - } - - // read history only in production - if (unittestIndex == -1) - { - strPath = OUStringToOString(history, RTL_TEXTENCODING_UTF8); - if (!m_pHistory->open(strPath.getStr())) - { - SAL_WARN("connectivity.mork", "Can not parse history mork file: " << strPath); - const OUString sError( getResources().getResourceStringWithSubstitution( - STR_COULD_NOT_LOAD_FILE, "$filename$", history)); - ::dbtools::throwGenericSQLException( sError, *this ); - } - } - - // check that we can retrieve the tables: - MorkTableMap *Tables = m_pBook->getTables( defaultScope ); - if (Tables) - { - // Iterate all tables - for ( const auto& rEntry : Tables->map ) - { - if ( 0 == rEntry.first ) continue; - SAL_INFO("connectivity.mork", "table->first : " << rEntry.first); - } - } - // check that we can retrieve the history tables: - MorkTableMap *Tables_hist = m_pHistory->getTables( defaultScope ); - if (Tables_hist) - { - // Iterate all tables - for ( const auto& rEntry : Tables_hist->map ) - { - if ( 0 == rEntry.first ) continue; - SAL_INFO("connectivity.mork", "table->first : " << rEntry.first); - } - } -} - -// XServiceInfo - -IMPLEMENT_SERVICE_INFO(OConnection, "com.sun.star.sdbc.drivers.mork.OConnection", "com.sun.star.sdbc.Connection") - - -Reference< XStatement > SAL_CALL OConnection::createStatement( ) -{ - SAL_INFO("connectivity.mork", "=> OConnection::createStatement()" ); - - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OConnection_BASE::rBHelper.bDisposed); - - // create a statement - // the statement can only be executed once - Reference< XStatement > xReturn = new OStatement(this); - m_aStatements.push_back(WeakReferenceHelper(xReturn)); - return xReturn; -} - -Reference< XPreparedStatement > SAL_CALL OConnection::prepareStatement( const OUString& _sSql ) -{ - SAL_INFO("connectivity.mork", "=> OConnection::prepareStatement()" ); - SAL_INFO("connectivity.mork", "OConnection::prepareStatement( " << _sSql << " )"); - - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OConnection_BASE::rBHelper.bDisposed); - - // the pre - // create a statement - // the statement can only be executed more than once - OPreparedStatement* pPrepared = new OPreparedStatement(this,_sSql); - Reference< XPreparedStatement > xReturn = pPrepared; - pPrepared->lateInit(); - - m_aStatements.push_back(WeakReferenceHelper(xReturn)); - return xReturn; -} - -Reference< XPreparedStatement > SAL_CALL OConnection::prepareCall( const OUString& _sSql ) -{ - SAL_INFO("connectivity.mork", "=> OConnection::prepareCall()" ); - SAL_INFO("connectivity.mork", "sql: " << _sSql); - ::dbtools::throwFeatureNotImplementedSQLException( "XConnection::prepareCall", *this ); - SAL_INFO("connectivity.mork", "OConnection::prepareCall( " << _sSql << " )"); - return nullptr; -} - -OUString SAL_CALL OConnection::nativeSQL( const OUString& _sSql ) -{ - SAL_INFO("connectivity.mork", "=> OConnection::nativeSQL()" ); - SAL_INFO("connectivity.mork", "sql: " << _sSql); - - ::osl::MutexGuard aGuard( m_aMutex ); - // when you need to transform SQL92 to you driver specific you can do it here - SAL_INFO("connectivity.mork", "OConnection::nativeSQL(" << _sSql << " )" ); - - return _sSql; -} - -void SAL_CALL OConnection::setAutoCommit( sal_Bool /*autoCommit*/ ) -{ - ::dbtools::throwFeatureNotImplementedSQLException( "XConnection::setAutoCommit", *this ); -} - -sal_Bool SAL_CALL OConnection::getAutoCommit( ) -{ - // you have to distinguish which if you are in autocommit mode or not - // at normal case true should be fine here - - return true; -} - -void SAL_CALL OConnection::commit( ) -{ - // when you database does support transactions you should commit here -} - -void SAL_CALL OConnection::rollback( ) -{ - // same as commit but for the other case -} - -sal_Bool SAL_CALL OConnection::isClosed( ) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - // just simple -> we are close when we are disposed that means someone called dispose(); (XComponent) - return OConnection_BASE::rBHelper.bDisposed; -} - -Reference< XDatabaseMetaData > SAL_CALL OConnection::getMetaData( ) -{ - SAL_INFO("connectivity.mork", "=> OConnection::getMetaData()" ); - - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OConnection_BASE::rBHelper.bDisposed); - - // here we have to create the class with biggest interface - // The answer is 42 :-) - Reference< XDatabaseMetaData > xMetaData = m_xMetaData; - if(!xMetaData.is()) - { - xMetaData = new ODatabaseMetaData(this); // need the connection because it can return it - m_xMetaData = xMetaData; - } - - return xMetaData; -} - -void SAL_CALL OConnection::setReadOnly( sal_Bool /*readOnly*/ ) -{ - ::dbtools::throwFeatureNotImplementedSQLException( "XConnection::setReadOnly", *this ); -} - -sal_Bool SAL_CALL OConnection::isReadOnly( ) -{ - // return if your connection to readonly - return false; -} - -void SAL_CALL OConnection::setCatalog( const OUString& /*catalog*/ ) -{ - ::dbtools::throwFeatureNotImplementedSQLException( "XConnection::setCatalog", *this ); -} - -OUString SAL_CALL OConnection::getCatalog( ) -{ - return OUString(); -} - -void SAL_CALL OConnection::setTransactionIsolation( sal_Int32 /*level*/ ) -{ - ::dbtools::throwFeatureNotImplementedSQLException( "XConnection::setTransactionIsolation", *this ); -} - -sal_Int32 SAL_CALL OConnection::getTransactionIsolation( ) -{ - // please have a look at @see com.sun.star.sdbc.TransactionIsolation - return TransactionIsolation::NONE; -} - -Reference< css::container::XNameAccess > SAL_CALL OConnection::getTypeMap( ) -{ - // if your driver has special database types you can return it here - return nullptr; -} - -void SAL_CALL OConnection::setTypeMap( const Reference< css::container::XNameAccess >& /*typeMap*/ ) -{ - ::dbtools::throwFeatureNotImplementedSQLException( "XConnection::setTypeMap", *this ); -} - -// XCloseable -void SAL_CALL OConnection::close( ) -{ - // we just dispose us - { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OConnection_BASE::rBHelper.bDisposed); - - } - dispose(); -} - -// XWarningsSupplier -Any SAL_CALL OConnection::getWarnings( ) -{ - // when you collected some warnings -> return it - return Any(); -} - -void SAL_CALL OConnection::clearWarnings( ) -{ - // you should clear your collected warnings here -} - -void OConnection::disposing() -{ - // we noticed that we should be destroyed in near future so we have to dispose our statements - ::osl::MutexGuard aGuard(m_aMutex); - m_xCatalog.clear(); -} - -Reference< XTablesSupplier > OConnection::createCatalog() -{ - ::osl::MutexGuard aGuard( m_aMutex ); - Reference< XTablesSupplier > xTab = m_xCatalog; - if(!m_xCatalog.is()) - { - OCatalog *pCat = new OCatalog(this); - xTab = pCat; - m_xCatalog = xTab; - } - return xTab; -} - -void OConnection::throwSQLException( const ErrorDescriptor& _rError, const Reference< XInterface >& _rxContext ) -{ - if (_rError.getResId() != nullptr) - { - throwGenericSQLException( _rError.getResId(), _rxContext ); - OSL_FAIL( "OConnection::throwSQLException: unreachable (2)!" ); - } - - throwGenericSQLException( STR_UNSPECIFIED_ERROR, _rxContext ); -} - -void OConnection::throwSQLException( const char* pErrorResourceId, const Reference< XInterface >& _rxContext ) -{ - ErrorDescriptor aError; - aError.setResId(pErrorResourceId); - throwSQLException(aError, _rxContext); -} - -} // namespace connectivity::mork - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/drivers/mork/MConnection.hxx b/connectivity/source/drivers/mork/MConnection.hxx deleted file mode 100644 index 67511b891d84..000000000000 --- a/connectivity/source/drivers/mork/MConnection.hxx +++ /dev/null @@ -1,98 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - */ - -#ifndef INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_MORK_MCONNECTION_HXX -#define INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_MORK_MCONNECTION_HXX - -#include <TConnection.hxx> -#include "MColumnAlias.hxx" - -#include <rtl/ref.hxx> - -#include <com/sun/star/sdbcx/XTablesSupplier.hpp> - -// do we want here namespace too? -class MorkParser; - -namespace connectivity::mork - { - class MorkDriver; - class ErrorDescriptor; - - typedef connectivity::OMetaConnection OConnection_BASE; // implements basics and text encoding - - class OConnection final : public OConnection_BASE - { - // Data attributes - - rtl::Reference<MorkDriver> m_xDriver; // Pointer to the owning - // driver object - OColumnAlias m_aColumnAlias; - // Mork Parser (abook) - std::unique_ptr<MorkParser> m_pBook; - // Mork Parser (history) - std::unique_ptr<MorkParser> m_pHistory; - // Store Catalog - css::uno::Reference< css::sdbcx::XTablesSupplier> m_xCatalog; - - public: - /// @throws css::sdbc::SQLException - void construct( const OUString& url); - explicit OConnection(MorkDriver* const driver); - virtual ~OConnection() override; - - const rtl::Reference<MorkDriver>& getDriver() const {return m_xDriver;}; - MorkParser* getMorkParser(std::string_view t) {return t == "CollectedAddressBook" ? m_pHistory.get() : m_pBook.get();}; - - // OComponentHelper - virtual void SAL_CALL disposing() override; - - // XServiceInfo - DECLARE_SERVICE_INFO(); - // XConnection - virtual css::uno::Reference< css::sdbc::XStatement > SAL_CALL createStatement( ) override; - virtual css::uno::Reference< css::sdbc::XPreparedStatement > SAL_CALL prepareStatement( const OUString& sql ) override; - virtual css::uno::Reference< css::sdbc::XPreparedStatement > SAL_CALL prepareCall( const OUString& sql ) override; - virtual OUString SAL_CALL nativeSQL( const OUString& sql ) override; - virtual void SAL_CALL setAutoCommit( sal_Bool autoCommit ) override; - virtual sal_Bool SAL_CALL getAutoCommit( ) override; - virtual void SAL_CALL commit( ) override; - virtual void SAL_CALL rollback( ) override; - virtual sal_Bool SAL_CALL isClosed( ) override; - virtual css::uno::Reference< css::sdbc::XDatabaseMetaData > SAL_CALL getMetaData( ) override; - virtual void SAL_CALL setReadOnly( sal_Bool readOnly ) override; - virtual sal_Bool SAL_CALL isReadOnly( ) override; - virtual void SAL_CALL setCatalog( const OUString& catalog ) override; - virtual OUString SAL_CALL getCatalog( ) override; - virtual void SAL_CALL setTransactionIsolation( sal_Int32 level ) override; - virtual sal_Int32 SAL_CALL getTransactionIsolation( ) override; - virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getTypeMap( ) override; - virtual void SAL_CALL setTypeMap( const css::uno::Reference< css::container::XNameAccess >& typeMap ) override; - // XCloseable - virtual void SAL_CALL close( ) override; - // XWarningsSupplier - virtual css::uno::Any SAL_CALL getWarnings( ) override; - virtual void SAL_CALL clearWarnings() override; - - const OColumnAlias & getColumnAlias() const { return m_aColumnAlias; } - - static bool getForceLoadTables() {return true;} - - // Added to enable me to use SQLInterpreter which requires an - // XNameAccess i/f to access tables. - css::uno::Reference< css::sdbcx::XTablesSupplier > createCatalog(); - - void throwSQLException( const ErrorDescriptor& _rError, const css::uno::Reference< css::uno::XInterface >& _rxContext ); - void throwSQLException( const char* pErrorResourceId, const css::uno::Reference< css::uno::XInterface >& _rxContext ); - }; - -} -#endif // INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_MORK_MCONNECTION_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/drivers/mork/MDatabaseMetaData.cxx b/connectivity/source/drivers/mork/MDatabaseMetaData.cxx deleted file mode 100644 index 959494095b9f..000000000000 --- a/connectivity/source/drivers/mork/MDatabaseMetaData.cxx +++ /dev/null @@ -1,959 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - */ - -#include "MConnection.hxx" -#include "MDatabaseMetaData.hxx" - -#include <com/sun/star/sdbc/TransactionIsolation.hpp> -#include <com/sun/star/sdbc/ColumnSearch.hpp> -#include <sal/log.hxx> - -#include <string_view> -#include <vector> - -#include "MDatabaseMetaDataHelper.hxx" - -using namespace connectivity::mork; -using namespace connectivity; - -using namespace com::sun::star::uno; -using namespace com::sun::star::sdbc; - - -namespace connectivity::mork -{ - sal_Int32 const s_nCOLUMN_SIZE = 256; - sal_Int32 const s_nDECIMAL_DIGITS = 0; - sal_Int32 const s_nNULLABLE = 1; - sal_Int32 const s_nCHAR_OCTET_LENGTH = 65535; -} - -ODatabaseMetaData::ODatabaseMetaData(OConnection* _pCon) - : ::connectivity::ODatabaseMetaDataBase(_pCon,_pCon->getConnectionInfo()) - ,m_pConnection(_pCon) - ,m_pMetaDataHelper(new MDatabaseMetaDataHelper) -{ - OSL_ENSURE(m_pConnection,"ODatabaseMetaData::ODatabaseMetaData: No connection set!"); -} - -ODatabaseMetaData::~ODatabaseMetaData() -{ -} - - -ODatabaseMetaDataResultSet::ORows ODatabaseMetaData::getColumnRows( - const OUString& tableNamePattern, - const OUString& columnNamePattern ) -{ - SAL_INFO("connectivity.mork", "=> ODatabaseMetaData::getColumnRows()" ); - SAL_INFO("connectivity.mork", "tableNamePattern: " << tableNamePattern); - SAL_INFO("connectivity.mork", "columnNamePattern: " << columnNamePattern); - - ODatabaseMetaDataResultSet::ORows aRows; - ODatabaseMetaDataResultSet::ORow aRow(19); - - ::osl::MutexGuard aGuard( m_aMutex ); - std::vector< OUString > tables; - connectivity::mork::MDatabaseMetaDataHelper::getTableStrings(m_pConnection, tables); - - // **************************************************** - // Some entries in a row never change, so set them now - // **************************************************** - - // Catalog - aRow[1] = new ORowSetValueDecorator(OUString()); - // Schema - aRow[2] = new ORowSetValueDecorator(OUString()); - // DATA_TYPE - aRow[5] = new ORowSetValueDecorator(static_cast<sal_Int16>(DataType::VARCHAR)); - // TYPE_NAME, not used - aRow[6] = new ORowSetValueDecorator(OUString("VARCHAR")); - // COLUMN_SIZE - aRow[7] = new ORowSetValueDecorator(s_nCOLUMN_SIZE); - // BUFFER_LENGTH, not used - aRow[8] = ODatabaseMetaDataResultSet::getEmptyValue(); - // DECIMAL_DIGITS. - aRow[9] = new ORowSetValueDecorator(s_nDECIMAL_DIGITS); - // NUM_PREC_RADIX - aRow[10] = new ORowSetValueDecorator(sal_Int32(10)); - // NULLABLE - aRow[11] = new ORowSetValueDecorator(s_nNULLABLE); - // REMARKS - aRow[12] = ODatabaseMetaDataResultSet::getEmptyValue(); - // COULUMN_DEF, not used - aRow[13] = ODatabaseMetaDataResultSet::getEmptyValue(); - // SQL_DATA_TYPE, not used - aRow[14] = ODatabaseMetaDataResultSet::getEmptyValue(); - // SQL_DATETIME_SUB, not used - aRow[15] = ODatabaseMetaDataResultSet::getEmptyValue(); - // CHAR_OCTET_LENGTH, refer to [5] - aRow[16] = new ORowSetValueDecorator(s_nCHAR_OCTET_LENGTH); - // IS_NULLABLE - aRow[18] = new ORowSetValueDecorator(OUString("YES")); - - // Iterate over all tables - for(const OUString & table : tables) { - if(match(tableNamePattern, table,'\0')) { - // TABLE_NAME - aRow[3] = new ORowSetValueDecorator( table ); - - const OColumnAlias& colNames = m_pConnection->getColumnAlias(); - - SAL_INFO("connectivity.mork", "\tTableName = : " << table); - // Iterate over all columns in the table. - for (const auto& [rName, rAlias] : colNames) - { - if ( match( columnNamePattern, rName, '\0' ) ) - { - SAL_INFO("connectivity.mork", "\t\tColumnNam : " << rName); - - // COLUMN_NAME - aRow[4] = new ORowSetValueDecorator( rName ); - // ORDINAL_POSITION - aRow[17] = new ORowSetValueDecorator( static_cast< sal_Int32 >( rAlias.columnPosition ) + 1 ); - aRows.push_back(aRow); - } - } - } - } - return aRows; -} - -OUString ODatabaseMetaData::impl_getCatalogSeparator_throw( ) -{ - return OUString(); -} - -sal_Int32 SAL_CALL ODatabaseMetaData::getMaxBinaryLiteralLength( ) -{ - return 65535; // 0 means no limit -} - -sal_Int32 SAL_CALL ODatabaseMetaData::getMaxRowSize( ) -{ - return 0; // 0 means no limit -} - -sal_Int32 SAL_CALL ODatabaseMetaData::getMaxCatalogNameLength( ) -{ - return 0; // 0 means no limit -} - -sal_Int32 SAL_CALL ODatabaseMetaData::getMaxCharLiteralLength( ) -{ - return 254; // 0 means no limit -} - -sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnNameLength( ) -{ - return 20; // 0 means no limit -} - -sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInIndex( ) -{ - return 0; // 0 means no limit -} - -sal_Int32 SAL_CALL ODatabaseMetaData::getMaxCursorNameLength( ) -{ - return 0; // 0 means no limit -} - -sal_Int32 SAL_CALL ODatabaseMetaData::getMaxConnections( ) -{ - return 0; // 0 means no limit -} - -sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInTable( ) -{ - return 0; // 0 means no limit -} - -sal_Int32 ODatabaseMetaData::impl_getMaxStatements_throw( ) -{ - return 0; -} - -sal_Int32 SAL_CALL ODatabaseMetaData::getMaxTableNameLength( ) -{ - return 0; // 0 means no limit -} - -sal_Int32 ODatabaseMetaData::impl_getMaxTablesInSelect_throw( ) -{ - // We only support a single table - return 1; -} - - -sal_Bool SAL_CALL ODatabaseMetaData::doesMaxRowSizeIncludeBlobs( ) -{ - return false; -} - -sal_Bool SAL_CALL ODatabaseMetaData::storesLowerCaseQuotedIdentifiers( ) -{ - return false; -} - -sal_Bool SAL_CALL ODatabaseMetaData::storesLowerCaseIdentifiers( ) -{ - return false; -} - -bool ODatabaseMetaData::impl_storesMixedCaseQuotedIdentifiers_throw( ) -{ - return false; -} - -sal_Bool SAL_CALL ODatabaseMetaData::storesMixedCaseIdentifiers( ) -{ - return false; -} - -sal_Bool SAL_CALL ODatabaseMetaData::storesUpperCaseQuotedIdentifiers( ) -{ - return false; -} - -sal_Bool SAL_CALL ODatabaseMetaData::storesUpperCaseIdentifiers( ) -{ - return false; -} - -bool ODatabaseMetaData::impl_supportsAlterTableWithAddColumn_throw( ) -{ - return false; -} - -bool ODatabaseMetaData::impl_supportsAlterTableWithDropColumn_throw( ) -{ - return false; -} - -sal_Int32 SAL_CALL ODatabaseMetaData::getMaxIndexLength( ) -{ - return 0; // 0 means no limit -} - -sal_Bool SAL_CALL ODatabaseMetaData::supportsNonNullableColumns( ) -{ - return false; -} - -OUString SAL_CALL ODatabaseMetaData::getCatalogTerm( ) -{ - return OUString(); -} - -OUString ODatabaseMetaData::impl_getIdentifierQuoteString_throw( ) -{ - // normally this is " - return "\""; -} - -OUString SAL_CALL ODatabaseMetaData::getExtraNameCharacters( ) -{ - return OUString(); -} - -sal_Bool SAL_CALL ODatabaseMetaData::supportsDifferentTableCorrelationNames( ) -{ - return true; -} - -bool ODatabaseMetaData::impl_isCatalogAtStart_throw( ) -{ - return true; -} - -sal_Bool SAL_CALL ODatabaseMetaData::dataDefinitionIgnoredInTransactions( ) -{ - return true; -} - -sal_Bool SAL_CALL ODatabaseMetaData::dataDefinitionCausesTransactionCommit( ) -{ - return true; -} - -sal_Bool SAL_CALL ODatabaseMetaData::supportsDataManipulationTransactionsOnly( ) -{ - //We support create table - return false; -} - -sal_Bool SAL_CALL ODatabaseMetaData::supportsDataDefinitionAndDataManipulationTransactions( ) -{ - return false; -} - -sal_Bool SAL_CALL ODatabaseMetaData::supportsPositionedDelete( ) -{ - return false; -} - -sal_Bool SAL_CALL ODatabaseMetaData::supportsPositionedUpdate( ) -{ - return false; -} - -sal_Bool SAL_CALL ODatabaseMetaData::supportsOpenStatementsAcrossRollback( ) -{ - return false; -} - -sal_Bool SAL_CALL ODatabaseMetaData::supportsOpenStatementsAcrossCommit( ) -{ - return false; -} - -sal_Bool SAL_CALL ODatabaseMetaData::supportsOpenCursorsAcrossCommit( ) -{ - return false; -} - -sal_Bool SAL_CALL ODatabaseMetaData::supportsOpenCursorsAcrossRollback( ) -{ - return false; -} - -sal_Bool SAL_CALL ODatabaseMetaData::supportsTransactionIsolationLevel( sal_Int32 /*level*/ ) -{ - return false; -} - -bool ODatabaseMetaData::impl_supportsSchemasInDataManipulation_throw( ) -{ - return false; -} - -sal_Bool SAL_CALL ODatabaseMetaData::supportsANSI92FullSQL( ) -{ - return false; -} - -sal_Bool SAL_CALL ODatabaseMetaData::supportsANSI92EntryLevelSQL( ) -{ - return true; // should be supported at least -} - -sal_Bool SAL_CALL ODatabaseMetaData::supportsIntegrityEnhancementFacility( ) -{ - return false; -} - -sal_Bool SAL_CALL ODatabaseMetaData::supportsSchemasInIndexDefinitions( ) -{ - return false; -} - -bool ODatabaseMetaData::impl_supportsSchemasInTableDefinitions_throw( ) -{ - return false; -} - -bool ODatabaseMetaData::impl_supportsCatalogsInTableDefinitions_throw( ) -{ - return false; -} - -sal_Bool SAL_CALL ODatabaseMetaData::supportsCatalogsInIndexDefinitions( ) -{ - return false; -} - -bool ODatabaseMetaData::impl_supportsCatalogsInDataManipulation_throw( ) -{ - return false; -} - -sal_Bool SAL_CALL ODatabaseMetaData::supportsOuterJoins( ) -{ - return false; -} - -sal_Int32 SAL_CALL ODatabaseMetaData::getMaxStatementLength( ) -{ - return 0;// 0 means no limit -} - -sal_Int32 SAL_CALL ODatabaseMetaData::getMaxProcedureNameLength( ) -{ - return 0; // 0 means no limit -} - -sal_Int32 SAL_CALL ODatabaseMetaData::getMaxSchemaNameLength( ) -{ - return 0; // 0 means no limit -} - -sal_Bool SAL_CALL ODatabaseMetaData::supportsTransactions( ) -{ - return false; -} - -sal_Bool SAL_CALL ODatabaseMetaData::allProceduresAreCallable( ) -{ - return false; -} - -sal_Bool SAL_CALL ODatabaseMetaData::supportsStoredProcedures( ) -{ - return false; -} - -sal_Bool SAL_CALL ODatabaseMetaData::supportsSelectForUpdate( ) -{ - return false; -} - -sal_Bool SAL_CALL ODatabaseMetaData::allTablesAreSelectable( ) -{ - // We allow you to select from any table. - return true; -} - -sal_Bool SAL_CALL ODatabaseMetaData::isReadOnly( ) -{ - //we support insert/update/delete now - //But we have to set this to return sal_True otherwise the UI will add create "table/edit table" - //entry to the popup menu. We should avoid them. - return true; -} - -sal_Bool SAL_CALL ODatabaseMetaData::usesLocalFiles( ) -{ - return false; -} - -sal_Bool SAL_CALL ODatabaseMetaData::usesLocalFilePerTable( ) -{ - return false; -} - -sal_Bool SAL_CALL ODatabaseMetaData::supportsTypeConversion( ) -{ - return false; -} - -sal_Bool SAL_CALL ODatabaseMetaData::nullPlusNonNullIsNull( ) -{ - return false; -} - -sal_Bool SAL_CALL ODatabaseMetaData::supportsColumnAliasing( ) -{ - // Support added for this. - return true; -} - -sal_Bool SAL_CALL ODatabaseMetaData::supportsTableCorrelationNames( ) -{ - return false; -} - -sal_Bool SAL_CALL ODatabaseMetaData::supportsConvert( sal_Int32 /*fromType*/, sal_Int32 /*toType*/ ) -{ - return false; -} - -sal_Bool SAL_CALL ODatabaseMetaData::supportsExpressionsInOrderBy( ) -{ - return false; -} - -sal_Bool SAL_CALL ODatabaseMetaData::supportsGroupBy( ) -{ - return false; -} - -sal_Bool SAL_CALL ODatabaseMetaData::supportsGroupByBeyondSelect( ) -{ - return false; -} - -sal_Bool SAL_CALL ODatabaseMetaData::supportsGroupByUnrelated( ) -{ - return false; -} - -sal_Bool SAL_CALL ODatabaseMetaData::supportsMultipleTransactions( ) -{ - return false; -} - -sal_Bool SAL_CALL ODatabaseMetaData::supportsMultipleResultSets( ) -{ - return false; -} - -sal_Bool SAL_CALL ODatabaseMetaData::supportsLikeEscapeClause( ) -{ - return false; -} - -sal_Bool SAL_CALL ODatabaseMetaData::supportsOrderByUnrelated( ) -{ - return false; -} - -sal_Bool SAL_CALL ODatabaseMetaData::supportsUnion( ) -{ - return false; -} - -sal_Bool SAL_CALL ODatabaseMetaData::supportsUnionAll( ) -{ - return false; -} - -sal_Bool SAL_CALL ODatabaseMetaData::supportsMixedCaseIdentifiers( ) -{ - return true; -} - -bool ODatabaseMetaData::impl_supportsMixedCaseQuotedIdentifiers_throw( ) -{ - // Any case may be used - return true; -} - -sal_Bool SAL_CALL ODatabaseMetaData::nullsAreSortedAtEnd( ) -{ - return false; -} - -sal_Bool SAL_CALL ODatabaseMetaData::nullsAreSortedAtStart( ) -{ - return true; -} - -sal_Bool SAL_CALL ODatabaseMetaData::nullsAreSortedHigh( ) -{ - return false; -} - -sal_Bool SAL_CALL ODatabaseMetaData::nullsAreSortedLow( ) -{ - return true; -} - -sal_Bool SAL_CALL ODatabaseMetaData::supportsSchemasInProcedureCalls( ) -{ - return false; -} - -sal_Bool SAL_CALL ODatabaseMetaData::supportsSchemasInPrivilegeDefinitions( ) -{ - return false; -} - -sal_Bool SAL_CALL ODatabaseMetaData::supportsCatalogsInProcedureCalls( ) -{ - return false; -} - -sal_Bool SAL_CALL ODatabaseMetaData::supportsCatalogsInPrivilegeDefinitions( ) -{ - return false; -} - -sal_Bool SAL_CALL ODatabaseMetaData::supportsCorrelatedSubqueries( ) -{ - return false; -} - -sal_Bool SAL_CALL ODatabaseMetaData::supportsSubqueriesInComparisons( ) -{ - return false; -} - -sal_Bool SAL_CALL ODatabaseMetaData::supportsSubqueriesInExists( ) -{ - return false; -} - -sal_Bool SAL_CALL ODatabaseMetaData::supportsSubqueriesInIns( ) -{ - return false; -} - -sal_Bool SAL_CALL ODatabaseMetaData::supportsSubqueriesInQuantifieds( ) -{ - return false; -} - -sal_Bool SAL_CALL ODatabaseMetaData::supportsANSI92IntermediateSQL( ) -{ - return false; -} - -OUString SAL_CALL ODatabaseMetaData::getURL( ) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - return m_pConnection->getURL(); -} - -OUString SAL_CALL ODatabaseMetaData::getUserName( ) -{ - return OUString(); -} - -OUString SAL_CALL ODatabaseMetaData::getDriverName( ) -{ - return OUString(); -} - -OUString SAL_CALL ODatabaseMetaData::getDriverVersion() -{ - OUString aValue = OUString::number(1); - return aValue; -} - -OUString SAL_CALL ODatabaseMetaData::getDatabaseProductVersion( ) -{ - OUString aValue = OUString::number(0); - return aValue; -} - -OUString SAL_CALL ODatabaseMetaData::getDatabaseProductName( ) -{ - return OUString(); -} - -OUString SAL_CALL ODatabaseMetaData::getProcedureTerm( ) -{ - return OUString(); -} - -OUString SAL_CALL ODatabaseMetaData::getSchemaTerm( ) -{ - return OUString(); -} - -sal_Int32 SAL_CALL ODatabaseMetaData::getDriverMajorVersion( ) -{ - return 1; -} - -sal_Int32 SAL_CALL ODatabaseMetaData::getDefaultTransactionIsolation( ) -{ - return TransactionIsolation::NONE; -} - -sal_Int32 SAL_CALL ODatabaseMetaData::getDriverMinorVersion( ) -{ - return 0; -} - -OUString SAL_CALL ODatabaseMetaData::getSQLKeywords( ) -{ - return OUString(); -} - -OUString SAL_CALL ODatabaseMetaData::getSearchStringEscape( ) -{ - return OUString(); -} - -OUString SAL_CALL ODatabaseMetaData::getStringFunctions( ) -{ - return OUString(); -} - -OUString SAL_CALL ODatabaseMetaData::getTimeDateFunctions( ) -{ - return OUString(); -} - -OUString SAL_CALL ODatabaseMetaData::getSystemFunctions( ) -{ - return OUString(); -} - -OUString SAL_CALL ODatabaseMetaData::getNumericFunctions( ) -{ - return OUString(); -} - -sal_Bool SAL_CALL ODatabaseMetaData::supportsExtendedSQLGrammar( ) -{ - return false; -} - -sal_Bool SAL_CALL ODatabaseMetaData::supportsCoreSQLGrammar( ) -{ - return false; -} - -sal_Bool SAL_CALL ODatabaseMetaData::supportsMinimumSQLGrammar( ) -{ - return true; -} - -sal_Bool SAL_CALL ODatabaseMetaData::supportsFullOuterJoins( ) -{ - return false; -} - -sal_Bool SAL_CALL ODatabaseMetaData::supportsLimitedOuterJoins( ) -{ - return false; -} - -sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInGroupBy( ) -{ - return 0; // 0 means no limit -} - -sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInOrderBy( ) -{ - return 0; // 0 means no limit -} - -sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInSelect( ) -{ - return 0; // 0 means no limit -} - -sal_Int32 SAL_CALL ODatabaseMetaData::getMaxUserNameLength( ) -{ - return 0; // 0 means no limit -} - -sal_Bool SAL_CALL ODatabaseMetaData::supportsResultSetType( sal_Int32 /*setType*/ ) -{ - return false; -} - -sal_Bool SAL_CALL ODatabaseMetaData::supportsResultSetConcurrency( sal_Int32 /*setType*/, sal_Int32 /*concurrency*/ ) -{ - return false; -} - -sal_Bool SAL_CALL ODatabaseMetaData::ownUpdatesAreVisible( sal_Int32 /*setType*/ ) -{ - return true; -} - -sal_Bool SAL_CALL ODatabaseMetaData::ownDeletesAreVisible( sal_Int32 /*setType*/ ) -{ - return true; -} - -sal_Bool SAL_CALL ODatabaseMetaData::ownInsertsAreVisible( sal_Int32 /*setType*/ ) -{ - return true; -} - -sal_Bool SAL_CALL ODatabaseMetaData::othersUpdatesAreVisible( sal_Int32 /*setType*/ ) -{ - return false; -} - -sal_Bool SAL_CALL ODatabaseMetaData::othersDeletesAreVisible( sal_Int32 /*setType*/ ) -{ - return false; -} - -sal_Bool SAL_CALL ODatabaseMetaData::othersInsertsAreVisible( sal_Int32 /*setType*/ ) -{ - return false; -} - -sal_Bool SAL_CALL ODatabaseMetaData::updatesAreDetected( sal_Int32 /*setType*/ ) -{ - return true; -} - -sal_Bool SAL_CALL ODatabaseMetaData::deletesAreDetected( sal_Int32 /*setType*/ ) -{ - return true; -} - -sal_Bool SAL_CALL ODatabaseMetaData::insertsAreDetected( sal_Int32 /*setType*/ ) -{ - return true; -} - -sal_Bool SAL_CALL ODatabaseMetaData::supportsBatchUpdates( ) -{ - return false; -} - -// here follow all methods which return a resultset -// the first methods is an example implementation how to use this resultset -// of course you could implement it on your and you should do this because -// the general way is more memory expensive - -Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTableTypes( ) -{ - // there exists no possibility to get table types so we have to check - static const std::u16string_view sTableTypes[] = - { - u"TABLE", - u"VIEW" - // Currently we only support a 'TABLE' and 'VIEW' nothing more complex - - // OUString("SYSTEM TABLE"), - // OUString("GLOBAL TEMPORARY"), - // OUString("LOCAL TEMPORARY"), - // OUString("ALIAS"), - // OUString("SYNONYM") - }; - ::connectivity::ODatabaseMetaDataResultSet* pResult = new ::connectivity::ODatabaseMetaDataResultSet(ODatabaseMetaDataResultSet::eTableTypes); - Reference< XResultSet > xRef = pResult; - - // here we fill the rows which should be visible when ask for data from the resultset returned here - ODatabaseMetaDataResultSet::ORows aRows; - for(const auto & sTableType : sTableTypes) - { - ODatabaseMetaDataResultSet::ORow aRow; - aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue()); - aRow.push_back(new ORowSetValueDecorator(OUString(sTableType))); - // bound row - aRows.push_back(aRow); - } - // here we set the rows at the resultset - pResult->setRows(aRows); - return xRef; -} - -Reference< XResultSet > ODatabaseMetaData::impl_getTypeInfo_throw( ) -{ - // this returns an empty resultset where the column-names are already set - // in special the metadata of the resultset already returns the right columns - ODatabaseMetaDataResultSet* pResultSet = new ODatabaseMetaDataResultSet(ODatabaseMetaDataResultSet::eTypeInfo); - Reference< XResultSet > xResultSet = pResultSet; - static ODatabaseMetaDataResultSet::ORows aRows = [&]() - { - ODatabaseMetaDataResultSet::ORows tmp; - ODatabaseMetaDataResultSet::ORow aRow; - aRow.reserve(19); - aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue()); - aRow.push_back(new ORowSetValueDecorator(OUString("VARCHAR"))); - aRow.push_back(new ORowSetValueDecorator(DataType::VARCHAR)); - aRow.push_back(new ORowSetValueDecorator(sal_Int32(s_nCHAR_OCTET_LENGTH))); - aRow.push_back(ODatabaseMetaDataResultSet::getQuoteValue()); - aRow.push_back(ODatabaseMetaDataResultSet::getQuoteValue()); - aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue()); - // aRow.push_back(new ORowSetValueDecorator((sal_Int32)ColumnValue::NULLABLE)); - aRow.push_back(ODatabaseMetaDataResultSet::get1Value()); - aRow.push_back(ODatabaseMetaDataResultSet::get1Value()); - aRow.push_back(new ORowSetValueDecorator(sal_Int32(ColumnSearch::CHAR))); - aRow.push_back(ODatabaseMetaDataResultSet::get1Value()); - aRow.push_back(ODatabaseMetaDataResultSet::get0Value()); - aRow.push_back(ODatabaseMetaDataResultSet::get0Value()); - aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue()); - aRow.push_back(ODatabaseMetaDataResultSet::get0Value()); - aRow.push_back(ODatabaseMetaDataResultSet::get0Value()); - aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue()); - aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue()); - aRow.push_back(new ORowSetValueDecorator(sal_Int32(10))); - - tmp.push_back(aRow); - return tmp; - }(); - pResultSet->setRows(aRows); - return xResultSet; -} - -Reference< XResultSet > SAL_CALL ODatabaseMetaData::getColumns( - const Any& /*catalog*/, const OUString& /*schemaPattern*/, const OUString& tableNamePattern, - const OUString& columnNamePattern ) -{ - // this returns an empty resultset where the column-names are already set - // in special the metadata of the resultset already returns the right columns - ODatabaseMetaDataResultSet* pResultSet = new ODatabaseMetaDataResultSet(ODatabaseMetaDataResultSet::eColumns); - Reference< XResultSet > xResultSet = pResultSet; - pResultSet->setRows( getColumnRows( tableNamePattern, columnNamePattern )); - return xResultSet; -} - -Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTables( - const Any& /*catalog*/, const OUString& /*schemaPattern*/, - const OUString& tableNamePattern, const Sequence< OUString >& /*types*/ ) -{ - SAL_INFO("connectivity.mork", "=> ODatabaseMetaData::getTables()" ); - // this returns an empty resultset where the column-names are already set - // in special the metadata of the resultset already returns the right columns - ODatabaseMetaDataResultSet* pResultSet = new ODatabaseMetaDataResultSet(ODatabaseMetaDataResultSet::eTables); - Reference< XResultSet > xResultSet = pResultSet; - - // ODatabaseMetaDataResultSet::ORows aRows; - // aRows = m_pDbMetaDataHelper->getTables( m_pConnection, tableNamePattern ); - // pResultSet->setRows( aRows ); - ODatabaseMetaDataResultSet::ORows _rRows; - connectivity::mork::MDatabaseMetaDataHelper::getTables( m_pConnection, tableNamePattern, _rRows ); - pResultSet->setRows( _rRows ); - - return xResultSet; -} - -Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTablePrivileges( - const Any& /*catalog*/, const OUString& /*schemaPattern*/, const OUString& tableNamePattern ) -{ - SAL_INFO("connectivity.mork", "=> ODatabaseMetaData::getTablePrivileges()" ); - ::connectivity::ODatabaseMetaDataResultSet* pResult = new ::connectivity::ODatabaseMetaDataResultSet(ODatabaseMetaDataResultSet::eTablePrivileges); - Reference< XResultSet > xRef = pResult; - - std::vector< OUString > tables; - connectivity::mork::MDatabaseMetaDataHelper::getTableStrings( m_pConnection, tables); - - ::connectivity::ODatabaseMetaDataResultSet::ORows aRows; - ::connectivity::ODatabaseMetaDataResultSet::ORow aRow(8); - aRows.reserve(8); - aRow[0] = ::connectivity::ODatabaseMetaDataResultSet::getEmptyValue(); - aRow[1] = ::connectivity::ODatabaseMetaDataResultSet::getEmptyValue(); - aRow[3] = ::connectivity::ODatabaseMetaDataResultSet::getEmptyValue(); - aRow[4] = ::connectivity::ODatabaseMetaDataResultSet::getEmptyValue(); - aRow[5] = new ::connectivity::ORowSetValueDecorator(getUserName()); - aRow[7] = new ::connectivity::ORowSetValueDecorator(OUString("NO")); - - - // Iterate over all tables - for(const OUString & table : tables) { - if(match(tableNamePattern, table,'\0')) - { - // TABLE_NAME - aRow[2] = new ORowSetValueDecorator( table ); - - SAL_INFO("connectivity.mork", "\tTableName = : " << table); - - aRow[6] = ::connectivity::ODatabaseMetaDataResultSet::getSelectValue(); - aRows.push_back(aRow); - aRow[6] = ::connectivity::ODatabaseMetaDataResultSet::getInsertValue(); - aRows.push_back(aRow); - aRow[6] = ::connectivity::ODatabaseMetaDataResultSet::getDeleteValue(); - aRows.push_back(aRow); - aRow[6] = ::connectivity::ODatabaseMetaDataResultSet::getUpdateValue(); - aRows.push_back(aRow); - aRow[6] = ::connectivity::ODatabaseMetaDataResultSet::getCreateValue(); - aRows.push_back(aRow); - aRow[6] = ::connectivity::ODatabaseMetaDataResultSet::getReadValue(); - aRows.push_back(aRow); - aRow[6] = ::connectivity::ODatabaseMetaDataResultSet::getAlterValue(); - aRows.push_back(aRow); - aRow[6] = ::connectivity::ODatabaseMetaDataResultSet::getDropValue(); - aRows.push_back(aRow); - } - } - pResult->setRows(aRows); - return xRef; -} - -Reference< XResultSet > SAL_CALL ODatabaseMetaData::getUDTs( const Any& /*catalog*/, const OUString& /*schemaPattern*/, const OUString& /*typeNamePattern*/, const Sequence< sal_Int32 >& /*types*/ ) -{ - return nullptr; -} - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/drivers/mork/MDatabaseMetaData.hxx b/connectivity/source/drivers/mork/MDatabaseMetaData.hxx deleted file mode 100644 index 22f4aad769e6..000000000000 --- a/connectivity/source/drivers/mork/MDatabaseMetaData.hxx +++ /dev/null @@ -1,189 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - */ - -#ifndef INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_MORK_MDATABASEMETADATA_HXX -#define INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_MORK_MDATABASEMETADATA_HXX - -#include <memory> -#include <TDatabaseMetaDataBase.hxx> -#include "MConnection.hxx" - -namespace connectivity::mork - { - class MDatabaseMetaDataHelper; - - //************ Class: ODatabaseMetaData - - - class ODatabaseMetaData : public ODatabaseMetaDataBase - { - OConnection* m_pConnection; - std::unique_ptr<MDatabaseMetaDataHelper> - m_pMetaDataHelper; - - /// @throws css::sdbc::SQLException - ODatabaseMetaDataResultSet::ORows getColumnRows( const OUString& tableNamePattern, const OUString& columnNamePattern ); - - protected: - virtual ~ODatabaseMetaData() override; - - public: - explicit ODatabaseMetaData(OConnection* _pCon); - - private: - virtual css::uno::Reference< css::sdbc::XResultSet > impl_getTypeInfo_throw() override; - // cached database information - virtual OUString impl_getIdentifierQuoteString_throw( ) override; - virtual bool impl_isCatalogAtStart_throw( ) override; - virtual OUString impl_getCatalogSeparator_throw( ) override; - virtual bool impl_supportsCatalogsInTableDefinitions_throw( ) override; - virtual bool impl_supportsSchemasInTableDefinitions_throw( ) override ; - virtual bool impl_supportsCatalogsInDataManipulation_throw( ) override; - virtual bool impl_supportsSchemasInDataManipulation_throw( ) override ; - virtual bool impl_supportsMixedCaseQuotedIdentifiers_throw( ) override ; - virtual bool impl_supportsAlterTableWithAddColumn_throw( ) override; - virtual bool impl_supportsAlterTableWithDropColumn_throw( ) override; - virtual sal_Int32 impl_getMaxStatements_throw( ) override; - virtual sal_Int32 impl_getMaxTablesInSelect_throw( ) override; - virtual bool impl_storesMixedCaseQuotedIdentifiers_throw( ) override; - - // as I mentioned before this interface is really BIG - // XDatabaseMetaData - virtual sal_Bool SAL_CALL allProceduresAreCallable( ) override; - virtual sal_Bool SAL_CALL allTablesAreSelectable( ) override; - virtual OUString SAL_CALL getURL( ) override; - virtual OUString SAL_CALL getUserName( ) override; - virtual sal_Bool SAL_CALL isReadOnly( ) override; - virtual sal_Bool SAL_CALL nullsAreSortedHigh( ) override; - virtual sal_Bool SAL_CALL nullsAreSortedLow( ) override; - virtual sal_Bool SAL_CALL nullsAreSortedAtStart( ) override; - virtual sal_Bool SAL_CALL nullsAreSortedAtEnd( ) override; - virtual OUString SAL_CALL getDatabaseProductName( ) override; - virtual OUString SAL_CALL getDatabaseProductVersion( ) override; - virtual OUString SAL_CALL getDriverName( ) override; - virtual OUString SAL_CALL getDriverVersion( ) override; - virtual sal_Int32 SAL_CALL getDriverMajorVersion( ) override; - virtual sal_Int32 SAL_CALL getDriverMinorVersion( ) override; - virtual sal_Bool SAL_CALL usesLocalFiles( ) override; - virtual sal_Bool SAL_CALL usesLocalFilePerTable( ) override; - virtual sal_Bool SAL_CALL supportsMixedCaseIdentifiers( ) override; - virtual sal_Bool SAL_CALL storesUpperCaseIdentifiers( ) override; - virtual sal_Bool SAL_CALL storesLowerCaseIdentifiers( ) override; - virtual sal_Bool SAL_CALL storesMixedCaseIdentifiers( ) override; - virtual sal_Bool SAL_CALL storesUpperCaseQuotedIdentifiers( ) override; - virtual sal_Bool SAL_CALL storesLowerCaseQuotedIdentifiers( ) override; - virtual OUString SAL_CALL getSQLKeywords( ) override; - virtual OUString SAL_CALL getNumericFunctions( ) override; - virtual OUString SAL_CALL getStringFunctions( ) override; - virtual OUString SAL_CALL getSystemFunctions( ) override; - virtual OUString SAL_CALL getTimeDateFunctions( ) override; - virtual OUString SAL_CALL getSearchStringEscape( ) override; - virtual OUString SAL_CALL getExtraNameCharacters( ) override; - virtual sal_Bool SAL_CALL supportsColumnAliasing( ) override; - virtual sal_Bool SAL_CALL nullPlusNonNullIsNull( ) override; - virtual sal_Bool SAL_CALL supportsTypeConversion( ) override; - virtual sal_Bool SAL_CALL supportsConvert( sal_Int32 fromType, sal_Int32 toType ) override; - virtual sal_Bool SAL_CALL supportsTableCorrelationNames( ) override; - virtual sal_Bool SAL_CALL supportsDifferentTableCorrelationNames( ) override; - virtual sal_Bool SAL_CALL supportsExpressionsInOrderBy( ) override; - virtual sal_Bool SAL_CALL supportsOrderByUnrelated( ) override; - virtual sal_Bool SAL_CALL supportsGroupBy( ) override; - virtual sal_Bool SAL_CALL supportsGroupByUnrelated( ) override; - virtual sal_Bool SAL_CALL supportsGroupByBeyondSelect( ) override; - virtual sal_Bool SAL_CALL supportsLikeEscapeClause( ) override; - virtual sal_Bool SAL_CALL supportsMultipleResultSets( ) override; - virtual sal_Bool SAL_CALL supportsMultipleTransactions( ) override; ... etc. - the rest is truncated _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits