From 21ab38ffc6629e813838160fba7dafc11ccc5e66 Mon Sep 17 00:00:00 2001 From: Andras Timar Date: Thu, 16 Feb 2023 21:12:52 +0100 Subject: build fix, that works This reverts commit 638557b2f8baf87ab40d57beaa444038ace94d8a. Change-Id: Idadbcc18200bd01ab92868d087c993d847bd88cd --- connectivity/source/drivers/hsqldb/HDriver.cxx | 18 ++++----- external/hsqldb/patches/disable-dump-script.patch | 46 ++++++----------------- 2 files changed, 21 insertions(+), 43 deletions(-) diff --git a/connectivity/source/drivers/hsqldb/HDriver.cxx b/connectivity/source/drivers/hsqldb/HDriver.cxx index 649cfbda03f9..84dc2132756d 100644 --- a/connectivity/source/drivers/hsqldb/HDriver.cxx +++ b/connectivity/source/drivers/hsqldb/HDriver.cxx @@ -251,15 +251,15 @@ namespace connectivity std::unique_ptr pStream( ::utl::UcbStreamHelper::CreateStream(xStream) ); if (pStream) { - OStringBuffer sLine; + OString sLine; OString sVersionString; while ( pStream->ReadLine(sLine) ) { if ( sLine.isEmpty() ) continue; sal_Int32 nIdx {0}; - const std::string_view sIniKey = o3tl::getToken(sLine, 0, '=', nIdx); - const OString sValue(o3tl::getToken(sLine, 0, '=', nIdx)); + const OString sIniKey = sLine.getToken(0, '=', nIdx); + const OString sValue = sLine.getToken(0, '=', nIdx); if( sIniKey == "hsqldb.compatible_version" ) { sVersionString = sValue; @@ -275,9 +275,9 @@ namespace connectivity if (!sVersionString.isEmpty()) { sal_Int32 nIdx {0}; - const sal_Int32 nMajor = o3tl::toInt32(o3tl::getToken(sVersionString, 0, '.', nIdx)); - const sal_Int32 nMinor = o3tl::toInt32(o3tl::getToken(sVersionString, 0, '.', nIdx)); - const sal_Int32 nMicro = o3tl::toInt32(o3tl::getToken(sVersionString, 0, '.', nIdx)); + const sal_Int32 nMajor = sVersionString.getToken(0, '.', nIdx).toInt32(); + const sal_Int32 nMinor = sVersionString.getToken(0, '.', nIdx).toInt32(); + const sal_Int32 nMicro = sVersionString.getToken(0, '.', nIdx).toInt32(); if ( nMajor > 1 || ( nMajor == 1 && nMinor > 8 ) || ( nMajor == 1 && nMinor == 8 && nMicro > 0 ) ) @@ -296,7 +296,7 @@ namespace connectivity // // hsqldb 2.6.0 release notes have: added system role SCRIPT_OPS for export / import of database structure and data // which seems to provide a builtin way to do this with contemporary hsqldb - static const OUStringLiteral sScript(u"script"); + const OUString sScript( "script" ); if (!bIsNewDatabase && xStorage->isStreamElement(sScript)) { Reference xStream = xStorage->openStreamElement(sScript, ElementModes::READ); @@ -305,10 +305,10 @@ namespace connectivity std::unique_ptr pStream(::utl::UcbStreamHelper::CreateStream(xStream)); if (pStream) { - OStringBuffer sLine; + OString sLine; while (pStream->ReadLine(sLine)) { - OString sText = sLine.makeStringAndClear().trim(); + OString sText = sLine.trim(); if (sText.startsWithIgnoreAsciiCase("SCRIPT")) { ::connectivity::SharedResources aResources; diff --git a/external/hsqldb/patches/disable-dump-script.patch b/external/hsqldb/patches/disable-dump-script.patch index 13e0213f7e57..401dd38abc9a 100644 --- a/external/hsqldb/patches/disable-dump-script.patch +++ b/external/hsqldb/patches/disable-dump-script.patch @@ -1,36 +1,14 @@ --- a/hsqldb/src/org/hsqldb/DatabaseCommandInterpreter.java 2023-02-13 11:08:11.297243034 +0000 +++ b/hsqldb/src/org/hsqldb/DatabaseCommandInterpreter.java 2023-02-13 13:49:17.973089433 +0000 -@@ -392,31 +392,19 @@ - */ - private Result processScript() throws IOException, HsqlException { - -- String token = tokenizer.getString(); -- ScriptWriterText dsw = null; -+ tokenizer.getString(); - - session.checkAdmin(); - - try { - if (tokenizer.wasValue()) { -- if (tokenizer.getType() != Types.VARCHAR) { -- throw Trace.error(Trace.INVALID_IDENTIFIER); -- } -- -- dsw = new ScriptWriterText(database, token, true, true, true); -- -- dsw.writeAll(); -- -- return new Result(ResultConstants.UPDATECOUNT); -+ throw Trace.error(Trace.ACCESS_IS_DENIED); - } else { - tokenizer.back(); - - return DatabaseScript.getScript(database, false); - } - } finally { -- if (dsw != null) { -- dsw.close(); -- } - } - } - +@@ -403,6 +403,11 @@ + throw Trace.error(Trace.INVALID_IDENTIFIER); + } + ++ // added condition to avoid execution of spurious command in .script or .log file ++ if (session.isProcessingScript() || session.isProcessingLog()) { ++ return new Result(ResultConstants.UPDATECOUNT); ++ } ++ + dsw = new ScriptWriterText(database, token, true, true, true); + + dsw.writeAll(); -- cgit v1.2.3