[Libreoffice-commits] .: Branch 'feature/mork' - connectivity/Library_mork.mk connectivity/source

David Ostrovsky davido at kemper.freedesktop.org
Sun Aug 12 15:11:57 PDT 2012


 connectivity/Library_mork.mk                           |    2 
 connectivity/source/drivers/mork/MColumnAlias.cxx      |  184 ++++++++++++
 connectivity/source/drivers/mork/MColumnAlias.hxx      |   79 +++++
 connectivity/source/drivers/mork/MConfigAccess.cxx     |  259 +++++++++++++++++
 connectivity/source/drivers/mork/MConfigAccess.hxx     |   32 ++
 connectivity/source/drivers/mork/MConnection.cxx       |    1 
 connectivity/source/drivers/mork/MConnection.hxx       |    4 
 connectivity/source/drivers/mork/MDatabaseMetaData.cxx |   17 -
 connectivity/source/drivers/mork/MExtConfigAccess.hxx  |   39 ++
 connectivity/source/drivers/mork/MResultSet.cxx        |   17 -
 10 files changed, 615 insertions(+), 19 deletions(-)

New commits:
commit b075a9b9672198651c5bbf534944bcb227245887
Author: David Ostrovsky <david at ostrovsky.org>
Date:   Mon Aug 13 00:09:59 2012 +0200

    mork driver: add OColumnAlias
    
    Change-Id: I85329469e92d51126f4e86bcafde7756277d7ddb

diff --git a/connectivity/Library_mork.mk b/connectivity/Library_mork.mk
index 388dd91..97eda03 100644
--- a/connectivity/Library_mork.mk
+++ b/connectivity/Library_mork.mk
@@ -34,6 +34,8 @@ $(eval $(call gb_Library_use_sdk_api,mork))
 
 $(eval $(call gb_Library_add_exception_objects,mork, \
     connectivity/source/drivers/mork/MColumns \
+    connectivity/source/drivers/mork/MConfigAccess \
+    connectivity/source/drivers/mork/MColumnAlias \
     connectivity/source/drivers/mork/MNSFolders \
     connectivity/source/drivers/mork/MNSINIParser \
     connectivity/source/drivers/mork/MNSProfileDiscover \
diff --git a/connectivity/source/drivers/mork/MColumnAlias.cxx b/connectivity/source/drivers/mork/MColumnAlias.cxx
new file mode 100644
index 0000000..d2c3ad1
--- /dev/null
+++ b/connectivity/source/drivers/mork/MColumnAlias.cxx
@@ -0,0 +1,184 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ *   Licensed to the Apache Software Foundation (ASF) under one or more
+ *   contributor license agreements. See the NOTICE file distributed
+ *   with this work for additional information regarding copyright
+ *   ownership. The ASF licenses this file to you under the Apache
+ *   License, Version 2.0 (the "License"); you may not use this file
+ *   except in compliance with the License. You may obtain a copy of
+ *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#include <sal/macros.h>
+#include "MColumnAlias.hxx"
+#include "MConnection.hxx"
+#include "MExtConfigAccess.hxx"
+
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/container/XNameAccess.hpp>
+
+#include <tools/diagnose_ex.h>
+
+#include <algorithm>
+#include <functional>
+
+using namespace ::connectivity;
+using namespace ::connectivity::mork;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::container;
+
+//------------------------------------------------------------------------------
+OColumnAlias::OColumnAlias( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB )
+{
+    static const sal_Char* s_pProgrammaticNames[] =
+    {
+        "FirstName",
+        "LastName",
+        "DisplayName",
+        "NickName",
+        "PrimaryEmail",
+        "SecondEmail",
+        "PreferMailFormat",
+        "WorkPhone",
+        "HomePhone",
+        "FaxNumber",
+        "PagerNumber",
+        "CellularNumber",
+        "HomeAddress",
+        "HomeAddress2",
+        "HomeCity",
+        "HomeState",
+        "HomeZipCode",
+        "HomeCountry",
+        "WorkAddress",
+        "WorkAddress2",
+        "WorkCity",
+        "WorkState",
+        "WorkZipCode",
+        "WorkCountry",
+        "JobTitle",
+        "Department",
+        "Company",
+        "WebPage1",
+        "WebPage2",
+        "BirthYear",
+        "BirthMonth",
+        "BirthDay",
+        "Custom1",
+        "Custom2",
+        "Custom3",
+        "Custom4",
+        "Notes",
+    };
+
+    for ( size_t i = 0; i < sizeof( s_pProgrammaticNames ) / sizeof( s_pProgrammaticNames[0] ); ++i )
+        m_aAliasMap[ ::rtl::OUString::createFromAscii( s_pProgrammaticNames[i] ) ] = AliasEntry( s_pProgrammaticNames[i], i );
+
+    initialize( _rxORB );
+}
+
+//------------------------------------------------------------------------------
+void OColumnAlias::initialize( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB )
+{
+    // open our driver settings config node
+
+    // the config path for our own driver's settings
+    Reference< XPropertySet > xDriverNode = createDriverConfigNode( _rxORB );
+    if ( xDriverNode.is() )
+    {
+        try
+        {
+            //.............................................................
+            Reference< XNameAccess > xAliasesNode;
+            xDriverNode->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ColumnAliases")) ) >>= xAliasesNode;
+            OSL_ENSURE( xAliasesNode.is(), "OColumnAlias::setAlias: missing the aliases node!" );
+
+            // this is a set of string nodes
+            Sequence< ::rtl::OUString > aProgrammaticNames;
+            if ( xAliasesNode.is() )
+                aProgrammaticNames = xAliasesNode->getElementNames();
+
+            //.............................................................
+            // travel through all the set elements
+            const ::rtl::OUString* pProgrammaticNames = aProgrammaticNames.getConstArray();
+            const ::rtl::OUString* pProgrammaticNamesEnd = pProgrammaticNames + aProgrammaticNames.getLength();
+            ::rtl::OUString sAssignedAlias;
+
+            for ( ; pProgrammaticNames < pProgrammaticNamesEnd; ++pProgrammaticNames )
+            {
+                OSL_VERIFY( xAliasesNode->getByName( *pProgrammaticNames ) >>= sAssignedAlias );
+
+                // normalize in case the config data is corrupted
+                // (what we really don't need is an empty alias ...)
+                if ( sAssignedAlias.isEmpty() )
+                      sAssignedAlias = *pProgrammaticNames;
+
+                ::rtl::OString sAsciiProgrammaticName( ::rtl::OUStringToOString( *pProgrammaticNames, RTL_TEXTENCODING_ASCII_US ) );
+                //.............................................................
+            #if OSL_DEBUG_LEVEL > 0
+                bool bFound = false;
+            #endif
+                for (   AliasMap::iterator search = m_aAliasMap.begin();
+                        ( search != m_aAliasMap.end() );
+                        ++search
+                    )
+                {
+                    if ( search->second.programmaticAsciiName.equals( sAsciiProgrammaticName ) )
+                    {
+                        AliasEntry entry( search->second );
+                        m_aAliasMap.erase( search );
+                        m_aAliasMap[ sAssignedAlias ] = entry;
+
+                    #if OSL_DEBUG_LEVEL > 0
+                        bFound = true;
+                    #endif
+
+                        break;
+                    }
+                }
+
+                OSL_ENSURE( bFound, "OColumnAlias::setAlias: did not find a programmatic name which exists in the configuration!" );
+            }
+        }
+        catch( const Exception& )
+        {
+            DBG_UNHANDLED_EXCEPTION();
+        }
+    }
+}
+
+//------------------------------------------------------------------
+::rtl::OString OColumnAlias::getProgrammaticNameOrFallbackToUTF8Alias( const ::rtl::OUString& _rAlias ) const
+{
+    AliasMap::const_iterator pos = m_aAliasMap.find( _rAlias );
+    if ( pos == m_aAliasMap.end() )
+    {
+        OSL_FAIL( "OColumnAlias::getProgrammaticNameOrFallbackToUTF8Alias: no programmatic name for this alias!" );
+        return ::rtl::OUStringToOString( _rAlias, RTL_TEXTENCODING_UTF8 );
+    }
+    return pos->second.programmaticAsciiName;
+}
+
+//------------------------------------------------------------------
+bool OColumnAlias::isColumnSearchable( const ::rtl::OUString _alias ) const
+{
+    ::rtl::OString sProgrammatic = getProgrammaticNameOrFallbackToUTF8Alias( _alias );
+
+    return  (   !sProgrammatic.equals( "HomeCountry" )
+            &&  !sProgrammatic.equals( "WorkCountry" )
+            );
+    // for those, we know that they're not searchable in the Mozilla/LDAP implementation.
+    // There might be more ...
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mork/MColumnAlias.hxx b/connectivity/source/drivers/mork/MColumnAlias.hxx
new file mode 100644
index 0000000..3b713ae
--- /dev/null
+++ b/connectivity/source/drivers/mork/MColumnAlias.hxx
@@ -0,0 +1,79 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ *   Licensed to the Apache Software Foundation (ASF) under one or more
+ *   contributor license agreements. See the NOTICE file distributed
+ *   with this work for additional information regarding copyright
+ *   ownership. The ASF licenses this file to you under the Apache
+ *   License, Version 2.0 (the "License"); you may not use this file
+ *   except in compliance with the License. You may obtain a copy of
+ *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+
+#ifndef _CONNECTIVITY_MORK_COLUMNALIAS_HXX_
+#define _CONNECTIVITY_MORK_COLUMNALIAS_HXX_
+
+#include <unotools/confignode.hxx>
+
+#include <osl/mutex.hxx>
+#include <vector>
+#include <boost/unordered_map.hpp>
+
+namespace connectivity
+{
+    namespace mork
+    {
+        class OColumnAlias
+        {
+        public:
+            struct AliasEntry
+            {
+                ::rtl::OString  programmaticAsciiName;
+                size_t columnPosition;
+
+                AliasEntry()
+                    :programmaticAsciiName()
+                    ,columnPosition( 0 )
+                {
+                }
+                AliasEntry( const sal_Char* _programmaticAsciiName, size_t _columnPosition )
+                    :programmaticAsciiName( _programmaticAsciiName )
+                    ,columnPosition( _columnPosition )
+                {
+                }
+            };
+            typedef ::boost::unordered_map< ::rtl::OUString, AliasEntry, ::rtl::OUStringHash > AliasMap;
+
+        private:
+            AliasMap    m_aAliasMap;
+
+        public:
+            OColumnAlias( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & );
+
+            inline bool hasAlias( const ::rtl::OUString& _rAlias ) const
+            {
+                return m_aAliasMap.find( _rAlias ) != m_aAliasMap.end();
+            }
+            ::rtl::OString getProgrammaticNameOrFallbackToUTF8Alias( const ::rtl::OUString& _rAlias ) const;
+
+            inline AliasMap::const_iterator begin() const { return m_aAliasMap.begin(); }
+            inline AliasMap::const_iterator end() const { return m_aAliasMap.end(); }
+
+            bool isColumnSearchable( const ::rtl::OUString _alias ) const;
+
+        private:
+            void initialize( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB );
+        };
+    }
+}
+#endif // _CONNECTIVITY_MORK_COLUMNALIAS_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mork/MConfigAccess.cxx b/connectivity/source/drivers/mork/MConfigAccess.cxx
new file mode 100644
index 0000000..0734f12
--- /dev/null
+++ b/connectivity/source/drivers/mork/MConfigAccess.cxx
@@ -0,0 +1,259 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ *   Licensed to the Apache Software Foundation (ASF) under one or more
+ *   contributor license agreements. See the NOTICE file distributed
+ *   with this work for additional information regarding copyright
+ *   ownership. The ASF licenses this file to you under the Apache
+ *   License, Version 2.0 (the "License"); you may not use this file
+ *   except in compliance with the License. You may obtain a copy of
+ *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+
+#include "com/sun/star/configuration/theDefaultProvider.hpp"
+#include "comphelper/processfactory.hxx"
+
+#include "MConfigAccess.hxx"
+#include "MExtConfigAccess.hxx"
+#include "MConnection.hxx"
+#include "MDriver.hxx"
+
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::beans;
+
+//.........................................................................
+namespace connectivity
+{
+    namespace mork
+    {
+        //-----------------------------------------------------------------
+        Reference< XPropertySet > createDriverConfigNode( Reference< XMultiServiceFactory > _rxORB )
+        {
+            Reference< XPropertySet > xNode;
+            try
+            {
+                //=============================================================
+                // create the config provider
+                Reference< XMultiServiceFactory > xConfigProvider(
+                    com::sun::star::configuration::theDefaultProvider::get(
+                        comphelper::getComponentContext( _rxORB ) ) );
+
+                ::rtl::OUString sCompleteNodePath(RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Office.DataAccess/DriverSettings/" ));
+                sCompleteNodePath += MorkDriver::getImplementationName_Static(  );
+
+                //=========================================================
+                // arguments for creating the config access
+                Sequence< Any > aArguments(2);
+                // the path to the node to open
+                aArguments[0] <<= PropertyValue(
+                    ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("nodepath")),
+                    0,
+                    makeAny( sCompleteNodePath ),
+                    PropertyState_DIRECT_VALUE
+                );
+                // the depth: -1 means unlimited
+                aArguments[1] <<= PropertyValue(
+                    ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("depth")),
+                    0,
+                    makeAny( (sal_Int32)-1 ),
+                    PropertyState_DIRECT_VALUE
+                );
+
+                //=========================================================
+                // create the access
+                Reference< XInterface > xAccess = xConfigProvider->createInstanceWithArguments(
+                    ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.configuration.ConfigurationAccess" )),
+                    aArguments
+                );
+                OSL_ENSURE( xAccess.is(), "createDriverConfigNode: invalid access returned (should throw an exception instead)!" );
+
+                xNode = xNode.query( xAccess );
+            }
+            catch( const Exception& )
+            {
+                OSL_FAIL( "createDriverConfigNode: caught an exception while accessing the driver's config node!" );
+            }
+
+            // outta here
+            return xNode;
+        }
+
+        //-----------------------------------------------------------------
+        namespace
+        {
+            // a private helper to accessing the point where we store the reference
+            // to the factory
+            Reference< XMultiServiceFactory >& accessFactoryStorage( )
+            {
+                static Reference< XMultiServiceFactory > xMozabServiceFactory;
+                return xMozabServiceFactory;
+            }
+        }
+
+        //-----------------------------------------------------------------
+        void setMozabServiceFactory( const Reference< XMultiServiceFactory >& _rxFactory )
+        {
+            accessFactoryStorage( ) = _rxFactory;
+        }
+
+        //-----------------------------------------------------------------
+        const Reference< XMultiServiceFactory >& getMozabServiceFactory( )
+        {
+            return accessFactoryStorage( );
+        }
+
+        //-----------------------------------------------------------------
+        ::rtl::OUString getDescription(const sal_Char* sNode,const ::rtl::OUString & sDefault)
+        {
+            ::rtl::OUString sPreferredName;
+            ::rtl::OUString sDescription;
+
+            Reference< XMultiServiceFactory > xFactory = getMozabServiceFactory();
+            OSL_ENSURE( xFactory.is(), "getPreferredProfileName: invalid service factory!" );
+            if ( xFactory.is() )
+            {
+                try
+                {
+                    Reference< XPropertySet > xDriverNode = createDriverConfigNode( xFactory );
+                    Reference< XPropertySet > xMozPrefsNode;
+                    if ( xDriverNode.is() )
+                        xDriverNode->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("MozillaPreferences" )) ) >>= xMozPrefsNode;
+                    OSL_ENSURE( xMozPrefsNode.is(), "getPreferredProfileName: could not access the node for the mozilla preferences!" );
+                    if ( xMozPrefsNode.is() )
+                        xMozPrefsNode->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ProfileName" )) ) >>= sPreferredName;
+                    if ( xMozPrefsNode.is() )
+                        xMozPrefsNode->getPropertyValue( ::rtl::OUString::createFromAscii(sNode) ) >>= sDescription;
+                    if (sDescription.getLength() == 0)
+                        sDescription = sDefault;
+                }
+                catch( const Exception& )
+                {
+                    OSL_FAIL( "getDescription: caught an exception!" );
+                }
+            }
+            if (sDescription.getLength() == 0)
+                sDescription = sDefault;
+            return sDescription;
+        }
+        //-----------------------------------------------------------------
+        ::rtl::OUString getPreferredProfileName( )
+        {
+            ::rtl::OUString sPreferredName;
+
+            Reference< XMultiServiceFactory > xFactory = getMozabServiceFactory();
+            OSL_ENSURE( xFactory.is(), "getPreferredProfileName: invalid service factory!" );
+            if ( xFactory.is() )
+            {
+                try
+                {
+                    Reference< XPropertySet > xDriverNode = createDriverConfigNode( xFactory );
+                    Reference< XPropertySet > xMozPrefsNode;
+                    if ( xDriverNode.is() )
+                        xDriverNode->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("MozillaPreferences" )) ) >>= xMozPrefsNode;
+                    OSL_ENSURE( xMozPrefsNode.is(), "getPreferredProfileName: could not access the node for the mozilla preferences!" );
+                    if ( xMozPrefsNode.is() )
+                        xMozPrefsNode->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ProfileName" )) ) >>= sPreferredName;
+                }
+                catch( const Exception& )
+                {
+                    OSL_FAIL( "getPreferredProfileName: caught an exception!" );
+                }
+            }
+            return sPreferredName;
+        }
+    }
+}
+
+//.........................................................................
+
+//-------------------------------------------------------------------------
+extern "C" const sal_Unicode* SAL_CALL getUserProfile( void )
+{
+    static sal_Bool         bReadConfig = sal_False;
+    static ::rtl::OUString  sUserProfile;
+    if ( !bReadConfig )
+    {
+        sUserProfile = ::connectivity::mork::getPreferredProfileName( );
+        bReadConfig = sal_True;
+    }
+
+    return sUserProfile.getStr();
+}
+//------------------------------------------------------------------------
+extern "C" const sal_Char* SAL_CALL getPabDescription( void )
+{
+    static sal_Bool         bReadConfig = sal_False;
+    static ::rtl::OUString  usPabDescription;
+    static ::rtl::OString   sPabDescription;
+
+    if ( !bReadConfig )
+    {
+        usPabDescription = ::connectivity::mork::getDescription(
+                            "PabDescription" ,
+                            ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Personal Address Book" )));
+        sPabDescription = ::rtl::OUStringToOString( usPabDescription,
+                                                 RTL_TEXTENCODING_UTF8);
+        bReadConfig = sal_True;
+    }
+
+    return sPabDescription.getStr();
+}
+
+//-------------------------------------------------------------------------
+extern "C" const sal_Char* SAL_CALL getHisDescription( void )
+{
+    static sal_Bool         bReadConfig = sal_False;
+    static ::rtl::OUString  usHisDescription;
+    static ::rtl::OString   sHisDescription;
+
+    if ( !bReadConfig )
+    {
+        usHisDescription = ::connectivity::mork::getDescription(
+                            "HisDescription" ,
+                            ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Collected Addresses" )));
+        sHisDescription = ::rtl::OUStringToOString( usHisDescription,
+                                                 RTL_TEXTENCODING_UTF8);
+        bReadConfig = sal_True;
+    }
+
+    return sHisDescription.getStr();
+}
+
+//-------------------------------------------------------------------------
+// MConfigAccess was invented to allow non-UNO parts access to the configuration.
+// Unfortunately, configuration access requires a XMultiServiceFactory - which the
+// mozilla side does not have.
+// So we create a "library-local" service factory here: Every need for a service
+// factory can be fullfilled by this factory (similar to the get/setProcessServiceFactory
+// in comphelper).
+// This is halfway valid, as usually, the mozabdrv library is invoked from the mozab library
+// only. The latter contains the driver class (and only this class and nothing more), and
+// the driver class is a singleton. The driver itself is created with a service factory,
+// which (by definition) can and should be used for all subsequent service requests.
+// And this is exactly what we're allowing with the following functions ....
+
+/** _pFactory must point to an XMultiServiceFactory, which must be aquired once
+    for purpose of safely transfering it. The callee will release this interface
+    when it has stored the pointer somewhere else.
+*/
+extern "C" SAL_DLLPUBLIC_EXPORT void SAL_CALL setMozabServiceFactory(
+    void* _pFactory )
+{
+    Reference< XMultiServiceFactory > xFactory = static_cast< XMultiServiceFactory* >( _pFactory );
+  //  ::connectivity::mozab::setMozabServiceFactory( xFactory );
+
+    // by definition, the object behind the interface pointer has been acquired once for purpose
+    // of safely transporting it
+    xFactory->release();
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mork/MConfigAccess.hxx b/connectivity/source/drivers/mork/MConfigAccess.hxx
new file mode 100644
index 0000000..e00986b
--- /dev/null
+++ b/connectivity/source/drivers/mork/MConfigAccess.hxx
@@ -0,0 +1,32 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ *   Licensed to the Apache Software Foundation (ASF) under one or more
+ *   contributor license agreements. See the NOTICE file distributed
+ *   with this work for additional information regarding copyright
+ *   ownership. The ASF licenses this file to you under the Apache
+ *   License, Version 2.0 (the "License"); you may not use this file
+ *   except in compliance with the License. You may obtain a copy of
+ *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef CONNECTIVITY_MORK_MCONFIGACCESS_HXX
+
+#include <sal/types.h>
+
+extern "C" const sal_Unicode* SAL_CALL getUserProfile( void );
+
+extern "C" const sal_Char* SAL_CALL getPabDescription( void );
+
+extern "C" const sal_Char* SAL_CALL getHisDescription( void );
+
+#endif  // CONNECTIVITY_MORK_MCONFIGACCESS_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mork/MConnection.cxx b/connectivity/source/drivers/mork/MConnection.cxx
index 08baf7e..9a7ae5b 100644
--- a/connectivity/source/drivers/mork/MConnection.cxx
+++ b/connectivity/source/drivers/mork/MConnection.cxx
@@ -47,6 +47,7 @@ static const int defaultScope = 0x80;
 OConnection::OConnection(MorkDriver* _pDriver)
     :OSubComponent<OConnection, OConnection_BASE>((::cppu::OWeakObject*)_pDriver, this)
     ,m_pDriver(_pDriver)
+    ,m_aColumnAlias( _pDriver->getFactory() )
 {
     m_pDriver->acquire();
     m_pProfileAccess = new ProfileAccess();
diff --git a/connectivity/source/drivers/mork/MConnection.hxx b/connectivity/source/drivers/mork/MConnection.hxx
index 2967520..72cf592 100644
--- a/connectivity/source/drivers/mork/MConnection.hxx
+++ b/connectivity/source/drivers/mork/MConnection.hxx
@@ -14,6 +14,7 @@
 
 #include "connectivity/OSubComponent.hxx"
 #include "TConnection.hxx"
+#include "MColumnAlias.hxx"
 
 #include <com/sun/star/beans/PropertyValue.hpp>
 #include <com/sun/star/sdbc/SQLWarning.hpp>
@@ -50,6 +51,7 @@ namespace connectivity
             ::com::sun::star::sdbc::SQLWarning      m_aLastWarning;
             MorkDriver*                             m_pDriver;      //  Pointer to the owning
                                                                     //  driver object
+            OColumnAlias    m_aColumnAlias;
             // Profile Access
             ProfileAccess* m_pProfileAccess;
             // Mork Parser
@@ -98,6 +100,8 @@ namespace connectivity
             virtual ::com::sun::star::uno::Any SAL_CALL getWarnings(  ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
             virtual void SAL_CALL clearWarnings() throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
 
+            const OColumnAlias & getColumnAlias() const   { return (m_aColumnAlias); }
+
             static ::rtl::OUString getDriverImplementationName();
 
             sal_Bool getForceLoadTables() {return true;}
diff --git a/connectivity/source/drivers/mork/MDatabaseMetaData.cxx b/connectivity/source/drivers/mork/MDatabaseMetaData.cxx
index afa538a..fce0330 100644
--- a/connectivity/source/drivers/mork/MDatabaseMetaData.cxx
+++ b/connectivity/source/drivers/mork/MDatabaseMetaData.cxx
@@ -131,9 +131,9 @@ ODatabaseMetaDataResultSet::ORows& SAL_CALL ODatabaseMetaData::getColumnRows(
             // TABLE_NAME
             aRow[3] = new ORowSetValueDecorator( tables[j] );
 
-            SAL_INFO("connectivity.mork", "\tTableName = : " << tables[j]);
+            const OColumnAlias& colNames = m_pConnection->getColumnAlias();
 
-#if 0
+            SAL_INFO("connectivity.mork", "\tTableName = : " << tables[j]);
             // Iterate over all collumns in the table.
             for (   OColumnAlias::AliasMap::const_iterator compare = colNames.begin();
                     compare != colNames.end();
@@ -142,7 +142,9 @@ ODatabaseMetaDataResultSet::ORows& SAL_CALL ODatabaseMetaData::getColumnRows(
             {
                 if ( match( columnNamePattern, compare->first, '\0' ) )
                 {
-                    OSL_TRACE( "\t\t\tColumnName = %s;", OUtoCStr( compare->first ) );
+//                    OSL_TRACE( "\t\t\tColumnName = %s;", OUtoCStr( compare->first ) );
+                    SAL_INFO("connectivity.mork", "\t\tColumnNam : " << compare->first);
+
                     // COLUMN_NAME
                     aRow[4] = new ORowSetValueDecorator( compare->first );
                     // ORDINAL_POSITION
@@ -150,15 +152,6 @@ ODatabaseMetaDataResultSet::ORows& SAL_CALL ODatabaseMetaData::getColumnRows(
                     aRows.push_back(aRow);
                 }
             }
-#endif
-            SAL_INFO("connectivity.mork", "\tTableName = : " << tables[j]);
-            std::string name = "name";
-            OUString ouName(name.c_str(), name.length(), RTL_TEXTENCODING_UTF8);
-            // COLUMN_NAME
-            aRow[4] = new ORowSetValueDecorator(ouName );
-            // ORDINAL_POSITION
-            aRow[17] = new ORowSetValueDecorator( static_cast< sal_Int32 >(0) + 1 );
-            aRows.push_back(aRow);
         }
     }
     return( aRows );
diff --git a/connectivity/source/drivers/mork/MExtConfigAccess.hxx b/connectivity/source/drivers/mork/MExtConfigAccess.hxx
new file mode 100644
index 0000000..44e7a86
--- /dev/null
+++ b/connectivity/source/drivers/mork/MExtConfigAccess.hxx
@@ -0,0 +1,39 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ *   Licensed to the Apache Software Foundation (ASF) under one or more
+ *   contributor license agreements. See the NOTICE file distributed
+ *   with this work for additional information regarding copyright
+ *   ownership. The ASF licenses this file to you under the Apache
+ *   License, Version 2.0 (the "License"); you may not use this file
+ *   except in compliance with the License. You may obtain a copy of
+ *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef CONNECTIVITY_MORK_MEXTCONFIGACCESS_HXX
+
+// This is the extended version (for use on the SO side of the driver) of MConfigAccess
+// (which is for use on the mozilla side only)
+
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+
+namespace connectivity
+{
+    namespace mork
+    {
+        ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >
+                createDriverConfigNode( ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > _rxORB );
+    }
+}
+
+#endif // CONNECTIVITY_MORK_MEXTCONFIGACCESS_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/mork/MResultSet.cxx b/connectivity/source/drivers/mork/MResultSet.cxx
index c150cf1..eea07df 100644
--- a/connectivity/source/drivers/mork/MResultSet.cxx
+++ b/connectivity/source/drivers/mork/MResultSet.cxx
@@ -1056,17 +1056,19 @@ void OResultSet::analyseWhereClause( const OSQLParseNode*                 parseT
 void OResultSet::fillRowData()
     throw( ::com::sun::star::sdbc::SQLException )
 {
-    OSL_FAIL( "OResultSet::fillRowData() not implemented!" );
-/*
+    SAL_INFO("connectivity.mork", "=> OResultSet::fillRowData()" );
+
     OSL_ENSURE( m_pStatement, "Require a statement" );
 
-    MQueryExpression queryExpression;
 
-    OConnection* xConnection = static_cast<OConnection*>(m_pStatement->getConnection().get());
     m_xColumns = m_pSQLIterator->getSelectColumns();
 
     OSL_ENSURE(m_xColumns.is(), "Need the Columns!!");
 
+/*
+    OConnection* xConnection = static_cast<OConnection*>(m_pStatement->getConnection().get());
+    MQueryExpression queryExpression;
+
     OSQLColumns::Vector::const_iterator aIter = m_xColumns->get().begin();
     const ::rtl::OUString sProprtyName = OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME);
     ::rtl::OUString sName;
@@ -1194,8 +1196,8 @@ sal_Int32 OResultSet::getRowForCardNumber(sal_Int32 nCardNum)
 void SAL_CALL OResultSet::executeQuery() throw( ::com::sun::star::sdbc::SQLException,
                                                 ::com::sun::star::uno::RuntimeException)
 {
-    OSL_FAIL( "OResultSet::executeQuery() not implemented" );
-/*
+    SAL_INFO("connectivity.mork", "=> OResultSet::executeQuery()" );
+
     ResultSetEntryGuard aGuard( *this );
 
     OSL_ENSURE( m_pTable, "Need a Table object");
@@ -1217,6 +1219,7 @@ void SAL_CALL OResultSet::executeQuery() throw( ::com::sun::star::sdbc::SQLExcep
 
     OSL_ENSURE(m_xColumns.is(), "Need the Columns!!");
 
+/*
     switch( m_pSQLIterator->getStatementType() )
     {
         case SQL_STATEMENT_SELECT:
@@ -1524,7 +1527,7 @@ sal_Int32 OResultSet::deletedCount()
 // -----------------------------------------------------------------------------
 sal_Bool OResultSet::seekRow( eRowPosition /*pos*/, sal_Int32 /*nOffset*/ )
 {
-    OSL_FAIL( "OResultSet::seekRow() not omplemented" );
+    OSL_FAIL( "OResultSet::seekRow() not implemented" );
 /*
     ResultSetEntryGuard aGuard( *this );
     if ( !m_pKeySet.is() )


More information about the Libreoffice-commits mailing list