[Libreoffice-commits] core.git: Branch 'aoo/trunk' - apache-commons/java connectivity/java connectivity/prj connectivity/target.pmk dbaccess/source postprocess/packcomponents postprocess/packregistry scp2/source
Damjan Jovanovic
damjan at apache.org
Sun Aug 20 20:10:47 UTC 2017
apache-commons/java/lang/makefile.mk | 4
connectivity/java/sdbc_postgresql/build.xml | 249 ++
connectivity/java/sdbc_postgresql/makefile.mk | 50
connectivity/java/sdbc_postgresql/postgresql.component | 30
connectivity/java/sdbc_postgresql/sdbc_postgresql.xcu | 71
connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/PostgresqlCatalog.java | 90
connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/PostgresqlConnection.java | 198 +
connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/PostgresqlDatabaseMetadata.java | 752 ++++++
connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/PostgresqlDriver.java | 199 +
connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/PostgresqlPreparedStatement.java | 348 +++
connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/PostgresqlResultSet.java | 495 ++++
connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/PostgresqlResultSetMetaData.java | 127 +
connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/PostgresqlStatement.java | 188 +
connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/PostgresqlTable.java | 125 +
connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/PostgresqlTables.java | 151 +
connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/comphelper/CompHelper.java | 74
connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/comphelper/OArrayEnumeration.java | 55
connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/comphelper/OEnumerationByIndex.java | 118 +
connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/comphelper/OEnumerationByName.java | 116 +
connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/comphelper/PropertySet.java | 160 +
connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/comphelper/PropertySetAdapter.java | 411 +++
connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/sdbcx/ISQLStatementHelper.java | 28
connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/sdbcx/OCatalog.java | 169 +
connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/sdbcx/OColumn.java | 279 ++
connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/sdbcx/OColumnContainer.java | 123 +
connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/sdbcx/OContainer.java | 461 +++
connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/sdbcx/ODescriptor.java | 76
connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/sdbcx/OIndex.java | 121 +
connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/sdbcx/OIndexColumn.java | 96
connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/sdbcx/OIndexColumnContainer.java | 121 +
connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/sdbcx/OIndexContainer.java | 208 +
connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/sdbcx/OKey.java | 150 +
connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/sdbcx/OKeyColumn.java | 101
connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/sdbcx/OKeyColumnContainer.java | 115
connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/sdbcx/OKeyContainer.java | 277 ++
connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/sdbcx/OTable.java | 187 +
connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/sdbcx/OfficeResourceBundle.java | 130 +
connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/sdbcx/Resources.java | 66
connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/sdbcx/SharedResources.java | 213 +
connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/sdbcx/SqlTableHelper.java | 261 ++
connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/sdbcx/descriptors/SdbcxColumnDescriptor.java | 194 +
connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/sdbcx/descriptors/SdbcxColumnDescriptorContainer.java | 36
connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/sdbcx/descriptors/SdbcxDescriptorContainer.java | 59
connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/sdbcx/descriptors/SdbcxIndexColumnDescriptor.java | 58
connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/sdbcx/descriptors/SdbcxIndexColumnDescriptorContainer.java | 35
connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/sdbcx/descriptors/SdbcxIndexDescriptor.java | 94
connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/sdbcx/descriptors/SdbcxIndexDescriptorContainer.java | 44
connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/sdbcx/descriptors/SdbcxKeyColumnDescriptor.java | 58
connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/sdbcx/descriptors/SdbcxKeyColumnDescriptorContainer.java | 35
connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/sdbcx/descriptors/SdbcxKeyDescriptor.java | 113
connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/sdbcx/descriptors/SdbcxKeyDescriptorContainer.java | 44
connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/sdbcx/descriptors/SdbcxTableDescriptor.java | 109
connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/util/ComposeRule.java | 31
connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/util/DBTypeConversion.java | 426 +++
connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/util/DatabaseMetaDataResultSet.java | 489 ++++
connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/util/DbTools.java | 679 +++++
connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/util/MapToXNameAccessAdapter.java | 91
connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/util/MapToXNameContainerAdapter.java | 77
connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/util/ORowSetValue.java | 1154 ++++++++++
connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/util/Osl.java | 36
connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/util/PropertyIds.java | 95
connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/util/StandardSQLState.java | 58
connectivity/prj/build.lst | 3
connectivity/prj/d.lst | 2
connectivity/target.pmk | 3
dbaccess/source/core/misc/dsntypes.cxx | 19
dbaccess/source/inc/dsntypes.hxx | 1
postprocess/packcomponents/makefile.mk | 1
postprocess/packregistry/makefile.mk | 3
scp2/source/ooo/file_ooo.scp | 7
scp2/source/ooo/module_hidden_ooo.scp | 2
71 files changed, 11235 insertions(+), 14 deletions(-)
New commits:
commit 330392f87e90e4345273d42425b3ffc735281a7c
Author: Damjan Jovanovic <damjan at apache.org>
Date: Sun Aug 20 19:16:28 2017 +0000
#i127350# - Table design: can't change length of Postgresql char types
Add the initial version of a new SDBC driver, for the PostgreSQL database.
Also its build changes: since it needs Apache Commons Lang version 3,
get configure.ac to check for that, and get that to always build,
just like our driver does.
Patch by: me
diff --git a/apache-commons/java/lang/makefile.mk b/apache-commons/java/lang/makefile.mk
index 763f2bbe45e1..e9174bed4ff5 100644
--- a/apache-commons/java/lang/makefile.mk
+++ b/apache-commons/java/lang/makefile.mk
@@ -37,7 +37,7 @@ ANT_BUILDFILE=build.xml
TAR!:=$(GNUTAR)
-.IF "$(SOLAR_JAVA)" != "" && "$(ENABLE_MEDIAWIKI)" == "YES"
+.IF "$(SOLAR_JAVA)" != ""
# --- Files --------------------------------------------------------
TARFILE_NAME=commons-lang3-3.3-src
@@ -70,7 +70,7 @@ BUILD_ACTION=$(ANT) -Dbuild.label="build-$(RSCREVISION)" -f $(ANT_BUILDFILE) jar
.INCLUDE : set_ext.mk
.INCLUDE : target.mk
-.IF "$(SOLAR_JAVA)" != "" && "$(ENABLE_MEDIAWIKI)" == "YES"
+.IF "$(SOLAR_JAVA)" != ""
.INCLUDE : tg_ext.mk
.ENDIF
diff --git a/connectivity/java/sdbc_postgresql/build.xml b/connectivity/java/sdbc_postgresql/build.xml
new file mode 100644
index 000000000000..42f8b5d33970
--- /dev/null
+++ b/connectivity/java/sdbc_postgresql/build.xml
@@ -0,0 +1,249 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--***********************************************************
+ *
+ * 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
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ ***********************************************************-->
+
+
+<project name="sdbc_postgresql" default="main" basedir=".">
+
+ <!-- ================================================================= -->
+ <!-- settings -->
+ <!-- ================================================================= -->
+
+ <!-- global properties -->
+ <property file="../../../ant.properties"/>
+ <!-- version info -->
+ <property file="../../../solenv/inc/minor.mk"/>
+
+ <!-- name of this sub target used in recursive builds -->
+ <property name="target" value="sdbc_postgresql"/>
+
+ <!-- name of jar file created, without .jar extension -->
+ <property name="jarname" value="sdbc_postgresql"/>
+
+ <!-- relative path to project directory -->
+ <property name="prj" value="../.."/>
+
+ <!-- build output directory -->
+ <!-- FIXME: there are also extremely rare/obsolete dbcs/bndchk/truetime/hbtoolkit cases in main/solenv/inc/settings.mk -->
+ <condition property="out" value="${prj}/${OUTPATH}.cap">
+ <isset property="${profile}"/>
+ </condition>
+ <condition property="out" value="${prj}/${OUTPATH}.pro">
+ <isset property="${PRODUCT}"/>
+ </condition>
+ <property name="out" value="${prj}/${OUTPATH}"/>
+
+ <!-- build directories -->
+ <property name="build.dir" value="${out}"/>
+ <property name="build.class" value="${build.dir}/class/${target}"/>
+ <property name="build.misc" value="${build.dir}/misc/${target}"/>
+
+ <!-- start of java source code package structure -->
+ <property name="java.dir" value="src"/>
+
+ <!-- define how to handle CLASSPATH environment -->
+ <property name="build.sysclasspath" value="ignore"/>
+
+ <!-- classpath settings for compile and javadoc tasks -->
+ <condition property="jar-class-path" value="${COMMONS_LANG_JAR}" else="commons-lang3-3.3.jar">
+ <equals arg1="${SYSTEM_APACHE_COMMONS}" arg2="YES"/>
+ </condition>
+ <condition property="commons-lang-jar" value="${COMMONS_LANG_JAR}" else="${OUTDIR}/bin/commons-lang3-3.3.jar">
+ <equals arg1="${SYSTEM_APACHE_COMMONS}" arg2="YES"/>
+ </condition>
+ <path id="classpath">
+ <pathelement location="${OUTDIR}/bin/juh.jar"/>
+ <pathelement location="${OUTDIR}/bin/jurt.jar"/>
+ <pathelement location="${OUTDIR}/bin/ridl.jar"/>
+ <pathelement location="${OUTDIR}/bin/unoil.jar"/>
+ <!-- 3rd party libs -->
+ <pathelement location="${commons-lang-jar}"/>
+ </path>
+
+ <!-- name to display in documentation -->
+ <property name="docname" value="sdbc_postgresql"/>
+
+ <!-- set "modern" java compiler -->
+ <property name="build.compiler" value="modern"/>
+
+ <!-- set wether we want to compile with debug information -->
+ <property name="debug" value="on"/>
+
+ <!-- set wether we want to compile with optimisation -->
+ <property name="optimize" value="off"/>
+
+ <!-- set wether we want to compile with or without deprecation -->
+ <property name="deprecation" value="on"/>
+
+ <target name="info">
+ <echo message="--------------------"/>
+ <echo message="${target}"/>
+ <echo message="--------------------"/>
+ </target>
+
+ <!-- ================================================================= -->
+ <!-- custom targets -->
+ <!-- ================================================================= -->
+
+ <!-- the main target, called in recursive builds -->
+ <target name="main" depends="info,prepare,compile,jar,javadoc,zipdoc"/>
+
+ <!-- prepare output directories -->
+ <target name="prepare">
+ <mkdir dir="${build.dir}"/>
+ <mkdir dir="${build.dir}/doc/${target}"/>
+ <mkdir dir="${build.class}"/>
+ <mkdir dir="${build.misc}"/>
+ </target>
+
+
+ <target name="res" depends="prepare">
+ <copy todir="${build.class}">
+ <fileset dir="${java.dir}">
+ <include name="**/*.properties"/>
+ <include name="**/*.css"/>
+ <include name="**/*.dtd"/>
+ <include name="**/*.form"/>
+ <include name="**/*.gif "/>
+ <include name="**/*.htm"/>
+ <include name="**/*.html"/>
+ <include name="**/*.js"/>
+ <include name="**/*.mod"/>
+ <include name="**/*.sql"/>
+ <include name="**/*.xml"/>
+ <include name="**/*.xsl"/>
+ <include name="**/*.map"/>
+
+ </fileset>
+ </copy>
+ </target>
+
+
+ <target name="compile" depends="prepare,res">
+ <javac destdir="${build.class}"
+ debug="${debug}"
+ debuglevel="lines,vars,source"
+ deprecation="${deprecation}"
+ optimize="${optimize}"
+ classpathref="classpath">
+ <src path="${java.dir}"/>
+ <include name="**/*.java"/>
+ </javac>
+ </target>
+
+ <!-- check if javadoc is up to date -->
+ <target name="javadoc_check" depends="prepare" if="build.dir">
+ <uptodate property="javadocBuild.notRequired" value="true"
+ targetfile="${build.dir}/doc/${target}/${target}_javadoc.zip">
+ <srcfiles dir="${java.dir}" includes="**/*.java"/>
+ </uptodate>
+ </target>
+
+ <!-- generate java documentation -->
+ <target name="javadoc" depends="prepare,javadoc_check,compile"
+ unless="javadocBuild.notRequired"
+ if="build.dir">
+
+ <javadoc destdir="${build.dir}/doc/${target}/javadoc"
+ verbose="false"
+ author="false"
+ nodeprecated="true"
+ nodeprecatedlist="true"
+ use="true"
+ Doctitle="${docname}"
+ windowtitle="${docname}"
+ classpathref="classpath">
+
+ <packageset dir="${java.dir}" defaultexcludes="yes">
+ <include name="com/**"/>
+ <include name="org/**"/>
+ </packageset>
+
+ <link offline="true" href="http://java.sun.com/j2se/1.4.2/docs/api"
+ packagelistLoc="${common.doc}/jdk1.4.2"/>
+ <link offline="true"
+ href="http://java.sun.com/products/servlet/2.3/javadoc"
+ packagelistLoc="${common.doc}/servlet2.3"/>
+ <link offline="true"
+ href="http://logging.apache.org/log4j/docs/api"
+ packagelistLoc="${common.doc}/log4j-1.2.8"/>
+ <link offline="true"
+ href="http://java.sun.com/products/javabeans/glasgow/javadocs"
+ packagelistLoc="${common.doc}/jaf-1.0.2"/>
+ <link offline="true"
+ href="http://java.sun.com/products/javamail/javadocs"
+ packagelistLoc="${common.doc}/javamail-1.3.1"/>
+ <link offline="true"
+ href="http://ws.apache.org/soap/docs"
+ packagelistLoc="${common.doc}/soap-2.3.1"/>
+
+ <bottom><i>Copyright © 2004 Sun Microsystems, Inc., 901 San Antonio Road, Palo Alto, CA 94303 USA</i></bottom>
+ <header>${docname}</header>
+
+ </javadoc>
+ </target>
+
+ <!-- zip documentation and store in build/doc/${target} -->
+ <target name="zipdoc" depends="javadoc" if="build.dir" unless="javadocBuild.notRequired">
+ <zip zipfile="${build.dir}/doc/${target}/${target}_javadoc.zip"
+ basedir="${build.dir}/doc/${target}/javadoc"
+ update="true"/>
+ </target>
+
+ <!-- clean up -->
+ <target name="clean" depends="prepare">
+ <delete dir="${build.class}" includeEmptyDirs="true"/>
+ <delete dir="${build.dir}/doc/${target}" includeEmptyDirs="true"/>
+ </target>
+
+ <!-- create jar file -->
+ <target name="jar" depends="prepare,compile" if="build.class">
+ <jar jarfile="${build.class}/${jarname}.jar"
+ basedir="${build.class}">
+ <manifest>
+ <attribute name="Class-Path" value="${jar-class-path} juh.jar jurt.jar ridl.jar unoil.jar"/>
+ <attribute name="Solar-Version" value="${RSCREVISION}"/>
+ <attribute name="RegistrationClassName" value="com.sun.star.sdbcx.comp.postgresql.PostgresqlDriver"/>
+ <attribute name="Sealed" value="true"/>
+ <attribute name="UNO-Type-Path" value=""/>
+ </manifest>
+ <include name="**/*.class"/>
+ <include name="**/*.properties"/>
+ <include name="**/*.css"/>
+ <include name="**/*.dtd"/>
+ <include name="**/*.form"/>
+ <include name="**/*.gif "/>
+ <include name="**/*.htm"/>
+ <include name="**/*.html"/>
+ <include name="**/*.js"/>
+ <include name="**/*.mod"/>
+ <include name="**/*.sql"/>
+ <include name="**/*.xml"/>
+ <include name="**/*.xsl"/>
+ <include name="**/*.map"/>
+ </jar>
+ </target>
+
+ <target name="test" depends="prepare">
+ </target>
+
+</project>
+
diff --git a/connectivity/java/sdbc_postgresql/makefile.mk b/connectivity/java/sdbc_postgresql/makefile.mk
new file mode 100644
index 000000000000..bab2fc72a123
--- /dev/null
+++ b/connectivity/java/sdbc_postgresql/makefile.mk
@@ -0,0 +1,50 @@
+#**************************************************************
+#
+# 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
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+#**************************************************************
+
+
+
+PRJ=..$/..
+PRJNAME=connectivity
+TARGET=sdbc_postgresql
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : $(PRJ)$/makefile.pmk
+.INCLUDE : $(PRJ)$/version.mk
+
+.IF defined(debug) || defined(DEBUG)
+ANTDEBUG=true
+.ELSE
+ANTDEBUG=off
+.ENDIF
+
+ANT_FLAGS+=-Dantdebug=$(ANTDEBUG)
+
+# --- Targets ------------------------------------------------------
+.INCLUDE : $(PRJ)$/target.pmk
+
+ALLTAR: ANTBUILD $(MISC)/postgresql.component
+
+$(MISC)/postgresql.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \
+ postgresql.component
+ $(XSLTPROC) --nonet --stringparam uri '$(COMPONENTPREFIX_URE_JAVA)sdbc_postgresql.jar' \
+ -o $@ $(SOLARENV)/bin/createcomponent.xslt postgresql.component
+
diff --git a/connectivity/java/sdbc_postgresql/postgresql.component b/connectivity/java/sdbc_postgresql/postgresql.component
new file mode 100644
index 000000000000..d1f0ce6f85b0
--- /dev/null
+++ b/connectivity/java/sdbc_postgresql/postgresql.component
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--***********************************************************
+ *
+ * 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
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ ***********************************************************-->
+
+
+
+<component loader="com.sun.star.loader.Java2"
+ xmlns="http://openoffice.org/2010/uno-components">
+ <implementation name="com.sun.star.sdbcx.comp.postgresql.PostgresqlDriver">
+ <service name="com.sun.star.sdbc.Driver"/>
+ </implementation>
+</component>
diff --git a/connectivity/java/sdbc_postgresql/sdbc_postgresql.xcu b/connectivity/java/sdbc_postgresql/sdbc_postgresql.xcu
new file mode 100644
index 000000000000..38db83c28bb8
--- /dev/null
+++ b/connectivity/java/sdbc_postgresql/sdbc_postgresql.xcu
@@ -0,0 +1,71 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--***********************************************************
+ *
+ * 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
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ ***********************************************************-->
+
+
+<oor:component-data oor:name="Drivers" oor:package="org.openoffice.Office.DataAccess" xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema">
+ <node oor:name="Installed">
+ <node oor:name="sdbc:postgresql:jdbc:*" oor:op="replace">
+ <prop oor:name="Driver">
+ <value>com.sun.star.sdbcx.comp.postgresql.PostgresqlDriver</value>
+ </prop>
+ <prop oor:name="DriverTypeDisplayName" oor:type="xs:string">
+ <value xml:lang="en-US">PostgreSQL</value>
+ </prop>
+ <node oor:name="Properties">
+ <node oor:name="JavaDriverClass" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:string">
+ <value>org.postgresql.Driver</value>
+ </prop>
+ </node>
+ </node>
+ <node oor:name="Features">
+ </node>
+ <node oor:name="MetaData">
+ <node oor:name="SupportsBrowsing" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <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="Authentication" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:string">
+ <value>UserPassword</value>
+ </prop>
+ </node>
+ <node oor:name="SupportsColumnDescription" 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/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/PostgresqlCatalog.java b/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/PostgresqlCatalog.java
new file mode 100644
index 000000000000..638b8f31c947
--- /dev/null
+++ b/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/PostgresqlCatalog.java
@@ -0,0 +1,90 @@
+/**************************************************************
+ *
+ * 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
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+
+package com.sun.star.sdbcx.comp.postgresql;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import com.sun.star.sdbc.SQLException;
+import com.sun.star.sdbc.XResultSet;
+import com.sun.star.sdbc.XRow;
+import com.sun.star.sdbcx.comp.postgresql.comphelper.CompHelper;
+import com.sun.star.sdbcx.comp.postgresql.sdbcx.OCatalog;
+import com.sun.star.sdbcx.comp.postgresql.sdbcx.OContainer;
+import com.sun.star.uno.Any;
+import com.sun.star.uno.UnoRuntime;
+
+public class PostgresqlCatalog extends OCatalog {
+ public PostgresqlCatalog(PostgresqlConnection connection) throws SQLException {
+ super(connection.getMetaData());
+ }
+
+ @Override
+ public OContainer refreshTables() {
+ XResultSet results = null;
+ try {
+ // Using { "VIEW", "TABLE", "%" } shows INFORMATION_SCHEMA and others, but it also shows indexes :-(
+ results = metadata.getTables(Any.VOID, "%", "%", new String[] { "VIEW", "TABLE" });
+ XRow row = UnoRuntime.queryInterface(XRow.class, results);
+ List<String> names = new ArrayList<>();
+ while (results.next()) {
+ String name = buildName(row);
+ System.out.println("Table " + name);
+ names.add(name);
+ }
+ return new PostgresqlTables(lock, metadata, this, names);
+ } catch (SQLException sqlException) {
+ } finally {
+ CompHelper.disposeComponent(results);
+ }
+ return null;
+ }
+
+ @Override
+ public OContainer refreshViews() {
+ XResultSet results = null;
+ try {
+ results = metadata.getTables(Any.VOID, "%", "%", new String[] { "VIEW" });
+ XRow row = UnoRuntime.queryInterface(XRow.class, results);
+ List<String> names = new ArrayList<>();
+ while (results.next()) {
+ String name = buildName(row);
+ names.add(name);
+ }
+ return new PostgresqlTables(lock, metadata, this, names);
+ } catch (SQLException sqlException) {
+ } finally {
+ CompHelper.disposeComponent(results);
+ }
+ return null;
+ }
+
+ @Override
+ public OContainer refreshGroups() {
+ return null;
+ }
+
+ @Override
+ public OContainer refreshUsers() {
+ return null;
+ }
+}
diff --git a/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/PostgresqlConnection.java b/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/PostgresqlConnection.java
new file mode 100644
index 000000000000..8e1d554d7805
--- /dev/null
+++ b/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/PostgresqlConnection.java
@@ -0,0 +1,198 @@
+/**************************************************************
+ *
+ * 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
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+
+package com.sun.star.sdbcx.comp.postgresql;
+
+import java.util.HashSet;
+import java.util.concurrent.atomic.AtomicBoolean;
+
+import com.sun.star.container.XNameAccess;
+import com.sun.star.lang.DisposedException;
+import com.sun.star.lang.EventObject;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XEventListener;
+import com.sun.star.lib.uno.helper.ComponentBase;
+import com.sun.star.sdbc.SQLException;
+import com.sun.star.sdbc.XConnection;
+import com.sun.star.sdbc.XDatabaseMetaData;
+import com.sun.star.sdbc.XPreparedStatement;
+import com.sun.star.sdbc.XStatement;
+import com.sun.star.sdbc.XWarningsSupplier;
+import com.sun.star.uno.UnoRuntime;
+
+public class PostgresqlConnection extends ComponentBase implements XConnection, XWarningsSupplier, XEventListener {
+ private XConnection impl;
+ private XComponent implComponent;
+ private XWarningsSupplier implWarningsSupplier;
+ private String url;
+ private AtomicBoolean isDisposed = new AtomicBoolean(false);
+ private HashSet<XComponent> statements = new HashSet<>();
+
+ public PostgresqlConnection(XConnection impl, String url) {
+ this.impl = impl;
+ implComponent = UnoRuntime.queryInterface(XComponent.class, impl);
+ implWarningsSupplier = UnoRuntime.queryInterface(XWarningsSupplier.class, impl);
+ this.url = url;
+ }
+
+ // XComponent:
+
+ @Override
+ protected synchronized void postDisposing() {
+ isDisposed.set(true);
+ implComponent.dispose();
+ for (XComponent pgStatement : statements) {
+ try {
+ pgStatement.dispose();
+ } catch (DisposedException disposedException) {
+ }
+ }
+ };
+
+ private void checkDisposed() throws DisposedException {
+ if (isDisposed.get()) {
+ throw new DisposedException();
+ }
+ }
+
+ // XEventListener:
+
+ public synchronized void disposing(EventObject source) {
+ statements.remove(source.Source);
+ }
+
+ // XWarningsSupplier:
+
+ public void clearWarnings() throws SQLException {
+ checkDisposed();
+ implWarningsSupplier.clearWarnings();
+ }
+
+ public Object getWarnings() throws SQLException {
+ checkDisposed();
+ return implWarningsSupplier.getWarnings();
+ }
+
+ // XConnection:
+
+ public void close() throws SQLException {
+ dispose();
+ }
+
+ public void commit() throws SQLException {
+ checkDisposed();
+ impl.commit();
+ }
+
+ public synchronized XStatement createStatement() throws SQLException {
+ checkDisposed();
+ PostgresqlStatement pgStatement = new PostgresqlStatement(impl.createStatement(), this);
+ statements.add(pgStatement);
+ pgStatement.addEventListener(this);
+ return pgStatement;
+ }
+
+ public boolean getAutoCommit() throws SQLException {
+ checkDisposed();
+ return impl.getAutoCommit();
+ }
+
+ public String getCatalog() throws SQLException {
+ checkDisposed();
+ return impl.getCatalog();
+ }
+
+ public XDatabaseMetaData getMetaData() throws SQLException {
+ checkDisposed();
+ return new PostgresqlDatabaseMetadata(impl.getMetaData(), this, url);
+ }
+
+ public int getTransactionIsolation() throws SQLException {
+ checkDisposed();
+ return impl.getTransactionIsolation();
+ }
+
+ public XNameAccess getTypeMap() throws SQLException {
+ checkDisposed();
+ return impl.getTypeMap();
+ }
+
+ public boolean isClosed() throws SQLException {
+ checkDisposed();
+ return impl.isClosed();
+ }
+
+ public boolean isReadOnly() throws SQLException {
+ checkDisposed();
+ return impl.isReadOnly();
+ }
+
+ public String nativeSQL(String arg0) throws SQLException {
+ checkDisposed();
+ return impl.nativeSQL(arg0);
+ }
+
+ public synchronized XPreparedStatement prepareCall(String arg0) throws SQLException {
+ checkDisposed();
+ PostgresqlPreparedStatement pgStatement = new PostgresqlPreparedStatement(impl.prepareCall(arg0), this);
+ statements.add(pgStatement);
+ pgStatement.addEventListener(this);
+ return pgStatement;
+ }
+
+ public synchronized XPreparedStatement prepareStatement(String arg0) throws SQLException {
+ checkDisposed();
+ PostgresqlPreparedStatement pgStatement = new PostgresqlPreparedStatement(impl.prepareStatement(arg0), this);
+ statements.add(pgStatement);
+ pgStatement.addEventListener(this);
+ return pgStatement;
+ }
+
+ public void rollback() throws SQLException {
+ checkDisposed();
+ impl.rollback();
+ }
+
+ public void setAutoCommit(boolean arg0) throws SQLException {
+ checkDisposed();
+ impl.setAutoCommit(arg0);
+ }
+
+ public void setCatalog(String arg0) throws SQLException {
+ checkDisposed();
+ impl.setCatalog(arg0);
+ }
+
+ public void setReadOnly(boolean arg0) throws SQLException {
+ checkDisposed();
+ impl.setReadOnly(arg0);
+ }
+
+ public void setTransactionIsolation(int arg0) throws SQLException {
+ checkDisposed();
+ impl.setTransactionIsolation(arg0);
+ }
+
+ public void setTypeMap(XNameAccess arg0) throws SQLException {
+ checkDisposed();
+ impl.setTypeMap(arg0);
+ }
+}
diff --git a/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/PostgresqlDatabaseMetadata.java b/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/PostgresqlDatabaseMetadata.java
new file mode 100644
index 000000000000..3e0b24064362
--- /dev/null
+++ b/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/PostgresqlDatabaseMetadata.java
@@ -0,0 +1,752 @@
+/**************************************************************
+ *
+ * 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
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+
+package com.sun.star.sdbcx.comp.postgresql;
+
+import java.util.ArrayList;
+
+import com.sun.star.lib.uno.helper.WeakBase;
+import com.sun.star.sdbc.DataType;
+import com.sun.star.sdbc.SQLException;
+import com.sun.star.sdbc.XConnection;
+import com.sun.star.sdbc.XDatabaseMetaData;
+import com.sun.star.sdbc.XResultSet;
+import com.sun.star.sdbc.XRow;
+import com.sun.star.sdbcx.comp.postgresql.util.DatabaseMetaDataResultSet;
+import com.sun.star.sdbcx.comp.postgresql.util.ORowSetValue;
+import com.sun.star.uno.UnoRuntime;
+
+public class PostgresqlDatabaseMetadata extends WeakBase implements XDatabaseMetaData {
+ private XDatabaseMetaData impl;
+ private XConnection connection;
+ private String url;
+
+ public PostgresqlDatabaseMetadata(XDatabaseMetaData impl, XConnection connection, String url) {
+ this.impl = impl;
+ this.connection = connection;
+ this.url = url;
+ }
+
+ public boolean allProceduresAreCallable() throws SQLException {
+ return impl.allProceduresAreCallable();
+ }
+
+ public boolean allTablesAreSelectable() throws SQLException {
+ return impl.allTablesAreSelectable();
+ }
+
+ public boolean dataDefinitionCausesTransactionCommit() throws SQLException {
+ return impl.dataDefinitionCausesTransactionCommit();
+ }
+
+ public boolean dataDefinitionIgnoredInTransactions() throws SQLException {
+ return impl.dataDefinitionIgnoredInTransactions();
+ }
+
+ public boolean deletesAreDetected(int arg0) throws SQLException {
+ return impl.deletesAreDetected(arg0);
+ }
+
+ public boolean doesMaxRowSizeIncludeBlobs() throws SQLException {
+ return impl.doesMaxRowSizeIncludeBlobs();
+ }
+
+ public XResultSet getBestRowIdentifier(Object arg0, String arg1, String arg2, int arg3, boolean arg4) throws SQLException {
+ return new PostgresqlResultSet(impl.getBestRowIdentifier(arg0, arg1, arg2, arg3, arg4), null);
+ }
+
+ public String getCatalogSeparator() throws SQLException {
+ return impl.getCatalogSeparator();
+ }
+
+ public String getCatalogTerm() throws SQLException {
+ return impl.getCatalogTerm();
+ }
+
+ public XResultSet getCatalogs() throws SQLException {
+ return new PostgresqlResultSet(impl.getCatalogs(), null);
+ }
+
+ public XResultSet getColumnPrivileges(Object arg0, String arg1, String arg2, String arg3) throws SQLException {
+ return new PostgresqlResultSet(impl.getColumnPrivileges(arg0, arg1, arg2, arg3), null);
+ }
+
+ public XResultSet getColumns(Object arg0, String arg1, String arg2, String arg3) throws SQLException {
+ XResultSet results = impl.getColumns(arg0, arg1, arg2, arg3);
+ XRow row = UnoRuntime.queryInterface(XRow.class, results);
+ ArrayList<ORowSetValue[]> table = new ArrayList<>();
+ while (results.next()) {
+ String tableCat = row.getString(1);
+ String tableSchem = row.getString(2);
+ String tableName = row.getString(3);
+ String columnName = row.getString(4);
+ short dataType = row.getShort(5);
+ String typeName = row.getString(6);
+ int columnSize = row.getInt(7);
+ int bufferLength = row.getInt(8); // FIXME: is it int?
+ int decimalDigits = row.getInt(9);
+ int numPrecRadix = row.getInt(10);
+ int nullable = row.getInt(11);
+ String remarks = row.getString(12);
+ String columnDef = row.getString(13);
+ int sqlDataType = row.getInt(14);
+ int sqlDateTimeSub = row.getInt(15);
+ int charOctetLength = row.getInt(16);
+ int ordinalPosition = row.getInt(17);
+ String isNullable = row.getString(18);
+
+ if (dataType == DataType.BIT) {
+ if (typeName.equals("bool")) {
+ dataType = DataType.BOOLEAN;
+ }
+ }
+
+ ORowSetValue[] rowOut = new ORowSetValue[18];
+ rowOut[0] = new ORowSetValue(tableCat);
+ rowOut[1] = new ORowSetValue(tableSchem);
+ rowOut[2] = new ORowSetValue(tableName);
+ rowOut[3] = new ORowSetValue(columnName);
+ rowOut[4] = new ORowSetValue(dataType);
+ rowOut[5] = new ORowSetValue(typeName);
+ rowOut[6] = new ORowSetValue(columnSize);
+ rowOut[7] = new ORowSetValue(bufferLength);
+ rowOut[8] = new ORowSetValue(decimalDigits);
+ rowOut[9] = new ORowSetValue(numPrecRadix);
+ rowOut[10] = new ORowSetValue(nullable);
+ rowOut[11] = new ORowSetValue(remarks);
+ rowOut[12] = new ORowSetValue(columnDef);
+ rowOut[13] = new ORowSetValue(sqlDataType);
+ rowOut[14] = new ORowSetValue(sqlDateTimeSub);
+ rowOut[15] = new ORowSetValue(charOctetLength);
+ rowOut[16] = new ORowSetValue(ordinalPosition);
+ rowOut[17] = new ORowSetValue(isNullable);
+ table.add(rowOut);
+ }
+ return new DatabaseMetaDataResultSet(results, table);
+ }
+
+ public XConnection getConnection() throws SQLException {
+ return connection;
+ }
+
+ public XResultSet getCrossReference(Object arg0, String arg1, String arg2, Object arg3, String arg4, String arg5) throws SQLException {
+ return new PostgresqlResultSet(impl.getCrossReference(arg0, arg1, arg2, arg3, arg4, arg5), null);
+ }
+
+ public String getDatabaseProductName() throws SQLException {
+ return impl.getDatabaseProductName();
+ }
+
+ public String getDatabaseProductVersion() throws SQLException {
+ return impl.getDatabaseProductVersion();
+ }
+
+ public int getDefaultTransactionIsolation() throws SQLException {
+ return impl.getDefaultTransactionIsolation();
+ }
+
+ public int getDriverMajorVersion() {
+ return impl.getDriverMajorVersion();
+ }
+
+ public int getDriverMinorVersion() {
+ return impl.getDriverMinorVersion();
+ }
+
+ public String getDriverName() throws SQLException {
+ return impl.getDriverName();
+ }
+
+ public String getDriverVersion() throws SQLException {
+ return impl.getDriverVersion();
+ }
+
+ public XResultSet getExportedKeys(Object arg0, String arg1, String arg2) throws SQLException {
+ return new PostgresqlResultSet(impl.getExportedKeys(arg0, arg1, arg2), null);
+ }
+
+ public String getExtraNameCharacters() throws SQLException {
+ return impl.getExtraNameCharacters();
+ }
+
+ public String getIdentifierQuoteString() throws SQLException {
+ return impl.getIdentifierQuoteString();
+ }
+
+ public XResultSet getImportedKeys(Object arg0, String arg1, String arg2) throws SQLException {
+ return new PostgresqlResultSet(impl.getImportedKeys(arg0, arg1, arg2), null);
+ }
+
+ public XResultSet getIndexInfo(Object arg0, String arg1, String arg2, boolean arg3, boolean arg4) throws SQLException {
+ return new PostgresqlResultSet(impl.getIndexInfo(arg0, arg1, arg2, arg3, arg4), null);
+ }
+
+ public int getMaxBinaryLiteralLength() throws SQLException {
+ return impl.getMaxBinaryLiteralLength();
+ }
+
+ public int getMaxCatalogNameLength() throws SQLException {
+ return impl.getMaxCatalogNameLength();
+ }
+
+ public int getMaxCharLiteralLength() throws SQLException {
+ return impl.getMaxCharLiteralLength();
+ }
+
+ public int getMaxColumnNameLength() throws SQLException {
+ return impl.getMaxColumnNameLength();
+ }
+
+ public int getMaxColumnsInGroupBy() throws SQLException {
+ return impl.getMaxColumnsInGroupBy();
+ }
+
+ public int getMaxColumnsInIndex() throws SQLException {
+ return impl.getMaxColumnsInIndex();
+ }
+
+ public int getMaxColumnsInOrderBy() throws SQLException {
+ return impl.getMaxColumnsInOrderBy();
+ }
+
+ public int getMaxColumnsInSelect() throws SQLException {
+ return impl.getMaxColumnsInSelect();
+ }
+
+ public int getMaxColumnsInTable() throws SQLException {
+ return impl.getMaxColumnsInTable();
+ }
+
+ public int getMaxConnections() throws SQLException {
+ return impl.getMaxConnections();
+ }
+
+ public int getMaxCursorNameLength() throws SQLException {
+ return impl.getMaxCursorNameLength();
+ }
+
+ public int getMaxIndexLength() throws SQLException {
+ return impl.getMaxIndexLength();
+ }
+
+ public int getMaxProcedureNameLength() throws SQLException {
+ return impl.getMaxProcedureNameLength();
+ }
+
+ public int getMaxRowSize() throws SQLException {
+ return impl.getMaxRowSize();
+ }
+
+ public int getMaxSchemaNameLength() throws SQLException {
+ return impl.getMaxSchemaNameLength();
+ }
+
+ public int getMaxStatementLength() throws SQLException {
+ return impl.getMaxStatementLength();
+ }
+
+ public int getMaxStatements() throws SQLException {
+ return impl.getMaxStatements();
+ }
+
+ public int getMaxTableNameLength() throws SQLException {
+ return impl.getMaxTableNameLength();
+ }
+
+ public int getMaxTablesInSelect() throws SQLException {
+ return impl.getMaxTablesInSelect();
+ }
+
+ public int getMaxUserNameLength() throws SQLException {
+ return impl.getMaxUserNameLength();
+ }
+
+ public String getNumericFunctions() throws SQLException {
+ return impl.getNumericFunctions();
+ }
+
+ public XResultSet getPrimaryKeys(Object arg0, String arg1, String arg2) throws SQLException {
+ return new PostgresqlResultSet(impl.getPrimaryKeys(arg0, arg1, arg2), null);
+ }
+
+ public XResultSet getProcedureColumns(Object arg0, String arg1, String arg2, String arg3) throws SQLException {
+ return new PostgresqlResultSet(impl.getProcedureColumns(arg0, arg1, arg2, arg3), null);
+ }
+
+ public String getProcedureTerm() throws SQLException {
+ return impl.getProcedureTerm();
+ }
+
+ public XResultSet getProcedures(Object arg0, String arg1, String arg2) throws SQLException {
+ return new PostgresqlResultSet(impl.getProcedures(arg0, arg1, arg2), null);
+ }
+
+ public String getSQLKeywords() throws SQLException {
+ return impl.getSQLKeywords();
+ }
+
+ public String getSchemaTerm() throws SQLException {
+ return impl.getSchemaTerm();
+ }
+
+ public XResultSet getSchemas() throws SQLException {
+ return new PostgresqlResultSet(impl.getSchemas(), null);
+ }
+
+ public String getSearchStringEscape() throws SQLException {
+ return impl.getSearchStringEscape();
+ }
+
+ public String getStringFunctions() throws SQLException {
+ return impl.getStringFunctions();
+ }
+
+ public String getSystemFunctions() throws SQLException {
+ return impl.getSystemFunctions();
+ }
+
+ public XResultSet getTablePrivileges(Object arg0, String arg1, String arg2) throws SQLException {
+ return new PostgresqlResultSet(impl.getTablePrivileges(arg0, arg1, arg2), null);
+ }
+
+ public XResultSet getTableTypes() throws SQLException {
+ return new PostgresqlResultSet(impl.getTableTypes(), null);
+ }
+
+ public XResultSet getTables(Object arg0, String arg1, String arg2, String[] arg3) throws SQLException {
+ return new PostgresqlResultSet(impl.getTables(arg0, arg1, arg2, arg3), null);
+ }
+
+ public String getTimeDateFunctions() throws SQLException {
+ return impl.getTimeDateFunctions();
+ }
+
+ public XResultSet getTypeInfo() throws SQLException {
+ XResultSet results = impl.getTypeInfo();
+ XRow row = UnoRuntime.queryInterface(XRow.class, results);
+ ArrayList<ORowSetValue[]> table = new ArrayList<>();
+ while (results.next()) {
+ String typeName = row.getString(1);
+ short dataType = row.getShort(2);
+ int precision = row.getInt(3);
+ String literalPrefix = row.getString(4);
+ String literalSuffix = row.getString(5);
+ String createParams = row.getString(6);
+ short nullable = row.getShort(7);
+ boolean caseSensitive = row.getBoolean(8);
+ short searchable = row.getShort(9);
+ boolean unsignedAttribute = row.getBoolean(10);
+ boolean fixedPrecScale = row.getBoolean(11);
+ boolean autoIncrement = row.getBoolean(12);
+ String localTypeName = row.getString(13);
+ short minimumScale = row.getShort(14);
+ short maximumScale = row.getShort(15);
+ int sqlDataType = row.getInt(16);
+ int sqlDateTimeSub = row.getInt(17);
+ int numPrecRadix = row.getInt(18);
+
+ if (dataType == DataType.BIT) {
+ if (typeName.equals("bit")) {
+ // but the editor sees multi-bit columns as single bit
+ // and single bit can't be edited either: syntax error
+ createParams = "length";
+ } else if (typeName.equals("bool")) {
+ dataType = DataType.BOOLEAN;
+ }
+ }
+ if ((dataType == DataType.CHAR || dataType == DataType.VARCHAR)) {
+ precision = 10485760;
+ createParams = "length";
+ }
+
+ ORowSetValue[] rowOut = new ORowSetValue[18];
+ rowOut[0] = new ORowSetValue(typeName);
+ rowOut[1] = new ORowSetValue(dataType);
+ rowOut[2] = new ORowSetValue(precision);
+ rowOut[3] = new ORowSetValue(literalPrefix);
+ rowOut[4] = new ORowSetValue(literalSuffix);
+ rowOut[5] = new ORowSetValue(createParams);
+ rowOut[6] = new ORowSetValue(nullable);
+ rowOut[7] = new ORowSetValue(caseSensitive);
+ rowOut[8] = new ORowSetValue(searchable);
+ rowOut[9] = new ORowSetValue(unsignedAttribute);
+ rowOut[10] = new ORowSetValue(fixedPrecScale);
+ rowOut[11] = new ORowSetValue(autoIncrement);
+ rowOut[12] = new ORowSetValue(localTypeName);
+ rowOut[13] = new ORowSetValue(minimumScale);
+ rowOut[14] = new ORowSetValue(maximumScale);
+ rowOut[15] = new ORowSetValue(sqlDataType);
+ rowOut[16] = new ORowSetValue(sqlDateTimeSub);
+ rowOut[17] = new ORowSetValue(numPrecRadix);
+ table.add(rowOut);
+ //System.out.println(String.format("type %s, data type %d, SQL type %d, precision %d, createParams %s", typeName, dataType, sqlDataType, precision, createParams));
+ }
+ return new DatabaseMetaDataResultSet(results, table);
+ }
+
+ public XResultSet getUDTs(Object arg0, String arg1, String arg2, int[] arg3) throws SQLException {
+ return new PostgresqlResultSet(impl.getUDTs(arg0, arg1, arg2, arg3), null);
+ }
+
+ public String getURL() throws SQLException {
+ return url;
+ }
+
+ public String getUserName() throws SQLException {
+ return impl.getUserName();
+ }
+
+ public XResultSet getVersionColumns(Object arg0, String arg1, String arg2) throws SQLException {
+ return new PostgresqlResultSet(impl.getVersionColumns(arg0, arg1, arg2), null);
+ }
+
+ public boolean insertsAreDetected(int arg0) throws SQLException {
+ return impl.insertsAreDetected(arg0);
+ }
+
+ public boolean isCatalogAtStart() throws SQLException {
+ return impl.isCatalogAtStart();
+ }
+
+ public boolean isReadOnly() throws SQLException {
+ return impl.isReadOnly();
+ }
+
+ public boolean nullPlusNonNullIsNull() throws SQLException {
+ return impl.nullPlusNonNullIsNull();
+ }
+
+ public boolean nullsAreSortedAtEnd() throws SQLException {
+ return impl.nullsAreSortedAtEnd();
+ }
+
+ public boolean nullsAreSortedAtStart() throws SQLException {
+ return impl.nullsAreSortedAtStart();
+ }
+
+ public boolean nullsAreSortedHigh() throws SQLException {
+ return impl.nullsAreSortedHigh();
+ }
+
+ public boolean nullsAreSortedLow() throws SQLException {
+ return impl.nullsAreSortedLow();
+ }
+
+ public boolean othersDeletesAreVisible(int arg0) throws SQLException {
+ return impl.othersDeletesAreVisible(arg0);
+ }
+
+ public boolean othersInsertsAreVisible(int arg0) throws SQLException {
+ return impl.othersInsertsAreVisible(arg0);
+ }
+
+ public boolean othersUpdatesAreVisible(int arg0) throws SQLException {
+ return impl.othersUpdatesAreVisible(arg0);
+ }
+
+ public boolean ownDeletesAreVisible(int arg0) throws SQLException {
+ return impl.ownDeletesAreVisible(arg0);
+ }
+
+ public boolean ownInsertsAreVisible(int arg0) throws SQLException {
+ return impl.ownInsertsAreVisible(arg0);
+ }
+
+ public boolean ownUpdatesAreVisible(int arg0) throws SQLException {
+ return impl.ownUpdatesAreVisible(arg0);
+ }
+
+ public boolean storesLowerCaseIdentifiers() throws SQLException {
+ return impl.storesLowerCaseIdentifiers();
+ }
+
+ public boolean storesLowerCaseQuotedIdentifiers() throws SQLException {
+ return impl.storesLowerCaseQuotedIdentifiers();
+ }
+
+ public boolean storesMixedCaseIdentifiers() throws SQLException {
+ return impl.storesMixedCaseIdentifiers();
+ }
+
+ public boolean storesMixedCaseQuotedIdentifiers() throws SQLException {
+ return impl.storesMixedCaseQuotedIdentifiers();
+ }
+
+ public boolean storesUpperCaseIdentifiers() throws SQLException {
+ return impl.storesUpperCaseIdentifiers();
+ }
+
+ public boolean storesUpperCaseQuotedIdentifiers() throws SQLException {
+ return impl.storesUpperCaseQuotedIdentifiers();
+ }
+
+ public boolean supportsANSI92EntryLevelSQL() throws SQLException {
+ return impl.supportsANSI92EntryLevelSQL();
+ }
+
+ public boolean supportsANSI92FullSQL() throws SQLException {
+ return impl.supportsANSI92FullSQL();
+ }
+
+ public boolean supportsANSI92IntermediateSQL() throws SQLException {
+ return impl.supportsANSI92IntermediateSQL();
+ }
+
+ public boolean supportsAlterTableWithAddColumn() throws SQLException {
+ return impl.supportsAlterTableWithAddColumn();
+ }
+
+ public boolean supportsAlterTableWithDropColumn() throws SQLException {
+ return impl.supportsAlterTableWithDropColumn();
+ }
+
+ public boolean supportsBatchUpdates() throws SQLException {
+ return impl.supportsBatchUpdates();
+ }
+
+ public boolean supportsCatalogsInDataManipulation() throws SQLException {
+ return impl.supportsCatalogsInDataManipulation();
+ }
+
+ public boolean supportsCatalogsInIndexDefinitions() throws SQLException {
+ return impl.supportsCatalogsInIndexDefinitions();
+ }
+
+ public boolean supportsCatalogsInPrivilegeDefinitions() throws SQLException {
+ return impl.supportsCatalogsInPrivilegeDefinitions();
+ }
+
+ public boolean supportsCatalogsInProcedureCalls() throws SQLException {
+ return impl.supportsCatalogsInProcedureCalls();
+ }
+
+ public boolean supportsCatalogsInTableDefinitions() throws SQLException {
+ return impl.supportsCatalogsInTableDefinitions();
+ }
+
+ public boolean supportsColumnAliasing() throws SQLException {
+ return impl.supportsColumnAliasing();
+ }
+
+ public boolean supportsConvert(int arg0, int arg1) throws SQLException {
+ return impl.supportsConvert(arg0, arg1);
+ }
+
+ public boolean supportsCoreSQLGrammar() throws SQLException {
+ return impl.supportsCoreSQLGrammar();
+ }
+
+ public boolean supportsCorrelatedSubqueries() throws SQLException {
+ return impl.supportsCorrelatedSubqueries();
+ }
+
+ public boolean supportsDataDefinitionAndDataManipulationTransactions() throws SQLException {
+ return impl.supportsDataDefinitionAndDataManipulationTransactions();
+ }
+
+ public boolean supportsDataManipulationTransactionsOnly() throws SQLException {
+ return impl.supportsDataManipulationTransactionsOnly();
+ }
+
+ public boolean supportsDifferentTableCorrelationNames() throws SQLException {
+ return impl.supportsDifferentTableCorrelationNames();
+ }
+
+ public boolean supportsExpressionsInOrderBy() throws SQLException {
+ return impl.supportsExpressionsInOrderBy();
+ }
+
+ public boolean supportsExtendedSQLGrammar() throws SQLException {
+ return impl.supportsExtendedSQLGrammar();
+ }
+
+ public boolean supportsFullOuterJoins() throws SQLException {
+ return impl.supportsFullOuterJoins();
+ }
+
+ public boolean supportsGroupBy() throws SQLException {
+ return impl.supportsGroupBy();
+ }
+
+ public boolean supportsGroupByBeyondSelect() throws SQLException {
+ return impl.supportsGroupByBeyondSelect();
+ }
+
+ public boolean supportsGroupByUnrelated() throws SQLException {
+ return impl.supportsGroupByUnrelated();
+ }
+
+ public boolean supportsIntegrityEnhancementFacility() throws SQLException {
+ return impl.supportsIntegrityEnhancementFacility();
+ }
+
+ public boolean supportsLikeEscapeClause() throws SQLException {
+ return impl.supportsLikeEscapeClause();
+ }
+
+ public boolean supportsLimitedOuterJoins() throws SQLException {
+ return impl.supportsLimitedOuterJoins();
+ }
+
+ public boolean supportsMinimumSQLGrammar() throws SQLException {
+ return impl.supportsMinimumSQLGrammar();
+ }
+
+ public boolean supportsMixedCaseIdentifiers() throws SQLException {
+ return impl.supportsMixedCaseIdentifiers();
+ }
+
+ public boolean supportsMixedCaseQuotedIdentifiers() throws SQLException {
+ return impl.supportsMixedCaseQuotedIdentifiers();
+ }
+
+ public boolean supportsMultipleResultSets() throws SQLException {
+ return impl.supportsMultipleResultSets();
+ }
+
+ public boolean supportsMultipleTransactions() throws SQLException {
+ return impl.supportsMultipleTransactions();
+ }
+
+ public boolean supportsNonNullableColumns() throws SQLException {
+ return impl.supportsNonNullableColumns();
+ }
+
+ public boolean supportsOpenCursorsAcrossCommit() throws SQLException {
+ return impl.supportsOpenCursorsAcrossCommit();
+ }
+
+ public boolean supportsOpenCursorsAcrossRollback() throws SQLException {
+ return impl.supportsOpenCursorsAcrossRollback();
+ }
+
+ public boolean supportsOpenStatementsAcrossCommit() throws SQLException {
+ return impl.supportsOpenStatementsAcrossCommit();
+ }
+
+ public boolean supportsOpenStatementsAcrossRollback() throws SQLException {
+ return impl.supportsOpenStatementsAcrossRollback();
+ }
+
+ public boolean supportsOrderByUnrelated() throws SQLException {
+ return impl.supportsOrderByUnrelated();
+ }
+
+ public boolean supportsOuterJoins() throws SQLException {
+ return impl.supportsOuterJoins();
+ }
+
+ public boolean supportsPositionedDelete() throws SQLException {
+ return impl.supportsPositionedDelete();
+ }
+
+ public boolean supportsPositionedUpdate() throws SQLException {
+ return impl.supportsPositionedUpdate();
+ }
+
+ public boolean supportsResultSetConcurrency(int arg0, int arg1) throws SQLException {
+ return impl.supportsResultSetConcurrency(arg0, arg1);
+ }
+
+ public boolean supportsResultSetType(int arg0) throws SQLException {
+ return impl.supportsResultSetType(arg0);
+ }
+
+ public boolean supportsSchemasInDataManipulation() throws SQLException {
+ return impl.supportsSchemasInDataManipulation();
+ }
+
+ public boolean supportsSchemasInIndexDefinitions() throws SQLException {
+ return impl.supportsSchemasInIndexDefinitions();
+ }
+
+ public boolean supportsSchemasInPrivilegeDefinitions() throws SQLException {
+ return impl.supportsSchemasInPrivilegeDefinitions();
+ }
+
+ public boolean supportsSchemasInProcedureCalls() throws SQLException {
+ return impl.supportsSchemasInProcedureCalls();
+ }
+
+ public boolean supportsSchemasInTableDefinitions() throws SQLException {
+ return impl.supportsSchemasInTableDefinitions();
+ }
+
+ public boolean supportsSelectForUpdate() throws SQLException {
+ return impl.supportsSelectForUpdate();
+ }
+
+ public boolean supportsStoredProcedures() throws SQLException {
+ return impl.supportsStoredProcedures();
+ }
+
+ public boolean supportsSubqueriesInComparisons() throws SQLException {
+ return impl.supportsSubqueriesInComparisons();
+ }
+
+ public boolean supportsSubqueriesInExists() throws SQLException {
+ return impl.supportsSubqueriesInExists();
+ }
+
+ public boolean supportsSubqueriesInIns() throws SQLException {
+ return impl.supportsSubqueriesInIns();
+ }
+
+ public boolean supportsSubqueriesInQuantifieds() throws SQLException {
+ return impl.supportsSubqueriesInQuantifieds();
+ }
+
+ public boolean supportsTableCorrelationNames() throws SQLException {
+ return impl.supportsTableCorrelationNames();
+ }
+
+ public boolean supportsTransactionIsolationLevel(int arg0) throws SQLException {
+ return impl.supportsTransactionIsolationLevel(arg0);
+ }
+
+ public boolean supportsTransactions() throws SQLException {
+ return impl.supportsTransactions();
+ }
+
+ public boolean supportsTypeConversion() throws SQLException {
+ return impl.supportsTypeConversion();
+ }
+
+ public boolean supportsUnion() throws SQLException {
+ return impl.supportsUnion();
+ }
+
+ public boolean supportsUnionAll() throws SQLException {
+ return impl.supportsUnionAll();
+ }
+
+ public boolean updatesAreDetected(int arg0) throws SQLException {
+ return impl.updatesAreDetected(arg0);
+ }
+
+ public boolean usesLocalFilePerTable() throws SQLException {
+ return impl.usesLocalFilePerTable();
+ }
+
+ public boolean usesLocalFiles() throws SQLException {
+ return impl.usesLocalFiles();
+ }
+}
diff --git a/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/PostgresqlDriver.java b/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/PostgresqlDriver.java
new file mode 100644
index 000000000000..43fd434f2037
--- /dev/null
+++ b/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/PostgresqlDriver.java
@@ -0,0 +1,199 @@
+/**************************************************************
+ *
+ * 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
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+
+package com.sun.star.sdbcx.comp.postgresql;
+
+import java.util.ArrayList;
+import java.util.concurrent.atomic.AtomicBoolean;
+
+import com.sun.star.beans.PropertyValue;
+import com.sun.star.lang.DisposedException;
+import com.sun.star.lang.XServiceInfo;
+import com.sun.star.lang.XSingleComponentFactory;
+import com.sun.star.lib.uno.helper.ComponentBase;
+import com.sun.star.lib.uno.helper.Factory;
+import com.sun.star.sdbc.DriverPropertyInfo;
+import com.sun.star.sdbc.SQLException;
+import com.sun.star.sdbc.XConnection;
+import com.sun.star.sdbc.XDriver;
+import com.sun.star.sdbc.XDriverManager;
+import com.sun.star.sdbcx.XDataDefinitionSupplier;
+import com.sun.star.sdbcx.XTablesSupplier;
+import com.sun.star.sdbcx.comp.postgresql.sdbcx.SharedResources;
+import com.sun.star.sdbcx.comp.postgresql.util.StandardSQLState;
+import com.sun.star.uno.Exception;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XComponentContext;
+
+public class PostgresqlDriver extends ComponentBase implements XServiceInfo, XDriver, XDataDefinitionSupplier {
+ private static String[] services = new String[] {
+ "com.sun.star.sdbc.Driver",
+ "com.sun.star.sdbcx.Driver"
+ };
+ private XComponentContext componentContext;
+ private AtomicBoolean isDisposed = new AtomicBoolean(false);
+
+ public static XSingleComponentFactory __getComponentFactory(String implName) {
+ XSingleComponentFactory xSingleComponentFactory = null;
+ if (implName.equals(getImplementationNameStatic())) {
+ xSingleComponentFactory = Factory.createComponentFactory(PostgresqlDriver.class,
+ getImplementationNameStatic(), services);
+ }
+ return xSingleComponentFactory;
+ }
+
+ public PostgresqlDriver(XComponentContext componentContext) {
+ this.componentContext = componentContext;
+ SharedResources.registerClient(componentContext);
+ }
+
+ private static String getImplementationNameStatic() {
+ return PostgresqlDriver.class.getName();
+ }
+
+ // XComponent:
+
+ @Override
+ protected void postDisposing() {
+ isDisposed.set(true);
+ componentContext = null;
+ SharedResources.revokeClient();
+ }
+
+ private void checkDisposed() throws DisposedException {
+ if (isDisposed.get()) {
+ throw new DisposedException();
+ }
+ }
+
+ // XServiceInfo:
+
+ @Override
+ public String getImplementationName() {
+ return getImplementationNameStatic();
+ }
+
+ @Override
+ public String[] getSupportedServiceNames() {
+ return services.clone();
+ }
+
+ @Override
+ public boolean supportsService(String serviceName) {
+ for (String service : services) {
+ if (service.equals(serviceName)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ // XDriver:
+
+ @Override
+ public boolean acceptsURL(String url) throws SQLException {
+ return url.startsWith("sdbc:postgresql:jdbc:");
+ }
+
+ @Override
+ public XConnection connect(String url, PropertyValue[] info) throws SQLException {
+ checkDisposed();
+ XConnection connection = null;
+ if (acceptsURL(url)) {
+ String jdbcUrl = transformUrl(url);
+ System.out.println("Using SDBC URL " + url + " and JDBC URL " + jdbcUrl);
+
+ try {
+ Object driverManagerObject = componentContext.getServiceManager().createInstanceWithContext(
+ "com.sun.star.sdbc.DriverManager", componentContext);
+ XDriverManager driverManager = UnoRuntime.queryInterface(XDriverManager.class, driverManagerObject);
+
+ ArrayList<PropertyValue> properties = new ArrayList<>();
+ boolean haveJavaClass = false;
+ for (PropertyValue property : info) {
+ if (property.Name.equals("JavaDriverClass")) {
+ haveJavaClass = true;
+ }
+ properties.add(property);
+ }
+ if (!haveJavaClass) {
+ PropertyValue javaClassProperty = new PropertyValue();
+ javaClassProperty.Name = "JavaDriverClass";
+ javaClassProperty.Value = "org.postgresql.Driver";
+ properties.add(javaClassProperty);
+ }
+ PropertyValue[] jdbcInfo = properties.toArray(new PropertyValue[properties.size()]);
+
+ connection = driverManager.getConnectionWithInfo(jdbcUrl, jdbcInfo);
+ if (connection != null) {
+ connection = new PostgresqlConnection(connection, url);
+ }
+ } catch (SQLException sqlException) {
+ throw sqlException;
+ } catch (Exception exception) {
+ throw new SQLException(exception.getMessage(), this, StandardSQLState.SQL_UNABLE_TO_CONNECT.text(), 0, exception);
+ }
+ }
+ return connection;
+ }
+
+ @Override
+ public int getMajorVersion() {
+ return 1;
+ }
+
+ @Override
+ public int getMinorVersion() {
+ return 0;
+ }
+
+ @Override
+ public DriverPropertyInfo[] getPropertyInfo(String url, PropertyValue[] info) throws SQLException {
+ if (!acceptsURL(url)) {
+ return new DriverPropertyInfo[0];
+ }
+ return new DriverPropertyInfo [] {
+ new DriverPropertyInfo("JavaClassName", "The JDBC driver class name.", true,
+ "com.postgresql.Driver", new String[0]),
+ };
+ }
+
+ private static String transformUrl(String url) {
+ // 012345678901234567890
+ // sdbc:postgresql:jdbc:
+ return "jdbc:postgresql:" + url.substring(21);
+ }
+
+ // XDataDefinitionSupplier:
+
+ public XTablesSupplier getDataDefinitionByConnection(XConnection connection) throws SQLException {
+ checkDisposed();
+ return new PostgresqlCatalog((PostgresqlConnection)connection);
+ }
+
+ public XTablesSupplier getDataDefinitionByURL(String url, PropertyValue[] info) throws SQLException {
+ checkDisposed();
+ if (!acceptsURL(url)) {
+ throw new SQLException(); // FIXME
+ }
+ return getDataDefinitionByConnection(connect(url, info));
+ }
+}
diff --git a/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/PostgresqlPreparedStatement.java b/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/PostgresqlPreparedStatement.java
new file mode 100644
index 000000000000..ff4b99684a5a
--- /dev/null
+++ b/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/PostgresqlPreparedStatement.java
@@ -0,0 +1,348 @@
+/**************************************************************
+ *
+ * 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
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+
+package com.sun.star.sdbcx.comp.postgresql;
+
+import java.util.concurrent.atomic.AtomicBoolean;
+
+import com.sun.star.beans.PropertyVetoException;
+import com.sun.star.beans.UnknownPropertyException;
+import com.sun.star.beans.XPropertyChangeListener;
+import com.sun.star.beans.XPropertySet;
+import com.sun.star.beans.XPropertySetInfo;
+import com.sun.star.beans.XVetoableChangeListener;
+import com.sun.star.io.XInputStream;
+import com.sun.star.lang.DisposedException;
+import com.sun.star.lang.IllegalArgumentException;
+import com.sun.star.lang.WrappedTargetException;
+import com.sun.star.lib.uno.helper.ComponentBase;
+import com.sun.star.sdbc.SQLException;
+import com.sun.star.sdbc.XArray;
+import com.sun.star.sdbc.XBlob;
+import com.sun.star.sdbc.XClob;
+import com.sun.star.sdbc.XCloseable;
+import com.sun.star.sdbc.XConnection;
+import com.sun.star.sdbc.XMultipleResults;
+import com.sun.star.sdbc.XParameters;
+import com.sun.star.sdbc.XPreparedBatchExecution;
+import com.sun.star.sdbc.XPreparedStatement;
+import com.sun.star.sdbc.XRef;
+import com.sun.star.sdbc.XResultSet;
+import com.sun.star.sdbc.XResultSetMetaData;
+import com.sun.star.sdbc.XResultSetMetaDataSupplier;
+import com.sun.star.sdbc.XWarningsSupplier;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.util.Date;
+import com.sun.star.util.DateTime;
+import com.sun.star.util.Time;
+import com.sun.star.util.XCancellable;
+
+public class PostgresqlPreparedStatement extends ComponentBase
+ implements XPreparedStatement, XCloseable, XPropertySet, XCancellable, XResultSetMetaDataSupplier, XParameters, XPreparedBatchExecution,
+ XWarningsSupplier, XMultipleResults {
+
+ private XPreparedStatement impl;
+ private XCloseable implCloseable;
+ private XPropertySet implPropertySet;
+ private XCancellable implCancellable;
+ private XResultSetMetaDataSupplier implResultSetMetaDataSupplier;
+ private XParameters implParameters;
+ private XPreparedBatchExecution implPreparedBatchExecution;
+ private XWarningsSupplier implWarningsSupplier;
+ private XMultipleResults implMultipleResults;
+ private XConnection connection;
+ private AtomicBoolean isDisposed = new AtomicBoolean(false);
+
+ public PostgresqlPreparedStatement(XPreparedStatement impl, XConnection connection) {
+ this.impl = impl;
+ this.implCloseable = UnoRuntime.queryInterface(XCloseable.class, impl);
+ this.implPropertySet = UnoRuntime.queryInterface(XPropertySet.class, impl);
+ this.implCancellable = UnoRuntime.queryInterface(XCancellable.class, impl);
+ this.implResultSetMetaDataSupplier = UnoRuntime.queryInterface(XResultSetMetaDataSupplier.class, impl);
+ this.implParameters = UnoRuntime.queryInterface(XParameters.class, impl);
+ this.implPreparedBatchExecution = UnoRuntime.queryInterface(XPreparedBatchExecution.class, impl);
+ this.implWarningsSupplier = UnoRuntime.queryInterface(XWarningsSupplier.class, impl);
+ this.implMultipleResults = UnoRuntime.queryInterface(XMultipleResults.class, impl);
+ this.connection = connection;
+ }
+
+ // XComponentBase:
+
+ @Override
+ protected void postDisposing() {
+ isDisposed.set(true);
+ try {
+ implCloseable.close();
+ } catch (SQLException sqlException) {
+ }
+ }
+
+ private void checkDisposed() {
+ if (isDisposed.get()) {
+ throw new DisposedException();
+ }
+ }
+
+ // XPreparedStatement:
+
+ public boolean execute() throws SQLException {
+ checkDisposed();
+ return impl.execute();
+ }
+
+ public XResultSet executeQuery() throws SQLException {
+ checkDisposed();
+ return new PostgresqlResultSet(impl.executeQuery(), this);
+ }
+
+ public int executeUpdate() throws SQLException {
+ checkDisposed();
+ return impl.executeUpdate();
+ }
+
+ public XConnection getConnection() throws SQLException {
+ checkDisposed();
+ return connection;
+ }
+
+ // XCloseable:
+
+ public void close() throws SQLException {
+ dispose();
+ }
+
+ // XPropertySet:
+
+ public void addPropertyChangeListener(String arg0, XPropertyChangeListener arg1) throws UnknownPropertyException, WrappedTargetException {
+ checkDisposed();
+ implPropertySet.addPropertyChangeListener(arg0, arg1);
+ }
+
+ public void addVetoableChangeListener(String arg0, XVetoableChangeListener arg1) throws UnknownPropertyException, WrappedTargetException {
+ checkDisposed();
+ implPropertySet.addVetoableChangeListener(arg0, arg1);
+ }
+
+ public XPropertySetInfo getPropertySetInfo() {
+ checkDisposed();
+ return implPropertySet.getPropertySetInfo();
+ }
+
+ public Object getPropertyValue(String arg0) throws UnknownPropertyException, WrappedTargetException {
+ checkDisposed();
+ return implPropertySet.getPropertyValue(arg0);
+ }
+
+ public void removePropertyChangeListener(String arg0, XPropertyChangeListener arg1) throws UnknownPropertyException, WrappedTargetException {
+ checkDisposed();
+ implPropertySet.removePropertyChangeListener(arg0, arg1);
+ }
+
+ public void removeVetoableChangeListener(String arg0, XVetoableChangeListener arg1) throws UnknownPropertyException, WrappedTargetException {
+ checkDisposed();
+ implPropertySet.removeVetoableChangeListener(arg0, arg1);
+ }
+
+ public void setPropertyValue(String arg0, Object arg1)
+ throws UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException {
+ checkDisposed();
+ implPropertySet.setPropertyValue(arg0, arg1);
+ }
+
+ // XCancellable:
+
+ public void cancel() {
+ checkDisposed();
+ implCancellable.cancel();
+ }
+
+ // XResultSetMetaDataSupplier:
+
+ public XResultSetMetaData getMetaData() throws SQLException {
+ checkDisposed();
+ return new PostgresqlResultSetMetaData(implResultSetMetaDataSupplier.getMetaData());
+ }
+
+ // XParameters:
+
+ public void clearParameters() throws SQLException {
+ checkDisposed();
+ implParameters.clearParameters();
+ }
+
+ public void setArray(int arg0, XArray arg1) throws SQLException {
+ checkDisposed();
+ implParameters.setArray(arg0, arg1);
+ }
+
+ public void setBinaryStream(int arg0, XInputStream arg1, int arg2) throws SQLException {
+ checkDisposed();
+ implParameters.setBinaryStream(arg0, arg1, arg2);
+ }
+
+ public void setBlob(int arg0, XBlob arg1) throws SQLException {
+ checkDisposed();
+ implParameters.setBlob(arg0, arg1);
+ }
+
+ public void setBoolean(int arg0, boolean arg1) throws SQLException {
+ checkDisposed();
+ implParameters.setBoolean(arg0, arg1);
+ }
+
+ public void setByte(int arg0, byte arg1) throws SQLException {
+ checkDisposed();
+ implParameters.setByte(arg0, arg1);
+ }
+
+ public void setBytes(int arg0, byte[] arg1) throws SQLException {
+ checkDisposed();
+ implParameters.setBytes(arg0, arg1);
+ }
+
+ public void setCharacterStream(int arg0, XInputStream arg1, int arg2) throws SQLException {
+ checkDisposed();
+ implParameters.setCharacterStream(arg0, arg1, arg2);
+ }
+
+ public void setClob(int arg0, XClob arg1) throws SQLException {
+ checkDisposed();
+ implParameters.setClob(arg0, arg1);
+ }
+
+ public void setDate(int arg0, Date arg1) throws SQLException {
+ checkDisposed();
+ implParameters.setDate(arg0, arg1);
+ }
+
+ public void setDouble(int arg0, double arg1) throws SQLException {
+ checkDisposed();
+ implParameters.setDouble(arg0, arg1);
+ }
+
+ public void setFloat(int arg0, float arg1) throws SQLException {
+ checkDisposed();
+ implParameters.setFloat(arg0, arg1);
+ }
+
+ public void setInt(int arg0, int arg1) throws SQLException {
+ checkDisposed();
+ implParameters.setInt(arg0, arg1);
+ }
+
+ public void setLong(int arg0, long arg1) throws SQLException {
+ checkDisposed();
+ implParameters.setLong(arg0, arg1);
+ }
+
+ public void setNull(int arg0, int arg1) throws SQLException {
+ checkDisposed();
+ implParameters.setNull(arg0, arg1);
+ }
+
+ public void setObject(int arg0, Object arg1) throws SQLException {
+ checkDisposed();
+ implParameters.setObject(arg0, arg1);
+ }
+
+ public void setObjectNull(int arg0, int arg1, String arg2) throws SQLException {
+ checkDisposed();
+ implParameters.setObjectNull(arg0, arg1, arg2);
+ }
+
+ public void setObjectWithInfo(int arg0, Object arg1, int arg2, int arg3) throws SQLException {
+ checkDisposed();
+ implParameters.setObjectWithInfo(arg0, arg1, arg2, arg3);
+ }
+
+ public void setRef(int arg0, XRef arg1) throws SQLException {
+ checkDisposed();
+ implParameters.setRef(arg0, arg1);
+ }
+
+ public void setShort(int arg0, short arg1) throws SQLException {
+ checkDisposed();
+ implParameters.setShort(arg0, arg1);
+ }
+
+ public void setString(int arg0, String arg1) throws SQLException {
+ checkDisposed();
+ implParameters.setString(arg0, arg1);
+ }
+
+ public void setTime(int arg0, Time arg1) throws SQLException {
+ checkDisposed();
+ implParameters.setTime(arg0, arg1);
+ }
+
+ public void setTimestamp(int arg0, DateTime arg1) throws SQLException {
+ checkDisposed();
+ implParameters.setTimestamp(arg0, arg1);
+ }
+
+ // XPreparedBatchExecution:
+
+ public void addBatch() throws SQLException {
+ checkDisposed();
+ implPreparedBatchExecution.addBatch();
+ }
+
+ public void clearBatch() throws SQLException {
+ checkDisposed();
+ implPreparedBatchExecution.clearBatch();
+ }
+
+ public int[] executeBatch() throws SQLException {
+ checkDisposed();
+ return implPreparedBatchExecution.executeBatch();
+ }
+
+ // XWarningsSupplier:
+
+ public void clearWarnings() throws SQLException {
+ checkDisposed();
+ implWarningsSupplier.clearWarnings();
+ }
+
+ public Object getWarnings() throws SQLException {
+ checkDisposed();
+ return implWarningsSupplier.getWarnings();
+ }
+
+ // XMultipleResults:
+
+ public boolean getMoreResults() throws SQLException {
+ checkDisposed();
+ return implMultipleResults.getMoreResults();
+ }
+
+ public XResultSet getResultSet() throws SQLException {
+ checkDisposed();
+ return new PostgresqlResultSet(implMultipleResults.getResultSet(), this);
+ }
+
+ public int getUpdateCount() throws SQLException {
+ checkDisposed();
+ return implMultipleResults.getUpdateCount();
+ }
+
+
+}
diff --git a/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/PostgresqlResultSet.java b/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/PostgresqlResultSet.java
new file mode 100644
index 000000000000..1ba5d62cbedb
--- /dev/null
+++ b/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/PostgresqlResultSet.java
@@ -0,0 +1,495 @@
+/**************************************************************
+ *
+ * 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
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+
+package com.sun.star.sdbcx.comp.postgresql;
+
+import java.util.concurrent.atomic.AtomicBoolean;
+
+import com.sun.star.beans.PropertyVetoException;
+import com.sun.star.beans.UnknownPropertyException;
+import com.sun.star.beans.XPropertyChangeListener;
+import com.sun.star.beans.XPropertySet;
+import com.sun.star.beans.XPropertySetInfo;
+import com.sun.star.beans.XVetoableChangeListener;
+import com.sun.star.container.XNameAccess;
+import com.sun.star.io.XInputStream;
+import com.sun.star.lang.DisposedException;
+import com.sun.star.lang.IllegalArgumentException;
+import com.sun.star.lang.WrappedTargetException;
+import com.sun.star.lib.uno.helper.ComponentBase;
+import com.sun.star.sdbc.SQLException;
+import com.sun.star.sdbc.XArray;
+import com.sun.star.sdbc.XBlob;
+import com.sun.star.sdbc.XClob;
+import com.sun.star.sdbc.XCloseable;
+import com.sun.star.sdbc.XColumnLocate;
+import com.sun.star.sdbc.XRef;
+import com.sun.star.sdbc.XResultSet;
+import com.sun.star.sdbc.XResultSetMetaData;
+import com.sun.star.sdbc.XResultSetMetaDataSupplier;
+import com.sun.star.sdbc.XResultSetUpdate;
+import com.sun.star.sdbc.XRow;
+import com.sun.star.sdbc.XRowUpdate;
+import com.sun.star.sdbc.XWarningsSupplier;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.util.Date;
+import com.sun.star.util.DateTime;
+import com.sun.star.util.Time;
+import com.sun.star.util.XCancellable;
+
+public class PostgresqlResultSet extends ComponentBase
+ implements XResultSet, XRow, XResultSetMetaDataSupplier, XCancellable, XWarningsSupplier, XResultSetUpdate,
+ XRowUpdate, XCloseable, XColumnLocate, XPropertySet {
+
+ private XResultSet impl;
+ private XRow implRow;
+ private XResultSetMetaDataSupplier implResultSetMetaDataSupplier;
+ private XCancellable implCancellable;
+ private XWarningsSupplier implWarningsSupplier;
+ private XResultSetUpdate implResultSetUpdate;
+ private XRowUpdate implRowUpdate;
+ private XCloseable implCloseable;
+ private XColumnLocate implColumnLocate;
+ private XPropertySet implPropertySet;
+ private Object statement;
+ private AtomicBoolean isDisposed = new AtomicBoolean(false);
+
+ public PostgresqlResultSet(XResultSet impl, Object statement) {
+ this.impl = impl;
+ this.implRow = UnoRuntime.queryInterface(XRow.class, impl);
+ this.implResultSetMetaDataSupplier = UnoRuntime.queryInterface(XResultSetMetaDataSupplier.class, impl);
+ this.implCancellable = UnoRuntime.queryInterface(XCancellable.class, impl);
+ this.implWarningsSupplier = UnoRuntime.queryInterface(XWarningsSupplier.class, impl);
+ this.implResultSetUpdate = UnoRuntime.queryInterface(XResultSetUpdate.class, impl);
+ this.implRowUpdate = UnoRuntime.queryInterface(XRowUpdate.class, impl);
+ this.implCloseable = UnoRuntime.queryInterface(XCloseable.class, impl);
+ this.implColumnLocate = UnoRuntime.queryInterface(XColumnLocate.class, impl);
+ this.implPropertySet = UnoRuntime.queryInterface(XPropertySet.class, impl);
+ this.statement = statement;
+ }
+
+ // XComponent:
+
+ @Override
+ protected synchronized void postDisposing() {
+ isDisposed.set(true);
+ try {
+ implCloseable.close();
+ } catch (SQLException sqlException) {
+ }
+ };
+
+ private void checkDisposed() throws DisposedException {
+ if (isDisposed.get()) {
+ throw new DisposedException();
+ }
+ }
+
+ // XCloseable:
+
+ public void close() throws SQLException {
+ dispose();
+ }
+
+ // XResultSet:
+
+ public boolean absolute(int arg0) throws SQLException {
+ checkDisposed();
+ return impl.absolute(arg0);
+ }
+
+ public void afterLast() throws SQLException {
+ checkDisposed();
+ impl.afterLast();
+ }
+
+ public void beforeFirst() throws SQLException {
+ checkDisposed();
+ impl.beforeFirst();
+ }
+
+ public boolean first() throws SQLException {
+ checkDisposed();
+ return impl.first();
+ }
+
+ public int getRow() throws SQLException {
+ checkDisposed();
+ return impl.getRow();
+ }
+
+ public Object getStatement() throws SQLException {
+ checkDisposed();
+ return statement;
+ }
+
+ public boolean isAfterLast() throws SQLException {
+ checkDisposed();
+ return impl.isAfterLast();
+ }
+
+ public boolean isBeforeFirst() throws SQLException {
+ checkDisposed();
+ return impl.isBeforeFirst();
+ }
+
+ public boolean isFirst() throws SQLException {
+ checkDisposed();
+ return impl.isFirst();
+ }
+
+ public boolean isLast() throws SQLException {
+ checkDisposed();
+ return impl.isLast();
+ }
+
+ public boolean last() throws SQLException {
+ checkDisposed();
+ return impl.last();
+ }
+
+ public boolean next() throws SQLException {
+ checkDisposed();
+ return impl.next();
+ }
+
+ public boolean previous() throws SQLException {
+ checkDisposed();
+ return impl.previous();
+ }
+
+ public void refreshRow() throws SQLException {
+ checkDisposed();
+ impl.refreshRow();
+ }
+
+ public boolean relative(int arg0) throws SQLException {
+ checkDisposed();
+ return impl.relative(arg0);
+ }
+
+ public boolean rowDeleted() throws SQLException {
+ checkDisposed();
+ return impl.rowDeleted();
+ }
+
+ public boolean rowInserted() throws SQLException {
+ checkDisposed();
+ return impl.rowInserted();
+ }
+
+ public boolean rowUpdated() throws SQLException {
+ checkDisposed();
+ return impl.rowUpdated();
+ }
+
+ // XRow:
+
+ public XArray getArray(int arg0) throws SQLException {
+ checkDisposed();
+ return implRow.getArray(arg0);
+ }
+
+ public XInputStream getBinaryStream(int arg0) throws SQLException {
+ checkDisposed();
+ return implRow.getBinaryStream(arg0);
+ }
+
+ public XBlob getBlob(int arg0) throws SQLException {
+ checkDisposed();
+ return implRow.getBlob(arg0);
+ }
+
+ public boolean getBoolean(int arg0) throws SQLException {
+ checkDisposed();
+ return implRow.getBoolean(arg0);
+ }
+
+ public byte getByte(int arg0) throws SQLException {
+ checkDisposed();
+ return implRow.getByte(arg0);
+ }
+
+ public byte[] getBytes(int arg0) throws SQLException {
+ checkDisposed();
+ return implRow.getBytes(arg0);
+ }
+
+ public XInputStream getCharacterStream(int arg0) throws SQLException {
+ checkDisposed();
+ return implRow.getCharacterStream(arg0);
+ }
+
+ public XClob getClob(int arg0) throws SQLException {
+ checkDisposed();
+ return implRow.getClob(arg0);
+ }
+
+ public Date getDate(int arg0) throws SQLException {
+ checkDisposed();
+ return implRow.getDate(arg0);
+ }
+
+ public double getDouble(int arg0) throws SQLException {
+ checkDisposed();
+ return implRow.getDouble(arg0);
+ }
+
+ public float getFloat(int arg0) throws SQLException {
+ checkDisposed();
+ return implRow.getFloat(arg0);
+ }
+
+ public int getInt(int arg0) throws SQLException {
+ checkDisposed();
+ return implRow.getInt(arg0);
+ }
+
+ public long getLong(int arg0) throws SQLException {
+ checkDisposed();
+ return implRow.getLong(arg0);
+ }
+
+ public Object getObject(int arg0, XNameAccess arg1) throws SQLException {
+ checkDisposed();
+ return implRow.getObject(arg0, arg1);
+ }
+
+ public XRef getRef(int arg0) throws SQLException {
+ checkDisposed();
+ return implRow.getRef(arg0);
+ }
+
+ public short getShort(int arg0) throws SQLException {
+ checkDisposed();
+ return implRow.getShort(arg0);
+ }
+
+ public String getString(int arg0) throws SQLException {
+ checkDisposed();
+ return implRow.getString(arg0);
+ }
+
+ public Time getTime(int arg0) throws SQLException {
+ checkDisposed();
+ return implRow.getTime(arg0);
+ }
+
+ public DateTime getTimestamp(int arg0) throws SQLException {
+ checkDisposed();
+ return implRow.getTimestamp(arg0);
+ }
+
+ public boolean wasNull() throws SQLException {
+ checkDisposed();
+ return implRow.wasNull();
+ }
+
+ // XResultSetMetaDataSupplier:
+
+ public XResultSetMetaData getMetaData() throws SQLException {
+ checkDisposed();
+ return new PostgresqlResultSetMetaData(implResultSetMetaDataSupplier.getMetaData());
+ }
+
+ // XCancellable:
+
+ public void cancel() {
+ checkDisposed();
+ implCancellable.cancel();
+ }
+
+ // XWarningsSupplier:
+
+ public void clearWarnings() throws SQLException {
+ checkDisposed();
+ implWarningsSupplier.clearWarnings();
+ }
+
+ public Object getWarnings() throws SQLException {
+ checkDisposed();
+ return implWarningsSupplier.getWarnings();
+ }
+
+ // XResultSetUpdate:
+
+ public void cancelRowUpdates() throws SQLException {
+ checkDisposed();
+ implResultSetUpdate.cancelRowUpdates();
+ }
+
+ public void deleteRow() throws SQLException {
+ checkDisposed();
+ implResultSetUpdate.deleteRow();
+ }
+
+ public void insertRow() throws SQLException {
+ checkDisposed();
+ implResultSetUpdate.insertRow();
+ }
+
+ public void moveToCurrentRow() throws SQLException {
+ checkDisposed();
+ implResultSetUpdate.moveToCurrentRow();
+ }
+
+ public void moveToInsertRow() throws SQLException {
+ checkDisposed();
+ implResultSetUpdate.moveToInsertRow();
+ }
+
+ public void updateRow() throws SQLException {
+ checkDisposed();
+ implResultSetUpdate.updateRow();
+ }
+
+ // XRowUpdate:
+
+ public void updateBinaryStream(int arg0, XInputStream arg1, int arg2) throws SQLException {
+ checkDisposed();
+ implRowUpdate.updateBinaryStream(arg0, arg1, arg2);
+ }
+
+ public void updateBoolean(int arg0, boolean arg1) throws SQLException {
+ checkDisposed();
+ implRowUpdate.updateBoolean(arg0, arg1);
+ }
+
+ public void updateByte(int arg0, byte arg1) throws SQLException {
+ checkDisposed();
+ implRowUpdate.updateByte(arg0, arg1);
+ }
+
+ public void updateBytes(int arg0, byte[] arg1) throws SQLException {
+ checkDisposed();
+ implRowUpdate.updateBytes(arg0, arg1);
+ }
+
+ public void updateCharacterStream(int arg0, XInputStream arg1, int arg2) throws SQLException {
+ checkDisposed();
+ implRowUpdate.updateCharacterStream(arg0, arg1, arg2);
+ }
+
+ public void updateDate(int arg0, Date arg1) throws SQLException {
+ checkDisposed();
+ implRowUpdate.updateDate(arg0, arg1);
+ }
+
+ public void updateDouble(int arg0, double arg1) throws SQLException {
+ checkDisposed();
+ implRowUpdate.updateDouble(arg0, arg1);
+ }
+
+ public void updateFloat(int arg0, float arg1) throws SQLException {
+ checkDisposed();
+ implRowUpdate.updateFloat(arg0, arg1);
+ }
+
+ public void updateInt(int arg0, int arg1) throws SQLException {
+ checkDisposed();
+ implRowUpdate.updateInt(arg0, arg1);
+ }
+
+ public void updateLong(int arg0, long arg1) throws SQLException {
+ checkDisposed();
+ implRowUpdate.updateLong(arg0, arg1);
+ }
+
+ public void updateNull(int arg0) throws SQLException {
+ checkDisposed();
+ implRowUpdate.updateNull(arg0);
+ }
+
+ public void updateNumericObject(int arg0, Object arg1, int arg2) throws SQLException {
+ checkDisposed();
+ implRowUpdate.updateNumericObject(arg0, arg1, arg2);
+ }
+
+ public void updateObject(int arg0, Object arg1) throws SQLException {
+ checkDisposed();
+ implRowUpdate.updateObject(arg0, arg1);
+ }
+
+ public void updateShort(int arg0, short arg1) throws SQLException {
+ checkDisposed();
+ implRowUpdate.updateShort(arg0, arg1);
+ }
+
+ public void updateString(int arg0, String arg1) throws SQLException {
+ checkDisposed();
+ implRowUpdate.updateString(arg0, arg1);
+ }
+
+ public void updateTime(int arg0, Time arg1) throws SQLException {
+ checkDisposed();
+ implRowUpdate.updateTime(arg0, arg1);
+ }
+
+ public void updateTimestamp(int arg0, DateTime arg1) throws SQLException {
+ checkDisposed();
+ implRowUpdate.updateTimestamp(arg0, arg1);
+ }
+
+ // XColumnLocate:
+
+ public int findColumn(String arg0) throws SQLException {
+ checkDisposed();
+ return implColumnLocate.findColumn(arg0);
+ }
+
+ // XPropertySet:
+
+ public void addPropertyChangeListener(String arg0, XPropertyChangeListener arg1) throws UnknownPropertyException, WrappedTargetException {
+ checkDisposed();
+ implPropertySet.addPropertyChangeListener(arg0, arg1);
+ }
+
+ public void addVetoableChangeListener(String arg0, XVetoableChangeListener arg1) throws UnknownPropertyException, WrappedTargetException {
+ checkDisposed();
+ implPropertySet.addVetoableChangeListener(arg0, arg1);
+ }
+
+ public XPropertySetInfo getPropertySetInfo() {
+ checkDisposed();
+ return implPropertySet.getPropertySetInfo();
+ }
+
+ public Object getPropertyValue(String arg0) throws UnknownPropertyException, WrappedTargetException {
+ checkDisposed();
+ return implPropertySet.getPropertyValue(arg0);
+ }
+
+ public void removePropertyChangeListener(String arg0, XPropertyChangeListener arg1) throws UnknownPropertyException, WrappedTargetException {
+ checkDisposed();
+ implPropertySet.removePropertyChangeListener(arg0, arg1);
+ }
+
+ public void removeVetoableChangeListener(String arg0, XVetoableChangeListener arg1) throws UnknownPropertyException, WrappedTargetException {
+ checkDisposed();
+ implPropertySet.removeVetoableChangeListener(arg0, arg1);
+ }
+
+ public void setPropertyValue(String arg0, Object arg1)
+ throws UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException {
+ checkDisposed();
+ implPropertySet.setPropertyValue(arg0, arg1);
+ }
+}
diff --git a/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/PostgresqlResultSetMetaData.java b/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/PostgresqlResultSetMetaData.java
new file mode 100644
index 000000000000..cb54880787f6
--- /dev/null
+++ b/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/PostgresqlResultSetMetaData.java
@@ -0,0 +1,127 @@
+/**************************************************************
+ *
+ * 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
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+
+package com.sun.star.sdbcx.comp.postgresql;
+
+import com.sun.star.lib.uno.helper.WeakBase;
+import com.sun.star.sdbc.DataType;
+import com.sun.star.sdbc.SQLException;
+import com.sun.star.sdbc.XResultSetMetaData;
+
+public class PostgresqlResultSetMetaData extends WeakBase implements XResultSetMetaData {
+
+ private XResultSetMetaData impl;
+
+ public PostgresqlResultSetMetaData(XResultSetMetaData impl) {
+ this.impl = impl;
+ }
+
+ public String getCatalogName(int arg0) throws SQLException {
+ return impl.getCatalogName(arg0);
+ }
+
+ public int getColumnCount() throws SQLException {
+ return impl.getColumnCount();
+ }
+
+ public int getColumnDisplaySize(int arg0) throws SQLException {
+ return impl.getColumnDisplaySize(arg0);
+ }
+
+ public String getColumnLabel(int arg0) throws SQLException {
+ return impl.getColumnLabel(arg0);
+ }
+
+ public String getColumnName(int arg0) throws SQLException {
+ return impl.getColumnName(arg0);
+ }
+
+ public String getColumnServiceName(int arg0) throws SQLException {
+ return impl.getColumnServiceName(arg0);
+ }
+
+ public int getColumnType(int column) throws SQLException {
+ int columnType = impl.getColumnType(column);
+ if (columnType == DataType.BIT) {
+ String columnName = getColumnTypeName(column);
+ if (columnName.equals("bool")) {
+ columnType = DataType.BOOLEAN;
+ }
+ }
+ return columnType;
+ }
+
+ public String getColumnTypeName(int column) throws SQLException {
+ return impl.getColumnTypeName(column);
+ }
+
+ public int getPrecision(int arg0) throws SQLException {
+ return impl.getPrecision(arg0);
+ }
+
+ public int getScale(int arg0) throws SQLException {
+ return impl.getScale(arg0);
+ }
+
+ public String getSchemaName(int arg0) throws SQLException {
+ return impl.getSchemaName(arg0);
+ }
+
+ public String getTableName(int arg0) throws SQLException {
+ return impl.getTableName(arg0);
+ }
+
+ public boolean isAutoIncrement(int arg0) throws SQLException {
+ return impl.isAutoIncrement(arg0);
+ }
+
+ public boolean isCaseSensitive(int arg0) throws SQLException {
+ return impl.isCaseSensitive(arg0);
+ }
+
+ public boolean isCurrency(int arg0) throws SQLException {
+ return impl.isCurrency(arg0);
+ }
+
+ public boolean isDefinitelyWritable(int arg0) throws SQLException {
+ return impl.isDefinitelyWritable(arg0);
+ }
+
+ public int isNullable(int arg0) throws SQLException {
+ return impl.isNullable(arg0);
+ }
+
+ public boolean isReadOnly(int arg0) throws SQLException {
+ return impl.isReadOnly(arg0);
+ }
+
+ public boolean isSearchable(int arg0) throws SQLException {
+ return impl.isSearchable(arg0);
+ }
+
+ public boolean isSigned(int arg0) throws SQLException {
+ return impl.isSigned(arg0);
+ }
+
+ public boolean isWritable(int arg0) throws SQLException {
+ return impl.isWritable(arg0);
+ }
+}
diff --git a/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/PostgresqlStatement.java b/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/PostgresqlStatement.java
new file mode 100644
index 000000000000..462e10f23399
--- /dev/null
+++ b/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/PostgresqlStatement.java
@@ -0,0 +1,188 @@
+/**************************************************************
+ *
+ * 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
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+
+package com.sun.star.sdbcx.comp.postgresql;
+
+import java.util.concurrent.atomic.AtomicBoolean;
+
+import com.sun.star.beans.PropertyVetoException;
+import com.sun.star.beans.UnknownPropertyException;
+import com.sun.star.beans.XPropertyChangeListener;
+import com.sun.star.beans.XPropertySet;
+import com.sun.star.beans.XPropertySetInfo;
+import com.sun.star.beans.XVetoableChangeListener;
+import com.sun.star.lang.DisposedException;
+import com.sun.star.lang.IllegalArgumentException;
+import com.sun.star.lang.WrappedTargetException;
+import com.sun.star.lib.uno.helper.ComponentBase;
+import com.sun.star.sdbc.SQLException;
+import com.sun.star.sdbc.XCloseable;
+import com.sun.star.sdbc.XConnection;
+import com.sun.star.sdbc.XMultipleResults;
+import com.sun.star.sdbc.XResultSet;
+import com.sun.star.sdbc.XStatement;
+import com.sun.star.sdbc.XWarningsSupplier;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.util.XCancellable;
+
+public class PostgresqlStatement extends ComponentBase
+ implements XCloseable, XPropertySet, XCancellable, XStatement, XWarningsSupplier, XMultipleResults {
+
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list