https://bugs.documentfoundation.org/show_bug.cgi?id=144694
Julien Nabet <[email protected]> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |[email protected] --- Comment #4 from Julien Nabet <[email protected]> --- Thank you Robert, I could reproduce this. The problem is in dbaccess/source/ui/dlg/directsql.cxx: 230 if (_rStatement.toAsciiUpperCase().startsWith("SELECT")) 231 { 232 css::uno::Reference< css::sdbc::XResultSet > xRS = xStatement->executeQuery(_rStatement); 233 if (m_xShowOutput->get_active()) 234 display(xRS); 235 } 236 else 237 { 238 sal_Int32 resultCount = xStatement->executeUpdate(_rStatement); 239 addOutputText(OUString(OUString::number(resultCount) + " rows updated\n")); 240 } See https://opengrok.libreoffice.org/xref/core/dbaccess/source/ui/dlg/directsql.cxx?r=76f89b00#230 The pb isn't about "Run SQL command directly" checkbox. It's the fact that this dialog uses "executeUpdate" as soon as a command doesn't begin with "START". Here it begins with: "WITH RECURSIVE" Perhaps we can consider these cases: - UPDATE -> executeUpdate - INSERT INTO -> executeUpdate - CREATE TABLE -> execute - anything else -> executeQuery Here's a patch: diff --git a/dbaccess/source/ui/dlg/directsql.cxx b/dbaccess/source/ui/dlg/directsql.cxx index e6828ae2aa3c..0d5c00248e85 100644 --- a/dbaccess/source/ui/dlg/directsql.cxx +++ b/dbaccess/source/ui/dlg/directsql.cxx @@ -227,17 +227,27 @@ namespace dbaui } else { - if (_rStatement.toAsciiUpperCase().startsWith("SELECT")) - { - css::uno::Reference< css::sdbc::XResultSet > xRS = xStatement->executeQuery(_rStatement); - if (m_xShowOutput->get_active()) - display(xRS); - } - else + if (_rStatement.toAsciiUpperCase().startsWith("UPDATE")) { sal_Int32 resultCount = xStatement->executeUpdate(_rStatement); addOutputText(OUString(OUString::number(resultCount) + " rows updated\n")); + }; + if (_rStatement.toAsciiUpperCase().startsWith("INSERT")) + { + sal_Int32 resultCount = xStatement->executeUpdate(_rStatement); + addOutputText(OUString(OUString::number(resultCount) + " rows inserted\n")); + }; + if (_rStatement.toAsciiUpperCase().startsWith("CREATE")) + { + xStatement->execute(_rStatement); + addOutputText(u"Command executed\n"); } + else + { + css::uno::Reference< css::sdbc::XResultSet > xRS = xStatement->executeQuery(_rStatement); + if (m_xShowOutput->get_active()) + display(xRS); + }; } // successful sStatus = DBA_RES(STR_COMMAND_EXECUTED_SUCCESSFULLY); Of course, we should make the strings translatable but it's another point. Lionel: any thoughts here? -- You are receiving this mail because: You are the assignee for the bug.
