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


The following commit(s) were added to refs/heads/hsqldb2 by this push:
     new 56dde1cf90 connectivity: reject databases from newer HSQLDB, drop the 
modified=yes conversion block
56dde1cf90 is described below

commit 56dde1cf90db1da4307184d613c647654ddb86b6
Author: Jim Jagielski <[email protected]>
AuthorDate: Thu Oct 29 10:05:19 2026 -0400

    connectivity: reject databases from newer HSQLDB, drop the modified=yes 
conversion block
---
 main/connectivity/source/drivers/hsqldb/HDriver.cxx | 21 +++++++++++----------
 .../connectivity/source/inc/resource/hsqldb_res.hrc |  4 ++--
 .../source/resource/conn_shared_res.src             |  8 ++++----
 3 files changed, 17 insertions(+), 16 deletions(-)

diff --git a/main/connectivity/source/drivers/hsqldb/HDriver.cxx 
b/main/connectivity/source/drivers/hsqldb/HDriver.cxx
index cc73a39c79..4fb83668fe 100644
--- a/main/connectivity/source/drivers/hsqldb/HDriver.cxx
+++ b/main/connectivity/source/drivers/hsqldb/HDriver.cxx
@@ -271,7 +271,8 @@ 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
                 {
@@ -295,10 +296,6 @@ namespace connectivity
                                     {
                                         sVersionString = sValue;
                                     }
-                                                                       else if 
( sLine.Equals("modified=yes",0,sizeof("modified=yes")-1) )
-                                    {
-                                                                               
bModified = true;
-                                                                       }
                                     else
                                     {
                                         if  (   (  sVersionString.Len() == 0 )
@@ -312,7 +309,13 @@ namespace connectivity
                                 if ( sVersionString.Len() )
                                 {
                                                                        const 
sal_Int32 nMajor = sVersionString.GetToken(0,'.').ToInt32();
-                                                                       if ( 
nMajor < 2 )
+                                                                       const 
sal_Int32 nMinor = sVersionString.GetToken(1,'.').ToInt32();
+                                                                       if ( 
nMajor > 2 || (nMajor == 2 && nMinor > 5) )
+                                                                       {
+                                                           
::connectivity::SharedResources aResources;
+                                                           sMessage = 
aResources.getResourceString(STR_ERROR_NEW_VERSION);
+                                                                       }
+                                                                       else if 
( nMajor < 2 )
                                                        {
                                                                                
bAskUser = true;
                                                        }
@@ -326,11 +329,9 @@ namespace connectivity
                 {
                 }
 
-                               // check if database was shutdown correctly 
before converting to new a version
-                               if ( bModified && bAskUser )
+                               // reject databases from newer HSQLDB versions 
that cannot be opened
+                               if ( sMessage.getLength() )
                                {
-                                       ::connectivity::SharedResources 
aResources;
-                                       const ::rtl::OUString sMessage = 
aResources.getResourceString(STR_SHUTDOWN_REQUIRED);
                                        
::dbtools::throwGenericSQLException(sMessage ,*this);
                                }
                                // need to convert file, ask for user 
approvement
diff --git a/main/connectivity/source/inc/resource/hsqldb_res.hrc 
b/main/connectivity/source/inc/resource/hsqldb_res.hrc
index 412b2ad156..f937a09878 100644
--- a/main/connectivity/source/inc/resource/hsqldb_res.hrc
+++ b/main/connectivity/source/inc/resource/hsqldb_res.hrc
@@ -37,7 +37,7 @@
 #define STR_NO_TABLE_EDITOR_DIALOG  ( STR_HSQLDB_BASE +    3 )
 #define STR_NO_TABLENAME            ( STR_HSQLDB_BASE +    4 )
 #define STR_NO_DOCUMENTUI           ( STR_HSQLDB_BASE +    5 )
-#define STR_CONVERT_TO_NEW_VERSION  ( STR_HSQLDB_BASE +    6 )
-#define STR_SHUTDOWN_REQUIRED       ( STR_HSQLDB_BASE +    7 )
+#define STR_ERROR_NEW_VERSION       ( STR_HSQLDB_BASE +    6 )
+#define STR_CONVERT_TO_NEW_VERSION  ( STR_HSQLDB_BASE +    7 )
 
 #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 e0c4bdb4cb..bf2cda2ba6 100644
--- a/main/connectivity/source/resource/conn_shared_res.src
+++ b/main/connectivity/source/resource/conn_shared_res.src
@@ -629,13 +629,13 @@ String STR_NO_DOCUMENTUI
 {
        Text [ en-US ] = "The provided DocumentUI is not allowed to be NULL." ;
 };
-String STR_CONVERT_TO_NEW_VERSION
+String STR_ERROR_NEW_VERSION
 {
-       Text [ en-US ] = "The database file is stored in an old version. Do you 
want to convert into the new version?" ;
+       Text [ en-US ] = "The connection could not be established. The database 
was created by a newer version of %PRODUCTNAME." ;
 };
-String STR_SHUTDOWN_REQUIRED
+String STR_CONVERT_TO_NEW_VERSION
 {
-       Text [ en-US ] = "The database file was not stored correctly by a 
previous version of %PRODUCTNAME.\nPlease open the file with Apache OpenOffice 
4.1 or earlier, then click the Tables icon and save." ;
+       Text [ en-US ] = "The database file is stored in an old version. Do you 
want to convert into the new version?" ;
 };
 
 // ********************************************************************** EOF

Reply via email to