From 7edca7dc740f6877fa85c2a996ca869c6b971a48 Mon Sep 17 00:00:00 2001 From: jucasaca Date: Wed, 3 Apr 2024 18:15:39 +0200 Subject: [PATCH] tdf#158056 Connect to MS Access .mdb files by mean of ACE.OLEDB.12.0 provider * Modify the code so that all connections to MS Access files, both .mdb and .accdb are made with the provider "Microsoft.ACE.OLEDB.12.0". * Remove all references to the "Microsoft.Jet.OLEDB.4.0" provider to clean up the code. * Leave only one entry "Microsoft Access" in the Connection Wizard, which would work for .mdb and .accdb files. * Remove the entry "Microsoft Access 2007" from the Connection Wizard, since it is no longer needed. Change-Id: If523712d071199d61e0c994b35291d3a69246ad1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165756 Tested-by: Jenkins Reviewed-by: Mike Kaganski --- .../openoffice/Office/DataAccess/Drivers.xcu | 19 ++----------------- .../source/drivers/ado/AConnection.cxx | 6 +++--- dbaccess/inc/strings.hrc | 1 - dbaccess/source/core/misc/dsntypes.cxx | 9 ++------- dbaccess/source/inc/dsntypes.hxx | 1 - dbaccess/source/ui/dlg/ConnectionHelper.cxx | 15 ++------------- dbaccess/source/ui/dlg/ConnectionPage.cxx | 1 - dbaccess/source/ui/dlg/DbAdminImpl.cxx | 1 - dbaccess/source/ui/dlg/dbwiz.cxx | 1 - sw/inc/dbmgr.hxx | 1 - sw/inc/strings.hrc | 3 +-- sw/source/uibase/dbui/dbmgr.cxx | 19 +++---------------- 12 files changed, 13 insertions(+), 64 deletions(-) diff --git a/connectivity/registry/ado/org/openoffice/Office/DataAccess/Drivers.xcu b/connectivity/registry/ado/org/openoffice/Office/DataAccess/Drivers.xcu index 288c23e2e497..28f915ff8e3e 100644 --- a/connectivity/registry/ado/org/openoffice/Office/DataAccess/Drivers.xcu +++ b/connectivity/registry/ado/org/openoffice/Office/DataAccess/Drivers.xcu @@ -214,7 +214,7 @@ - + com.sun.star.comp.sdbc.ado.ODriver @@ -340,7 +340,7 @@ - mdb + @@ -350,20 +350,5 @@ - - - sdbc:ado:access:PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=* - - - Microsoft Access 2007 - - - - - - - - - diff --git a/connectivity/source/drivers/ado/AConnection.cxx b/connectivity/source/drivers/ado/AConnection.cxx index 686a9fed58aa..b879e1b11801 100644 --- a/connectivity/source/drivers/ado/AConnection.cxx +++ b/connectivity/source/drivers/ado/AConnection.cxx @@ -121,9 +121,9 @@ void OConnection::construct(std::u16string_view url,const Sequence< PropertyValu WpADOProperties aProps = m_aAdoConnection.get_Properties(); if(aProps.IsValid()) { - OTools::putValue(aProps, std::u16string_view(u"Jet OLEDB:ODBC Parsing"), true); + OTools::putValue(aProps, std::u16string_view(u"ACE OLEDB:ODBC Parsing"), true); OLEVariant aVar( - OTools::getValue(aProps, std::u16string_view(u"Jet OLEDB:Engine Type"))); + OTools::getValue(aProps, std::u16string_view(u"ACE OLEDB:Engine Type"))); if(!aVar.isNull() && !aVar.isEmpty()) m_nEngineType = aVar.getInt32(); } @@ -184,7 +184,7 @@ OUString SAL_CALL OConnection::nativeSQL( const OUString& _sql ) WpADOProperties aProps = m_aAdoConnection.get_Properties(); if(aProps.IsValid()) { - OTools::putValue(aProps, std::u16string_view(u"Jet OLEDB:ODBC Parsing"), true); + OTools::putValue(aProps, std::u16string_view(u"ACE OLEDB:ODBC Parsing"), true); WpADOCommand aCommand; aCommand.Create(); aCommand.put_ActiveConnection(static_cast(m_aAdoConnection)); diff --git a/dbaccess/inc/strings.hrc b/dbaccess/inc/strings.hrc index 0c6226ea8fee..0691ff9f7a8b 100644 --- a/dbaccess/inc/strings.hrc +++ b/dbaccess/inc/strings.hrc @@ -293,7 +293,6 @@ #define STR_JDBCDRIVER_SUCCESS NC_("STR_JDBCDRIVER_SUCCESS", "The JDBC driver was loaded successfully.") #define STR_JDBCDRIVER_NO_SUCCESS NC_("STR_JDBCDRIVER_NO_SUCCESS", "The JDBC driver could not be loaded.") #define STR_MSACCESS_FILTERNAME NC_("STR_MSACCESS_FILTERNAME", "MS Access file") -#define STR_MSACCESS_2007_FILTERNAME NC_("STR_MSACCESS_2007_FILTERNAME", "MS Access 2007 file") #define STR_FIREBIRD_FILTERNAME NC_("STR_FIREBIRD_FILTERNAME", "Firebird Database") #define STR_RSC_CHARSETS NC_("STR_RSC_CHARSETS", "System") diff --git a/dbaccess/source/core/misc/dsntypes.cxx b/dbaccess/source/core/misc/dsntypes.cxx index 2f74fd05e35d..6a081c47a1f7 100644 --- a/dbaccess/source/core/misc/dsntypes.cxx +++ b/dbaccess/source/core/misc/dsntypes.cxx @@ -228,8 +228,7 @@ void ODsnTypeCollection::extractHostNamePort(const OUString& _rDsn,OUString& _sD _rsHostname = sUrl.getToken(0,'/'); _sDatabaseName = sUrl.copy(sUrl.lastIndexOf('/')+1); } - else if ( _rDsn.startsWithIgnoreAsciiCase("sdbc:ado:access:Provider=Microsoft.ACE.OLEDB.12.0;DATA SOURCE=") - || _rDsn.startsWithIgnoreAsciiCase("sdbc:ado:access:PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=") ) + else if ( _rDsn.startsWithIgnoreAsciiCase("sdbc:ado:access:")) { OUString sNewFileName; if ( ::osl::FileBase::getFileURLFromSystemPath( sUrl, sNewFileName ) == ::osl::FileBase::E_None ) @@ -339,10 +338,7 @@ DATASOURCE_TYPE ODsnTypeCollection::determineType(std::u16string_view _rDsn) con { if (sDsn.startsWithIgnoreAsciiCase("sdbc:ado:access:")) { - if (sDsn.startsWithIgnoreAsciiCase("sdbc:ado:access:Provider=Microsoft.ACE.OLEDB.12.0;")) - return DST_MSACCESS_2007; - else - return DST_MSACCESS; + return DST_MSACCESS; } return DST_ADO; } @@ -455,7 +451,6 @@ void ODsnTypeCollection::fillPageIds(std::u16string_view _sURL,std::vectordetermineType(m_eType); - if ( ( ::dbaccess::DST_CALC == eType) || ( ::dbaccess::DST_WRITER == eType) || ( ::dbaccess::DST_MSACCESS == eType) || ( ::dbaccess::DST_MSACCESS_2007 == eType) ) + if ( ( ::dbaccess::DST_CALC == eType) || ( ::dbaccess::DST_WRITER == eType) || ( ::dbaccess::DST_MSACCESS == eType) ) { if( pathExists(sURL, true) == PATH_NOT_EXIST ) { diff --git a/dbaccess/source/ui/dlg/ConnectionPage.cxx b/dbaccess/source/ui/dlg/ConnectionPage.cxx index 398029850264..557045800658 100644 --- a/dbaccess/source/ui/dlg/ConnectionPage.cxx +++ b/dbaccess/source/ui/dlg/ConnectionPage.cxx @@ -105,7 +105,6 @@ namespace dbaui m_xFT_Connection->set_label(DBA_RES(STR_COMMONURL)); break; case ::dbaccess::DST_MSACCESS: - case ::dbaccess::DST_MSACCESS_2007: m_xFT_Connection->set_label(DBA_RES(STR_MSACCESS_MDB_FILE)); m_xConnectionURL->set_help_id(HID_DSADMIN_MSACCESS_MDB_FILE); break; diff --git a/dbaccess/source/ui/dlg/DbAdminImpl.cxx b/dbaccess/source/ui/dlg/DbAdminImpl.cxx index 5a630ceff03e..3fa122bf6c69 100644 --- a/dbaccess/source/ui/dlg/DbAdminImpl.cxx +++ b/dbaccess/source/ui/dlg/DbAdminImpl.cxx @@ -465,7 +465,6 @@ OUString ODbDataSourceAdministrationHelper::getConnectionURL() const case ::dbaccess::DST_WRITER: break; case ::dbaccess::DST_MSACCESS: - case ::dbaccess::DST_MSACCESS_2007: { OUString sFileName = pCollection->cutPrefix(pUrlItem->GetValue()); OUString sNewFileName; diff --git a/dbaccess/source/ui/dlg/dbwiz.cxx b/dbaccess/source/ui/dlg/dbwiz.cxx index 699cf4d16c9b..f34e58c1717e 100644 --- a/dbaccess/source/ui/dlg/dbwiz.cxx +++ b/dbaccess/source/ui/dlg/dbwiz.cxx @@ -137,7 +137,6 @@ WizardState ODbTypeWizDialog::determineNextState( WizardState _nCurrentState ) c case ::dbaccess::DST_KAB: case ::dbaccess::DST_MACAB: case ::dbaccess::DST_MSACCESS: - case ::dbaccess::DST_MSACCESS_2007: case ::dbaccess::DST_JDBC: case ::dbaccess::DST_CALC: case ::dbaccess::DST_WRITER: diff --git a/sw/inc/dbmgr.hxx b/sw/inc/dbmgr.hxx index 9693eee95c74..ae5730d5cfc1 100644 --- a/sw/inc/dbmgr.hxx +++ b/sw/inc/dbmgr.hxx @@ -485,7 +485,6 @@ enum class DBConnURIType CALC, DBASE, FLAT, - MSJET, MSACE, WRITER }; diff --git a/sw/inc/strings.hrc b/sw/inc/strings.hrc index b3e9a9370bfc..ea58fccb736c 100644 --- a/sw/inc/strings.hrc +++ b/sw/inc/strings.hrc @@ -891,8 +891,7 @@ #define STR_FILTER_DOC NC_("STR_FILTER_DOC", "Microsoft Word") #define STR_FILTER_TXT NC_("STR_FILTER_TXT", "Plain text") #define STR_FILTER_CSV NC_("STR_FILTER_CSV", "Text Comma Separated") -#define STR_FILTER_MDB NC_("STR_FILTER_MDB", "Microsoft Access") -#define STR_FILTER_ACCDB NC_("STR_FILTER_ACCDB", "Microsoft Access 2007") +#define STR_FILTER_ACCDB NC_("STR_FILTER_ACCDB", "Microsoft Access") #define ST_CONFIGUREMAIL NC_("ST_CONFIGUREMAIL", "In order to be able to send mail merge documents by email, %PRODUCTNAME requires information about the email account to be used.\n\nDo you want to enter email account information now?") #define ST_FILTERNAME NC_("ST_FILTERNAME", "%PRODUCTNAME Address List (.csv)") diff --git a/sw/source/uibase/dbui/dbmgr.cxx b/sw/source/uibase/dbui/dbmgr.cxx index 7c97db631403..d7c11eba7575 100644 --- a/sw/source/uibase/dbui/dbmgr.cxx +++ b/sw/source/uibase/dbui/dbmgr.cxx @@ -2571,11 +2571,8 @@ DBConnURIType GetDBunoType(const INetURLObject &rURL) type = DBConnURIType::FLAT; } #ifdef _WIN32 - else if (sExt.equalsIgnoreAsciiCase("mdb") || sExt.equalsIgnoreAsciiCase("mde")) - { - type = DBConnURIType::MSJET; - } - else if (sExt.equalsIgnoreAsciiCase("accdb") || sExt.equalsIgnoreAsciiCase("accde")) + else if (sExt.equalsIgnoreAsciiCase("accdb") || sExt.equalsIgnoreAsciiCase("accde") + || sExt.equalsIgnoreAsciiCase("mdb") || sExt.equalsIgnoreAsciiCase("mde")) { type = DBConnURIType::MSACE; } @@ -2631,14 +2628,6 @@ uno::Any GetDBunoURI(const INetURLObject &rURL, DBConnURIType& rType) aUrlTmp.GetMainURL(INetURLObject::DecodeMechanism::NONE); aURLAny <<= sDBURL; } - break; - case DBConnURIType::MSJET: -#ifdef _WIN32 - { - OUString sDBURL("sdbc:ado:access:PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=" + rURL.PathToFileName()); - aURLAny <<= sDBURL; - } -#endif break; case DBConnURIType::MSACE: #ifdef _WIN32 @@ -2698,7 +2687,6 @@ OUString LoadAndRegisterDataSource_Impl(DBConnURIType type, const uno::Reference aTableFilterAny <<= aFilters; } break; - case DBConnURIType::MSJET: case DBConnURIType::MSACE: aSuppressVersionsAny <<= true; break; @@ -2805,8 +2793,7 @@ OUString SwDBManager::LoadAndRegisterDataSource(weld::Window* pParent, SwDocShel { SwResId(STR_FILTER_TXT), "*.txt" }, { SwResId(STR_FILTER_CSV), "*.csv" }, #ifdef _WIN32 - { SwResId(STR_FILTER_MDB), "*.mdb;*.mde" }, - { SwResId(STR_FILTER_ACCDB), "*.accdb;*.accde" }, + { SwResId(STR_FILTER_ACCDB), "*.accdb;*.accde;*.mdb;*.mde" }, #endif };