This is an automated email from the ASF dual-hosted git repository. jimjag pushed a commit to branch hsqldb2 in repository https://gitbox.apache.org/repos/asf/openoffice.git
commit c23c53be7c707e466b635b6cc8aa3d3d331446f1 Author: Jim Jagielski <[email protected]> AuthorDate: Sun Nov 8 07:37:16 2026 -0500 hsqldb: ask before converting a 1.8 database, and don't open it on a 'No' dbaccess never passed the document's InteractionHandler to the driver. With no answer at all it still converts, since headless the default handler answers nothing. The prompt holds the data source mutex; a connect from another thread can deadlock. --- main/connectivity/source/drivers/hsqldb/HDriver.cxx | 12 ++++-------- main/connectivity/source/inc/resource/hsqldb_res.hrc | 2 +- main/connectivity/source/resource/conn_shared_res.src | 6 +++--- main/dbaccess/source/core/dataaccess/datasource.cxx | 9 +++++++++ 4 files changed, 17 insertions(+), 12 deletions(-) diff --git a/main/connectivity/source/drivers/hsqldb/HDriver.cxx b/main/connectivity/source/drivers/hsqldb/HDriver.cxx index 7dae08691d..d51e2e4842 100644 --- a/main/connectivity/source/drivers/hsqldb/HDriver.cxx +++ b/main/connectivity/source/drivers/hsqldb/HDriver.cxx @@ -273,7 +273,7 @@ namespace connectivity aProperties.put( "jdbc.interval_as_varchar", ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "true" ) ) ); aProperties.put( "get_column_name", ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "false" ) ) ); - bool bAskUser = false,bModified = false; + bool bAskUser = false; ::rtl::OUString sMessage; ::rtl::OUString sProperties( RTL_CONSTASCII_USTRINGPARAM( "properties" ) ); try @@ -298,10 +298,6 @@ namespace connectivity { sVersionString = sValue; } - else if ( sLine.Equals("modified=yes",0,sizeof("modified=yes")-1) ) - { - bModified = true; - } else { if ( ( sVersionString.Len() == 0 ) @@ -352,11 +348,11 @@ namespace connectivity OInteraction< XInteractionDisapprove >* pDisApprove = new OInteraction< XInteractionDisapprove >; pRequest->addContinuation(pDisApprove); xInteraction->handle(xRequest); - if ( !pDisApprove->wasSelected() ) + if ( pDisApprove->wasSelected() ) { - bAskUser = false; + StorageContainer::revokeStorage(sKey,NULL); + ::dbtools::throwGenericSQLException(aResources.getResourceString(STR_CONVERSION_DECLINED) ,*this); } - aProperties.put( "sql.enforce_size", ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "false" ) ) ); } // readonly? diff --git a/main/connectivity/source/inc/resource/hsqldb_res.hrc b/main/connectivity/source/inc/resource/hsqldb_res.hrc index e3cdec1adb..d5964ced9a 100644 --- a/main/connectivity/source/inc/resource/hsqldb_res.hrc +++ b/main/connectivity/source/inc/resource/hsqldb_res.hrc @@ -39,6 +39,6 @@ #define STR_NO_DOCUMENTUI ( STR_HSQLDB_BASE + 5 ) #define STR_ERROR_NEW_VERSION ( STR_HSQLDB_BASE + 6 ) #define STR_CONVERT_TO_NEW_VERSION ( STR_HSQLDB_BASE + 7 ) -#define STR_SHUTDOWN_REQUIRED ( STR_HSQLDB_BASE + 8 ) +#define STR_CONVERSION_DECLINED ( STR_HSQLDB_BASE + 8 ) #endif // CONNECTIVITY_RESOURCE_HSQLDB_HRC diff --git a/main/connectivity/source/resource/conn_shared_res.src b/main/connectivity/source/resource/conn_shared_res.src index 8fce2a26cb..96b9852028 100644 --- a/main/connectivity/source/resource/conn_shared_res.src +++ b/main/connectivity/source/resource/conn_shared_res.src @@ -635,11 +635,11 @@ String STR_ERROR_NEW_VERSION }; String STR_CONVERT_TO_NEW_VERSION { - Text = "The database file is stored in an old version. Do you want to convert into the new version?" ; + Text [ en-US ] = "The database file is stored in an old version. Do you want to convert into the new version?" ; }; -String STR_SHUTDOWN_REQUIRED +String STR_CONVERSION_DECLINED { - Text = "The database file was not stored correctly by a previous version of %PRODUCTNAME.\nPlease open the file with Apache OpenOffice 4.1.x, then click the Tables icon and save." ; + Text [ en-US ] = "The database was not opened because it was not converted to the new version." ; }; // ********************************************************************** EOF diff --git a/main/dbaccess/source/core/dataaccess/datasource.cxx b/main/dbaccess/source/core/dataaccess/datasource.cxx index 67a21fbfa7..5c16f7aed4 100644 --- a/main/dbaccess/source/core/dataaccess/datasource.cxx +++ b/main/dbaccess/source/core/dataaccess/datasource.cxx @@ -764,6 +764,15 @@ Reference< XConnection > ODatabaseSource::buildLowLevelConnection(const ::rtl::O aDriverInfo[nCount].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Storage")); Reference< css::document::XDocumentSubStorageSupplier> xDocSup( m_pImpl->getDocumentSubStorageSupplier() ); aDriverInfo[nCount++].Value <<= xDocSup->getDocumentSubStorage(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("database")),ElementModes::READWRITE); + + // lets the embedded driver ask before it converts a database from an older engine + Reference< XInteractionHandler > xHandler( m_pImpl->getMediaDescriptor().getOrDefault( "InteractionHandler", Reference< XInteractionHandler >() ) ); + if ( xHandler.is() ) + { + aDriverInfo.realloc( nCount + 1 ); + aDriverInfo[nCount].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("InteractionHandler")); + aDriverInfo[nCount++].Value <<= xHandler; + } } if (nAdditionalArgs) xReturn = xManager->getConnectionWithInfo(m_pImpl->m_sConnectURL, ::comphelper::concatSequences(aUserPwd,aDriverInfo));
