[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - dbaccess/source
Julien Nabet (via logerrit)
logerrit at kemper.freedesktop.org
Mon Sep 27 11:02:07 UTC 2021
dbaccess/source/ui/dlg/directsql.cxx | 23 ++++++++++++++++++++++-
1 file changed, 22 insertions(+), 1 deletion(-)
New commits:
commit 638bdd87fc19377b157c82feb073be22c89d32de
Author: Julien Nabet <serval2412 at yahoo.fr>
AuthorDate: Sat Sep 25 17:29:34 2021 +0200
Commit: Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Mon Sep 27 13:01:32 2021 +0200
tdf#144694: improve Direct SQL dialog command type heuristics
When the SDBC driver doesn't support multiple results sets:
* special-case INSERT, UPDATE, DELETE like
SELECT already was.
* for unrecognised SQL commands, take the "show output"
checkbox as a hint whether to use executeUpdate()
or executeQuery()
+ create a new var to store statement in uppercase
instead of calling toAsciiUpperCase() repeatedly
Change-Id: I9a7d1d3d93e72e0a42871c1859346c9e40de868e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122608
Reviewed-by: Julien Nabet <serval2412 at yahoo.fr>
(cherry picked from commit 1c1b2b2f8d2abd6d179128b2fc4cb40c490566eb)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122632
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli at libreoffice.org>
diff --git a/dbaccess/source/ui/dlg/directsql.cxx b/dbaccess/source/ui/dlg/directsql.cxx
index ac3425999cf9..03d7b2115dc8 100644
--- a/dbaccess/source/ui/dlg/directsql.cxx
+++ b/dbaccess/source/ui/dlg/directsql.cxx
@@ -211,7 +211,28 @@ namespace dbaui
}
else
{
- if (_rStatement.toAsciiUpperCase().startsWith("SELECT"))
+ const OUString upperStatement = _rStatement.toAsciiUpperCase();
+ if (upperStatement.startsWith("UPDATE"))
+ {
+ sal_Int32 resultCount = xStatement->executeUpdate(_rStatement);
+ addOutputText(OUString(OUString::number(resultCount) + " rows updated\n"));
+ }
+ else if (upperStatement.startsWith("INSERT"))
+ {
+ sal_Int32 resultCount = xStatement->executeUpdate(_rStatement);
+ addOutputText(OUString(OUString::number(resultCount) + " rows inserted\n"));
+ }
+ else if (upperStatement.startsWith("DELETE"))
+ {
+ sal_Int32 resultCount = xStatement->executeUpdate(_rStatement);
+ addOutputText(OUString(OUString::number(resultCount) + " rows deleted\n"));
+ }
+ else if (upperStatement.startsWith("CREATE"))
+ {
+ xStatement->executeUpdate(_rStatement);
+ addOutputText(u"Command executed\n");
+ }
+ else if (upperStatement.startsWith("SELECT") || m_xShowOutput->get_active())
{
css::uno::Reference< css::sdbc::XResultSet > xRS = xStatement->executeQuery(_rStatement);
if (m_xShowOutput->get_active())
More information about the Libreoffice-commits
mailing list