summaryrefslogtreecommitdiffstats
path: root/connectivity/source/inc/hsqldb
diff options
context:
space:
mode:
Diffstat (limited to 'connectivity/source/inc/hsqldb')
-rw-r--r--connectivity/source/inc/hsqldb/HCatalog.hxx60
-rw-r--r--connectivity/source/inc/hsqldb/HColumns.hxx56
-rw-r--r--connectivity/source/inc/hsqldb/HConnection.hxx142
-rw-r--r--connectivity/source/inc/hsqldb/HDriver.hxx123
-rw-r--r--connectivity/source/inc/hsqldb/HStorageAccess.hxx43
-rw-r--r--connectivity/source/inc/hsqldb/HStorageMap.hxx97
-rw-r--r--connectivity/source/inc/hsqldb/HTable.hxx115
-rw-r--r--connectivity/source/inc/hsqldb/HTables.hxx52
-rw-r--r--connectivity/source/inc/hsqldb/HTools.hxx49
-rw-r--r--connectivity/source/inc/hsqldb/HUser.hxx73
-rw-r--r--connectivity/source/inc/hsqldb/HUsers.hxx52
-rw-r--r--connectivity/source/inc/hsqldb/HView.hxx88
-rw-r--r--connectivity/source/inc/hsqldb/HViews.hxx51
13 files changed, 1001 insertions, 0 deletions
diff --git a/connectivity/source/inc/hsqldb/HCatalog.hxx b/connectivity/source/inc/hsqldb/HCatalog.hxx
new file mode 100644
index 000000000..8d1da42de
--- /dev/null
+++ b/connectivity/source/inc/hsqldb/HCatalog.hxx
@@ -0,0 +1,60 @@
+/* -*- 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 .
+ */
+#pragma once
+
+#include <sdbcx/VCatalog.hxx>
+
+namespace connectivity::hsqldb
+ {
+ // please don't name the class the same name as in another namespaces
+ // some compilers have problems with this task as I noticed on windows
+ class OHCatalog : public connectivity::sdbcx::OCatalog
+ {
+ css::uno::Reference< css::sdbc::XConnection > m_xConnection;
+
+ /** calls XDatabaseMetaData::getTables.
+ @param _sKindOfObject
+ The type of tables to be fetched.
+ @param _rNames
+ The container for the names to be filled.
+ */
+ void refreshObjects(const css::uno::Sequence< OUString >& _sKindOfObject,::std::vector< OUString>& _rNames);
+
+ public:
+ // implementation of the pure virtual methods
+ virtual void refreshTables() override;
+ virtual void refreshViews() override ;
+ virtual void refreshGroups() override;
+ virtual void refreshUsers() override ;
+
+ public:
+ OHCatalog(const css::uno::Reference< css::sdbc::XConnection >& _xConnection);
+
+ sdbcx::OCollection* getPrivateTables() const { return m_pTables.get(); }
+ sdbcx::OCollection* getPrivateViews() const { return m_pViews.get(); }
+ const css::uno::Reference< css::sdbc::XConnection >& getConnection() const { return m_xConnection; }
+
+ virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
+ // ::cppu::OComponentHelper
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override;
+ };
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/hsqldb/HColumns.hxx b/connectivity/source/inc/hsqldb/HColumns.hxx
new file mode 100644
index 000000000..c27645f45
--- /dev/null
+++ b/connectivity/source/inc/hsqldb/HColumns.hxx
@@ -0,0 +1,56 @@
+/* -*- 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 .
+ */
+#pragma once
+#include <connectivity/TColumnsHelper.hxx>
+#include <connectivity/sdbcx/VColumn.hxx>
+
+namespace connectivity::hsqldb
+ {
+ class OHSQLColumns : public OColumnsHelper
+ {
+ protected:
+ virtual css::uno::Reference< css::beans::XPropertySet > createDescriptor() override;
+ public:
+ OHSQLColumns( ::cppu::OWeakObject& _rParent
+ ,::osl::Mutex& _rMutex
+ ,const ::std::vector< OUString> &_rVector
+ );
+ };
+
+ class OHSQLColumn;
+ typedef ::comphelper::OIdPropertyArrayUsageHelper<OHSQLColumn> OHSQLColumn_PROP;
+
+ class OHSQLColumn : public sdbcx::OColumn,
+ public OHSQLColumn_PROP
+ {
+ OUString m_sAutoIncrement;
+ protected:
+ virtual ::cppu::IPropertyArrayHelper* createArrayHelper( sal_Int32 _nId) const override;
+ virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() override;
+
+ public:
+ OHSQLColumn();
+ virtual void construct() override;
+
+ virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override;
+ };
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/hsqldb/HConnection.hxx b/connectivity/source/inc/hsqldb/HConnection.hxx
new file mode 100644
index 000000000..6e2a54c9c
--- /dev/null
+++ b/connectivity/source/inc/hsqldb/HConnection.hxx
@@ -0,0 +1,142 @@
+/* -*- 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 .
+ */
+
+#pragma once
+
+#include <connectivity/ConnectionWrapper.hxx>
+#include <com/sun/star/util/XFlushable.hpp>
+#include <com/sun/star/sdbc/XDriver.hpp>
+#include <com/sun/star/sdb/application/XTableUIProvider.hpp>
+#include <cppuhelper/compbase.hxx>
+#include <cppuhelper/basemutex.hxx>
+#include <comphelper/uno3.hxx>
+#include <comphelper/interfacecontainer2.hxx>
+
+namespace connectivity::hsqldb
+ {
+ class SAL_NO_VTABLE IMethodGuardAccess
+ {
+ public:
+ virtual ::osl::Mutex& getMutex() const = 0;
+ virtual void checkDisposed() const = 0;
+
+ protected:
+ ~IMethodGuardAccess() {}
+ };
+
+
+ // OHsqlConnection - wraps all methods to the real connection from the driver
+ // but when disposed it doesn't dispose the real connection
+
+ typedef ::cppu::WeakComponentImplHelper< css::util::XFlushable
+ , css::sdb::application::XTableUIProvider
+ > OHsqlConnection_BASE;
+
+ class OHsqlConnection :public cppu::BaseMutex
+ ,public OHsqlConnection_BASE
+ ,public OConnectionWrapper
+ ,public IMethodGuardAccess
+ {
+ private:
+ ::comphelper::OInterfaceContainerHelper2 m_aFlushListeners;
+ css::uno::Reference< css::sdbc::XDriver > m_xDriver;
+ css::uno::Reference< css::uno::XComponentContext > m_xContext;
+ bool m_bIni;
+ bool m_bReadOnly;
+
+ protected:
+ virtual void SAL_CALL disposing() override;
+ virtual ~OHsqlConnection() override;
+
+ public:
+ OHsqlConnection(
+ const css::uno::Reference< css::sdbc::XDriver >& _rxDriver,
+ const css::uno::Reference< css::sdbc::XConnection >& _xConnection,
+ const css::uno::Reference< css::uno::XComponentContext>& _rxContext
+ );
+
+ // XServiceInfo
+ DECLARE_SERVICE_INFO();
+ DECLARE_XTYPEPROVIDER()
+ DECLARE_XINTERFACE( )
+
+ // IMethodGuardAccess
+ virtual ::osl::Mutex& getMutex() const override;
+ virtual void checkDisposed() const override;
+
+ // XFlushable
+ virtual void SAL_CALL flush( ) override;
+ virtual void SAL_CALL addFlushListener( const css::uno::Reference< css::util::XFlushListener >& l ) override;
+ virtual void SAL_CALL removeFlushListener( const css::uno::Reference< css::util::XFlushListener >& l ) override;
+
+ // XTableUIProvider
+ virtual css::uno::Reference< css::graphic::XGraphic > SAL_CALL getTableIcon( const OUString& TableName, ::sal_Int32 ColorMode ) override;
+ virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getTableEditor( const css::uno::Reference< css::sdb::application::XDatabaseDocumentUI >& DocumentUI, const OUString& TableName ) override;
+
+ private:
+
+ /** retrieves our table container
+ @return
+ our table container. Guaranteed to not be <NULL/>.
+ @throws css::lang::WrappedTargetException
+ if a non-RuntimeException is caught during obtaining the container.
+ @throws css::uno::RuntimeException
+ if a serious error occurs
+ @precond
+ We're not disposed.
+ */
+ css::uno::Reference< css::container::XNameAccess >
+ impl_getTableContainer_throw();
+
+ /** checks whether the given table name denotes an existing table
+ @param _rTableName
+ the fully name of the table to check for existence
+ @throws css::lang::IllegalArgumentException
+ if the name does not denote an existing table
+ @precond
+ We're not disposed.
+ */
+ void impl_checkExistingTable_throw( const OUString& _rTableName );
+
+ /** checks whether the given table name refers to a HSQL TEXT TABLE
+ */
+ bool impl_isTextTable_nothrow( const OUString& _rTableName );
+
+ /** retrieves the icon for HSQL TEXT TABLEs
+ */
+ css::uno::Reference< css::graphic::XGraphic >
+ impl_getTextTableIcon_nothrow();
+ };
+
+
+ // OHsqlConnection
+
+ class MethodGuard : public ::osl::MutexGuard
+ {
+ public:
+ MethodGuard( const IMethodGuardAccess& _rComponent )
+ : ::osl::MutexGuard( _rComponent.getMutex() )
+ {
+ _rComponent.checkDisposed();
+ }
+ };
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/hsqldb/HDriver.hxx b/connectivity/source/inc/hsqldb/HDriver.hxx
new file mode 100644
index 000000000..0dda7e5e0
--- /dev/null
+++ b/connectivity/source/inc/hsqldb/HDriver.hxx
@@ -0,0 +1,123 @@
+/* -*- 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 .
+ */
+#pragma once
+
+#include <com/sun/star/sdbc/XDriver.hpp>
+#include <com/sun/star/sdbcx/XDataDefinitionSupplier.hpp>
+#include <com/sun/star/sdbcx/XCreateCatalog.hpp>
+#include <com/sun/star/embed/XTransactionListener.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <cppuhelper/compbase.hxx>
+#include <cppuhelper/basemutex.hxx>
+#include <connectivity/CommonTools.hxx>
+
+
+namespace connectivity::hsqldb
+ {
+ typedef ::cppu::WeakComponentImplHelper< css::sdbc::XDriver
+ , css::sdbcx::XDataDefinitionSupplier
+ , css::lang::XServiceInfo
+ , css::sdbcx::XCreateCatalog
+ , css::embed::XTransactionListener
+ > ODriverDelegator_BASE;
+
+ typedef std::pair< css::uno::WeakReferenceHelper,css::uno::WeakReferenceHelper> TWeakRefPair;
+ typedef std::pair< OUString ,TWeakRefPair > TWeakConnectionPair;
+
+ typedef std::pair< css::uno::WeakReferenceHelper,TWeakConnectionPair> TWeakPair;
+ typedef std::vector< TWeakPair > TWeakPairVector;
+
+
+ /** delegates all calls to the original driver and extend the existing one with the SDBCX layer.
+
+ */
+ class ODriverDelegator final : public ::cppu::BaseMutex
+ ,public ODriverDelegator_BASE
+ {
+ TWeakPairVector m_aConnections; // vector containing a list
+ // of all the Connection objects
+ // for this Driver
+ css::uno::Reference< css::sdbc::XDriver > m_xDriver;
+ css::uno::Reference< css::uno::XComponentContext > m_xContext;
+ bool m_bInShutDownConnections;
+
+ /** load the driver we want to delegate.
+ The <member>m_xDriver</member> may be <NULL/> if the driver could not be loaded.
+ @return
+ The driver which was currently selected.
+ */
+ css::uno::Reference< css::sdbc::XDriver > const & loadDriver( );
+
+ /** shut down the connection and revoke the storage from the map
+ @param _aIter
+ The connection to shut down and storage to revoke.
+ */
+ void shutdownConnection(const TWeakPairVector::iterator& _aIter);
+
+ public:
+ /** creates a new delegator for a HSQLDB driver
+ */
+ ODriverDelegator(const css::uno::Reference< css::uno::XComponentContext >& _rxContext);
+
+ // XServiceInfo
+ DECLARE_SERVICE_INFO();
+
+ // XDriver
+ virtual css::uno::Reference< css::sdbc::XConnection > SAL_CALL connect( const OUString& url, const css::uno::Sequence< css::beans::PropertyValue >& info ) override;
+ virtual sal_Bool SAL_CALL acceptsURL( const OUString& url ) override;
+ virtual css::uno::Sequence< css::sdbc::DriverPropertyInfo > SAL_CALL getPropertyInfo( const OUString& url, const css::uno::Sequence< css::beans::PropertyValue >& info ) override;
+ virtual sal_Int32 SAL_CALL getMajorVersion( ) override;
+ virtual sal_Int32 SAL_CALL getMinorVersion( ) override;
+
+ // XDataDefinitionSupplier
+ virtual css::uno::Reference< css::sdbcx::XTablesSupplier > SAL_CALL getDataDefinitionByConnection( const css::uno::Reference< css::sdbc::XConnection >& connection ) override;
+ virtual css::uno::Reference< css::sdbcx::XTablesSupplier > SAL_CALL getDataDefinitionByURL( const OUString& url, const css::uno::Sequence< css::beans::PropertyValue >& info ) override;
+
+ // XCreateCatalog
+ virtual void SAL_CALL createCatalog( const css::uno::Sequence< css::beans::PropertyValue >& info ) override;
+
+ // XEventListener
+ virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override;
+
+ // XTransactionListener
+ virtual void SAL_CALL preCommit( const css::lang::EventObject& aEvent ) override;
+ virtual void SAL_CALL commited( const css::lang::EventObject& aEvent ) override;
+ virtual void SAL_CALL preRevert( const css::lang::EventObject& aEvent ) override;
+ virtual void SAL_CALL reverted( const css::lang::EventObject& aEvent ) override;
+
+ void shutdownConnections();
+ void flushConnections();
+ private:
+ /// dtor
+ virtual ~ODriverDelegator() override;
+ // OComponentHelper
+ virtual void SAL_CALL disposing() override;
+
+ /** called when we connected to a newly created embedded database
+ */
+ void onConnectedNewDatabase(
+ const css::uno::Reference< css::sdbc::XConnection >& _rxConnection
+ );
+ };
+
+
+} // namespace connectivity::hsqldb
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/hsqldb/HStorageAccess.hxx b/connectivity/source/inc/hsqldb/HStorageAccess.hxx
new file mode 100644
index 000000000..5a49162c2
--- /dev/null
+++ b/connectivity/source/inc/hsqldb/HStorageAccess.hxx
@@ -0,0 +1,43 @@
+/* -*- 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 .
+ */
+
+#pragma once
+
+#include <sal/config.h>
+
+#if defined __clang__
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wunknown-attributes"
+#endif
+#include <jni.h>
+#if defined __clang__
+#pragma clang diagnostic pop
+#endif
+
+namespace connectivity::hsqldb
+{
+ class DataLogFile;
+}
+
+jint read_from_storage_stream( JNIEnv * env, jstring name, jstring key );
+jint read_from_storage_stream_into_buffer( JNIEnv * env, jstring name, jstring key, jbyteArray buffer, jint off, jint len );
+void write_to_storage_stream_from_buffer( JNIEnv* env, jstring name, jstring key, jbyteArray buffer, jint off, jint len );
+void write_to_storage_stream( JNIEnv* env, jstring name, jstring key, jint v );
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/hsqldb/HStorageMap.hxx b/connectivity/source/inc/hsqldb/HStorageMap.hxx
new file mode 100644
index 000000000..06f31e6df
--- /dev/null
+++ b/connectivity/source/inc/hsqldb/HStorageMap.hxx
@@ -0,0 +1,97 @@
+/* -*- 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 .
+ */
+#pragma once
+
+#include <sal/config.h>
+
+#include <map>
+#include <memory>
+
+#include <com/sun/star/embed/XStorage.hpp>
+#include <com/sun/star/embed/XTransactionListener.hpp>
+#include <com/sun/star/io/XStream.hpp>
+#include <com/sun/star/io/XOutputStream.hpp>
+#include <com/sun/star/io/XInputStream.hpp>
+#include <com/sun/star/io/XSeekable.hpp>
+
+#if defined __clang__
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wunknown-attributes"
+#endif
+#include <jni.h>
+#if defined __clang__
+#pragma clang diagnostic pop
+#endif
+
+#include <uno/environment.hxx>
+
+namespace connectivity::hsqldb
+ {
+ class StreamHelper
+ {
+ css::uno::Reference< css::io::XStream> m_xStream;
+ css::uno::Reference< css::io::XSeekable> m_xSeek;
+ css::uno::Reference< css::io::XOutputStream> m_xOutputStream;
+ css::uno::Reference< css::io::XInputStream> m_xInputStream;
+ public:
+ StreamHelper(const css::uno::Reference< css::io::XStream>& _xStream);
+ ~StreamHelper();
+
+ css::uno::Reference< css::io::XInputStream> const & getInputStream();
+ css::uno::Reference< css::io::XOutputStream> const & getOutputStream();
+ css::uno::Reference< css::io::XSeekable> const & getSeek();
+ };
+
+
+ typedef std::map< OUString, std::shared_ptr<StreamHelper> > TStreamMap;
+
+ struct StorageData {
+ css::uno::Reference<css::embed::XStorage> storage;
+ css::uno::Environment storageEnvironment;
+ OUString url;
+ TStreamMap streams;
+
+ css::uno::Reference<css::embed::XStorage> mapStorage() const;
+ };
+
+ typedef std::map<OUString, StorageData> TStorages;
+ /** contains all storages so far accessed.
+ */
+ class StorageContainer
+ {
+ public:
+ static OUString registerStorage(const css::uno::Reference< css::embed::XStorage>& _xStorage,const OUString& _sURL);
+ static TStorages::mapped_type getRegisteredStorage(const OUString& _sKey);
+ static OUString getRegisteredKey(const css::uno::Reference< css::embed::XStorage>& _xStorage);
+ static void revokeStorage(const OUString& _sKey,const css::uno::Reference< css::embed::XTransactionListener>& _xListener);
+
+ static TStreamMap::mapped_type registerStream(JNIEnv * env,jstring name, jstring key,sal_Int32 _nMode);
+ static void revokeStream(JNIEnv * env,jstring name, jstring key);
+ static TStreamMap::mapped_type getRegisteredStream( JNIEnv * env, jstring name, jstring key);
+
+ static OUString jstring2ustring(JNIEnv * env, jstring jstr);
+ static OUString removeURLPrefix(std::u16string_view _sURL,const OUString& _sFileURL);
+ static OUString removeOldURLPrefix(const OUString& _sURL);
+ static void throwJavaException(const css::uno::Exception& _aException,JNIEnv * env);
+ };
+
+} // namespace connectivity::hsqldb
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/hsqldb/HTable.hxx b/connectivity/source/inc/hsqldb/HTable.hxx
new file mode 100644
index 000000000..060784115
--- /dev/null
+++ b/connectivity/source/inc/hsqldb/HTable.hxx
@@ -0,0 +1,115 @@
+/* -*- 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 .
+ */
+
+#pragma once
+
+#include <sal/config.h>
+
+#include <string_view>
+
+#include <connectivity/TTableHelper.hxx>
+#include <comphelper/IdPropArrayHelper.hxx>
+
+namespace connectivity::hsqldb
+ {
+
+ class OHSQLTable;
+ typedef ::comphelper::OIdPropertyArrayUsageHelper< OHSQLTable > OHSQLTable_PROP;
+ class OHSQLTable : public OTableHelper
+ ,public OHSQLTable_PROP
+ {
+ sal_Int32 m_nPrivileges; // we have to set our privileges by our own
+
+ /** executes the statement.
+ @param _rStatement
+ The statement to execute.
+ */
+ void executeStatement(const OUString& _rStatement );
+ protected:
+
+ /** creates the column collection for the table
+ @param _rNames
+ The column names.
+ */
+ virtual sdbcx::OCollection* createColumns(const ::std::vector< OUString>& _rNames) override;
+
+ /** creates the key collection for the table
+ @param _rNames
+ The key names.
+ */
+ virtual sdbcx::OCollection* createKeys(const ::std::vector< OUString>& _rNames) override;
+
+ /** creates the index collection for the table
+ @param _rNames
+ The index names.
+ */
+ virtual sdbcx::OCollection* createIndexes(const ::std::vector< OUString>& _rNames) override;
+
+ /** used to implement the creation of the array helper which is shared amongst all instances of the class.
+ This method needs to be implemented in derived classes.
+ <BR>
+ The method gets called with s_aMutex acquired.
+ @return a pointer to the newly created array helper. Must not be NULL.
+ */
+ virtual ::cppu::IPropertyArrayHelper* createArrayHelper(sal_Int32 nId) const override;
+ virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() override;
+
+ public:
+ OHSQLTable( sdbcx::OCollection* _pTables,
+ const css::uno::Reference< css::sdbc::XConnection >& _xConnection);
+ OHSQLTable( sdbcx::OCollection* _pTables,
+ const css::uno::Reference< css::sdbc::XConnection >& _xConnection,
+ const OUString& Name,
+ const OUString& Type,
+ const OUString& Description,
+ const OUString& SchemaName,
+ const OUString& CatalogName,
+ sal_Int32 _nPrivileges
+ );
+
+ // ODescriptor
+ virtual void construct() override;
+ // css::lang::XUnoTunnel
+ virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override;
+ static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId();
+
+ virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
+ //XTypeProvider
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override;
+ // XAlterTable
+ virtual void SAL_CALL alterColumnByName( const OUString& colName, const css::uno::Reference< css::beans::XPropertySet >& descriptor ) override;
+
+ // XRename
+ virtual void SAL_CALL rename( const OUString& newName ) override;
+
+ /**
+ returns the ALTER TABLE XXX COLUMN statement
+ */
+ OUString getAlterTableColumnPart() const;
+
+ // some methods to alter table structures
+ void alterColumnType(sal_Int32 nNewType,const OUString& _rColName,const css::uno::Reference< css::beans::XPropertySet >& _xDescriptor);
+ void alterDefaultValue(std::u16string_view _sNewDefault,const OUString& _rColName);
+ void dropDefaultValue(const OUString& _sNewDefault);
+
+ };
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/hsqldb/HTables.hxx b/connectivity/source/inc/hsqldb/HTables.hxx
new file mode 100644
index 000000000..a421be35e
--- /dev/null
+++ b/connectivity/source/inc/hsqldb/HTables.hxx
@@ -0,0 +1,52 @@
+/* -*- 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 .
+ */
+#pragma once
+
+#include <connectivity/sdbcx/VCollection.hxx>
+#include <com/sun/star/sdbc/XDatabaseMetaData.hpp>
+namespace connectivity::hsqldb
+ {
+ class OTables final : public sdbcx::OCollection
+ {
+ css::uno::Reference< css::sdbc::XDatabaseMetaData > m_xMetaData;
+
+ virtual sdbcx::ObjectType createObject(const OUString& _rName) override;
+ virtual void impl_refresh() override;
+ virtual css::uno::Reference< css::beans::XPropertySet > createDescriptor() override;
+ virtual sdbcx::ObjectType appendObject( const OUString& _rForName, const css::uno::Reference< css::beans::XPropertySet >& descriptor ) override;
+ virtual void dropObject(sal_Int32 _nPos, const OUString& _sElementName) override;
+
+ void createTable( const css::uno::Reference< css::beans::XPropertySet >& descriptor );
+ virtual OUString getNameForObject(const sdbcx::ObjectType& _xObject) override;
+ public:
+ OTables(const css::uno::Reference< css::sdbc::XDatabaseMetaData >& _rMetaData,::cppu::OWeakObject& _rParent, ::osl::Mutex& _rMutex,
+ const ::std::vector< OUString> &_rVector) : sdbcx::OCollection(_rParent, true, _rMutex, _rVector)
+ ,m_xMetaData(_rMetaData)
+ {}
+
+ // only the name is identical to ::cppu::OComponentHelper
+ virtual void disposing() override;
+
+ // XDrop
+ void appendNew(const OUString& _rsNewTable);
+ };
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/hsqldb/HTools.hxx b/connectivity/source/inc/hsqldb/HTools.hxx
new file mode 100644
index 000000000..a847b2d9a
--- /dev/null
+++ b/connectivity/source/inc/hsqldb/HTools.hxx
@@ -0,0 +1,49 @@
+/* -*- 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 .
+ */
+
+#pragma once
+
+#include <rtl/ustrbuf.hxx>
+
+
+namespace connectivity::hsqldb
+{
+
+ class HTools
+ {
+ public:
+ /** appends a proper WHERE clause to the given buffer, which filters
+ for a given table name
+
+ @param _bShortForm
+ <TRUE/> if the column names of the system table which is being asked
+ have the short form (TABLE_CAT instead of TABLE_CATALOG, and so on)
+ */
+ static void appendTableFilterCrit(
+ OUStringBuffer& _inout_rBuffer, std::u16string_view _rCatalog,
+ std::u16string_view _rSchema, std::u16string_view _rName,
+ bool _bShortForm
+ );
+ };
+
+
+} // namespace connectivity::hsqldb
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/hsqldb/HUser.hxx b/connectivity/source/inc/hsqldb/HUser.hxx
new file mode 100644
index 000000000..dc69c636e
--- /dev/null
+++ b/connectivity/source/inc/hsqldb/HUser.hxx
@@ -0,0 +1,73 @@
+/* -*- 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 .
+ */
+
+#pragma once
+
+#include <sdbcx/VUser.hxx>
+#include <com/sun/star/sdbc/XConnection.hpp>
+
+namespace connectivity::hsqldb
+ {
+ typedef connectivity::sdbcx::OUser OUser_TYPEDEF;
+
+ class OHSQLUser : public OUser_TYPEDEF
+ {
+ css::uno::Reference< css::sdbc::XConnection > m_xConnection;
+
+ static OUString getPrivilegeString(sal_Int32 nRights);
+ // return the privileges and additional the grant rights
+ /// @throws css::sdbc::SQLException
+ /// @throws css::uno::RuntimeException
+ void findPrivilegesAndGrantPrivileges(const OUString& objName, sal_Int32 objType,sal_Int32& nRights,sal_Int32& nRightsWithGrant);
+ public:
+ virtual void refreshGroups() override;
+ public:
+ OHSQLUser( const css::uno::Reference< css::sdbc::XConnection >& _xConnection);
+ OHSQLUser( const css::uno::Reference< css::sdbc::XConnection >& _xConnection,const OUString& Name);
+
+ // XUser
+ virtual void SAL_CALL changePassword( const OUString& objPassword, const OUString& newPassword ) override;
+ // XAuthorizable
+ virtual sal_Int32 SAL_CALL getPrivileges( const OUString& objName, sal_Int32 objType ) override;
+ virtual sal_Int32 SAL_CALL getGrantablePrivileges( const OUString& objName, sal_Int32 objType ) override;
+ virtual void SAL_CALL grantPrivileges( const OUString& objName, sal_Int32 objType, sal_Int32 objPrivileges ) override;
+ virtual void SAL_CALL revokePrivileges( const OUString& objName, sal_Int32 objType, sal_Int32 objPrivileges ) override;
+ };
+
+ class OUserExtend;
+ typedef ::comphelper::OPropertyArrayUsageHelper<OUserExtend> OUserExtend_PROP;
+
+ class OUserExtend : public OHSQLUser,
+ public OUserExtend_PROP
+ {
+ OUString m_Password;
+ protected:
+ // OPropertyArrayUsageHelper
+ virtual ::cppu::IPropertyArrayHelper* createArrayHelper() const override;
+ // OPropertySetHelper
+ virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() override;
+ public:
+ OUserExtend(const css::uno::Reference< css::sdbc::XConnection >& _xConnection);
+
+ virtual void construct() override;
+ };
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/hsqldb/HUsers.hxx b/connectivity/source/inc/hsqldb/HUsers.hxx
new file mode 100644
index 000000000..5f72bceb7
--- /dev/null
+++ b/connectivity/source/inc/hsqldb/HUsers.hxx
@@ -0,0 +1,52 @@
+/* -*- 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 .
+ */
+
+#pragma once
+
+#include <connectivity/sdbcx/VCollection.hxx>
+#include <com/sun/star/sdbc/XConnection.hpp>
+namespace connectivity
+{
+ namespace sdbcx
+ {
+ class IRefreshableUsers;
+ }
+ namespace hsqldb
+ {
+ class OUsers : public sdbcx::OCollection
+ {
+ css::uno::Reference< css::sdbc::XConnection > m_xConnection;
+ connectivity::sdbcx::IRefreshableUsers* m_pParent;
+ public:
+ virtual sdbcx::ObjectType createObject(const OUString& _rName) override;
+ virtual css::uno::Reference< css::beans::XPropertySet > createDescriptor() override;
+ virtual void impl_refresh() override;
+ virtual sdbcx::ObjectType appendObject( const OUString& _rForName, const css::uno::Reference< css::beans::XPropertySet >& descriptor ) override;
+ virtual void dropObject(sal_Int32 _nPos, const OUString& _sElementName) override;
+ public:
+ OUsers( ::cppu::OWeakObject& _rParent,
+ ::osl::Mutex& _rMutex,
+ const ::std::vector< OUString> &_rVector,
+ const css::uno::Reference< css::sdbc::XConnection >& _xConnection,
+ connectivity::sdbcx::IRefreshableUsers* _pParent);
+ };
+ }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/hsqldb/HView.hxx b/connectivity/source/inc/hsqldb/HView.hxx
new file mode 100644
index 000000000..62e8e5f45
--- /dev/null
+++ b/connectivity/source/inc/hsqldb/HView.hxx
@@ -0,0 +1,88 @@
+/* -*- 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 .
+ */
+
+#pragma once
+
+#include <connectivity/sdbcx/VView.hxx>
+
+#include <com/sun/star/sdbcx/XAlterView.hpp>
+#include <com/sun/star/sdbc/XConnection.hpp>
+
+#include <comphelper/uno3.hxx>
+#include <cppuhelper/implbase1.hxx>
+
+
+namespace connectivity::hsqldb
+{
+
+ typedef ::connectivity::sdbcx::OView HView_Base;
+ typedef ::cppu::ImplHelper1< css::sdbcx::XAlterView > HView_IBASE;
+ class HView :public HView_Base
+ ,public HView_IBASE
+ {
+ public:
+ HView(
+ const css::uno::Reference< css::sdbc::XConnection >& _rxConnection,
+ bool _bCaseSensitive,
+ const OUString& _rSchemaName,
+ const OUString& _rName
+ );
+
+ // UNO
+ DECLARE_XINTERFACE()
+ DECLARE_XTYPEPROVIDER()
+
+ // XAlterView
+ virtual void SAL_CALL alterCommand( const OUString& NewCommand ) override;
+
+ protected:
+ virtual ~HView() override;
+
+ protected:
+ // OPropertyContainer
+ virtual void SAL_CALL getFastPropertyValue( css::uno::Any& _rValue, sal_Int32 _nHandle ) const override;
+
+ private:
+ /** retrieves the current command of the View */
+ OUString impl_getCommand() const;
+
+ /** retrieves the current command of the View
+
+ @throws css::lang::WrappedTargetException
+ if an error occurs while retrieving the command from the database.
+ */
+ OUString impl_getCommand_wrapSQLException() const;
+ /** retrieves the current command of the View
+
+ @throws css::sdbc::SQLException
+ if an error occurs while retrieving the command from the database.
+ */
+ OUString impl_getCommand_throwSQLException() const;
+
+ private:
+ css::uno::Reference< css::sdbc::XConnection > m_xConnection;
+ private:
+ using HView_Base::getFastPropertyValue;
+ };
+
+
+} // namespace connectivity::hsqldb
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/hsqldb/HViews.hxx b/connectivity/source/inc/hsqldb/HViews.hxx
new file mode 100644
index 000000000..cb2041524
--- /dev/null
+++ b/connectivity/source/inc/hsqldb/HViews.hxx
@@ -0,0 +1,51 @@
+/* -*- 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 .
+ */
+#pragma once
+
+#include <connectivity/sdbcx/VCollection.hxx>
+#include <com/sun/star/sdbc/XDatabaseMetaData.hpp>
+namespace connectivity::hsqldb
+ {
+ class HViews final : public sdbcx::OCollection
+ {
+ css::uno::Reference< css::sdbc::XConnection > m_xConnection;
+ css::uno::Reference< css::sdbc::XDatabaseMetaData > m_xMetaData;
+ bool m_bInDrop;
+
+ virtual sdbcx::ObjectType createObject(const OUString& _rName) override;
+ virtual void impl_refresh() override;
+ virtual css::uno::Reference< css::beans::XPropertySet > createDescriptor() override;
+ virtual sdbcx::ObjectType appendObject( const OUString& _rForName, const css::uno::Reference< css::beans::XPropertySet >& descriptor ) override;
+ virtual void dropObject(sal_Int32 _nPos, const OUString& _sElementName) override;
+
+ void createView( const css::uno::Reference< css::beans::XPropertySet >& descriptor );
+ public:
+ HViews(
+ const css::uno::Reference< css::sdbc::XConnection >& _rxConnection,
+ ::cppu::OWeakObject& _rParent, ::osl::Mutex& _rMutex, const ::std::vector< OUString> &_rVector );
+
+ // only the name is identical to ::cppu::OComponentHelper
+ virtual void disposing() override;
+
+ void dropByNameImpl(const OUString& elementName);
+ };
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */