diff options
author | Tamas Bunth <tamas.bunth@collabora.co.uk> | 2018-04-08 22:54:38 +0200 |
---|---|---|
committer | Tamás Bunth <btomi96@gmail.com> | 2018-04-10 11:34:35 +0200 |
commit | 8d381ae8d6c742a7e15bf7ad9e07b65f81728ef6 (patch) | |
tree | 208efa413476624cffa4b7e504078761dfeb1a0f /connectivity | |
parent | 87e7fd163bc587b5c7cbb59ba40a9856f8bb225d (diff) |
Remove dead HSQLDB driver
Change-Id: Id4cfb69079f0150c9cca2626c16df7fab441d916
Reviewed-on: https://gerrit.libreoffice.org/52611
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Tamás Bunth <btomi96@gmail.com>
Diffstat (limited to 'connectivity')
44 files changed, 2 insertions, 4246 deletions
diff --git a/connectivity/Configuration_hsqldb.mk b/connectivity/Configuration_hsqldb.mk deleted file mode 100644 index a9528cf4973c..000000000000 --- a/connectivity/Configuration_hsqldb.mk +++ /dev/null @@ -1,20 +0,0 @@ -# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- -# -# 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/. -# - -$(eval $(call gb_Configuration_Configuration,driver_hsqldb)) - -$(eval $(call gb_Configuration_add_spool_modules,driver_hsqldb,connectivity/registry/hsqldb,\ - org/openoffice/Office/DataAccess/Drivers-hsqldb.xcu \ -)) - -$(eval $(call gb_Configuration_add_localized_datas,driver_hsqldb,connectivity/registry/hsqldb,\ - org/openoffice/Office/DataAccess/Drivers.xcu \ -)) - -# vim: set noet sw=4 ts=4: diff --git a/connectivity/Jar_sdbc_hsqldb.mk b/connectivity/Jar_sdbc_hsqldb.mk deleted file mode 100644 index 20cd1f8ae044..000000000000 --- a/connectivity/Jar_sdbc_hsqldb.mk +++ /dev/null @@ -1,37 +0,0 @@ -# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- -# -# -# 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/. -# - -$(eval $(call gb_Jar_Jar,sdbc_hsqldb)) - -$(eval $(call gb_Jar_use_externals,sdbc_hsqldb,\ - hsqldb \ -)) - -$(eval $(call gb_Jar_add_manifest_classpath,sdbc_hsqldb,\ - $(if $(filter MACOSX,$(OS)),../../Frameworks/,..) \ -)) - -$(eval $(call gb_Jar_set_packageroot,sdbc_hsqldb,com)) - -$(eval $(call gb_Jar_add_packagedir,sdbc_hsqldb,org)) - -$(eval $(call gb_Jar_add_sourcefiles,sdbc_hsqldb,\ - connectivity/org/hsqldb/lib/FileSystemRuntimeException \ - connectivity/com/sun/star/sdbcx/comp/hsqldb/NativeInputStreamHelper \ - connectivity/com/sun/star/sdbcx/comp/hsqldb/NativeLibraries \ - connectivity/com/sun/star/sdbcx/comp/hsqldb/NativeOutputStreamHelper \ - connectivity/com/sun/star/sdbcx/comp/hsqldb/NativeStorageAccess \ - connectivity/com/sun/star/sdbcx/comp/hsqldb/StorageAccess \ - connectivity/com/sun/star/sdbcx/comp/hsqldb/StorageFileAccess \ - connectivity/com/sun/star/sdbcx/comp/hsqldb/StorageNativeInputStream \ - connectivity/com/sun/star/sdbcx/comp/hsqldb/StorageNativeOutputStream \ -)) - -# vim: set noet sw=4 ts=4: diff --git a/connectivity/JunitTest_complex.mk b/connectivity/JunitTest_complex.mk index 78947bfc2076..8893562589a3 100644 --- a/connectivity/JunitTest_complex.mk +++ b/connectivity/JunitTest_complex.mk @@ -22,10 +22,6 @@ $(eval $(call gb_JunitTest_use_jars,connectivity_complex,\ unoil \ )) -$(eval $(call gb_JunitTest_use_externals,connectivity_complex,\ - hsqldb \ -)) - $(eval $(call gb_JunitTest_add_classes,connectivity_complex,\ org.openoffice.test.UnoApiTest \ )) diff --git a/connectivity/Library_hsqldb.mk b/connectivity/Library_hsqldb.mk deleted file mode 100644 index 0685402145bb..000000000000 --- a/connectivity/Library_hsqldb.mk +++ /dev/null @@ -1,62 +0,0 @@ -# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- -# -# 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/. -# - -$(eval $(call gb_Library_Library,hsqldb)) - -$(eval $(call gb_Library_set_include,hsqldb,\ - -I$(SRCDIR)/connectivity/inc \ - -I$(SRCDIR)/connectivity/source/inc \ - $$(INCLUDE) \ -)) - -$(eval $(call gb_Library_use_externals,hsqldb,\ - boost_headers \ - hsqldb \ -)) - -$(eval $(call gb_Library_use_sdk_api,hsqldb)) - -$(eval $(call gb_Library_use_libraries,hsqldb,\ - comphelper \ - cppu \ - cppuhelper \ - dbtools \ - jvmfwk \ - sal \ - salhelper \ - tl \ - utl \ - i18nlangtag \ -)) - -$(eval $(call gb_Library_set_componentfile,hsqldb,connectivity/source/drivers/hsqldb/hsqldb)) - -$(eval $(call gb_Library_add_exception_objects,hsqldb,\ - connectivity/source/drivers/hsqldb/HCatalog \ - connectivity/source/drivers/hsqldb/HColumns \ - connectivity/source/drivers/hsqldb/HConnection \ - connectivity/source/drivers/hsqldb/HDriver \ - connectivity/source/drivers/hsqldb/HStorageAccess \ - connectivity/source/drivers/hsqldb/HStorageMap \ - connectivity/source/drivers/hsqldb/HTable \ - connectivity/source/drivers/hsqldb/HTables \ - connectivity/source/drivers/hsqldb/HTerminateListener \ - connectivity/source/drivers/hsqldb/HTools \ - connectivity/source/drivers/hsqldb/HUser \ - connectivity/source/drivers/hsqldb/HUsers \ - connectivity/source/drivers/hsqldb/HView \ - connectivity/source/drivers/hsqldb/HViews \ - connectivity/source/drivers/hsqldb/Hservices \ - connectivity/source/drivers/hsqldb/StorageFileAccess \ - connectivity/source/drivers/hsqldb/StorageNativeInputStream \ - connectivity/source/drivers/hsqldb/StorageNativeOutputStream \ - connectivity/source/drivers/hsqldb/accesslog \ -)) - -# vim: set noet sw=4 ts=4: diff --git a/connectivity/Module_connectivity.mk b/connectivity/Module_connectivity.mk index 3ba7ecf01d41..4a500eb3ea3d 100644 --- a/connectivity/Module_connectivity.mk +++ b/connectivity/Module_connectivity.mk @@ -40,10 +40,7 @@ $(eval $(call gb_Module_add_l10n_targets,connectivity,\ ifneq ($(ENABLE_JAVA),) $(eval $(call gb_Module_add_targets,connectivity,\ - Configuration_hsqldb \ Configuration_jdbc \ - Jar_sdbc_hsqldb \ - Library_hsqldb \ Library_jdbc \ )) endif diff --git a/connectivity/com/sun/star/sdbcx/comp/hsqldb/NativeInputStreamHelper.java b/connectivity/com/sun/star/sdbcx/comp/hsqldb/NativeInputStreamHelper.java deleted file mode 100644 index 66b6f5489862..000000000000 --- a/connectivity/com/sun/star/sdbcx/comp/hsqldb/NativeInputStreamHelper.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * 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 . - */ - -package com.sun.star.sdbcx.comp.hsqldb; - -public class NativeInputStreamHelper extends java.io.InputStream{ - private final String key; - private final String file; - private final StorageNativeInputStream in; - /** Creates a new instance of NativeInputStreamHelper */ - public NativeInputStreamHelper(String key,String _file) { - file = _file; - this.key = key; - in = new StorageNativeInputStream(key,file); - } - - @Override - public int read() throws java.io.IOException { - return in.read(key,file); - } - - @Override - public int read(byte[] b, int off, int len) throws java.io.IOException { - return in.read(key,file,b,off,len); - } - - @Override - public void close() throws java.io.IOException { - in.close(key,file); - } - - @Override - public long skip(long n) throws java.io.IOException { - return in.skip(key,file,n); - } - - @Override - public int available() throws java.io.IOException { - return in.available(key,file); - } - - @Override - public int read(byte[] b) throws java.io.IOException { - return in.read(key,file,b); - } - -} diff --git a/connectivity/com/sun/star/sdbcx/comp/hsqldb/NativeLibraries.java b/connectivity/com/sun/star/sdbcx/comp/hsqldb/NativeLibraries.java deleted file mode 100644 index 59541556b185..000000000000 --- a/connectivity/com/sun/star/sdbcx/comp/hsqldb/NativeLibraries.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * 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 . - */ - -package com.sun.star.sdbcx.comp.hsqldb; - -import java.io.File; -import java.net.URL; -import java.net.URLClassLoader; - -final class NativeLibraries { - public static void load() { - if (System.getProperty( "os.name" ).startsWith("Windows")) { - loadLibrary("msvcr71"); - loadLibrary("sal3"); - loadLibrary("dbtoolsmi"); - } - loadLibrary("hsqldb"); - } - - private static void loadLibrary(String libname) { - // At least on Mac OS X Tiger, System.loadLibrary("hsqldb2") does not - // find the hsqldb2 library one directory above sdbc_hsqldb.jar, even - // though ".." is on the jar's Class-Path; however, the alternative - // code (needing Java 1.5, which is given for Mac OS X Tiger) works - // there: - try { - System.loadLibrary(libname); - } catch (UnsatisfiedLinkError e) { - ClassLoader cl = NativeLibraries.class.getClassLoader(); - if (cl instanceof URLClassLoader) { - String sysname = System.mapLibraryName(libname); - // At least Oracle's 1.7.0_51 now maps to .dylib rather than - // .jnilib: - if (System.getProperty("os.name").startsWith("Mac") - && sysname.endsWith(".dylib")) - { - sysname - = sysname.substring( - 0, sysname.length() - "dylib".length()) - + "jnilib"; - } - URL url = ((URLClassLoader) cl).findResource(sysname); - if (url != null) { - try { - System.load(new File(url.toURI()).getAbsolutePath()); - } catch (Throwable t) { - throw new UnsatisfiedLinkError( - e.toString()+ " - " + t.toString()); - } - } - } - } - } - - private NativeLibraries() {} -} diff --git a/connectivity/com/sun/star/sdbcx/comp/hsqldb/NativeOutputStreamHelper.java b/connectivity/com/sun/star/sdbcx/comp/hsqldb/NativeOutputStreamHelper.java deleted file mode 100644 index 6445f24139d4..000000000000 --- a/connectivity/com/sun/star/sdbcx/comp/hsqldb/NativeOutputStreamHelper.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * 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 . - */ -package com.sun.star.sdbcx.comp.hsqldb; - -public class NativeOutputStreamHelper extends java.io.OutputStream{ - - private final String key; - private final String file; - private final StorageNativeOutputStream out; - /** Creates a new instance of NativeOutputStreamHelper */ - public NativeOutputStreamHelper(String key,String _file) { - file = _file; - this.key = key; - out = new StorageNativeOutputStream(file,key); - } - - @Override - public void write(byte[] b, int off, int len) throws java.io.IOException{ - out.write(key,file,b, off, len); - } - - @Override - public void write(byte[] b) throws java.io.IOException{ - out.write(key,file,b); - } - - @Override - public void close() throws java.io.IOException{ - out.close(key,file); - } - - @Override - public void write(int b) throws java.io.IOException{ - out.write(key,file,b); - } - - @Override - public void flush() throws java.io.IOException{ - out.flush(key,file); - } - - public void sync() throws java.io.IOException{ - out.sync(key,file); - } -} diff --git a/connectivity/com/sun/star/sdbcx/comp/hsqldb/NativeStorageAccess.java b/connectivity/com/sun/star/sdbcx/comp/hsqldb/NativeStorageAccess.java deleted file mode 100644 index 5a9bc8bb6c4c..000000000000 --- a/connectivity/com/sun/star/sdbcx/comp/hsqldb/NativeStorageAccess.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * 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 . - */ -package com.sun.star.sdbcx.comp.hsqldb; - -public class NativeStorageAccess { - static { NativeLibraries.load(); } - - public static final int READ = 1; - private static final int SEEKABLE = 2; - private static final int SEEKABLEREAD = 3; - public static final int WRITE = 4; - private static final int READWRITE = 7; - public static final int TRUNCATE = 8; - - /** Creates a new instance of StorageAccess */ - public NativeStorageAccess(String name,String _mode,Object key) throws java.io.IOException{ - try { - int mode = NativeStorageAccess.SEEKABLEREAD; - if ( _mode.equals("rw") ) - mode = NativeStorageAccess.READWRITE | NativeStorageAccess.SEEKABLE; - - openStream(name, (String)key, mode); - } catch(Exception ex1){ - java.io.IOException ex2 = new java.io.IOException(); - ex2.initCause(ex1); - throw ex2; - } - } - private native void openStream(String name,String key, int mode); - public native void close(String name,String key) throws java.io.IOException; - - public native long getFilePointer(String name,String key) throws java.io.IOException; - - public native long length(String name,String key) throws java.io.IOException; - - public native int read(String name,String key) throws java.io.IOException; - - public native int read(String name,String key,byte[] b, int off, int len) throws java.io.IOException; - - - - public native void seek(String name,String key,long position) throws java.io.IOException; - - public native void write(String name,String key,byte[] b, int offset, int length) throws java.io.IOException; - - -} diff --git a/connectivity/com/sun/star/sdbcx/comp/hsqldb/StorageAccess.java b/connectivity/com/sun/star/sdbcx/comp/hsqldb/StorageAccess.java deleted file mode 100644 index 6a53d110e661..000000000000 --- a/connectivity/com/sun/star/sdbcx/comp/hsqldb/StorageAccess.java +++ /dev/null @@ -1,126 +0,0 @@ -/* - * 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 . - */ - -package com.sun.star.sdbcx.comp.hsqldb; - -@SuppressWarnings("ucd") -public class StorageAccess implements org.hsqldb.lib.Storage { - String key; - String name; - boolean readonly; - NativeStorageAccess access; - /** Creates a new instance of StorageAccess */ - public StorageAccess(String name,Boolean readonly,Object key) throws java.io.IOException{ - this.key = (String)key; - this.name = name; - this.readonly = readonly.booleanValue(); - try { - access = new NativeStorageAccess(name, - this.readonly ? "r" : "rw" - ,key); - } catch(Exception ex1){ - java.io.IOException ex2 = new java.io.IOException(); - ex2.initCause(ex1); - throw ex2; - } - } - public void close() throws java.io.IOException{ - access.close(name,key); - } - - public long getFilePointer() throws java.io.IOException{ - return access.getFilePointer(name,key); - } - - public long length() throws java.io.IOException{ - return access.length(name,key); - } - - public int read() throws java.io.IOException{ - return access.read(name,key); - } - - public void read(byte[] b, int off, int len) throws java.io.IOException{ - access.read(name,key,b,off,len); - } - - // based on the same code that reads an int from the .data file in HSQLDB - public int readInt() throws java.io.IOException{ - byte [] tmp = new byte [4]; - - int count = access.read(name,key,tmp,0, 4); - - if (count != 4){ - throw new java.io.IOException(); - } - - count = 0; - int ch0 = tmp[count++] & 0xff; - int ch1 = tmp[count++] & 0xff; - int ch2 = tmp[count++] & 0xff; - int ch3 = tmp[count] & 0xff; - - return ((ch0 << 24) + (ch1 << 16) + (ch2 << 8) + (ch3)); - } - - public void seek(long position) throws java.io.IOException{ - access.seek(name,key,position); - } - - public void write(byte[] b, int offset, int length) throws java.io.IOException{ - access.write(name,key,b,offset,length); - } - - public void writeInt(int v) throws java.io.IOException{ - byte [] oneByte = new byte [4]; - oneByte[0] = (byte) ((v >>> 24) & 0xFF); - oneByte[1] = (byte) ((v >>> 16) & 0xFF); - oneByte[2] = (byte) ((v >>> 8) & 0xFF); - oneByte[3] = (byte) ((v >>> 0) & 0xFF); - - write(oneByte,0,4); - } - - public boolean isReadOnly() { - return readonly; - } - - @SuppressWarnings("cast") - public long readLong() throws java.io.IOException { - return (((long) readInt()) << 32) + (((long) readInt()) & 0xFFFFFFFFL); - } - - public boolean wasNio() { - return false; - } - - public void writeLong(long v) throws java.io.IOException { - byte [] oneByte = new byte [8]; - - oneByte[0] = (byte) ((v >>> 56) & 0xFF); - oneByte[1] = (byte) ((v >>> 48) & 0xFF); - oneByte[2] = (byte) ((v >>> 40) & 0xFF); - oneByte[3] = (byte) ((v >>> 32) & 0xFF); - oneByte[4] = (byte) ((v >>> 24) & 0xFF); - oneByte[5] = (byte) ((v >>> 16) & 0xFF); - oneByte[6] = (byte) ((v >>> 8) & 0xFF); - oneByte[7] = (byte) ((v >>> 0) & 0xFF); - - write(oneByte,0,8); - } -} diff --git a/connectivity/com/sun/star/sdbcx/comp/hsqldb/StorageFileAccess.java b/connectivity/com/sun/star/sdbcx/comp/hsqldb/StorageFileAccess.java deleted file mode 100644 index 0dd640c4ec57..000000000000 --- a/connectivity/com/sun/star/sdbcx/comp/hsqldb/StorageFileAccess.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * 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 . - */ -package com.sun.star.sdbcx.comp.hsqldb; - -import org.hsqldb.lib.FileAccess; -import org.hsqldb.lib.FileSystemRuntimeException; - -@SuppressWarnings("ucd") -public class StorageFileAccess implements org.hsqldb.lib.FileAccess{ - static { NativeLibraries.load(); } - - String ds_name; - String key; - /** Creates a new instance of StorageFileAccess */ - public StorageFileAccess(Object key) throws java.lang.Exception{ - this.key = (String)key; - } - - public void createParentDirs(String filename) { - } - - public boolean isStreamElement(String elementName) { - return isStreamElement(key,elementName); - } - - public java.io.InputStream openInputStreamElement(String streamName) throws java.io.IOException { - return new NativeInputStreamHelper(key,streamName); - } - - public java.io.OutputStream openOutputStreamElement(String streamName) throws java.io.IOException { - return new NativeOutputStreamHelper(key,streamName); - } - - public void removeElement(String filename) throws java.util.NoSuchElementException { - try { - if ( isStreamElement(key,filename) ) - removeElement(key,filename); - } catch (java.io.IOException e) { - throw new FileSystemRuntimeException( e ); - } - } - - public void renameElement(String oldName, String newName) throws java.util.NoSuchElementException { - try { - if ( isStreamElement(key,oldName) ){ - removeElement(key,newName); - renameElement(key,oldName, newName); - } - } catch (java.io.IOException e) { - throw new FileSystemRuntimeException( e ); - } - } - - private static class FileSync implements FileAccess.FileSync - { - private final NativeOutputStreamHelper os; - private FileSync(NativeOutputStreamHelper _os) - { - os = _os; - } - public void sync() throws java.io.IOException - { - os.sync(); - } - } - - public FileAccess.FileSync getFileSync(java.io.OutputStream os) throws java.io.IOException - { - return new FileSync((NativeOutputStreamHelper)os); - } - - static native boolean isStreamElement(String key,String elementName); - static native void removeElement(String key,String filename) throws java.util.NoSuchElementException, java.io.IOException; - static native void renameElement(String key,String oldName, String newName) throws java.util.NoSuchElementException, java.io.IOException; -} diff --git a/connectivity/com/sun/star/sdbcx/comp/hsqldb/StorageNativeInputStream.java b/connectivity/com/sun/star/sdbcx/comp/hsqldb/StorageNativeInputStream.java deleted file mode 100644 index cf147c9b5005..000000000000 --- a/connectivity/com/sun/star/sdbcx/comp/hsqldb/StorageNativeInputStream.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * 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 . - */ -package com.sun.star.sdbcx.comp.hsqldb; - -public class StorageNativeInputStream { - static { NativeLibraries.load(); } - - /** Creates a new instance of StorageNativeInputStream */ - public StorageNativeInputStream(String key,String _file) { - openStream(key,_file, NativeStorageAccess.READ); - } - private native void openStream(String key,String name, int mode); - public native int read(String key,String name) throws java.io.IOException; - public native int read(String key,String name,byte[] b, int off, int len) throws java.io.IOException; - public native void close(String key,String name) throws java.io.IOException; - public native long skip(String key,String name,long n) throws java.io.IOException; - public native int available(String key,String name) throws java.io.IOException; - public native int read(String key,String name,byte[] b) throws java.io.IOException; -} diff --git a/connectivity/com/sun/star/sdbcx/comp/hsqldb/StorageNativeOutputStream.java b/connectivity/com/sun/star/sdbcx/comp/hsqldb/StorageNativeOutputStream.java deleted file mode 100644 index 8cc6cb07d353..000000000000 --- a/connectivity/com/sun/star/sdbcx/comp/hsqldb/StorageNativeOutputStream.java +++ /dev/null @@ -1,145 +0,0 @@ -/* - * 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 . - */ -package com.sun.star.sdbcx.comp.hsqldb; - -public class StorageNativeOutputStream { - static { NativeLibraries.load(); } - - /** Creates a new instance of StorageNativeOutputStream */ - public StorageNativeOutputStream(String _name, Object key) { - openStream(_name, (String)key, NativeStorageAccess.WRITE | NativeStorageAccess.TRUNCATE); - } - - private native void openStream(String name,String key, int mode); - /** - * Writes <code>len</code> bytes from the specified byte array - * starting at offset <code>off</code> to this output stream. - * The general contract for <code>write(b, off, len)</code> is that - * some of the bytes in the array <code>b</code> are written to the - * output stream in order; element <code>b[off]</code> is the first - * byte written and <code>b[off+len-1]</code> is the last byte written - * by this operation. - * <p> - * The <code>write</code> method of <code>OutputStream</code> calls - * the write method of one argument on each of the bytes to be - * written out. Subclasses are encouraged to override this method and - * provide a more efficient implementation. - * <p> - * If <code>b</code> is <code>null</code>, a - * <code>NullPointerException</code> is thrown. - * <p> - * If <code>off</code> is negative, or <code>len</code> is negative, or - * <code>off+len</code> is greater than the length of the array - * <code>b</code>, then an <tt>IndexOutOfBoundsException</tt> is thrown. - * @param key The name of the data source. - * @param _file The name of the file to write to. - * @param b the data. - * @param off the start offset in the data. - * @param len the number of bytes to write. - * @exception java.io.IOException if an I/O error occurs. In particular, - * an <code>IOException</code> is thrown if the output - * stream is closed. - */ - public native void write(String key,String _file,byte[] b, int off, int len) throws java.io.IOException; - - /** - * Writes <code>b.length</code> bytes from the specified byte array - * to this output stream. The general contract for <code>write(b)</code> - * is that it should have exactly the same effect as the call - * <code>write(b, 0, b.length)</code>. - * - * @param b the data. - * @exception java.io.IOException if an I/O error occurs. - * @see java.io.OutputStream#write(byte[], int, int) - */ - public native void write(String key,String _file,byte[] b) throws java.io.IOException; - - /** - * Closes this output stream and releases any system resources - * associated with this stream. The general contract of <code>close</code> - * is that it closes the output stream. A closed stream cannot perform - * output operations and cannot be reopened. - * <p> - * The <code>close</code> method of <code>OutputStream</code> does nothing. - * @param key The name of the data source. - * @param _file The name of the file to write to. - * - * @exception java.io.IOException if an I/O error occurs. - */ - public native void close(String key,String _file) throws java.io.IOException; - - /** - * Writes the specified byte to this output stream. The general - * contract for <code>write</code> is that one byte is written - * to the output stream. The byte to be written is the eight - * low-order bits of the argument <code>b</code>. The 24 - * high-order bits of <code>b</code> are ignored. - * <p> - * Subclasses of <code>OutputStream</code> must provide an - * implementation for this method. - * - * @param key The name of the data source. - * @param _file The name of the file to write to. - * @param b the <code>byte</code>. - * @exception java.io.IOException if an I/O error occurs. In particular, - * an <code>IOException</code> may be thrown if the - * output stream has been closed. - */ - public native void write(String key,String _file,int b) throws java.io.IOException; - - /** - * Flushes this output stream and forces any buffered output bytes - * to be written out. The general contract of <code>flush</code> is - * that calling it is an indication that, if any bytes previously - * written have been buffered by the implementation of the output - * stream, such bytes should immediately be written to their - * intended destination. - * <p> - * The <code>flush</code> method of <code>OutputStream</code> does nothing. - * @param key The name of the data source. - * @param _file The name of the file to write to. - * - * @exception java.io.IOException if an I/O error occurs. - */ - public native void flush(String key,String _file) throws java.io.IOException; - - /** - * Force all system buffers to synchronize with the underlying - * device. This method returns after all modified data and - * attributes have been written to the relevant device(s). - * - * sync is meant to be used by code that requires physical - * storage (such as a file) to be in a known state For - * example, a class that provided a simple transaction facility - * might use sync to ensure that all changes to a file caused - * by a given transaction were recorded on a storage medium. - * - * sync only affects buffers downstream. If - * any in-memory buffering is being done by the application (for - * example, by a BufferedOutputStream object), those buffers must - * be flushed (for example, by invoking - * OutputStream.flush) before that data will be affected by sync. - * - * @exception java.io.IOException - * Thrown when the buffers cannot be flushed, - * or because the system cannot guarantee that all the - * buffers have been synchronized with physical media. - */ - public native void sync(String key,String _file) throws java.io.IOException; - -} diff --git a/connectivity/registry/hsqldb/org/openoffice/Office/DataAccess/Drivers.xcu b/connectivity/registry/hsqldb/org/openoffice/Office/DataAccess/Drivers.xcu deleted file mode 100644 index 59dc5b86ea21..000000000000 --- a/connectivity/registry/hsqldb/org/openoffice/Office/DataAccess/Drivers.xcu +++ /dev/null @@ -1,74 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - * 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 . ---> -<oor:component-data oor:name="Drivers" oor:package="org.openoffice.Office.DataAccess" xmlns:install="http://openoffice.org/2004/installation" xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema"> - <node oor:name="Installed" install:module="hsqldb"> - <node oor:name="sdbc:embedded:hsqldb" oor:op="replace"> - <prop oor:name="Driver"> - <value>com.sun.star.sdbcx.comp.hsqldb.Driver</value> - </prop> - <prop oor:name="DriverTypeDisplayName" oor:type="xs:string"> - <value xml:lang="en-US">HSQLDB Embedded</value> - </prop> - <node oor:name="Features"> - <node oor:name="UseDOSLineEnds" oor:op="replace"> - <prop oor:name="Value" oor:type="xs:boolean"> - <value>true</value> - </prop> - </node> - <node oor:name="FormsCheckRequiredFields" oor:op="replace"> - <prop oor:name="Value" oor:type="xs:boolean"> - <value>true</value> - </prop> - </node> - <node oor:name="EscapeDateTime" oor:op="replace"> - <prop oor:name="Value" oor:type="xs:boolean"> - <value>true</value> - </prop> - </node> - <node oor:name="AddIndexAppendix" oor:op="replace"> - <prop oor:name="Value" oor:type="xs:boolean"> - <value>false</value> - </prop> - </node> - <node oor:name="UseKeywordAsBeforeAlias" oor:op="replace"> - <prop oor:name="Value" oor:type="xs:boolean"> - <value>true</value> - </prop> - </node> - </node> - <node oor:name="MetaData"> - <node oor:name="SupportsTableCreation" oor:op="replace"> - <prop oor:name="Value" oor:type="xs:boolean"> - <value>true</value> - </prop> - </node> - <node oor:name="UseJava" oor:op="replace"> - <prop oor:name="Value" oor:type="xs:boolean"> - <value>true</value> - </prop> - </node> - <node oor:name="AutoIncrementIsPrimaryKey" oor:op="replace"> - <prop oor:name="Value" oor:type="xs:boolean"> - <value>true</value> - </prop> - </node> - </node> - </node> - </node> -</oor:component-data> diff --git a/connectivity/source/commontools/DriversConfig.cxx b/connectivity/source/commontools/DriversConfig.cxx index a6b78b0d0330..29f5b22de880 100644 --- a/connectivity/source/commontools/DriversConfig.cxx +++ b/connectivity/source/commontools/DriversConfig.cxx @@ -76,6 +76,7 @@ namespace OUString sDriverTypeDisplayName; aURLPatternNode.getNodeValue("DriverTypeDisplayName") >>= sDriverTypeDisplayName; + OSL_ENSURE(!sDriverTypeDisplayName.isEmpty(),"No valid DriverTypeDisplayName property!"); if ( !sDriverTypeDisplayName.isEmpty() ) _rInstalledDriver.sDriverTypeDisplayName = sDriverTypeDisplayName; @@ -112,9 +113,7 @@ const TInstalledDrivers& DriversConfigImpl::getInstalledDrivers(const uno::Refer { TInstalledDriver aInstalledDriver; lcl_readURLPatternNode(m_aInstalled,*pPatternIter,aInstalledDriver); - if ( !aInstalledDriver.sDriverFactory.isEmpty() && - ( aMiscOptions.IsExperimentalMode() || - aInstalledDriver.sDriverFactory != "com.sun.star.comp.sdbc.firebird.Driver" )) + if ( !aInstalledDriver.sDriverFactory.isEmpty() ) m_aDrivers.emplace(*pPatternIter,aInstalledDriver); } } // if ( m_aInstalled.isValid() ) diff --git a/connectivity/source/drivers/hsqldb/HCatalog.cxx b/connectivity/source/drivers/hsqldb/HCatalog.cxx deleted file mode 100644 index 9824ead35dc8..000000000000 --- a/connectivity/source/drivers/hsqldb/HCatalog.cxx +++ /dev/null @@ -1,150 +0,0 @@ -/* -*- 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 <hsqldb/HCatalog.hxx> -#include <hsqldb/HUsers.hxx> -#include <hsqldb/HTables.hxx> -#include <hsqldb/HViews.hxx> -#include <com/sun/star/sdbc/SQLException.hpp> -#include <com/sun/star/sdbc/XRow.hpp> -#include <com/sun/star/sdbc/XResultSet.hpp> -#include <comphelper/types.hxx> - - -using namespace connectivity; -using namespace connectivity::hsqldb; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::beans; -using namespace ::com::sun::star::sdbcx; -using namespace ::com::sun::star::sdbc; -using namespace ::com::sun::star::container; -using namespace ::com::sun::star::lang; - -OHCatalog::OHCatalog(const Reference< XConnection >& _xConnection) : sdbcx::OCatalog(_xConnection) - ,m_xConnection(_xConnection) -{ -} - -void OHCatalog::refreshObjects(const Sequence< OUString >& _sKindOfObject,::std::vector< OUString>& _rNames) -{ - Reference< XResultSet > xResult = m_xMetaData->getTables(Any(), - "%", - "%", - _sKindOfObject); - fillNames(xResult,_rNames); -} - -void OHCatalog::refreshTables() -{ - ::std::vector< OUString> aVector; - - Sequence< OUString > sTableTypes(2); - sTableTypes[0] = "VIEW"; - sTableTypes[1] = "TABLE"; - - refreshObjects(sTableTypes,aVector); - - if ( m_pTables ) - m_pTables->reFill(aVector); - else - m_pTables.reset( new OTables(m_xMetaData,*this,m_aMutex,aVector) ); -} - -void OHCatalog::refreshViews() -{ - Sequence< OUString > aTypes { "VIEW" }; - - bool bSupportsViews = false; - try - { - Reference<XResultSet> xRes = m_xMetaData->getTableTypes(); - Reference<XRow> xRow(xRes,UNO_QUERY); - while ( xRow.is() && xRes->next() ) - { - if ( (bSupportsViews = xRow->getString(1).equalsIgnoreAsciiCase(aTypes[0])) ) - { - break; - } - } - } - catch(const SQLException&) - { - } - - ::std::vector< OUString> aVector; - if ( bSupportsViews ) - refreshObjects(aTypes,aVector); - - if ( m_pViews ) - m_pViews->reFill(aVector); - else - m_pViews.reset( new HViews( m_xConnection, *this, m_aMutex, aVector ) ); -} - -void OHCatalog::refreshGroups() -{ -} - -void OHCatalog::refreshUsers() -{ - ::std::vector< OUString> aVector; - Reference< XStatement > xStmt = m_xConnection->createStatement( ); - Reference< XResultSet > xResult = xStmt->executeQuery("select User from hsqldb.user group by User"); - if ( xResult.is() ) - { - Reference< XRow > xRow(xResult,UNO_QUERY); - while( xResult->next() ) - aVector.push_back(xRow->getString(1)); - ::comphelper::disposeComponent(xResult); - } - ::comphelper::disposeComponent(xStmt); - - if(m_pUsers) - m_pUsers->reFill(aVector); - else - m_pUsers.reset( new OUsers(*this,m_aMutex,aVector,m_xConnection,this) ); -} - -Any SAL_CALL OHCatalog::queryInterface( const Type & rType ) -{ - if ( rType == cppu::UnoType<XGroupsSupplier>::get()) - return Any(); - - return OCatalog::queryInterface(rType); -} - -Sequence< Type > SAL_CALL OHCatalog::getTypes( ) -{ - Sequence< Type > aTypes = OCatalog::getTypes(); - std::vector<Type> aOwnTypes; - aOwnTypes.reserve(aTypes.getLength()); - const Type* pBegin = aTypes.getConstArray(); - const Type* pEnd = pBegin + aTypes.getLength(); - for(;pBegin != pEnd;++pBegin) - { - if ( !(*pBegin == cppu::UnoType<XGroupsSupplier>::get())) - { - aOwnTypes.push_back(*pBegin); - } - } - return Sequence< Type >(aOwnTypes.data(), aOwnTypes.size()); -} - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/drivers/hsqldb/HColumns.cxx b/connectivity/source/drivers/hsqldb/HColumns.cxx deleted file mode 100644 index da9b8bbd442b..000000000000 --- a/connectivity/source/drivers/hsqldb/HColumns.cxx +++ /dev/null @@ -1,78 +0,0 @@ -/* -*- 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 <hsqldb/HColumns.hxx> -#include <TConnection.hxx> - - -using namespace ::comphelper; -using namespace connectivity::hsqldb; -using namespace connectivity::sdbcx; -using namespace connectivity; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::beans; -using namespace ::com::sun::star::sdbcx; -using namespace ::com::sun::star::sdbc; -using namespace ::com::sun::star::container; -using namespace ::com::sun::star::lang; - -OHSQLColumns::OHSQLColumns( ::cppu::OWeakObject& _rParent - ,::osl::Mutex& _rMutex - ,const ::std::vector< OUString> &_rVector - ) : OColumnsHelper(_rParent,true/*_bCase*/,_rMutex,_rVector,true/*_bUseHardRef*/) -{ -} - -Reference< XPropertySet > OHSQLColumns::createDescriptor() -{ - return new OHSQLColumn; -} - - -OHSQLColumn::OHSQLColumn() - : connectivity::sdbcx::OColumn( true/*_bCase*/ ) -{ - construct(); -} - -void OHSQLColumn::construct() -{ - m_sAutoIncrement = "IDENTITY"; - registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_AUTOINCREMENTCREATION),PROPERTY_ID_AUTOINCREMENTCREATION,0,&m_sAutoIncrement, cppu::UnoType<decltype(m_sAutoIncrement)>::get()); -} - -::cppu::IPropertyArrayHelper* OHSQLColumn::createArrayHelper( sal_Int32 /*_nId*/ ) const -{ - return doCreateArrayHelper(); -} - -::cppu::IPropertyArrayHelper & SAL_CALL OHSQLColumn::getInfoHelper() -{ - return *OHSQLColumn_PROP::getArrayHelper(isNew() ? 1 : 0); -} - -Sequence< OUString > SAL_CALL OHSQLColumn::getSupportedServiceNames( ) -{ - Sequence< OUString > aSupported { "com.sun.star.sdbcx.Column" }; - - return aSupported; -} - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/drivers/hsqldb/HStorageMap.cxx b/connectivity/source/drivers/hsqldb/HStorageMap.cxx deleted file mode 100644 index ff5df7b01fe3..000000000000 --- a/connectivity/source/drivers/hsqldb/HStorageMap.cxx +++ /dev/null @@ -1,367 +0,0 @@ -/* -*- 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 <hsqldb/HStorageMap.hxx> -#include <comphelper/types.hxx> -#include <com/sun/star/embed/XTransactionBroadcaster.hpp> -#include <com/sun/star/embed/XTransactedObject.hpp> -#include <com/sun/star/embed/ElementModes.hpp> -#include <com/sun/star/lang/DisposedException.hpp> -#include <osl/diagnose.h> -#include <osl/thread.h> -#include <uno/mapping.hxx> -#include <algorithm> - -namespace connectivity -{ - - namespace hsqldb - { - - using namespace ::com::sun::star::uno; - using namespace ::com::sun::star::lang; - using namespace ::com::sun::star::embed; - using namespace ::com::sun::star::io; - - StreamHelper::StreamHelper(const Reference< XStream>& _xStream) - : m_xStream(_xStream) - { - } - - StreamHelper::~StreamHelper() - { - try - { - m_xStream.clear(); - m_xSeek.clear(); - if ( m_xInputStream.is() ) - { - m_xInputStream->closeInput(); - m_xInputStream.clear(); - } - // this is done implicitly by the closing of the input stream - else if ( m_xOutputStream.is() ) - { - m_xOutputStream->closeOutput(); - try - { - ::comphelper::disposeComponent(m_xOutputStream); - } - catch(const DisposedException&) - { - } - catch(const Exception&) - { - OSL_FAIL("Could not dispose OutputStream"); - } - m_xOutputStream.clear(); - } - } - catch(const Exception&) - { - OSL_FAIL("Exception caught!"); - } - } - - Reference< XInputStream> const & StreamHelper::getInputStream() - { - if ( !m_xInputStream.is() ) - m_xInputStream = m_xStream->getInputStream(); - return m_xInputStream; - } - - Reference< XOutputStream> const & StreamHelper::getOutputStream() - { - if ( !m_xOutputStream.is() ) - m_xOutputStream = m_xStream->getOutputStream(); - return m_xOutputStream; - } - - Reference< XSeekable> const & StreamHelper::getSeek() - { - if ( !m_xSeek.is() ) - m_xSeek.set(m_xStream,UNO_QUERY); - return m_xSeek; - } - - css::uno::Reference<css::embed::XStorage> StorageData::mapStorage() - const - { - css::uno::Environment env(css::uno::Environment::getCurrent()); - if (!(env.is() && storageEnvironment.is())) { - throw css::uno::RuntimeException("cannot get environments"); - } - if (env.get() == storageEnvironment.get()) { - return storage; - } else { - css::uno::Mapping map(storageEnvironment, env); - if (!map.is()) { - throw css::uno::RuntimeException("cannot get mapping"); - } - css::uno::Reference<css::embed::XStorage> mapped; - map.mapInterface( - reinterpret_cast<void **>(&mapped), storage.get(), - cppu::UnoType<css::embed::XStorage>::get()); - return mapped; - } - } - - TStorages& lcl_getStorageMap() - { - static TStorages s_aMap; - return s_aMap; - } - - OUString lcl_getNextCount() - { - static sal_Int32 s_nCount = 0; - return OUString::number(s_nCount++); - } - - OUString StorageContainer::removeURLPrefix(const OUString& _sURL,const OUString& _sFileURL) - { - return _sURL.copy(_sFileURL.getLength()+1); - } - - OUString StorageContainer::removeOldURLPrefix(const OUString& _sURL) - { - OUString sRet = _sURL; -#if defined(_WIN32) - sal_Int32 nIndex = sRet.lastIndexOf('\\'); -#else - sal_Int32 nIndex = sRet.lastIndexOf('/'); -#endif - if ( nIndex != -1 ) - { - sRet = _sURL.copy(nIndex+1); - } - return sRet; - - } - /*****************************************************************************/ - /* convert jstring to rtl_uString */ - - OUString StorageContainer::jstring2ustring(JNIEnv * env, jstring jstr) - { - if (env->ExceptionCheck()) - { - env->ExceptionClear(); - OSL_FAIL("ExceptionClear"); - } - OUString aStr; - if ( jstr ) - { - jboolean bCopy(true); - const jchar* pChar = env->GetStringChars(jstr,&bCopy); - jsize len = env->GetStringLength(jstr); - aStr = OUString( - reinterpret_cast<sal_Unicode const *>(pChar), len); - - if(bCopy) - env->ReleaseStringChars(jstr,pChar); - } - - if (env->ExceptionCheck()) - { - env->ExceptionClear(); - OSL_FAIL("ExceptionClear"); - } - return aStr; - } - - - OUString StorageContainer::registerStorage(const Reference< XStorage>& _xStorage,const OUString& _sURL) - { - OSL_ENSURE(_xStorage.is(),"Storage is NULL!"); - TStorages& rMap = lcl_getStorageMap(); - // check if the storage is already in our map - TStorages::const_iterator aFind = std::find_if(rMap.begin(),rMap.end(), - [&_xStorage] (const TStorages::value_type& storage) { - return storage.second.mapStorage() == _xStorage; - }); - - if ( aFind == rMap.end() ) - { - aFind = rMap.insert(TStorages::value_type(lcl_getNextCount(), {_xStorage, css::uno::Environment::getCurrent(), _sURL, TStreamMap()})).first; - } - - return aFind->first; - } - - TStorages::mapped_type StorageContainer::getRegisteredStorage(const OUString& _sKey) - { - TStorages::mapped_type aRet; - TStorages& rMap = lcl_getStorageMap(); - TStorages::const_iterator aFind = rMap.find(_sKey); - OSL_ENSURE(aFind != rMap.end(),"Storage could not be found in list!"); - if ( aFind != rMap.end() ) - aRet = aFind->second; - - return aRet; - } - - OUString StorageContainer::getRegisteredKey(const Reference< XStorage>& _xStorage) - { - OUString sKey; - OSL_ENSURE(_xStorage.is(),"Storage is NULL!"); - TStorages& rMap = lcl_getStorageMap(); - // check if the storage is already in our map - TStorages::const_iterator aFind = std::find_if(rMap.begin(),rMap.end(), - [&_xStorage] (const TStorages::value_type& storage) { - return storage.second.mapStorage() == _xStorage; - }); - - if ( aFind != rMap.end() ) - sKey = aFind->first; - return sKey; - } - - void StorageContainer::revokeStorage(const OUString& _sKey,const Reference<XTransactionListener>& _xListener) - { - TStorages& rMap = lcl_getStorageMap(); - TStorages::iterator aFind = rMap.find(_sKey); - if ( aFind != rMap.end() ) - { - try - { - if ( _xListener.is() ) - { - Reference<XTransactionBroadcaster> xBroad(aFind->second.mapStorage(),UNO_QUERY); - if ( xBroad.is() ) - xBroad->removeTransactionListener(_xListener); - Reference<XTransactedObject> xTrans(aFind->second.mapStorage(),UNO_QUERY); - if ( xTrans.is() ) - xTrans->commit(); - } - } - catch(const Exception&) - { - } - rMap.erase(aFind); - } - } - - TStreamMap::mapped_type StorageContainer::registerStream(JNIEnv * env,jstring name, jstring key,sal_Int32 _nMode) - { - TStreamMap::mapped_type pHelper; - TStorages& rMap = lcl_getStorageMap(); - OUString sKey = jstring2ustring(env,key); - TStorages::iterator aFind = rMap.find(sKey); - OSL_ENSURE(aFind != rMap.end(),"Storage could not be found in list!"); - if ( aFind != rMap.end() ) - { - TStorages::mapped_type aStoragePair = StorageContainer::getRegisteredStorage(sKey); - auto storage = aStoragePair.mapStorage(); - OSL_ENSURE(storage.is(),"No Storage available!"); - if ( storage.is() ) - { - OUString sOrgName = StorageContainer::jstring2ustring(env,name); - OUString sName = removeURLPrefix(sOrgName,aStoragePair.url); - TStreamMap::iterator aStreamFind = aFind->second.streams.find(sName); - OSL_ENSURE( aStreamFind == aFind->second.streams.end(),"A Stream was already registered for this object!"); - if ( aStreamFind != aFind->second.streams.end() ) - { - pHelper = aStreamFind->second; - } - else - { - try - { - try - { - pHelper.reset(new StreamHelper(storage->openStreamElement(sName,_nMode))); - } - catch(const Exception&) - { - OUString sStrippedName = removeOldURLPrefix(sOrgName); - - if ( (_nMode & ElementModes::WRITE) != ElementModes::WRITE ) - { - bool bIsStream = true; - try - { - bIsStream = storage->isStreamElement(sStrippedName); - } - catch(const Exception&) - { - bIsStream = false; - } - if ( !bIsStream ) - return pHelper; // readonly file without data stream - } - pHelper.reset( new StreamHelper(storage->openStreamElement( sStrippedName, _nMode ) ) ); - } - aFind->second.streams.emplace(sName,pHelper); - } - catch(const Exception& e) - { - SAL_WARN( "connectivity.hsqldb", "[HSQLDB-SDBC] caught an exception while opening a stream\n" - "Name: " << sName - << "\nMode: 0x" << ( _nMode < 16 ? "0" : "") - << std::hex << _nMode ); - StorageContainer::throwJavaException(e,env); - } - } - } - } - return pHelper; - } - - void StorageContainer::revokeStream( JNIEnv * env,jstring name, jstring key) - { - TStorages& rMap = lcl_getStorageMap(); - TStorages::iterator aFind = rMap.find(jstring2ustring(env,key)); - OSL_ENSURE(aFind != rMap.end(),"Storage could not be found in list!"); - if ( aFind != rMap.end() ) - aFind->second.streams.erase(removeURLPrefix(jstring2ustring(env,name),aFind->second.url)); - } - - TStreamMap::mapped_type StorageContainer::getRegisteredStream( JNIEnv * env,jstring name, jstring key) - { - TStreamMap::mapped_type pRet; - TStorages& rMap = lcl_getStorageMap(); - TStorages::const_iterator aFind = rMap.find(jstring2ustring(env,key)); - OSL_ENSURE(aFind != rMap.end(),"Storage could not be found in list!"); - if ( aFind != rMap.end() ) - { - TStreamMap::const_iterator aStreamFind = aFind->second.streams.find(removeURLPrefix(jstring2ustring(env,name),aFind->second.url)); - if ( aStreamFind != aFind->second.streams.end() ) - pRet = aStreamFind->second; - } - - return pRet; - } - - void StorageContainer::throwJavaException(const Exception& _aException,JNIEnv * env) - { - if (env->ExceptionCheck()) - env->ExceptionClear(); - SAL_WARN("connectivity.hsqldb", "forwarding Exception: " << _aException ); - OString cstr( OUStringToOString(_aException.Message, RTL_TEXTENCODING_JAVA_UTF8 ) ); - env->ThrowNew(env->FindClass("java/io/IOException"), cstr.getStr()); - } - - } // namespace hsqldb - - -} -// namespace connectivity - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/drivers/hsqldb/HTables.cxx b/connectivity/source/drivers/hsqldb/HTables.cxx deleted file mode 100644 index bde5866b9d92..000000000000 --- a/connectivity/source/drivers/hsqldb/HTables.cxx +++ /dev/null @@ -1,186 +0,0 @@ -/* -*- 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 <hsqldb/HTables.hxx> -#include <hsqldb/HViews.hxx> -#include <hsqldb/HTable.hxx> -#include <com/sun/star/sdbc/XRow.hpp> -#include <com/sun/star/sdbc/XResultSet.hpp> -#include <com/sun/star/sdbc/ColumnValue.hpp> -#include <com/sun/star/sdbcx/Privilege.hpp> -#include <com/sun/star/sdbc/KeyRule.hpp> -#include <com/sun/star/sdbcx/KeyType.hpp> -#include <hsqldb/HCatalog.hxx> -#include <comphelper/extract.hxx> -#include <connectivity/dbtools.hxx> -#include <connectivity/dbexception.hxx> -#include <cppuhelper/interfacecontainer.h> -#include <comphelper/types.hxx> -#include <TConnection.hxx> - -using namespace ::comphelper; -using namespace connectivity; -using namespace ::cppu; -using namespace connectivity::hsqldb; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::beans; -using namespace ::com::sun::star::sdbcx; -using namespace ::com::sun::star::sdbc; -using namespace ::com::sun::star::container; -using namespace ::com::sun::star::lang; -using namespace dbtools; - -sdbcx::ObjectType OTables::createObject(const OUString& _rName) -{ - OUString sCatalog,sSchema,sTable; - ::dbtools::qualifiedNameComponents(m_xMetaData,_rName,sCatalog,sSchema,sTable,::dbtools::EComposeRule::InDataManipulation); - - Sequence< OUString > sTableTypes(3); - sTableTypes[0] = "VIEW"; - sTableTypes[1] = "TABLE"; - sTableTypes[2] = "%"; // just to be sure to include anything else .... - - Any aCatalog; - if ( !sCatalog.isEmpty() ) - aCatalog <<= sCatalog; - Reference< XResultSet > xResult = m_xMetaData->getTables(aCatalog,sSchema,sTable,sTableTypes); - - sdbcx::ObjectType xRet = nullptr; - if ( xResult.is() ) - { - Reference< XRow > xRow(xResult,UNO_QUERY); - if ( xResult->next() ) // there can be only one table with this name - { - sal_Int32 nPrivileges = ::dbtools::getTablePrivileges( m_xMetaData, sCatalog, sSchema, sTable ); - if ( m_xMetaData->isReadOnly() ) - nPrivileges &= ~( Privilege::INSERT | Privilege::UPDATE | Privilege::DELETE | Privilege::CREATE | Privilege::ALTER | Privilege::DROP ); - - // obtain privileges - OHSQLTable* pRet = new OHSQLTable( this - ,static_cast<OHCatalog&>(m_rParent).getConnection() - ,sTable - ,xRow->getString(4) - ,xRow->getString(5) - ,sSchema - ,sCatalog - ,nPrivileges); - xRet = pRet; - } - ::comphelper::disposeComponent(xResult); - } - - return xRet; -} - -void OTables::impl_refresh( ) -{ - static_cast<OHCatalog&>(m_rParent).refreshTables(); -} - -void OTables::disposing() -{ -m_xMetaData.clear(); - OCollection::disposing(); -} - -Reference< XPropertySet > OTables::createDescriptor() -{ - return new OHSQLTable(this,static_cast<OHCatalog&>(m_rParent).getConnection()); -} - -// XAppend -sdbcx::ObjectType OTables::appendObject( const OUString& _rForName, const Reference< XPropertySet >& descriptor ) -{ - createTable(descriptor); - return createObject( _rForName ); -} - -// XDrop -void OTables::dropObject(sal_Int32 _nPos,const OUString& _sElementName) -{ - Reference< XInterface > xObject( getObject( _nPos ) ); - bool bIsNew = connectivity::sdbcx::ODescriptor::isNew( xObject ); - if (!bIsNew) - { - Reference< XConnection > xConnection = static_cast<OHCatalog&>(m_rParent).getConnection(); - - - OUString sCatalog,sSchema,sTable; - ::dbtools::qualifiedNameComponents(m_xMetaData,_sElementName,sCatalog,sSchema,sTable,::dbtools::EComposeRule::InDataManipulation); - - OUString aSql( "DROP " ); - - Reference<XPropertySet> xProp(xObject,UNO_QUERY); - bool bIsView; - if((bIsView = (xProp.is() && ::comphelper::getString(xProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE))) == "VIEW"))) // here we have a view - aSql += "VIEW "; - else - aSql += "TABLE "; - - OUString sComposedName( - ::dbtools::composeTableName( m_xMetaData, sCatalog, sSchema, sTable, true, ::dbtools::EComposeRule::InDataManipulation ) ); - aSql += sComposedName; - Reference< XStatement > xStmt = xConnection->createStatement( ); - if ( xStmt.is() ) - { - xStmt->execute(aSql); - ::comphelper::disposeComponent(xStmt); - } - // if no exception was thrown we must delete it from the views - if ( bIsView ) - { - HViews* pViews = static_cast<HViews*>(static_cast<OHCatalog&>(m_rParent).getPrivateViews()); - if ( pViews && pViews->hasByName(_sElementName) ) - pViews->dropByNameImpl(_sElementName); - } - } -} - -void OTables::createTable( const Reference< XPropertySet >& descriptor ) -{ - Reference< XConnection > xConnection = static_cast<OHCatalog&>(m_rParent).getConnection(); - OUString aSql = ::dbtools::createSqlCreateTableStatement(descriptor,xConnection); - - Reference< XStatement > xStmt = xConnection->createStatement( ); - if ( xStmt.is() ) - { - xStmt->execute(aSql); - ::comphelper::disposeComponent(xStmt); - } -} - -void OTables::appendNew(const OUString& _rsNewTable) -{ - insertElement(_rsNewTable,nullptr); - - // notify our container listeners - ContainerEvent aEvent(static_cast<XContainer*>(this), makeAny(_rsNewTable), Any(), Any()); - OInterfaceIteratorHelper2 aListenerLoop(m_aContainerListeners); - while (aListenerLoop.hasMoreElements()) - static_cast<XContainerListener*>(aListenerLoop.next())->elementInserted(aEvent); -} - -OUString OTables::getNameForObject(const sdbcx::ObjectType& _xObject) -{ - OSL_ENSURE(_xObject.is(),"OTables::getNameForObject: Object is NULL!"); - return ::dbtools::composeTableName( m_xMetaData, _xObject, ::dbtools::EComposeRule::InDataManipulation, false ); -} - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/drivers/hsqldb/HTerminateListener.cxx b/connectivity/source/drivers/hsqldb/HTerminateListener.cxx deleted file mode 100644 index df325efb75e8..000000000000 --- a/connectivity/source/drivers/hsqldb/HTerminateListener.cxx +++ /dev/null @@ -1,52 +0,0 @@ -/* -*- 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 "HTerminateListener.hxx" -#include <hsqldb/HDriver.hxx> - - -namespace connectivity -{ - - using namespace hsqldb; - using namespace ::com::sun::star::uno; - using namespace ::com::sun::star::lang; - -// XEventListener -void SAL_CALL OConnectionController::disposing( const EventObject& /*Source*/ ) -{ -} - -// XTerminateListener -void SAL_CALL OConnectionController::queryTermination( const EventObject& /*aEvent*/ ) -{ - m_pDriver->flushConnections(); -} - -void SAL_CALL OConnectionController::notifyTermination( const EventObject& /*aEvent*/ ) -{ - m_pDriver->shutdownConnections(); -} - - -} // namespace connectivity - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/drivers/hsqldb/HTerminateListener.hxx b/connectivity/source/drivers/hsqldb/HTerminateListener.hxx deleted file mode 100644 index 62e8ec79d660..000000000000 --- a/connectivity/source/drivers/hsqldb/HTerminateListener.hxx +++ /dev/null @@ -1,54 +0,0 @@ -/* -*- 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 INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_HSQLDB_HTERMINATELISTENER_HXX -#define INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_HSQLDB_HTERMINATELISTENER_HXX - -#include <cppuhelper/implbase.hxx> -#include <com/sun/star/frame/XTerminateListener.hpp> - - -namespace connectivity -{ - - - namespace hsqldb - { - class ODriverDelegator; - class OConnectionController : public ::cppu::WeakImplHelper< css::frame::XTerminateListener > - { - ODriverDelegator* m_pDriver; - protected: - virtual ~OConnectionController() override {m_pDriver = nullptr;} - public: - explicit OConnectionController(ODriverDelegator* _pDriver) : m_pDriver(_pDriver){} - - // XEventListener - virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override; - - // XTerminateListener - virtual void SAL_CALL queryTermination( const css::lang::EventObject& aEvent ) override; - virtual void SAL_CALL notifyTermination( const css::lang::EventObject& aEvent ) override; - }; - } - -} // namespace connectivity - -#endif // INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_HSQLDB_HTERMINATELISTENER_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/drivers/hsqldb/HTools.cxx b/connectivity/source/drivers/hsqldb/HTools.cxx deleted file mode 100644 index 9a31ace4602b..000000000000 --- a/connectivity/source/drivers/hsqldb/HTools.cxx +++ /dev/null @@ -1,53 +0,0 @@ -/* -*- 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 <hsqldb/HTools.hxx> - - -namespace connectivity { namespace hsqldb -{ - - void HTools::appendTableFilterCrit( OUStringBuffer& _inout_rBuffer, const OUString& _rCatalog, - const OUString& _rSchema, const OUString& _rName, bool _bShortForm ) - { - _inout_rBuffer.append( " WHERE " ); - if ( !_rCatalog.isEmpty() ) - { - _inout_rBuffer.appendAscii( _bShortForm ? "TABLE_CAT" : "TABLE_CATALOG" ); - _inout_rBuffer.append( " = '" ); - _inout_rBuffer.append ( _rCatalog ); - _inout_rBuffer.append( "' AND " ); - } - if ( !_rSchema.isEmpty() ) - { - _inout_rBuffer.appendAscii( _bShortForm ? "TABLE_SCHEM" : "TABLE_SCHEMA" ); - _inout_rBuffer.append( " = '" ); - _inout_rBuffer.append ( _rSchema ); - _inout_rBuffer.append( "' AND " ); - } - _inout_rBuffer.append( "TABLE_NAME = '" ); - _inout_rBuffer.append ( _rName ); - _inout_rBuffer.append( "'" ); - } - - -} } // namespace connectivity::hsqldb - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/drivers/hsqldb/HUser.cxx b/connectivity/source/drivers/hsqldb/HUser.cxx deleted file mode 100644 index 5fd38f739a51..000000000000 --- a/connectivity/source/drivers/hsqldb/HUser.cxx +++ /dev/null @@ -1,327 +0,0 @@ -/* -*- 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 <hsqldb/HUser.hxx> -#include <com/sun/star/sdbc/XRow.hpp> -#include <com/sun/star/sdbc/XResultSet.hpp> -#include <connectivity/dbtools.hxx> -#include <connectivity/dbexception.hxx> -#include <com/sun/star/sdbcx/Privilege.hpp> -#include <com/sun/star/sdbcx/PrivilegeObject.hpp> -#include <TConnection.hxx> -#include <strings.hrc> - -using namespace connectivity; -using namespace connectivity::hsqldb; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::beans; -using namespace ::com::sun::star::sdbcx; -using namespace ::com::sun::star::sdbc; -using namespace ::com::sun::star::container; -using namespace ::com::sun::star::lang; - -OHSQLUser::OHSQLUser( const css::uno::Reference< css::sdbc::XConnection >& _xConnection) : connectivity::sdbcx::OUser(true) - ,m_xConnection(_xConnection) -{ - construct(); -} - -OHSQLUser::OHSQLUser( const css::uno::Reference< css::sdbc::XConnection >& _xConnection, - const OUString& Name - ) : connectivity::sdbcx::OUser(Name,true) - ,m_xConnection(_xConnection) -{ - construct(); -} - -void OHSQLUser::refreshGroups() -{ -} - -OUserExtend::OUserExtend( const css::uno::Reference< css::sdbc::XConnection >& _xConnection) : OHSQLUser(_xConnection) -{ - construct(); -} - -void OUserExtend::construct() -{ - registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PASSWORD), PROPERTY_ID_PASSWORD,0,&m_Password,::cppu::UnoType<OUString>::get()); -} - -cppu::IPropertyArrayHelper* OUserExtend::createArrayHelper() const -{ - Sequence< Property > aProps; - describeProperties(aProps); - return new cppu::OPropertyArrayHelper(aProps); -} - -cppu::IPropertyArrayHelper & OUserExtend::getInfoHelper() -{ - return *OUserExtend_PROP::getArrayHelper(); -} -typedef connectivity::sdbcx::OUser_BASE OUser_BASE_RBHELPER; - -sal_Int32 SAL_CALL OHSQLUser::getPrivileges( const OUString& objName, sal_Int32 objType ) -{ - ::osl::MutexGuard aGuard(m_aMutex); - checkDisposed(OUser_BASE_RBHELPER::rBHelper.bDisposed); - - sal_Int32 nRights,nRightsWithGrant; - findPrivilegesAndGrantPrivileges(objName,objType,nRights,nRightsWithGrant); - return nRights; -} - -void OHSQLUser::findPrivilegesAndGrantPrivileges(const OUString& objName, sal_Int32 objType,sal_Int32& nRights,sal_Int32& nRightsWithGrant) -{ - nRightsWithGrant = nRights = 0; - // first we need to create the sql stmt to select the privs - Reference<XDatabaseMetaData> xMeta = m_xConnection->getMetaData(); - OUString sCatalog,sSchema,sTable; - ::dbtools::qualifiedNameComponents(xMeta,objName,sCatalog,sSchema,sTable,::dbtools::EComposeRule::InDataManipulation); - Reference<XResultSet> xRes; - switch(objType) - { - case PrivilegeObject::TABLE: - case PrivilegeObject::VIEW: - { - Any aCatalog; - if ( !sCatalog.isEmpty() ) - aCatalog <<= sCatalog; - xRes = xMeta->getTablePrivileges(aCatalog,sSchema,sTable); - } - break; - - case PrivilegeObject::COLUMN: - { - Any aCatalog; - if ( !sCatalog.isEmpty() ) - aCatalog <<= sCatalog; - xRes = xMeta->getColumnPrivileges(aCatalog,sSchema,sTable,"%"); - } - break; - } - - if ( xRes.is() ) - { - static const char sYes [] = "YES"; - - nRightsWithGrant = nRights = 0; - - Reference<XRow> xCurrentRow(xRes,UNO_QUERY); - while( xCurrentRow.is() && xRes->next() ) - { - OUString sGrantee = xCurrentRow->getString(5); - OUString sPrivilege = xCurrentRow->getString(6); - OUString sGrantable = xCurrentRow->getString(7); - - if (!m_Name.equalsIgnoreAsciiCase(sGrantee)) - continue; - - if (sPrivilege.equalsIgnoreAsciiCase("SELECT")) - { - nRights |= Privilege::SELECT; - if ( sGrantable.equalsIgnoreAsciiCase(sYes) ) - nRightsWithGrant |= Privilege::SELECT; - } - else if (sPrivilege.equalsIgnoreAsciiCase("INSERT")) - { - nRights |= Privilege::INSERT; - if ( sGrantable.equalsIgnoreAsciiCase(sYes) ) - nRightsWithGrant |= Privilege::INSERT; - } - else if (sPrivilege.equalsIgnoreAsciiCase("UPDATE")) - { - nRights |= Privilege::UPDATE; - if ( sGrantable.equalsIgnoreAsciiCase(sYes) ) - nRightsWithGrant |= Privilege::UPDATE; - } - else if (sPrivilege.equalsIgnoreAsciiCase("DELETE")) - { - nRights |= Privilege::DELETE; - if ( sGrantable.equalsIgnoreAsciiCase(sYes) ) - nRightsWithGrant |= Privilege::DELETE; - } - else if (sPrivilege.equalsIgnoreAsciiCase("READ")) - { - nRights |= Privilege::READ; - if ( sGrantable.equalsIgnoreAsciiCase(sYes) ) - nRightsWithGrant |= Privilege::READ; - } - else if (sPrivilege.equalsIgnoreAsciiCase("CREATE")) - { - nRights |= Privilege::CREATE; - if ( sGrantable.equalsIgnoreAsciiCase(sYes) ) - nRightsWithGrant |= Privilege::CREATE; - } - else if (sPrivilege.equalsIgnoreAsciiCase("ALTER")) - { - nRights |= Privilege::ALTER; - if ( sGrantable.equalsIgnoreAsciiCase(sYes) ) - nRightsWithGrant |= Privilege::ALTER; - } - else if (sPrivilege.equalsIgnoreAsciiCase("REFERENCE")) - { - nRights |= Privilege::REFERENCE; - if ( sGrantable.equalsIgnoreAsciiCase(sYes) ) - nRightsWithGrant |= Privilege::REFERENCE; - } - else if (sPrivilege.equalsIgnoreAsciiCase("DROP")) - { - nRights |= Privilege::DROP; - if ( sGrantable.equalsIgnoreAsciiCase(sYes) ) - nRightsWithGrant |= Privilege::DROP; - } - } - ::comphelper::disposeComponent(xRes); - } -} - -sal_Int32 SAL_CALL OHSQLUser::getGrantablePrivileges( const OUString& objName, sal_Int32 objType ) -{ - ::osl::MutexGuard aGuard(m_aMutex); - checkDisposed(OUser_BASE_RBHELPER::rBHelper.bDisposed); - - sal_Int32 nRights,nRightsWithGrant; - findPrivilegesAndGrantPrivileges(objName,objType,nRights,nRightsWithGrant); - return nRightsWithGrant; -} - -void SAL_CALL OHSQLUser::grantPrivileges( const OUString& objName, sal_Int32 objType, sal_Int32 objPrivileges ) -{ - if ( objType != PrivilegeObject::TABLE ) - { - ::connectivity::SharedResources aResources; - const OUString sError( aResources.getResourceString(STR_PRIVILEGE_NOT_GRANTED)); - ::dbtools::throwGenericSQLException(sError,*this); - } // if ( objType != PrivilegeObject::TABLE ) - - - ::osl::MutexGuard aGuard(m_aMutex); - - OUString sPrivs = getPrivilegeString(objPrivileges); - if(!sPrivs.isEmpty()) - { - Reference<XDatabaseMetaData> xMeta = m_xConnection->getMetaData(); - OUString sGrant = "GRANT " + sPrivs + - " ON " + ::dbtools::quoteTableName(xMeta,objName,::dbtools::EComposeRule::InDataManipulation) + - " TO " + ::dbtools::quoteName(xMeta->getIdentifierQuoteString(), m_Name); - - Reference<XStatement> xStmt = m_xConnection->createStatement(); - if(xStmt.is()) - xStmt->execute(sGrant); - ::comphelper::disposeComponent(xStmt); - } -} - -void SAL_CALL OHSQLUser::revokePrivileges( const OUString& objName, sal_Int32 objType, sal_Int32 objPrivileges ) -{ - if ( objType != PrivilegeObject::TABLE ) - { - ::connectivity::SharedResources aResources; - const OUString sError( aResources.getResourceString(STR_PRIVILEGE_NOT_REVOKED)); - ::dbtools::throwGenericSQLException(sError,*this); - } // if ( objType != PrivilegeObject::TABLE ) - - ::osl::MutexGuard aGuard(m_aMutex); - checkDisposed(OUser_BASE_RBHELPER::rBHelper.bDisposed); - OUString sPrivs = getPrivilegeString(objPrivileges); - if(!sPrivs.isEmpty()) - { - Reference<XDatabaseMetaData> xMeta = m_xConnection->getMetaData(); - OUString sGrant = "REVOKE " + sPrivs + - " ON " + ::dbtools::quoteTableName(xMeta,objName,::dbtools::EComposeRule::InDataManipulation) + - " FROM " + ::dbtools::quoteName(xMeta->getIdentifierQuoteString(), m_Name); - - Reference<XStatement> xStmt = m_xConnection->createStatement(); - if(xStmt.is()) - xStmt->execute(sGrant); - ::comphelper::disposeComponent(xStmt); - } -} - -// XUser -void SAL_CALL OHSQLUser::changePassword( const OUString& /*oldPassword*/, const OUString& newPassword ) -{ - ::osl::MutexGuard aGuard(m_aMutex); - checkDisposed(OUser_BASE_RBHELPER::rBHelper.bDisposed); - - Reference<XDatabaseMetaData> xMeta = m_xConnection->getMetaData(); - - if( m_Name != xMeta->getUserName() ) - { - ::dbtools::throwGenericSQLException("HSQLDB can only change password of the current user.", *this); - } - - OUString sAlterPwd = "SET PASSWORD " + - ::dbtools::quoteName(xMeta->getIdentifierQuoteString(), newPassword); - - Reference<XStatement> xStmt = m_xConnection->createStatement(); - if ( xStmt.is() ) - { - xStmt->execute(sAlterPwd); - ::comphelper::disposeComponent(xStmt); - } -} - -OUString OHSQLUser::getPrivilegeString(sal_Int32 nRights) -{ - OUString sPrivs; - if((nRights & Privilege::INSERT) == Privilege::INSERT) - sPrivs += "INSERT"; - - if((nRights & Privilege::DELETE) == Privilege::DELETE) - { - if(!sPrivs.isEmpty()) - sPrivs += ","; - sPrivs += "DELETE"; - } - - if((nRights & Privilege::UPDATE) == Privilege::UPDATE) - { - if(!sPrivs.isEmpty()) - sPrivs += ","; - sPrivs += "UPDATE"; - } - - if((nRights & Privilege::ALTER) == Privilege::ALTER) - { - if(!sPrivs.isEmpty()) - sPrivs += ","; - sPrivs += "ALTER"; - } - - if((nRights & Privilege::SELECT) == Privilege::SELECT) - { - if(!sPrivs.isEmpty()) - sPrivs += ","; - sPrivs += "SELECT"; - } - - if((nRights & Privilege::REFERENCE) == Privilege::REFERENCE) - { - if(!sPrivs.isEmpty()) - sPrivs += ","; - sPrivs += "REFERENCES"; - } - - return sPrivs; -} - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/drivers/hsqldb/HUsers.cxx b/connectivity/source/drivers/hsqldb/HUsers.cxx deleted file mode 100644 index c6992c9328c3..000000000000 --- a/connectivity/source/drivers/hsqldb/HUsers.cxx +++ /dev/null @@ -1,103 +0,0 @@ -/* -*- 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 <hsqldb/HUsers.hxx> -#include <hsqldb/HUser.hxx> -#include <hsqldb/HTable.hxx> -#include <com/sun/star/sdbc/XRow.hpp> -#include <com/sun/star/sdbc/XResultSet.hpp> -#include <connectivity/sdbcx/IRefreshable.hxx> -#include <comphelper/types.hxx> -#include <connectivity/dbexception.hxx> -#include <connectivity/dbtools.hxx> -#include <TConnection.hxx> - -using namespace ::comphelper; -using namespace connectivity; -using namespace connectivity::hsqldb; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::beans; -using namespace ::com::sun::star::sdbc; -using namespace ::com::sun::star::container; -using namespace ::com::sun::star::lang; - -OUsers::OUsers( ::cppu::OWeakObject& _rParent, - ::osl::Mutex& _rMutex, - const ::std::vector< OUString> &_rVector, - const css::uno::Reference< css::sdbc::XConnection >& _xConnection, - connectivity::sdbcx::IRefreshableUsers* _pParent) - : sdbcx::OCollection(_rParent, true, _rMutex, _rVector) - ,m_xConnection(_xConnection) - ,m_pParent(_pParent) -{ -} - - -sdbcx::ObjectType OUsers::createObject(const OUString& _rName) -{ - return new OHSQLUser(m_xConnection,_rName); -} - -void OUsers::impl_refresh() -{ - m_pParent->refreshUsers(); -} - -Reference< XPropertySet > OUsers::createDescriptor() -{ - OUserExtend* pNew = new OUserExtend(m_xConnection); - return pNew; -} - -// XAppend -sdbcx::ObjectType OUsers::appendObject( const OUString& _rForName, const Reference< XPropertySet >& descriptor ) -{ - OUString aQuote = m_xConnection->getMetaData()->getIdentifierQuoteString( ); - OUString sPassword; - descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PASSWORD)) >>= sPassword; - OUString aSql = "GRANT USAGE ON * TO " + - ::dbtools::quoteName(aQuote,_rForName) + " @\"%\" "; - if ( !sPassword.isEmpty() ) - { - aSql += " IDENTIFIED BY '" + sPassword + "'"; - } - - Reference< XStatement > xStmt = m_xConnection->createStatement( ); - if(xStmt.is()) - xStmt->execute(aSql); - ::comphelper::disposeComponent(xStmt); - - return createObject( _rForName ); -} - -// XDrop -void OUsers::dropObject(sal_Int32 /*nPos*/,const OUString& _sElementName) -{ - OUString aSql( "REVOKE ALL ON * FROM " ); - OUString aQuote = m_xConnection->getMetaData()->getIdentifierQuoteString( ); - aSql += ::dbtools::quoteName(aQuote,_sElementName); - - Reference< XStatement > xStmt = m_xConnection->createStatement( ); - if(xStmt.is()) - xStmt->execute(aSql); - ::comphelper::disposeComponent(xStmt); -} - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/drivers/hsqldb/HViews.cxx b/connectivity/source/drivers/hsqldb/HViews.cxx deleted file mode 100644 index c66d869e09a4..000000000000 --- a/connectivity/source/drivers/hsqldb/HViews.cxx +++ /dev/null @@ -1,158 +0,0 @@ -/* -*- 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 <hsqldb/HTables.hxx> -#include <hsqldb/HViews.hxx> -#include <hsqldb/HView.hxx> -#include <com/sun/star/sdbc/XRow.hpp> -#include <com/sun/star/sdbc/XResultSet.hpp> -#include <com/sun/star/sdbc/ColumnValue.hpp> -#include <com/sun/star/sdbc/KeyRule.hpp> -#include <com/sun/star/sdbcx/KeyType.hpp> -#include <com/sun/star/sdbcx/CheckOption.hpp> -#include <hsqldb/HCatalog.hxx> -#include <comphelper/extract.hxx> -#include <connectivity/dbtools.hxx> -#include <connectivity/dbexception.hxx> -#include <cppuhelper/interfacecontainer.h> -#include <comphelper/types.hxx> -#include <TConnection.hxx> - -using namespace ::comphelper; - -using namespace ::cppu; -using namespace connectivity; -using namespace connectivity::hsqldb; -using namespace css::uno; -using namespace css::beans; -using namespace css::sdbcx; -using namespace css::sdbc; -using namespace css::container; -using namespace css::lang; -using namespace dbtools; -typedef connectivity::sdbcx::OCollection OCollection_TYPE; - - -HViews::HViews( const Reference< XConnection >& _rxConnection, ::cppu::OWeakObject& _rParent, ::osl::Mutex& _rMutex, - const ::std::vector< OUString> &_rVector ) - :sdbcx::OCollection( _rParent, true, _rMutex, _rVector ) - ,m_xConnection( _rxConnection ) - ,m_xMetaData( _rxConnection->getMetaData() ) - ,m_bInDrop( false ) -{ -} - - -sdbcx::ObjectType HViews::createObject(const OUString& _rName) -{ - OUString sCatalog,sSchema,sTable; - ::dbtools::qualifiedNameComponents(m_xMetaData, - _rName, - sCatalog, - sSchema, - sTable, - ::dbtools::EComposeRule::InDataManipulation); - return new HView( m_xConnection, isCaseSensitive(), sSchema, sTable ); -} - - -void HViews::impl_refresh( ) -{ - static_cast<OHCatalog&>(m_rParent).refreshTables(); -} - -void HViews::disposing() -{ -m_xMetaData.clear(); - OCollection::disposing(); -} - -Reference< XPropertySet > HViews::createDescriptor() -{ - Reference<XConnection> xConnection = static_cast<OHCatalog&>(m_rParent).getConnection(); - connectivity::sdbcx::OView* pNew = new connectivity::sdbcx::OView(true, xConnection->getMetaData()); - return pNew; -} - -// XAppend -sdbcx::ObjectType HViews::appendObject( const OUString& _rForName, const Reference< XPropertySet >& descriptor ) -{ - createView(descriptor); - return createObject( _rForName ); -} - -// XDrop -void HViews::dropObject(sal_Int32 _nPos,const OUString& /*_sElementName*/) -{ - if ( m_bInDrop ) - return; - - Reference< XInterface > xObject( getObject( _nPos ) ); - bool bIsNew = connectivity::sdbcx::ODescriptor::isNew( xObject ); - if (!bIsNew) - { - OUString aSql( "DROP VIEW" ); - - Reference<XPropertySet> xProp(xObject,UNO_QUERY); - aSql += ::dbtools::composeTableName( m_xMetaData, xProp, ::dbtools::EComposeRule::InTableDefinitions, true ); - - Reference<XConnection> xConnection = static_cast<OHCatalog&>(m_rParent).getConnection(); - Reference< XStatement > xStmt = xConnection->createStatement( ); - xStmt->execute(aSql); - ::comphelper::disposeComponent(xStmt); - } -} - -void HViews::dropByNameImpl(const OUString& elementName) -{ - m_bInDrop = true; - OCollection_TYPE::dropByName(elementName); - m_bInDrop = false; -} - -void HViews::createView( const Reference< XPropertySet >& descriptor ) -{ - Reference<XConnection> xConnection = static_cast<OHCatalog&>(m_rParent).getConnection(); - - OUString sCommand; - descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_COMMAND)) >>= sCommand; - - OUString aSql = "CREATE VIEW " + - ::dbtools::composeTableName( m_xMetaData, descriptor, ::dbtools::EComposeRule::InTableDefinitions, true ) + - " AS " + sCommand; - - Reference< XStatement > xStmt = xConnection->createStatement( ); - if ( xStmt.is() ) - { - xStmt->execute(aSql); - ::comphelper::disposeComponent(xStmt); - } - - // insert the new view also in the tables collection - OTables* pTables = static_cast<OTables*>(static_cast<OHCatalog&>(m_rParent).getPrivateTables()); - if ( pTables ) - { - OUString sName = ::dbtools::composeTableName( m_xMetaData, descriptor, ::dbtools::EComposeRule::InDataManipulation, false ); - pTables->appendNew(sName); - } -} - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/drivers/hsqldb/Hservices.cxx b/connectivity/source/drivers/hsqldb/Hservices.cxx deleted file mode 100644 index 6d1294b9b072..000000000000 --- a/connectivity/source/drivers/hsqldb/Hservices.cxx +++ /dev/null @@ -1,105 +0,0 @@ -/* -*- 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 <hsqldb/HDriver.hxx> -#include <cppuhelper/factory.hxx> - -using namespace connectivity::hsqldb; -using css::uno::Reference; -using css::uno::Sequence; -using css::lang::XSingleServiceFactory; -using css::lang::XMultiServiceFactory; - -typedef Reference< XSingleServiceFactory > (*createFactoryFunc) - ( - const Reference< XMultiServiceFactory > & rServiceManager, - const OUString & rComponentName, - ::cppu::ComponentInstantiation pCreateFunction, - const Sequence< OUString > & rServiceNames, - rtl_ModuleCount* - ); - - -struct ProviderRequest -{ - Reference< XSingleServiceFactory > xRet; - Reference< XMultiServiceFactory > const xServiceManager; - OUString const sImplementationName; - - ProviderRequest( - void* pServiceManager, - sal_Char const* pImplementationName - ) - : xServiceManager(static_cast<XMultiServiceFactory*>(pServiceManager)) - , sImplementationName(OUString::createFromAscii(pImplementationName)) - { - } - - bool CREATE_PROVIDER( - const OUString& Implname, - const Sequence< OUString > & Services, - ::cppu::ComponentInstantiation Factory, - createFactoryFunc creator - ) - { - if (!xRet.is() && (Implname == sImplementationName)) - { - try - { - xRet = creator( xServiceManager, sImplementationName,Factory, Services,nullptr); - } - catch(...) - { - } - } - return xRet.is(); - } - - void* getProvider() const { return xRet.get(); } -}; - - -extern "C" SAL_DLLPUBLIC_EXPORT void* hsqldb_component_getFactory( - const sal_Char* pImplementationName, - void* pServiceManager, - void* /*pRegistryKey*/) -{ - void* pRet = nullptr; - if (pServiceManager) - { - ProviderRequest aReq(pServiceManager,pImplementationName); - - aReq.CREATE_PROVIDER( - ODriverDelegator::getImplementationName_Static(), - ODriverDelegator::getSupportedServiceNames_Static(), - ODriverDelegator_CreateInstance, ::cppu::createSingleFactory) - ; - - if(aReq.xRet.is()) - aReq.xRet->acquire(); - - pRet = aReq.getProvider(); - } - - return pRet; -}; - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/drivers/hsqldb/StorageFileAccess.cxx b/connectivity/source/drivers/hsqldb/StorageFileAccess.cxx deleted file mode 100644 index 76e506595817..000000000000 --- a/connectivity/source/drivers/hsqldb/StorageFileAccess.cxx +++ /dev/null @@ -1,170 +0,0 @@ -/* -*- 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 . - */ - - -#if defined(HAVE_CONFIG_H) && HAVE_CONFIG_H -#include <config.h> -#endif -#include <com/sun/star/container/XNameAccess.hpp> -#include <com/sun/star/embed/XStorage.hpp> -#include <com/sun/star/lang/IllegalArgumentException.hpp> -#include <hsqldb/HStorageMap.hxx> -#include <osl/diagnose.h> - - -using namespace ::com::sun::star::container; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::embed; -using namespace ::com::sun::star::io; -using namespace ::com::sun::star::lang; -using namespace ::connectivity::hsqldb; - -/* - * Class: com_sun_star_sdbcx_comp_hsqldb_StorageFileAccess - * Method: isStreamElement - * Signature: (Ljava/lang/String;Ljava/lang/String;)Z - */ -extern "C" SAL_JNI_EXPORT jboolean JNICALL Java_com_sun_star_sdbcx_comp_hsqldb_StorageFileAccess_isStreamElement - (JNIEnv * env, jobject /*obj_this*/,jstring key, jstring name) -{ - TStorages::mapped_type aStoragePair = StorageContainer::getRegisteredStorage(StorageContainer::jstring2ustring(env,key)); - auto storage = aStoragePair.mapStorage(); - if ( storage.is() ) - { - try - { - OUString sName = StorageContainer::jstring2ustring(env,name); - try - { - OUString sOldName = StorageContainer::removeOldURLPrefix(sName); - if ( storage->isStreamElement(sOldName) ) - { - try - { - storage->renameElement(sOldName,StorageContainer::removeURLPrefix(sName,aStoragePair.url)); - } - catch(const Exception&) - { - } - } - } - catch(const NoSuchElementException&) - { - } - catch(const IllegalArgumentException&) - { - } - return storage->isStreamElement(StorageContainer::removeURLPrefix(sName,aStoragePair.url)); - } - catch(const NoSuchElementException&) - { - } - catch(const Exception& e) - { - OSL_FAIL("Exception caught! : Java_com_sun_star_sdbcx_comp_hsqldb_StorageFileAccess_isStreamElement"); - if (env->ExceptionCheck()) - env->ExceptionClear(); - SAL_WARN("connectivity.hsqldb", "forwarding Exception: " << e); - } - } - return JNI_FALSE; -} - - -/* - * Class: com_sun_star_sdbcx_comp_hsqldb_StorageFileAccess - * Method: removeElement - * Signature: (Ljava/lang/String;Ljava/lang/String;)V - */ -extern "C" SAL_JNI_EXPORT void JNICALL Java_com_sun_star_sdbcx_comp_hsqldb_StorageFileAccess_removeElement - (JNIEnv * env, jobject /*obj_this*/,jstring key, jstring name) -{ -#ifdef HSQLDB_DBG - { - OUString sKey = StorageContainer::jstring2ustring(env,key); - OUString sName = StorageContainer::jstring2ustring(env,name); - } -#endif - TStorages::mapped_type aStoragePair = StorageContainer::getRegisteredStorage(StorageContainer::jstring2ustring(env,key)); - auto storage = aStoragePair.mapStorage(); - if ( storage.is() ) - { - try - { - storage->removeElement(StorageContainer::removeURLPrefix(StorageContainer::jstring2ustring(env,name),aStoragePair.url)); - } - catch(const NoSuchElementException&) - { - if (env->ExceptionCheck()) - env->ExceptionClear(); - } - catch(const Exception& e) - { - SAL_WARN("connectivity.hsqldb", "Exception caught! : Java_com_sun_star_sdbcx_comp_hsqldb_StorageFileAccess_removeElement " << e); - StorageContainer::throwJavaException(e,env); - } - } -} - - -/* - * Class: com_sun_star_sdbcx_comp_hsqldb_StorageFileAccess - * Method: renameElement - * Signature: (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V - */ -extern "C" SAL_JNI_EXPORT void JNICALL Java_com_sun_star_sdbcx_comp_hsqldb_StorageFileAccess_renameElement - (JNIEnv * env, jobject /*obj_this*/,jstring key, jstring oldname, jstring newname) -{ -#ifdef HSQLDB_DBG - { - OUString sKey = StorageContainer::jstring2ustring(env,key); - OUString sNewName = StorageContainer::jstring2ustring(env,newname); - OUString sOldName = StorageContainer::jstring2ustring(env,oldname); - } -#endif - TStorages::mapped_type aStoragePair = StorageContainer::getRegisteredStorage(StorageContainer::jstring2ustring(env,key)); - auto storage = aStoragePair.mapStorage(); - if ( storage.is() ) - { - try - { - storage->renameElement( - StorageContainer::removeURLPrefix(StorageContainer::jstring2ustring(env,oldname),aStoragePair.url), - StorageContainer::removeURLPrefix(StorageContainer::jstring2ustring(env,newname),aStoragePair.url) - ); -#ifdef HSQLDB_DBG - { - OUString sNewName = StorageContainer::removeURLPrefix(StorageContainer::jstring2ustring(env,newname),aStoragePair.first.second); - OSL_ENSURE(aStoragePair.first.first->isStreamElement(sNewName),"Stream could not be renamed"); - } -#endif - } - catch(const NoSuchElementException&) - { - } - catch(const Exception& e) - { - OSL_FAIL("Exception caught! : Java_com_sun_star_sdbcx_comp_hsqldb_StorageFileAccess_renameElement"); - StorageContainer::throwJavaException(e,env); - } - } -} - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/drivers/hsqldb/StorageNativeInputStream.cxx b/connectivity/source/drivers/hsqldb/StorageNativeInputStream.cxx deleted file mode 100644 index 2c738f15f37f..000000000000 --- a/connectivity/source/drivers/hsqldb/StorageNativeInputStream.cxx +++ /dev/null @@ -1,297 +0,0 @@ -/* -*- 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 . - */ - - -#if defined(HAVE_CONFIG_H) && HAVE_CONFIG_H -#include <config.h> -#endif -#include <com/sun/star/io/XStream.hpp> -#include <com/sun/star/container/XNameAccess.hpp> -#include <com/sun/star/document/XDocumentSubStorageSupplier.hpp> -#include <com/sun/star/embed/XStorage.hpp> -#include <com/sun/star/embed/ElementModes.hpp> -#include <comphelper/types.hxx> -#include <hsqldb/HStorageAccess.hxx> -#include <hsqldb/HStorageMap.hxx> - -#include <jvmaccess/virtualmachine.hxx> -#include <com/sun/star/lang/XSingleComponentFactory.hpp> -#include <osl/diagnose.h> -#include "accesslog.hxx" - -#include <limits> - - -using namespace ::com::sun::star::container; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::document; -using namespace ::com::sun::star::embed; -using namespace ::com::sun::star::io; -using namespace ::com::sun::star::lang; -using namespace ::connectivity::hsqldb; - -/*****************************************************************************/ -/* exception macros */ - -#define ThrowException(env, type, msg) { \ - env->ThrowNew(env->FindClass(type), msg); } -/* - * Class: com_sun_star_sdbcx_comp_hsqldb_StorageNativeInputStream - * Method: openStream - * Signature: (Ljava/lang/String;Ljava/lang/String;I)V - */ -extern "C" SAL_JNI_EXPORT void JNICALL Java_com_sun_star_sdbcx_comp_hsqldb_StorageNativeInputStream_openStream - (JNIEnv * env, jobject /*obj_this*/,jstring key, jstring name, jint mode) -{ -#ifdef HSQLDB_DBG - { - OperationLogFile( env, name, "input" ).logOperation( "openStream" ); - LogFile( env, name, "input" ).create(); - } -#endif - StorageContainer::registerStream(env,name,key,mode); -} - - -/* - * Class: com_sun_star_sdbcx_comp_hsqldb_StorageNativeInputStream - * Method: read - * Signature: (Ljava/lang/String;Ljava/lang/String;)I - */ -extern "C" SAL_JNI_EXPORT jint JNICALL Java_com_sun_star_sdbcx_comp_hsqldb_StorageNativeInputStream_read__Ljava_lang_String_2Ljava_lang_String_2 - (JNIEnv * env, jobject /*obj_this*/, jstring key, jstring name) -{ -#ifdef HSQLDB_DBG - OperationLogFile( env, name, "input" ).logOperation( "read()" ); - - DataLogFile aDataLog( env, name, "input" ); - return read_from_storage_stream( env, obj_this, name, key, &aDataLog ); -#else - return read_from_storage_stream( env, name, key ); -#endif -} - - -/* - * Class: com_sun_star_sdbcx_comp_hsqldb_StorageNativeInputStream - * Method: read - * Signature: (Ljava/lang/String;Ljava/lang/String;[BII)I - */ -extern "C" SAL_JNI_EXPORT jint JNICALL Java_com_sun_star_sdbcx_comp_hsqldb_StorageNativeInputStream_read__Ljava_lang_String_2Ljava_lang_String_2_3BII - (JNIEnv * env, jobject obj_this, jstring key, jstring name, jbyteArray buffer, jint off, jint len) -{ -#ifdef HSQLDB_DBG - OperationLogFile( env, name, "input" ).logOperation( "read( byte[], int, int )" ); - - DataLogFile aDataLog( env, name, "input" ); - return read_from_storage_stream_into_buffer( env, obj_this, name, key, buffer, off, len, &aDataLog ); -#else - (void)obj_this; - return read_from_storage_stream_into_buffer(env, name,key,buffer,off,len); -#endif -} - - -/* - * Class: com_sun_star_sdbcx_comp_hsqldb_StorageNativeInputStream - * Method: close - * Signature: (Ljava/lang/String;Ljava/lang/String;)V - */ -extern "C" SAL_JNI_EXPORT void JNICALL Java_com_sun_star_sdbcx_comp_hsqldb_StorageNativeInputStream_close - (JNIEnv * env, jobject /*obj_this*/,jstring key, jstring name) -{ -#ifdef HSQLDB_DBG - OperationLogFile aOpLog( env, name, "input" ); - aOpLog.logOperation( "close" ); - aOpLog.close(); - - LogFile aDataLog( env, name, "input" ); - aDataLog.close(); -#endif - StorageContainer::revokeStream(env,name,key); -} - - -/* - * Class: com_sun_star_sdbcx_comp_hsqldb_StorageNativeInputStream - * Method: skip - * Signature: (Ljava/lang/String;Ljava/lang/String;J)J - */ -extern "C" SAL_JNI_EXPORT jlong JNICALL Java_com_sun_star_sdbcx_comp_hsqldb_StorageNativeInputStream_skip - (JNIEnv * env, jobject /*obj_this*/,jstring key, jstring name, jlong n) -{ -#ifdef HSQLDB_DBG - OperationLogFile( env, name, "input" ).logOperation( "skip()" ); -#endif - - if ( n < 0 ) - ThrowException( env, - "java/io/IOException", - "n < 0"); - - std::shared_ptr<StreamHelper> pHelper = StorageContainer::getRegisteredStream(env,name,key); - OSL_ENSURE(pHelper.get(),"No stream helper!"); - if ( pHelper.get() ) - { - Reference<XInputStream> xIn = pHelper->getInputStream(); - if ( xIn.is() ) - { - try - { - sal_Int64 tmpLongVal = n; - sal_Int32 tmpIntVal; - - try - { - do { - if (tmpLongVal >= std::numeric_limits<sal_Int64>::max() ) - tmpIntVal = std::numeric_limits<sal_Int32>::max(); - else // Casting is safe here. - tmpIntVal = static_cast<sal_Int32>(tmpLongVal); - - tmpLongVal -= tmpIntVal; - - xIn->skipBytes(tmpIntVal); - - } while (tmpLongVal > 0); - } - catch(const Exception&) - { - } - - return n - tmpLongVal; - } - catch(const Exception& e) - { - OSL_FAIL("Exception caught! : skip();"); - StorageContainer::throwJavaException(e,env); - } - } - } - else - { - ThrowException( env, - "java/io/IOException", - "Stream is not valid"); - } - return 0; -} - - -/* - * Class: com_sun_star_sdbcx_comp_hsqldb_StorageNativeInputStream - * Method: available - * Signature: (Ljava/lang/String;Ljava/lang/String;)I - */ -extern "C" SAL_JNI_EXPORT jint JNICALL Java_com_sun_star_sdbcx_comp_hsqldb_StorageNativeInputStream_available - (JNIEnv * env, jobject /*obj_this*/,jstring key, jstring name) -{ -#ifdef HSQLDB_DBG - OperationLogFile aOpLog( env, name, "input" ); - aOpLog.logOperation( "available" ); -#endif - - std::shared_ptr<StreamHelper> pHelper = StorageContainer::getRegisteredStream(env,name,key); - OSL_ENSURE(pHelper.get(),"No stream helper!"); - Reference<XInputStream> xIn = pHelper.get() ? pHelper->getInputStream() : Reference<XInputStream>(); - if ( xIn.is() ) - { - try - { - jint nAvailable = xIn->available(); -#ifdef HSQLDB_DBG - aOpLog.logReturn( nAvailable ); -#endif - return nAvailable; - } - catch(const Exception& e) - { - OSL_FAIL("Exception caught! : available();"); - StorageContainer::throwJavaException(e,env); - } - } - else - { - ThrowException( env, - "java/io/IOException", - "Stream is not valid"); - } - return 0; -} - - -/* - * Class: com_sun_star_sdbcx_comp_hsqldb_StorageNativeInputStream - * Method: read - * Signature: (Ljava/lang/String;Ljava/lang/String;[B)I - */ -extern "C" SAL_JNI_EXPORT jint JNICALL Java_com_sun_star_sdbcx_comp_hsqldb_StorageNativeInputStream_read__Ljava_lang_String_2Ljava_lang_String_2_3B - (JNIEnv * env, jobject /*obj_this*/,jstring key, jstring name, jbyteArray buffer) -{ -#ifdef HSQLDB_DBG - OperationLogFile aOpLog( env, name, "input" ); - aOpLog.logOperation( "read( byte[] )" ); - - DataLogFile aDataLog( env, name, "input" ); -#endif - - std::shared_ptr<StreamHelper> pHelper = StorageContainer::getRegisteredStream(env,name,key); - Reference< XInputStream> xIn = pHelper.get() ? pHelper->getInputStream() : Reference< XInputStream>(); - OSL_ENSURE(xIn.is(),"Input stream is NULL!"); - jint nBytesRead = 0; - if ( xIn.is() ) - { - jsize nLen = env->GetArrayLength(buffer); - Sequence< ::sal_Int8 > aData(nLen); - - try - { - nBytesRead = xIn->readBytes(aData,nLen); - } - catch(const Exception& e) - { - OSL_FAIL("Exception caught! : skip();"); - StorageContainer::throwJavaException(e,env); - } - - // Casting bytesRead to an int is okay, since the user can - // only pass in an integer length to read, so the bytesRead - // must <= len. - - if (nBytesRead <= 0) { -#ifdef HSQLDB_DBG - aOpLog.logReturn( (jint)-1 ); -#endif - return -1; - } - OSL_ENSURE(nLen >= nBytesRead,"Buffer is too small!"); - OSL_ENSURE(aData.getLength() >= nBytesRead,"Buffer is too small!"); - env->SetByteArrayRegion(buffer, 0, nBytesRead, reinterpret_cast<jbyte*>(&aData[0])); -#ifdef HSQLDB_DBG - aDataLog.write( &aData[0], nBytesRead ); -#endif - } -#ifdef HSQLDB_DBG - aOpLog.logReturn( nBytesRead ); -#endif - return nBytesRead; -} - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/drivers/hsqldb/accesslog.cxx b/connectivity/source/drivers/hsqldb/accesslog.cxx deleted file mode 100644 index 880600a71d5a..000000000000 --- a/connectivity/source/drivers/hsqldb/accesslog.cxx +++ /dev/null @@ -1,78 +0,0 @@ -/* -*- 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/config.h> - -#ifdef HSQLDB_DBG - -#include <map> - -#include "accesslog.hxx" -#include "hsqldb/HStorageMap.hxx" - -#include <osl/thread.h> - -namespace connectivity { namespace hsqldb -{ - typedef std::map<OUString, FILE *> TDebugStreamMap; - TDebugStreamMap& getStreams() - { - static TDebugStreamMap streams; - return streams; - } - - - LogFile::LogFile( JNIEnv* env, jstring streamName, const sal_Char* _pAsciiSuffix ) - { - m_sFileName = StorageContainer::jstring2ustring(env,streamName) + - "." + OUString::createFromAscii( _pAsciiSuffix ); - } - - - FILE*& LogFile::getLogFile() - { - FILE*& pLogFile = getStreams()[m_sFileName]; - if ( !pLogFile ) - { - OString sByteLogName = OUStringToOString(m_sFileName,osl_getThreadTextEncoding()); - pLogFile = fopen( sByteLogName.getStr(), "a+" ); - } - return pLogFile; - } - - - void LogFile::writeString( const sal_Char* _pString, bool _bEndLine ) - { - FILE* pLogFile = getLogFile(); - fwrite( _pString, sizeof( *_pString ), strlen( _pString ), pLogFile ); - if ( _bEndLine ) - fwrite( "\n", sizeof( *_pString ), strlen( "\n" ), pLogFile ); - fflush( pLogFile ); - } - - - void LogFile::close() - { - fclose( getLogFile() ); - getLogFile() = NULL; - } -} } -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/drivers/hsqldb/accesslog.hxx b/connectivity/source/drivers/hsqldb/accesslog.hxx deleted file mode 100644 index bf34d9ffc190..000000000000 --- a/connectivity/source/drivers/hsqldb/accesslog.hxx +++ /dev/null @@ -1,138 +0,0 @@ -/* -*- 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 INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_HSQLDB_ACCESSLOG_HXX -#define INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_HSQLDB_ACCESSLOG_HXX - -#ifdef HSQLDB_DBG - -#include <jni.h> -#include <rtl/ustring.hxx> -#include <rtl/string.hxx> - -namespace connectivity { namespace hsqldb -{ - class LogFile - { - private: - OUString m_sFileName; - - public: - LogFile( JNIEnv* env, jstring streamName, const sal_Char* _pAsciiSuffix ); - - public: - void writeString( const sal_Char* _pString, bool _bEndLine = true ); - void create() { getLogFile(); } - virtual void close(); - - protected: - FILE*& getLogFile(); - }; - - class OperationLogFile : public LogFile - { - public: - OperationLogFile( JNIEnv* env, jstring streamName, const sal_Char* _pAsciiSuffix ) - :LogFile( env, streamName, ( OString( _pAsciiSuffix ) += ".op" ).getStr() ) - { - } - - void logOperation( const sal_Char* _pOp ) - { - writeString( _pOp, true ); - } - - void logOperation( const sal_Char* _pOp, jlong _nLongArg ) - { - OString sLine( _pOp ); - sLine += "( "; - sLine += OString::number( _nLongArg ); - sLine += " )"; - writeString( sLine.getStr(), true ); - } - - void logReturn( jlong _nRetVal ) - { - OString sLine( " -> " ); - sLine += OString::number( _nRetVal ); - writeString( sLine.getStr(), true ); - } - - void logReturn( jint _nRetVal ) - { - OString sLine( " -> " ); - sLine += OString::number( _nRetVal ); - writeString( sLine.getStr(), true ); - } - - virtual void close() - { - writeString( "-------------------------------", true ); - writeString( "", true ); - LogFile::close(); - } - }; - - class DataLogFile : public LogFile - { - public: - DataLogFile( JNIEnv* env, jstring streamName, const sal_Char* _pAsciiSuffix ) - :LogFile( env, streamName, _pAsciiSuffix ) - { - } - - void write( jint value ) - { - fputc( value, getLogFile() ); - fflush( getLogFile() ); - } - - void write( const sal_Int8* buffer, sal_Int32 bytesRead ) - { - fwrite( buffer, sizeof(sal_Int8), bytesRead, getLogFile() ); - fflush( getLogFile() ); - } - - sal_Int64 seek( sal_Int64 pos ) - { - FILE* pFile = getLogFile(); - fseek( pFile, 0, SEEK_END ); - if ( ftell( pFile ) < pos ) - { - sal_Int8 filler( 0 ); - while ( ftell( pFile ) < pos ) - fwrite( &filler, sizeof( sal_Int8 ), 1, pFile ); - fflush( pFile ); - } - fseek( pFile, pos, SEEK_SET ); - return ftell( pFile ); - } - - sal_Int64 tell() - { - return ftell( getLogFile() ); - } - }; - -} } -#endif - -#endif // INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_HSQLDB_ACCESSLOG_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/drivers/hsqldb/hsqldb.component b/connectivity/source/drivers/hsqldb/hsqldb.component deleted file mode 100644 index ab8318861416..000000000000 --- a/connectivity/source/drivers/hsqldb/hsqldb.component +++ /dev/null @@ -1,26 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - * 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 . - --> - -<component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@" - prefix="hsqldb" xmlns="http://openoffice.org/2010/uno-components"> - <implementation name="com.sun.star.sdbcx.comp.hsqldb.Driver"> - <service name="com.sun.star.sdbc.Driver"/> - <service name="com.sun.star.sdbcx.Driver"/> - </implementation> -</component> diff --git a/connectivity/source/inc/hsqldb/HCatalog.hxx b/connectivity/source/inc/hsqldb/HCatalog.hxx deleted file mode 100644 index f953c9f30ae1..000000000000 --- a/connectivity/source/inc/hsqldb/HCatalog.hxx +++ /dev/null @@ -1,64 +0,0 @@ -/* -*- 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 INCLUDED_CONNECTIVITY_SOURCE_INC_HSQLDB_HCATALOG_HXX -#define INCLUDED_CONNECTIVITY_SOURCE_INC_HSQLDB_HCATALOG_HXX - -#include <connectivity/sdbcx/VCatalog.hxx> - -namespace connectivity -{ - namespace hsqldb - { - // please don't name the class the same name as in an other 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; - }; - } -} -#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_HSQLDB_HCATALOG_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/inc/hsqldb/HColumns.hxx b/connectivity/source/inc/hsqldb/HColumns.hxx deleted file mode 100644 index f3fd008cd92f..000000000000 --- a/connectivity/source/inc/hsqldb/HColumns.hxx +++ /dev/null @@ -1,60 +0,0 @@ -/* -*- 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 INCLUDED_CONNECTIVITY_SOURCE_INC_HSQLDB_HCOLUMNS_HXX -#define INCLUDED_CONNECTIVITY_SOURCE_INC_HSQLDB_HCOLUMNS_HXX -#include <connectivity/TColumnsHelper.hxx> -#include <connectivity/sdbcx/VColumn.hxx> - -namespace connectivity -{ - namespace 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; - }; - } -} -#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_HSQLDB_HCOLUMNS_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/inc/hsqldb/HConnection.hxx b/connectivity/source/inc/hsqldb/HConnection.hxx deleted file mode 100644 index 19739437bf82..000000000000 --- a/connectivity/source/inc/hsqldb/HConnection.hxx +++ /dev/null @@ -1,150 +0,0 @@ -/* -*- 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 INCLUDED_CONNECTIVITY_SOURCE_INC_HSQLDB_HCONNECTION_HXX -#define INCLUDED_CONNECTIVITY_SOURCE_INC_HSQLDB_HCONNECTION_HXX - -#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 <com/sun/star/ui/dialogs/XExecutableDialog.hpp> -#include <cppuhelper/compbase.hxx> -#include <cppuhelper/basemutex.hxx> -#include <comphelper/uno3.hxx> -#include <comphelper/interfacecontainer2.hxx> - -namespace connectivity -{ - namespace 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 - { - private: - typedef ::osl::MutexGuard BaseGuard; - - public: - MethodGuard( const IMethodGuardAccess& _rComponent ) - :BaseGuard( _rComponent.getMutex() ) - { - _rComponent.checkDisposed(); - } - }; - } -} -#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_HSQLDB_HCONNECTION_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/inc/hsqldb/HDriver.hxx b/connectivity/source/inc/hsqldb/HDriver.hxx deleted file mode 100644 index b88e1227de1c..000000000000 --- a/connectivity/source/inc/hsqldb/HDriver.hxx +++ /dev/null @@ -1,140 +0,0 @@ -/* -*- 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 INCLUDED_CONNECTIVITY_SOURCE_INC_HSQLDB_HDRIVER_HXX -#define INCLUDED_CONNECTIVITY_SOURCE_INC_HSQLDB_HDRIVER_HXX - -#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/XMultiServiceFactory.hpp> -#include <com/sun/star/lang/XServiceInfo.hpp> -#include <com/sun/star/uno/XComponentContext.hpp> -#include <cppuhelper/compbase.hxx> -#include <cppuhelper/basemutex.hxx> -#include <comphelper/uno3.hxx> -#include <connectivity/CommonTools.hxx> - - -namespace connectivity -{ - - - namespace hsqldb - { - /// @throws css::uno::Exception - css::uno::Reference< css::uno::XInterface > ODriverDelegator_CreateInstance(const css::uno::Reference< css::lang::XMultiServiceFactory >& _rxFactory); - - 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(); - /// @throws css::uno::RuntimeException - static OUString getImplementationName_Static( ); - /// @throws css::uno::RuntimeException - static css::uno::Sequence< OUString > getSupportedServiceNames_Static( ); - - // 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 - -#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_HSQLDB_HDRIVER_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/inc/hsqldb/HStorageAccess.hxx b/connectivity/source/inc/hsqldb/HStorageAccess.hxx deleted file mode 100644 index c0ae65541530..000000000000 --- a/connectivity/source/inc/hsqldb/HStorageAccess.hxx +++ /dev/null @@ -1,39 +0,0 @@ -/* -*- 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 INCLUDED_CONNECTIVITY_SOURCE_INC_HSQLDB_HSTORAGEACCESS_HXX -#define INCLUDED_CONNECTIVITY_SOURCE_INC_HSQLDB_HSTORAGEACCESS_HXX - -#include <sal/config.h> - -#include <jni.h> - -namespace connectivity { namespace 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 ); - -#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_HSQLDB_HSTORAGEACCESS_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/inc/hsqldb/HStorageMap.hxx b/connectivity/source/inc/hsqldb/HStorageMap.hxx deleted file mode 100644 index 62ae7ec3d233..000000000000 --- a/connectivity/source/inc/hsqldb/HStorageMap.hxx +++ /dev/null @@ -1,97 +0,0 @@ -/* -*- 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 INCLUDED_CONNECTIVITY_SOURCE_INC_HSQLDB_HSTORAGEMAP_HXX -#define INCLUDED_CONNECTIVITY_SOURCE_INC_HSQLDB_HSTORAGEMAP_HXX - -#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> -#include <jni.h> -#include <uno/environment.hxx> - -namespace connectivity -{ - - namespace 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(const OUString& _sURL,const OUString& _sFileURL); - static OUString removeOldURLPrefix(const OUString& _sURL); - static void throwJavaException(const css::uno::Exception& _aException,JNIEnv * env); - }; - - } // namespace hsqldb - - -} // namespace connectivity - - -#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_HSQLDB_HSTORAGEMAP_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/inc/hsqldb/HTable.hxx b/connectivity/source/inc/hsqldb/HTable.hxx deleted file mode 100644 index b479039cc7b0..000000000000 --- a/connectivity/source/inc/hsqldb/HTable.hxx +++ /dev/null @@ -1,116 +0,0 @@ -/* -*- 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 INCLUDED_CONNECTIVITY_SOURCE_INC_HSQLDB_HTABLE_HXX -#define INCLUDED_CONNECTIVITY_SOURCE_INC_HSQLDB_HTABLE_HXX - -#include <connectivity/TTableHelper.hxx> -#include <com/sun/star/sdbc/XDatabaseMetaData.hpp> -#include <comphelper/IdPropArrayHelper.hxx> - -namespace connectivity -{ - namespace 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 statmenmt. - @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 an 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 css::uno::Sequence< sal_Int8 > getUnoTunnelImplementationId(); - - 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(); - - // some methods to alter table structures - void alterColumnType(sal_Int32 nNewType,const OUString& _rColName,const css::uno::Reference< css::beans::XPropertySet >& _xDescriptor); - void alterDefaultValue(const OUString& _sNewDefault,const OUString& _rColName); - void dropDefaultValue(const OUString& _sNewDefault); - - }; - } -} -#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_HSQLDB_HTABLE_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/inc/hsqldb/HTables.hxx b/connectivity/source/inc/hsqldb/HTables.hxx deleted file mode 100644 index bf0580396df2..000000000000 --- a/connectivity/source/inc/hsqldb/HTables.hxx +++ /dev/null @@ -1,56 +0,0 @@ -/* -*- 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 INCLUDED_CONNECTIVITY_SOURCE_INC_HSQLDB_HTABLES_HXX -#define INCLUDED_CONNECTIVITY_SOURCE_INC_HSQLDB_HTABLES_HXX - -#include <connectivity/sdbcx/VCollection.hxx> -#include <com/sun/star/sdbc/XDatabaseMetaData.hpp> -namespace connectivity -{ - namespace 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); - }; - } -} -#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_HSQLDB_HTABLES_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/inc/hsqldb/HTools.hxx b/connectivity/source/inc/hsqldb/HTools.hxx deleted file mode 100644 index 1c568ccc30cf..000000000000 --- a/connectivity/source/inc/hsqldb/HTools.hxx +++ /dev/null @@ -1,52 +0,0 @@ -/* -*- 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 INCLUDED_CONNECTIVITY_SOURCE_INC_HSQLDB_HTOOLS_HXX -#define INCLUDED_CONNECTIVITY_SOURCE_INC_HSQLDB_HTOOLS_HXX - -#include <rtl/ustrbuf.hxx> - - -namespace connectivity { namespace 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, const OUString& _rCatalog, - const OUString& _rSchema, const OUString& _rName, - bool _bShortForm - ); - }; - - -} } // namespace connectivity::hsqldb - - -#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_HSQLDB_HTOOLS_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/inc/hsqldb/HUser.hxx b/connectivity/source/inc/hsqldb/HUser.hxx deleted file mode 100644 index 4e1e98c92290..000000000000 --- a/connectivity/source/inc/hsqldb/HUser.hxx +++ /dev/null @@ -1,77 +0,0 @@ -/* -*- 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 INCLUDED_CONNECTIVITY_SOURCE_INC_HSQLDB_HUSER_HXX -#define INCLUDED_CONNECTIVITY_SOURCE_INC_HSQLDB_HUSER_HXX - -#include <connectivity/sdbcx/VUser.hxx> -#include <com/sun/star/sdbc/XConnection.hpp> - -namespace connectivity -{ - namespace 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 - { - protected: - OUString m_Password; - // 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; - }; - } -} -#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_HSQLDB_HUSER_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/inc/hsqldb/HUsers.hxx b/connectivity/source/inc/hsqldb/HUsers.hxx deleted file mode 100644 index 392b3412a39b..000000000000 --- a/connectivity/source/inc/hsqldb/HUsers.hxx +++ /dev/null @@ -1,55 +0,0 @@ -/* -*- 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 INCLUDED_CONNECTIVITY_SOURCE_INC_HSQLDB_HUSERS_HXX -#define INCLUDED_CONNECTIVITY_SOURCE_INC_HSQLDB_HUSERS_HXX - -#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); - }; - } -} - -#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_HSQLDB_HUSERS_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/inc/hsqldb/HView.hxx b/connectivity/source/inc/hsqldb/HView.hxx deleted file mode 100644 index 6e333bb1081d..000000000000 --- a/connectivity/source/inc/hsqldb/HView.hxx +++ /dev/null @@ -1,90 +0,0 @@ -/* -*- 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 INCLUDED_CONNECTIVITY_SOURCE_INC_HSQLDB_HVIEW_HXX -#define INCLUDED_CONNECTIVITY_SOURCE_INC_HSQLDB_HVIEW_HXX - -#include <connectivity/sdbcx/VView.hxx> - -#include <com/sun/star/sdbcx/XAlterView.hpp> - -#include <comphelper/uno3.hxx> -#include <cppuhelper/implbase1.hxx> - - -namespace connectivity { namespace 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 - - -#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_HSQLDB_HVIEW_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/inc/hsqldb/HViews.hxx b/connectivity/source/inc/hsqldb/HViews.hxx deleted file mode 100644 index 6f6724383e32..000000000000 --- a/connectivity/source/inc/hsqldb/HViews.hxx +++ /dev/null @@ -1,55 +0,0 @@ -/* -*- 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 INCLUDED_CONNECTIVITY_SOURCE_INC_HSQLDB_HVIEWS_HXX -#define INCLUDED_CONNECTIVITY_SOURCE_INC_HSQLDB_HVIEWS_HXX - -#include <connectivity/sdbcx/VCollection.hxx> -#include <com/sun/star/sdbc/XDatabaseMetaData.hpp> -namespace connectivity -{ - namespace 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); - }; - } -} -#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_HSQLDB_HVIEWS_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |