Author: damjan
Date: Sun Aug 20 19:16:28 2017
New Revision: 1805579
URL: http://svn.apache.org/viewvc?rev=1805579&view=rev
Log:
#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
Added:
openoffice/trunk/main/connectivity/java/sdbc_postgresql/
openoffice/trunk/main/connectivity/java/sdbc_postgresql/build.xml (with
props)
openoffice/trunk/main/connectivity/java/sdbc_postgresql/makefile.mk
openoffice/trunk/main/connectivity/java/sdbc_postgresql/postgresql.component
(with props)
openoffice/trunk/main/connectivity/java/sdbc_postgresql/sdbc_postgresql.xcu
(with props)
openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/
openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/
openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/
openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/
openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/
openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/
openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/
openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/PostgresqlCatalog.java
(with props)
openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/PostgresqlConnection.java
(with props)
openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/PostgresqlDatabaseMetadata.java
(with props)
openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/PostgresqlDriver.java
(with props)
openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/PostgresqlPreparedStatement.java
(with props)
openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/PostgresqlResultSet.java
(with props)
openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/PostgresqlResultSetMetaData.java
(with props)
openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/PostgresqlStatement.java
(with props)
openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/PostgresqlTable.java
(with props)
openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/PostgresqlTables.java
(with props)
openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/comphelper/
openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/comphelper/CompHelper.java
(with props)
openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/comphelper/OArrayEnumeration.java
(with props)
openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/comphelper/OEnumerationByIndex.java
(with props)
openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/comphelper/OEnumerationByName.java
(with props)
openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/comphelper/PropertySet.java
(with props)
openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/comphelper/PropertySetAdapter.java
(with props)
openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/sdbcx/
openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/sdbcx/ISQLStatementHelper.java
(with props)
openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/sdbcx/OCatalog.java
(with props)
openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/sdbcx/OColumn.java
(with props)
openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/sdbcx/OColumnContainer.java
(with props)
openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/sdbcx/OContainer.java
(with props)
openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/sdbcx/ODescriptor.java
(with props)
openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/sdbcx/OIndex.java
(with props)
openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/sdbcx/OIndexColumn.java
(with props)
openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/sdbcx/OIndexColumnContainer.java
(with props)
openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/sdbcx/OIndexContainer.java
(with props)
openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/sdbcx/OKey.java
(with props)
openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/sdbcx/OKeyColumn.java
(with props)
openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/sdbcx/OKeyColumnContainer.java
(with props)
openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/sdbcx/OKeyContainer.java
(with props)
openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/sdbcx/OTable.java
(with props)
openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/sdbcx/OfficeResourceBundle.java
(with props)
openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/sdbcx/Resources.java
(with props)
openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/sdbcx/SharedResources.java
(with props)
openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/sdbcx/SqlTableHelper.java
(with props)
openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/sdbcx/descriptors/
openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/sdbcx/descriptors/SdbcxColumnDescriptor.java
(with props)
openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/sdbcx/descriptors/SdbcxColumnDescriptorContainer.java
(with props)
openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/sdbcx/descriptors/SdbcxDescriptorContainer.java
(with props)
openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/sdbcx/descriptors/SdbcxIndexColumnDescriptor.java
(with props)
openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/sdbcx/descriptors/SdbcxIndexColumnDescriptorContainer.java
(with props)
openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/sdbcx/descriptors/SdbcxIndexDescriptor.java
(with props)
openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/sdbcx/descriptors/SdbcxIndexDescriptorContainer.java
(with props)
openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/sdbcx/descriptors/SdbcxKeyColumnDescriptor.java
(with props)
openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/sdbcx/descriptors/SdbcxKeyColumnDescriptorContainer.java
(with props)
openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/sdbcx/descriptors/SdbcxKeyDescriptor.java
(with props)
openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/sdbcx/descriptors/SdbcxKeyDescriptorContainer.java
(with props)
openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/sdbcx/descriptors/SdbcxTableDescriptor.java
(with props)
openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/util/
openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/util/ComposeRule.java
(with props)
openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/util/DBTypeConversion.java
(with props)
openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/util/DatabaseMetaDataResultSet.java
(with props)
openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/util/DbTools.java
(with props)
openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/util/MapToXNameAccessAdapter.java
(with props)
openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/util/MapToXNameContainerAdapter.java
(with props)
openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/util/ORowSetValue.java
(with props)
openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/util/Osl.java
(with props)
openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/util/PropertyIds.java
(with props)
openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/util/StandardSQLState.java
(with props)
Modified:
openoffice/trunk/main/apache-commons/java/lang/makefile.mk
openoffice/trunk/main/configure.ac
openoffice/trunk/main/connectivity/prj/build.lst
openoffice/trunk/main/connectivity/prj/d.lst
openoffice/trunk/main/connectivity/target.pmk
openoffice/trunk/main/dbaccess/source/core/misc/dsntypes.cxx
openoffice/trunk/main/dbaccess/source/inc/dsntypes.hxx
openoffice/trunk/main/postprocess/packcomponents/makefile.mk
openoffice/trunk/main/postprocess/packregistry/makefile.mk
openoffice/trunk/main/scp2/source/ooo/file_ooo.scp
openoffice/trunk/main/scp2/source/ooo/module_hidden_ooo.scp
Modified: openoffice/trunk/main/apache-commons/java/lang/makefile.mk
URL:
http://svn.apache.org/viewvc/openoffice/trunk/main/apache-commons/java/lang/makefile.mk?rev=1805579&r1=1805578&r2=1805579&view=diff
==============================================================================
--- openoffice/trunk/main/apache-commons/java/lang/makefile.mk (original)
+++ openoffice/trunk/main/apache-commons/java/lang/makefile.mk Sun Aug 20
19:16:28 2017
@@ -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
.INCLUDE : set_ext.mk
.INCLUDE : target.mk
-.IF "$(SOLAR_JAVA)" != "" && "$(ENABLE_MEDIAWIKI)" == "YES"
+.IF "$(SOLAR_JAVA)" != ""
.INCLUDE : tg_ext.mk
.ENDIF
Modified: openoffice/trunk/main/configure.ac
URL:
http://svn.apache.org/viewvc/openoffice/trunk/main/configure.ac?rev=1805579&r1=1805578&r2=1805579&view=diff
==============================================================================
--- openoffice/trunk/main/configure.ac (original)
+++ openoffice/trunk/main/configure.ac Sun Aug 20 19:16:28 2017
@@ -6246,94 +6246,94 @@ AC_SUBST(LIBFONTS_JAR)
AC_SUBST(LIBSERIALIZER_JAR)
# this has to be here because both the wiki publisher and the SRB use
-# commons-logging
-if test "$ENABLE_MEDIAWIKI" = "YES" -o "$ENABLE_REPORTBUILDER" = "YES"; then
- AC_MSG_CHECKING([which Apache commons-* libs to use])
- if test "$with_system_apache_commons" = "yes"; then
- SYSTEM_APACHE_COMMONS=YES
- AC_MSG_RESULT([external])
- if test "$ENABLE_MEDIAWIKI" = "YES"; then
- if test -z $COMMONS_CODEC_JAR; then
- AC_CHECK_FILE(/usr/share/java/commons-codec-1.9.jar,
- [ COMMONS_CODEC_JAR=/usr/share/java/commons-codec-1.9.jar ],
- [
- AC_CHECK_FILE(/usr/share/java/commons-codec.jar,
- [ COMMONS_CODEC_JAR=/usr/share/java/commons-codec.jar ],
- [AC_MSG_ERROR(commons-codec.jar replacement not found.)]
- )
- ]
- )
- else
- AC_CHECK_FILE($COMMONS_CODEC_JAR, [],
- [AC_MSG_ERROR(commons-codec.jar not found.)], [])
- fi
+# commons-logging, while the non-optional PostgreSQL connector uses
+# commons-lang.
+AC_MSG_CHECKING([which Apache commons-* libs to use])
+if test "$with_system_apache_commons" = "yes"; then
+ SYSTEM_APACHE_COMMONS=YES
+ AC_MSG_RESULT([external])
- if test -z $COMMONS_LANG_JAR; then
- AC_CHECK_FILE(/usr/share/java/commons-lang3-3.3.jar,
- [ COMMONS_LANG_JAR=/usr/share/java/commons-lang3-3.3.jar ],
- [
- AC_CHECK_FILE(/usr/share/java/commons-lang.jar,
- [ COMMONS_LANG_JAR=/usr/share/java/commons-lang.jar ],
- [AC_MSG_ERROR(commons-lang.jar replacement not found.)]
- )
- ]
+ if test -z $COMMONS_LANG_JAR; then
+ AC_CHECK_FILE(/usr/share/java/commons-lang3-3.3.jar,
+ [ COMMONS_LANG_JAR=/usr/share/java/commons-lang3-3.3.jar ],
+ [
+ AC_CHECK_FILE(/usr/share/java/commons-lang.jar,
+ [ COMMONS_LANG_JAR=/usr/share/java/commons-lang.jar ],
+ [AC_MSG_ERROR(commons-lang.jar replacement not found.)]
)
- else
- AC_CHECK_FILE($COMMONS_LANG_JAR, [],
- [AC_MSG_ERROR(commons-lang.jar not found.)], [])
- fi
- AC_MSG_CHECKING([whether commons-lang is version 3.x])
- export COMMONS_LANG_JAR
- if $PERL -e 'use Archive::Zip;
- my $file = "$ENV{'COMMONS_LANG_JAR'}";
- my $zip = Archive::Zip->new( $file );
- my $mf = $zip->contents ( "META-INF/MANIFEST.MF" );
- if ( $mf =~ m/Specification-Version: 3.*/ ) {
- exit 0;
- } else {
- exit 1;
- }'; then
- AC_MSG_RESULT([yes])
- else
- AC_MSG_ERROR([no, you need Apache Commons Lang 3.x])
- fi
+ ]
+ )
+ else
+ AC_CHECK_FILE($COMMONS_LANG_JAR, [],
+ [AC_MSG_ERROR(commons-lang.jar not found.)], [])
+ fi
+ AC_MSG_CHECKING([whether commons-lang is version 3.x])
+ export COMMONS_LANG_JAR
+ if $PERL -e 'use Archive::Zip;
+ my $file = "$ENV{'COMMONS_LANG_JAR'}";
+ my $zip = Archive::Zip->new( $file );
+ my $mf = $zip->contents ( "META-INF/MANIFEST.MF" );
+ if ( $mf =~ m/Specification-Version: 3.*/ ) {
+ exit 0;
+ } else {
+ exit 1;
+ }'; then
+ AC_MSG_RESULT([yes])
+ else
+ AC_MSG_ERROR([no, you need Apache Commons Lang 3.x])
+ fi
- if test -z $COMMONS_HTTPCLIENT_JAR; then
- AC_CHECK_FILE(/usr/share/java/commons-httpclient-3.1.jar,
- [ COMMONS_HTTPCLIENT_JAR=/usr/share/java/commons-httpclient-3.1.jar
],
- [
- AC_CHECK_FILE(/usr/share/java/commons-httpclient.jar,
- [ COMMONS_HTTPCLIENT_JAR=/usr/share/java/commons-httpclient.jar
],
- [AC_MSG_ERROR(commons-httpclient.jar replacement not found.)]
- )
- ]
- )
- else
- AC_CHECK_FILE($COMMONS_HTTPCLIENT_JAR, [],
- [AC_MSG_ERROR(commons-httpclient.jar not found.)], [])
- fi
+ if test "$ENABLE_MEDIAWIKI" = "YES"; then
+ if test -z $COMMONS_CODEC_JAR; then
+ AC_CHECK_FILE(/usr/share/java/commons-codec-1.9.jar,
+ [ COMMONS_CODEC_JAR=/usr/share/java/commons-codec-1.9.jar ],
+ [
+ AC_CHECK_FILE(/usr/share/java/commons-codec.jar,
+ [ COMMONS_CODEC_JAR=/usr/share/java/commons-codec.jar ],
+ [AC_MSG_ERROR(commons-codec.jar replacement not found.)]
+ )
+ ]
+ )
+ else
+ AC_CHECK_FILE($COMMONS_CODEC_JAR, [],
+ [AC_MSG_ERROR(commons-codec.jar not found.)], [])
fi
- if test "$ENABLE_MEDIAWIKI" = "YES" -o "$ENABLE_REPORTBUILDER" = "YES";
then
- if test -z $COMMONS_LOGGING_JAR; then
- AC_CHECK_FILE(/usr/share/java/commons-logging-1.1.3.jar,
- [ COMMONS_LOGGING_JAR=/usr/share/java/commons-logging-1.1.3.jar ],
- [
- AC_CHECK_FILE(/usr/share/java/commons-logging.jar,
- [ COMMONS_LOGGING_JAR=/usr/share/java/commons-logging.jar ],
- [AC_MSG_ERROR(commons-logging.jar replacement not found.)]
- )
- ]
- )
- else
- AC_CHECK_FILE($COMMONS_LOGGING_JAR, [],
- [AC_MSG_ERROR(commons-logging.jar not found.)], [])
- fi
+
+ if test -z $COMMONS_HTTPCLIENT_JAR; then
+ AC_CHECK_FILE(/usr/share/java/commons-httpclient-3.1.jar,
+ [ COMMONS_HTTPCLIENT_JAR=/usr/share/java/commons-httpclient-3.1.jar ],
+ [
+ AC_CHECK_FILE(/usr/share/java/commons-httpclient.jar,
+ [ COMMONS_HTTPCLIENT_JAR=/usr/share/java/commons-httpclient.jar ],
+ [AC_MSG_ERROR(commons-httpclient.jar replacement not found.)]
+ )
+ ]
+ )
+ else
+ AC_CHECK_FILE($COMMONS_HTTPCLIENT_JAR, [],
+ [AC_MSG_ERROR(commons-httpclient.jar not found.)], [])
+ fi
+ fi
+ if test "$ENABLE_MEDIAWIKI" = "YES" -o "$ENABLE_REPORTBUILDER" = "YES"; then
+ if test -z $COMMONS_LOGGING_JAR; then
+ AC_CHECK_FILE(/usr/share/java/commons-logging-1.1.3.jar,
+ [ COMMONS_LOGGING_JAR=/usr/share/java/commons-logging-1.1.3.jar ],
+ [
+ AC_CHECK_FILE(/usr/share/java/commons-logging.jar,
+ [ COMMONS_LOGGING_JAR=/usr/share/java/commons-logging.jar ],
+ [AC_MSG_ERROR(commons-logging.jar replacement not found.)]
+ )
+ ]
+ )
+ else
+ AC_CHECK_FILE($COMMONS_LOGGING_JAR, [],
+ [AC_MSG_ERROR(commons-logging.jar not found.)], [])
fi
- else
- AC_MSG_RESULT([internal])
- SYSTEM_APACHE_COMMONS=NO
- BUILD_TYPE="$BUILD_TYPE APACHE_COMMONS TOMCAT"
fi
+else
+ AC_MSG_RESULT([internal])
+ SYSTEM_APACHE_COMMONS=NO
+ BUILD_TYPE="$BUILD_TYPE APACHE_COMMONS TOMCAT"
fi
AC_SUBST(SYSTEM_APACHE_COMMONS)
AC_SUBST(COMMONS_CODEC_JAR)
Added: openoffice/trunk/main/connectivity/java/sdbc_postgresql/build.xml
URL:
http://svn.apache.org/viewvc/openoffice/trunk/main/connectivity/java/sdbc_postgresql/build.xml?rev=1805579&view=auto
==============================================================================
--- openoffice/trunk/main/connectivity/java/sdbc_postgresql/build.xml (added)
+++ openoffice/trunk/main/connectivity/java/sdbc_postgresql/build.xml Sun Aug
20 19:16:28 2017
@@ -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 &#169; 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>
+
Propchange: openoffice/trunk/main/connectivity/java/sdbc_postgresql/build.xml
------------------------------------------------------------------------------
svn:eol-style = native
Added: openoffice/trunk/main/connectivity/java/sdbc_postgresql/makefile.mk
URL:
http://svn.apache.org/viewvc/openoffice/trunk/main/connectivity/java/sdbc_postgresql/makefile.mk?rev=1805579&view=auto
==============================================================================
--- openoffice/trunk/main/connectivity/java/sdbc_postgresql/makefile.mk (added)
+++ openoffice/trunk/main/connectivity/java/sdbc_postgresql/makefile.mk Sun Aug
20 19:16:28 2017
@@ -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
+
Added:
openoffice/trunk/main/connectivity/java/sdbc_postgresql/postgresql.component
URL:
http://svn.apache.org/viewvc/openoffice/trunk/main/connectivity/java/sdbc_postgresql/postgresql.component?rev=1805579&view=auto
==============================================================================
Binary file - no diff available.
Propchange:
openoffice/trunk/main/connectivity/java/sdbc_postgresql/postgresql.component
------------------------------------------------------------------------------
svn:mime-type = application/xml
Added:
openoffice/trunk/main/connectivity/java/sdbc_postgresql/sdbc_postgresql.xcu
URL:
http://svn.apache.org/viewvc/openoffice/trunk/main/connectivity/java/sdbc_postgresql/sdbc_postgresql.xcu?rev=1805579&view=auto
==============================================================================
Binary file - no diff available.
Propchange:
openoffice/trunk/main/connectivity/java/sdbc_postgresql/sdbc_postgresql.xcu
------------------------------------------------------------------------------
svn:mime-type = application/xml
Added:
openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/PostgresqlCatalog.java
URL:
http://svn.apache.org/viewvc/openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/PostgresqlCatalog.java?rev=1805579&view=auto
==============================================================================
---
openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/PostgresqlCatalog.java
(added)
+++
openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/PostgresqlCatalog.java
Sun Aug 20 19:16:28 2017
@@ -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;
+ }
+}
Propchange:
openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/PostgresqlCatalog.java
------------------------------------------------------------------------------
svn:eol-style = native
Added:
openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/PostgresqlConnection.java
URL:
http://svn.apache.org/viewvc/openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/PostgresqlConnection.java?rev=1805579&view=auto
==============================================================================
---
openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/PostgresqlConnection.java
(added)
+++
openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/PostgresqlConnection.java
Sun Aug 20 19:16:28 2017
@@ -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);
+ }
+}
Propchange:
openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/PostgresqlConnection.java
------------------------------------------------------------------------------
svn:eol-style = native
Added:
openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/PostgresqlDatabaseMetadata.java
URL:
http://svn.apache.org/viewvc/openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/PostgresqlDatabaseMetadata.java?rev=1805579&view=auto
==============================================================================
---
openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/PostgresqlDatabaseMetadata.java
(added)
+++
openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/PostgresqlDatabaseMetadata.java
Sun Aug 20 19:16:28 2017
@@ -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();
+ }
+}
Propchange:
openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/PostgresqlDatabaseMetadata.java
------------------------------------------------------------------------------
svn:eol-style = native
Added:
openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/PostgresqlDriver.java
URL:
http://svn.apache.org/viewvc/openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/PostgresqlDriver.java?rev=1805579&view=auto
==============================================================================
---
openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/PostgresqlDriver.java
(added)
+++
openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/PostgresqlDriver.java
Sun Aug 20 19:16:28 2017
@@ -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));
+ }
+}
Propchange:
openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/PostgresqlDriver.java
------------------------------------------------------------------------------
svn:eol-style = native