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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Wed Feb 13 09:24:34 UTC 2019


 dbaccess/source/core/misc/dsntypes.cxx                         |   22 ----
 dbaccess/source/inc/dsntypes.hxx                               |    2 
 dbaccess/source/ui/dlg/generalpage.cxx                         |    4 
 officecfg/registry/schema/org/openoffice/Office/DataAccess.xcs |   45 ----------
 4 files changed, 5 insertions(+), 68 deletions(-)

New commits:
commit 74f9830db4f515856adefcbc936094ceca1b78fa
Author:     Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Thu Feb 7 11:26:14 2019 +0100
Commit:     Stephan Bergmann <sbergman at redhat.com>
CommitDate: Wed Feb 13 10:24:09 2019 +0100

    Remove dead and broken EmbeddedDatabases configuration
    
    As found out in 98c0b20864af965c3bb99a32f8ea57be7402e534 "Make Firebird the
    (unconditional) default for new databases":  "(Curiously,
    ODsnTypeCollection::getEmbeddedDatabase would read a DefaultEmbeddedDatabase
    value from the configuration before resorting to the hardcoded default, but
    `git log -SDefaultEmbeddedDatabase` makes it look like there has never been any
    code to actually write that setting.)"
    
    Digging deeper, the story appears to be as follows:  First, "INTEGRATION: CWS
    hsqldb" commits in 2004 had addded the EmbeddedDatabases group (and accompanying
    templates) to officecfg/registry/schema/org/openoffice/Office/DataAccess.xcs
    (ee11cb6373f6bbb28b1cdf57daa73465d030fda5), corresponding values (for HSQLDB)
    to officecfg/registry/data/org/openoffice/Office/DataAccess.xcu
    (60c5f0af740265ab81b620208205fe9e74be452f), and code to read those values
    (lcl_getEmbeddedDatabase in dbaccess/source/ui/misc/dsntypes.cxx;
    ODsnTypeCollection::getEmbeddedDatabaseURL et al in
    dbaccess/source/ui/misc/dsntypes.cxx; all
    a68938bc908c8f852912f3310d2f4bec779a3cea).  This looks like it actually worked.
    
    Then, "INTEGRATION: CWS dba24b" commits in 2007 removed the EmbeddedDatabases
    configuration data from
    officecfg/registry/data/org/openoffice/Office/DataAccess.xcu
    (473a3ccf63cc36ac3fa992dcb72d581496cb1bbf, "during #i80930#: The approach to
    read the concrete type of the embedded DB from the configuration does not work,
    there are enough places where we silently assume 'embedded == embedded HSQLDB'")
    and removed the code reading it (79bbd382beb13a8f4031cc9b61332d0794878699), but
    left the EmbeddedDatabases schema data in
    officecfg/registry/schema/org/openoffice/Office/DataAccess.xcs untouched.
    
    Then, b88a62cc97613e5dc00c806f59982cb57f9d1dc8 "CWS-TOOLING: integrate CWS
    dbaperf2" in 2009 reintroduced code that attempts to read the configuration data
    as ODsnTypeCollection::getEmbeddedDatabase
    (dbaccess/source/core/misc/dsntypes.cxx).  The reason for that may be
    "2009-05-06 14:22:21 +0200 oj  r271589 : #i101587# use config for the drivers"
    as listed in the commit message.  The code added as
    ODsnTypeCollection::getEmbeddedDatabase back then remained effectively unchanged
    until today, but looks fundamentally broken:  It starts out with trying to read
    an /org.openoffice.Office.DataAccess/EmbeddedDatabases/DefaultEmbeddedDatabase/
    Value property that can never be present per the schema (an
    /org.openoffice.Office.DataAccess/EmbeddedDatabases/DefaultEmbeddedDatabase
    property could be); so no data is ever actually read from the configuration by
    ODsnTypeCollection::getEmbeddedDatabase.  (And the commit also didn't add back
    any configuration data to
    officecfg/registry/data/org/openoffice/Office/DataAccess.xcu that could have
    been read in the first place, nor any code to generate such data
    programmatically.)
    
    So remove the broken code to read configuration data from
    ODsnTypeCollection::getEmbeddedDatabase (which means it can be a static member
    function now) and also remove the obviously unused EmbeddedDatabases group (and
    accompanying templates) from
    officecfg/registry/schema/org/openoffice/Office/DataAccess.xcs.
    
    Change-Id: Icc9b34075b9b7e960df6c236d3595b7fabe71f9d
    Reviewed-on: https://gerrit.libreoffice.org/67494
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/dbaccess/source/core/misc/dsntypes.cxx b/dbaccess/source/core/misc/dsntypes.cxx
index aeca5a029655..ee394325d74c 100644
--- a/dbaccess/source/core/misc/dsntypes.cxx
+++ b/dbaccess/source/core/misc/dsntypes.cxx
@@ -282,27 +282,9 @@ bool ODsnTypeCollection::isEmbeddedDatabase( const OUString& _sURL )
     return _sURL.startsWith( "sdbc:embedded:" );
 }
 
-OUString ODsnTypeCollection::getEmbeddedDatabase() const
+OUString ODsnTypeCollection::getEmbeddedDatabase()
 {
-    OUString sEmbeddedDatabaseURL;
-    const ::utl::OConfigurationTreeRoot aInstalled = ::utl::OConfigurationTreeRoot::createWithComponentContext(m_xContext, "org.openoffice.Office.DataAccess", -1, ::utl::OConfigurationTreeRoot::CM_READONLY);
-    if ( aInstalled.isValid() )
-    {
-        if ( aInstalled.hasByName("EmbeddedDatabases/DefaultEmbeddedDatabase/Value") )
-        {
-            static const OUStringLiteral s_sValue = "EmbeddedDatabases/DefaultEmbeddedDatabase/Value";
-
-            aInstalled.getNodeValue(s_sValue) >>= sEmbeddedDatabaseURL;
-            if ( !sEmbeddedDatabaseURL.isEmpty() )
-                aInstalled.getNodeValue(s_sValue + "/" + sEmbeddedDatabaseURL + "/URL") >>= sEmbeddedDatabaseURL;
-        }
-    }
-    if ( sEmbeddedDatabaseURL.isEmpty() )
-    {
-        sEmbeddedDatabaseURL = "sdbc:embedded:firebird";
-    }
-
-    return sEmbeddedDatabaseURL;
+    return "sdbc:embedded:firebird";
 }
 
 
diff --git a/dbaccess/source/inc/dsntypes.hxx b/dbaccess/source/inc/dsntypes.hxx
index fe64a933d77e..8ce435285bfe 100644
--- a/dbaccess/source/inc/dsntypes.hxx
+++ b/dbaccess/source/inc/dsntypes.hxx
@@ -160,7 +160,7 @@ public:
     /// checks if the given data source type embeds its data into the database document
     static bool isEmbeddedDatabase( const OUString& _sURL );
 
-    OUString getEmbeddedDatabase() const;
+    static OUString getEmbeddedDatabase();
 
     // returns true when the properties dialog can be shown, otherwise false.
     static bool isShowPropertiesEnabled( const OUString& _sURL );
diff --git a/dbaccess/source/ui/dlg/generalpage.cxx b/dbaccess/source/ui/dlg/generalpage.cxx
index ba609c6a89b4..567b1a2d65ae 100644
--- a/dbaccess/source/ui/dlg/generalpage.cxx
+++ b/dbaccess/source/ui/dlg/generalpage.cxx
@@ -251,7 +251,7 @@ namespace dbaui
 
         if (m_pCollection && bValid)
         {
-            implSetCurrentType( m_pCollection->getEmbeddedDatabase() );
+            implSetCurrentType( dbaccess::ODsnTypeCollection::getEmbeddedDatabase() );
             sDisplayName = m_pCollection->getTypeDisplayName( m_eCurrentSelection );
         }
 
@@ -486,7 +486,7 @@ namespace dbaui
         get( m_pPB_OpenDatabase, "openDatabase" );
 
         // If no driver for embedded DBs is installed, and no dBase driver, then hide the "Create new database" option
-        sal_Int32 nCreateNewDBIndex = m_pCollection->getIndexOf( m_pCollection->getEmbeddedDatabase() );
+        sal_Int32 nCreateNewDBIndex = m_pCollection->getIndexOf( dbaccess::ODsnTypeCollection::getEmbeddedDatabase() );
         if ( nCreateNewDBIndex == -1 )
             nCreateNewDBIndex = m_pCollection->getIndexOf( "sdbc:dbase:" );
         bool bHideCreateNew = ( nCreateNewDBIndex == -1 );
diff --git a/officecfg/registry/schema/org/openoffice/Office/DataAccess.xcs b/officecfg/registry/schema/org/openoffice/Office/DataAccess.xcs
index 98a581786d32..e2591ee34aea 100644
--- a/officecfg/registry/schema/org/openoffice/Office/DataAccess.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/DataAccess.xcs
@@ -38,16 +38,6 @@
         </info>
       </prop>
     </group>
-    <group oor:name="EmbeddedDatabaseSetting">
-      <info>
-        <desc>Describes a setting for an embedded database.</desc>
-      </info>
-      <prop oor:name="Value" oor:type="oor:any">
-        <info>
-          <desc>Describes the value for an embedded database setting.</desc>
-        </info>
-      </prop>
-    </group>
     <group oor:name="ReportEngineName">
       <info>
         <desc>Describes the report engine.</desc>
@@ -63,26 +53,6 @@
         </info>
       </prop>
     </group>
-    <group oor:name="EmbeddedDatabaseName">
-      <info>
-        <desc>Describes the URL schema for an embedded database. They must start with sdbc:embedded:.</desc>
-      </info>
-      <prop oor:name="URL" oor:type="xs:string">
-        <info>
-          <desc>Specifies the URL for the embedded database.</desc>
-        </info>
-      </prop>
-      <prop oor:name="UIName" oor:type="xs:string" oor:localized="true">
-        <info>
-          <desc>Specifies the name of the embedded database which will be displayed in the statusbar of the database application.</desc>
-        </info>
-      </prop>
-      <set oor:name="EmbeddedDatabaseSettings" oor:node-type="EmbeddedDatabaseSetting">
-        <info>
-          <desc>Specifies the settings of an embedded database.</desc>
-        </info>
-      </set>
-    </group>
     <group oor:name="DataSource">
       <info>
         <desc>Specifies the data source to be used for the bibliography.</desc>
@@ -240,21 +210,6 @@
         </info>
       </set>
     </group>
-    <group oor:name="EmbeddedDatabases">
-      <info>
-        <desc>Specifies the default embedded database which should be used.</desc>
-      </info>
-      <prop oor:name="DefaultEmbeddedDatabase" oor:type="xs:string">
-        <info>
-          <desc>Specifies the name of the embedded database to use.</desc>
-        </info>
-      </prop>
-      <set oor:name="EmbeddedDatabaseNames" oor:node-type="EmbeddedDatabaseName">
-        <info>
-          <desc>Specifies all embedded database names which are registered.</desc>
-        </info>
-      </set>
-    </group>
     <group oor:name="DriverManager">
       <info>
         <desc>Specifies additional information about the database drivers.</desc>


More information about the Libreoffice-commits mailing list