[Libreoffice-commits] core.git: dbaccess/source dbaccess/uiconfig

Julien Nabet (via logerrit) logerrit at kemper.freedesktop.org
Mon Aug 16 12:31:45 UTC 2021


 dbaccess/source/ui/dlg/directsql.cxx    |   16 ++++++++++++++++
 dbaccess/source/ui/inc/directsql.hxx    |    1 +
 dbaccess/uiconfig/ui/directsqldialog.ui |   19 +++++++++++++++++--
 3 files changed, 34 insertions(+), 2 deletions(-)

New commits:
commit 76f89b0097c02fa68c36cfc9a31de3b2e9166abc
Author:     Julien Nabet <serval2412 at yahoo.fr>
AuthorDate: Mon Aug 16 12:19:01 2021 +0200
Commit:     Julien Nabet <serval2412 at yahoo.fr>
CommitDate: Mon Aug 16 14:30:55 2021 +0200

    tdf#143656: Tools > SQL : add a checkbox to enable Direct SQL
    
    Change-Id: Ib3902d031777643f4814e5cfb11fdd2e0d39fce0
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120535
    Reviewed-by: Julien Nabet <serval2412 at yahoo.fr>
    Tested-by: Julien Nabet <serval2412 at yahoo.fr>

diff --git a/dbaccess/source/ui/dlg/directsql.cxx b/dbaccess/source/ui/dlg/directsql.cxx
index ac3425999cf9..e6828ae2aa3c 100644
--- a/dbaccess/source/ui/dlg/directsql.cxx
+++ b/dbaccess/source/ui/dlg/directsql.cxx
@@ -20,6 +20,7 @@
 #include <core_resource.hxx>
 #include <directsql.hxx>
 #include <sqledit.hxx>
+#include <strings.hxx>
 #include <strings.hrc>
 #include <comphelper/types.hxx>
 #include <osl/mutex.hxx>
@@ -29,6 +30,7 @@
 #include <vcl/weld.hxx>
 #include <com/sun/star/sdbc/SQLException.hpp>
 #include <com/sun/star/sdbc/XRow.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
 #include <com/sun/star/sdbc/XMultipleResults.hpp>
 
 namespace dbaui
@@ -45,6 +47,7 @@ namespace dbaui
         , m_xExecute(m_xBuilder->weld_button("execute"))
         , m_xSQLHistory(m_xBuilder->weld_combo_box("sqlhistory"))
         , m_xStatus(m_xBuilder->weld_text_view("status"))
+        , m_xDirectSQL(m_xBuilder->weld_check_button("directsql"))
         , m_xShowOutput(m_xBuilder->weld_check_button("showoutput"))
         , m_xOutput(m_xBuilder->weld_text_view("output"))
         , m_xClose(m_xBuilder->weld_button("close"))
@@ -181,6 +184,19 @@ namespace dbaui
             // create a statement
             Reference< XStatement > xStatement = m_xConnection->createStatement();
 
+            if (m_xDirectSQL->get_active())
+            {
+                Reference< com::sun::star::beans::XPropertySet > xStatementProps(xStatement, UNO_QUERY_THROW);
+                try
+                {
+                    xStatementProps->setPropertyValue(PROPERTY_ESCAPE_PROCESSING, makeAny(false));
+                }
+                catch( const Exception& )
+                {
+                    DBG_UNHANDLED_EXCEPTION("dbaccess");
+                }
+            }
+
             Reference<XDatabaseMetaData> xMeta = m_xConnection->getMetaData();
             css::uno::Reference< css::sdbc::XMultipleResults > xMR ( xStatement, UNO_QUERY );
 
diff --git a/dbaccess/source/ui/inc/directsql.hxx b/dbaccess/source/ui/inc/directsql.hxx
index b9f419d9a686..12a613cb382b 100644
--- a/dbaccess/source/ui/inc/directsql.hxx
+++ b/dbaccess/source/ui/inc/directsql.hxx
@@ -46,6 +46,7 @@ namespace dbaui
         std::unique_ptr<weld::Button> m_xExecute;
         std::unique_ptr<weld::ComboBox> m_xSQLHistory;
         std::unique_ptr<weld::TextView> m_xStatus;
+        std::unique_ptr<weld::CheckButton> m_xDirectSQL;
         std::unique_ptr<weld::CheckButton> m_xShowOutput;
         std::unique_ptr<weld::TextView> m_xOutput;
         std::unique_ptr<weld::Button> m_xClose;
diff --git a/dbaccess/uiconfig/ui/directsqldialog.ui b/dbaccess/uiconfig/ui/directsqldialog.ui
index 7546c9c7472d..8d8b57dc409b 100644
--- a/dbaccess/uiconfig/ui/directsqldialog.ui
+++ b/dbaccess/uiconfig/ui/directsqldialog.ui
@@ -125,6 +125,21 @@
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
                     <property name="column_spacing">12</property>
+                    <child>
+                      <object class="GtkCheckButton" id="directsql">
+                        <property name="label" translatable="yes" context="directsqldialog|directsql">Run SQL command _directly</property>
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="receives_default">False</property>
+                        <property name="use_underline">True</property>
+                        <property name="draw_indicator">True</property>
+                      </object>
+                      <packing>
+                        <property name="left_attach">0</property>
+                        <property name="top_attach">0</property>
+                        <property name="width">2</property>
+                      </packing>
+                    </child>
                     <child>
                       <object class="GtkCheckButton" id="showoutput">
                         <property name="label" translatable="yes" context="directsqldialog|showoutput">_Show output of "select" statements</property>
@@ -136,7 +151,7 @@
                       </object>
                       <packing>
                         <property name="left_attach">0</property>
-                        <property name="top_attach">0</property>
+                        <property name="top_attach">1</property>
                       </packing>
                     </child>
                     <child>
@@ -151,7 +166,7 @@
                       </object>
                       <packing>
                         <property name="left_attach">1</property>
-                        <property name="top_attach">0</property>
+                        <property name="top_attach">1</property>
                       </packing>
                     </child>
                   </object>


More information about the Libreoffice-commits mailing list