diff --git a/061a9f17323117c9358ed60f33ecff78-postgresql-9.1.1.tar.bz2 b/061a9f17323117c9358ed60f33ecff78-postgresql-9.1.1.tar.bz2 new file mode 100644 index 0000000..fceec2f --- /dev/null +++ b/061a9f17323117c9358ed60f33ecff78-postgresql-9.1.1.tar.bz2 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c794016bcf3fc1f561bc86796c6c9d050e3d8d2d55356515126e048275ae56f2 +size 14884071 diff --git a/0981bda6548a8c8233ffce2b6e4b2a23-mysql-connector-c++-1.1.0.tar.gz b/0981bda6548a8c8233ffce2b6e4b2a23-mysql-connector-c++-1.1.0.tar.gz new file mode 100644 index 0000000..e91c650 --- /dev/null +++ b/0981bda6548a8c8233ffce2b6e4b2a23-mysql-connector-c++-1.1.0.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:dfb8933dada706a1b3188b162fc5a9686b5ed46323bf09548ce291e8dd4545e2 +size 467089 diff --git a/128cfc86ed5953e57fe0f5ae98b62c2e-libtextcat-2.2.tar.gz b/128cfc86ed5953e57fe0f5ae98b62c2e-libtextcat-2.2.tar.gz deleted file mode 100644 index ef3b6b2..0000000 --- a/128cfc86ed5953e57fe0f5ae98b62c2e-libtextcat-2.2.tar.gz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:5677badffc48a8d332e345ea4fe225e3577f53fc95deeec8306000b256829655 -size 540999 diff --git a/34dd7951abbda99b7a75a09993a37965-libwps-0.2.4.tar.bz2 b/34dd7951abbda99b7a75a09993a37965-libwps-0.2.4.tar.bz2 new file mode 100644 index 0000000..5e6d1f2 --- /dev/null +++ b/34dd7951abbda99b7a75a09993a37965-libwps-0.2.4.tar.bz2 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:48a5bcc0fa8e51a27ec949937dba384e16c2f13a2ec727864af78df077d20c9f +size 314984 diff --git a/5ba6a61a2f66dfd5fee8cdd4cd262a37-libwpg-0.2.0.tar.bz2 b/5ba6a61a2f66dfd5fee8cdd4cd262a37-libwpg-0.2.0.tar.bz2 deleted file mode 100644 index fab8cbc..0000000 --- a/5ba6a61a2f66dfd5fee8cdd4cd262a37-libwpg-0.2.0.tar.bz2 +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:d823f4b2ddfe349cca09e40bd57af8220e8bf935bcfb66be520e02ba4d327dc6 -size 326684 diff --git a/7c2549f6b0a8bb604e6c4c729ffdcfe6-libcmis-0.1.0.tar.gz b/7c2549f6b0a8bb604e6c4c729ffdcfe6-libcmis-0.1.0.tar.gz new file mode 100644 index 0000000..726f069 --- /dev/null +++ b/7c2549f6b0a8bb604e6c4c729ffdcfe6-libcmis-0.1.0.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:78e6244c96c29c01babf38cd5176bcd9b5bafa8730bb84082340c691c70dfe76 +size 373519 diff --git a/801-sdbc-postgresql.diff b/801-sdbc-postgresql.diff deleted file mode 100644 index 36c3019..0000000 --- a/801-sdbc-postgresql.diff +++ /dev/null @@ -1,22230 +0,0 @@ ---- - connectivity/source/drivers/postgresql/makefile.mk | 214 ++ - .../source/drivers/postgresql/postgresql-sdbc.uno | 2 + - .../source/drivers/postgresql/postgresql.xcu | 50 + - .../source/drivers/postgresql/pq_allocator.hxx | 225 ++ - .../source/drivers/postgresql/pq_array.cxx | 95 + - .../source/drivers/postgresql/pq_array.hxx | 128 ++ - .../source/drivers/postgresql/pq_baseresultset.cxx | 742 +++++++ - .../source/drivers/postgresql/pq_baseresultset.hxx | 268 +++ - .../source/drivers/postgresql/pq_connection.cxx | 740 +++++++ - .../source/drivers/postgresql/pq_connection.hxx | 285 +++ - .../drivers/postgresql/pq_databasemetadata.cxx | 2164 ++++++++++++++++++++ - .../drivers/postgresql/pq_databasemetadata.hxx | 244 +++ - .../source/drivers/postgresql/pq_driver.cxx | 406 ++++ - .../source/drivers/postgresql/pq_driver.hxx | 161 ++ - .../postgresql/pq_fakedupdateableresultset.cxx | 206 ++ - .../postgresql/pq_fakedupdateableresultset.hxx | 133 ++ - .../drivers/postgresql/pq_preparedstatement.cxx | 881 ++++++++ - .../drivers/postgresql/pq_preparedstatement.hxx | 284 +++ - .../source/drivers/postgresql/pq_resultset.cxx | 257 +++ - .../source/drivers/postgresql/pq_resultset.hxx | 122 ++ - .../drivers/postgresql/pq_resultsetmetadata.cxx | 523 +++++ - .../drivers/postgresql/pq_resultsetmetadata.hxx | 156 ++ - .../drivers/postgresql/pq_sequenceresultset.cxx | 150 ++ - .../drivers/postgresql/pq_sequenceresultset.hxx | 130 ++ - .../postgresql/pq_sequenceresultsetmetadata.cxx | 182 ++ - .../postgresql/pq_sequenceresultsetmetadata.hxx | 53 + - .../source/drivers/postgresql/pq_statement.cxx | 1063 ++++++++++ - .../source/drivers/postgresql/pq_statement.hxx | 229 +++ - .../source/drivers/postgresql/pq_statics.cxx | 758 +++++++ - .../source/drivers/postgresql/pq_statics.hxx | 296 +++ - .../source/drivers/postgresql/pq_tools.cxx | 1232 +++++++++++ - .../source/drivers/postgresql/pq_tools.hxx | 201 ++ - .../drivers/postgresql/pq_updateableresultset.cxx | 569 +++++ - .../drivers/postgresql/pq_updateableresultset.hxx | 118 ++ - .../source/drivers/postgresql/pq_xbase.cxx | 279 +++ - .../source/drivers/postgresql/pq_xbase.hxx | 161 ++ - .../source/drivers/postgresql/pq_xcolumn.cxx | 124 ++ - .../source/drivers/postgresql/pq_xcolumn.hxx | 108 + - .../source/drivers/postgresql/pq_xcolumns.cxx | 616 ++++++ - .../source/drivers/postgresql/pq_xcolumns.hxx | 147 ++ - .../source/drivers/postgresql/pq_xcontainer.cxx | 514 +++++ - .../source/drivers/postgresql/pq_xcontainer.hxx | 240 +++ - .../source/drivers/postgresql/pq_xindex.cxx | 267 +++ - .../source/drivers/postgresql/pq_xindex.hxx | 156 ++ - .../source/drivers/postgresql/pq_xindexcolumn.cxx | 122 ++ - .../source/drivers/postgresql/pq_xindexcolumn.hxx | 109 + - .../source/drivers/postgresql/pq_xindexcolumns.cxx | 322 +++ - .../source/drivers/postgresql/pq_xindexcolumns.hxx | 146 ++ - .../source/drivers/postgresql/pq_xindexes.cxx | 355 ++++ - .../source/drivers/postgresql/pq_xindexes.hxx | 135 ++ - connectivity/source/drivers/postgresql/pq_xkey.cxx | 262 +++ - connectivity/source/drivers/postgresql/pq_xkey.hxx | 152 ++ - .../source/drivers/postgresql/pq_xkeycolumn.cxx | 121 ++ - .../source/drivers/postgresql/pq_xkeycolumn.hxx | 108 + - .../source/drivers/postgresql/pq_xkeycolumns.cxx | 411 ++++ - .../source/drivers/postgresql/pq_xkeycolumns.hxx | 134 ++ - .../source/drivers/postgresql/pq_xkeys.cxx | 387 ++++ - .../source/drivers/postgresql/pq_xkeys.hxx | 134 ++ - .../source/drivers/postgresql/pq_xtable.cxx | 484 +++++ - .../source/drivers/postgresql/pq_xtable.hxx | 220 ++ - .../source/drivers/postgresql/pq_xtables.cxx | 464 +++++ - .../source/drivers/postgresql/pq_xtables.hxx | 118 ++ - .../source/drivers/postgresql/pq_xuser.cxx | 257 +++ - .../source/drivers/postgresql/pq_xuser.hxx | 132 ++ - .../source/drivers/postgresql/pq_xusers.cxx | 256 +++ - .../source/drivers/postgresql/pq_xusers.hxx | 116 ++ - .../source/drivers/postgresql/pq_xview.cxx | 285 +++ - .../source/drivers/postgresql/pq_xview.hxx | 133 ++ - .../source/drivers/postgresql/pq_xviews.cxx | 304 +++ - .../source/drivers/postgresql/pq_xviews.hxx | 118 ++ - 70 files changed, 21664 insertions(+), 0 deletions(-) - create mode 100644 connectivity/source/drivers/postgresql/makefile.mk - create mode 100644 connectivity/source/drivers/postgresql/postgresql-sdbc.uno - create mode 100644 connectivity/source/drivers/postgresql/postgresql.xcu - create mode 100644 connectivity/source/drivers/postgresql/pq_allocator.hxx - create mode 100644 connectivity/source/drivers/postgresql/pq_array.cxx - create mode 100644 connectivity/source/drivers/postgresql/pq_array.hxx - create mode 100644 connectivity/source/drivers/postgresql/pq_baseresultset.cxx - create mode 100644 connectivity/source/drivers/postgresql/pq_baseresultset.hxx - create mode 100644 connectivity/source/drivers/postgresql/pq_connection.cxx - create mode 100644 connectivity/source/drivers/postgresql/pq_connection.hxx - create mode 100644 connectivity/source/drivers/postgresql/pq_databasemetadata.cxx - create mode 100644 connectivity/source/drivers/postgresql/pq_databasemetadata.hxx - create mode 100644 connectivity/source/drivers/postgresql/pq_driver.cxx - create mode 100644 connectivity/source/drivers/postgresql/pq_driver.hxx - create mode 100644 connectivity/source/drivers/postgresql/pq_fakedupdateableresultset.cxx - create mode 100644 connectivity/source/drivers/postgresql/pq_fakedupdateableresultset.hxx - create mode 100644 connectivity/source/drivers/postgresql/pq_preparedstatement.cxx - create mode 100644 connectivity/source/drivers/postgresql/pq_preparedstatement.hxx - create mode 100644 connectivity/source/drivers/postgresql/pq_resultset.cxx - create mode 100644 connectivity/source/drivers/postgresql/pq_resultset.hxx - create mode 100644 connectivity/source/drivers/postgresql/pq_resultsetmetadata.cxx - create mode 100644 connectivity/source/drivers/postgresql/pq_resultsetmetadata.hxx - create mode 100644 connectivity/source/drivers/postgresql/pq_sequenceresultset.cxx - create mode 100644 connectivity/source/drivers/postgresql/pq_sequenceresultset.hxx - create mode 100644 connectivity/source/drivers/postgresql/pq_sequenceresultsetmetadata.cxx - create mode 100644 connectivity/source/drivers/postgresql/pq_sequenceresultsetmetadata.hxx - create mode 100644 connectivity/source/drivers/postgresql/pq_statement.cxx - create mode 100644 connectivity/source/drivers/postgresql/pq_statement.hxx - create mode 100644 connectivity/source/drivers/postgresql/pq_statics.cxx - create mode 100644 connectivity/source/drivers/postgresql/pq_statics.hxx - create mode 100644 connectivity/source/drivers/postgresql/pq_tools.cxx - create mode 100644 connectivity/source/drivers/postgresql/pq_tools.hxx - create mode 100644 connectivity/source/drivers/postgresql/pq_updateableresultset.cxx - create mode 100644 connectivity/source/drivers/postgresql/pq_updateableresultset.hxx - create mode 100644 connectivity/source/drivers/postgresql/pq_xbase.cxx - create mode 100644 connectivity/source/drivers/postgresql/pq_xbase.hxx - create mode 100644 connectivity/source/drivers/postgresql/pq_xcolumn.cxx - create mode 100644 connectivity/source/drivers/postgresql/pq_xcolumn.hxx - create mode 100644 connectivity/source/drivers/postgresql/pq_xcolumns.cxx - create mode 100644 connectivity/source/drivers/postgresql/pq_xcolumns.hxx - create mode 100644 connectivity/source/drivers/postgresql/pq_xcontainer.cxx - create mode 100644 connectivity/source/drivers/postgresql/pq_xcontainer.hxx - create mode 100644 connectivity/source/drivers/postgresql/pq_xindex.cxx - create mode 100644 connectivity/source/drivers/postgresql/pq_xindex.hxx - create mode 100644 connectivity/source/drivers/postgresql/pq_xindexcolumn.cxx - create mode 100644 connectivity/source/drivers/postgresql/pq_xindexcolumn.hxx - create mode 100644 connectivity/source/drivers/postgresql/pq_xindexcolumns.cxx - create mode 100644 connectivity/source/drivers/postgresql/pq_xindexcolumns.hxx - create mode 100644 connectivity/source/drivers/postgresql/pq_xindexes.cxx - create mode 100644 connectivity/source/drivers/postgresql/pq_xindexes.hxx - create mode 100644 connectivity/source/drivers/postgresql/pq_xkey.cxx - create mode 100644 connectivity/source/drivers/postgresql/pq_xkey.hxx - create mode 100644 connectivity/source/drivers/postgresql/pq_xkeycolumn.cxx - create mode 100644 connectivity/source/drivers/postgresql/pq_xkeycolumn.hxx - create mode 100644 connectivity/source/drivers/postgresql/pq_xkeycolumns.cxx - create mode 100644 connectivity/source/drivers/postgresql/pq_xkeycolumns.hxx - create mode 100644 connectivity/source/drivers/postgresql/pq_xkeys.cxx - create mode 100644 connectivity/source/drivers/postgresql/pq_xkeys.hxx - create mode 100644 connectivity/source/drivers/postgresql/pq_xtable.cxx - create mode 100644 connectivity/source/drivers/postgresql/pq_xtable.hxx - create mode 100644 connectivity/source/drivers/postgresql/pq_xtables.cxx - create mode 100644 connectivity/source/drivers/postgresql/pq_xtables.hxx - create mode 100644 connectivity/source/drivers/postgresql/pq_xuser.cxx - create mode 100644 connectivity/source/drivers/postgresql/pq_xuser.hxx - create mode 100644 connectivity/source/drivers/postgresql/pq_xusers.cxx - create mode 100644 connectivity/source/drivers/postgresql/pq_xusers.hxx - create mode 100644 connectivity/source/drivers/postgresql/pq_xview.cxx - create mode 100644 connectivity/source/drivers/postgresql/pq_xview.hxx - create mode 100644 connectivity/source/drivers/postgresql/pq_xviews.cxx - create mode 100644 connectivity/source/drivers/postgresql/pq_xviews.hxx - -diff --git connectivity/source/drivers/postgresql/makefile.mk connectivity/source/drivers/postgresql/makefile.mk -new file mode 100644 -index 0000000..1afe9c1 ---- /dev/null -+++ connectivity/source/drivers/postgresql/makefile.mk -@@ -0,0 +1,214 @@ -+#************************************************************************* -+# -+# $RCSfile: makefile.mk,v $ -+# -+# $Revision: 1.1.2.15 $ -+# -+# last change: $Author: jbu $ $Date: 2010/02/07 12:31:34 $ -+# -+# The Contents of this file are made available subject to the terms of -+# either of the following licenses -+# -+# - GNU Lesser General Public License Version 2.1 -+# - Sun Industry Standards Source License Version 1.1 -+# -+# Sun Microsystems Inc., October, 2000 -+# -+# GNU Lesser General Public License Version 2.1 -+# ============================================= -+# Copyright 2000 by Sun Microsystems, Inc. -+# 901 San Antonio Road, Palo Alto, CA 94303, USA -+# -+# This library is free software; you can redistribute it and/or -+# modify it under the terms of the GNU Lesser General Public -+# License version 2.1, as published by the Free Software Foundation. -+# -+# This library is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+# Lesser General Public License for more details. -+# -+# You should have received a copy of the GNU Lesser General Public -+# License along with this library; if not, write to the Free Software -+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, -+# MA 02111-1307 USA -+# -+# -+# Sun Industry Standards Source License Version 1.1 -+# ================================================= -+# The contents of this file are subject to the Sun Industry Standards -+# Source License Version 1.1 (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.openoffice.org/license.html. -+# -+# Software provided under this License is provided on an "AS IS" basis, -+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, -+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, -+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. -+# See the License for the specific provisions governing your rights and -+# obligations concerning the Software. -+# -+# The Initial Developer of the Original Code is: Sun Microsystems, Inc. -+# -+# Copyright: 2000 by Sun Microsystems, Inc. -+# -+# All Rights Reserved. -+# -+# Contributor(s): _______________________________________ -+# -+# -+# -+#************************************************************************* -+PRJ=..$/..$/.. -+ -+PRJNAME=postgresql -+TARGET=postgresql -+ENABLE_EXCEPTIONS=TRUE -+LIBTARGET=NO -+USE_DEFFILE=TRUE -+NO_DEFAULT_STL=TRUE -+ -+# --- Settings ----------------------------------------------------- -+ -+.INCLUDE : settings.mk -+.IF "$(SYSTEM_POSTGRESQL)" != "YES" -+.INCLUDE : $(SOLARINCDIR)$/postgresql/postgresql-version.mk -+.ENDIF -+#------------------------------------------------------------------- -+ -+# uno component naming scheme -+DLLPRE= -+ -+PQ_SDBC_MAJOR=0 -+PQ_SDBC_MINOR=7 -+PQ_SDBC_MICRO=6b -+.IF "$(SYSTEM_POSTGRESQL)" == "YES" -+POSTGRESQL_MAJOR=`pg_config --version | awk '{ print $$2 }' | cut -d. -f1` -+POSTGRESQL_MINOR=`pg_config --version | awk '{ print $$2 }' | cut -d. -f2` -+POSTGRESQL_MICRO=`pg_config --version | awk '{ print $$2 }' | cut -d. -f3` -+.ENDIF -+ -+.IF "$(SYSTEM_POSTGRESQL)" != "YES" -+POSTGRESQL_INCLUDES=-I$(SOLARINCDIR)$/postgresql -+.ELSE -+POSTGRESQL_INCLUDES=-I`pg_config --includedir` -+.ENDIF -+ -+CFLAGS+=$(POSTGRESQL_INCLUDES) \ -+ -DPOSTGRESQL_MAJOR=$(POSTGRESQL_MAJOR) \ -+ -DPOSTGRESQL_MINOR=$(POSTGRESQL_MINOR) \ -+ -DPOSTGRESQL_MICRO=$(POSTGRESQL_MICRO) \ -+ -DPQ_SDBC_MAJOR=$(PQ_SDBC_MAJOR) \ -+ -DPQ_SDBC_MINOR=$(PQ_SDBC_MINOR) \ -+ -DPQ_SDBC_MICRO=$(PQ_SDBC_MICRO) -+ -+SHL1TARGET=postgresql-sdbc.uno -+LIB1TARGET=$(SLB)$/$(SHL1TARGET).lib -+LIB1OBJFILES= \ -+ $(SLO)$/pq_driver.obj -+ -+SHL1STDLIBS= \ -+ $(CPPULIB) \ -+ $(CPPUHELPERLIB) \ -+ $(SALLIB) -+ -+SHL1LIBS= $(LIB1TARGET) -+SHL1DEF= $(MISC)$/$(SHL1TARGET).def -+DEF1NAME= $(SHL1TARGET) -+SHL1VERSIONMAP=$(SOLARENV)$/src$/component.map -+ -+# use the static version -+.IF "$(GUI)"=="WNT" -+PQLIB=libpq.lib wsock32.lib advapi32.lib -+.ELSE -+PQLIB=-lpq -lcrypt -+.ENDIF -+SHL2TARGET=postgresql-sdbc-impl.uno -+LIB2TARGET=$(SLB)$/$(SHL2TARGET).lib -+LIB2OBJFILES= \ -+ $(SLO)$/pq_connection.obj \ -+ $(SLO)$/pq_statement.obj \ -+ $(SLO)$/pq_resultset.obj \ -+ $(SLO)$/pq_preparedstatement.obj \ -+ $(SLO)$/pq_resultsetmetadata.obj \ -+ $(SLO)$/pq_databasemetadata.obj \ -+ $(SLO)$/pq_sequenceresultset.obj \ -+ $(SLO)$/pq_baseresultset.obj \ -+ $(SLO)$/pq_statics.obj \ -+ $(SLO)$/pq_xtable.obj \ -+ $(SLO)$/pq_xcontainer.obj \ -+ $(SLO)$/pq_xbase.obj \ -+ $(SLO)$/pq_xtables.obj \ -+ $(SLO)$/pq_xcolumns.obj \ -+ $(SLO)$/pq_xcolumn.obj \ -+ $(SLO)$/pq_tools.obj \ -+ $(SLO)$/pq_xkey.obj \ -+ $(SLO)$/pq_xkeys.obj \ -+ $(SLO)$/pq_xkeycolumn.obj \ -+ $(SLO)$/pq_xkeycolumns.obj \ -+ $(SLO)$/pq_xuser.obj \ -+ $(SLO)$/pq_xusers.obj \ -+ $(SLO)$/pq_xview.obj \ -+ $(SLO)$/pq_xviews.obj \ -+ $(SLO)$/pq_xindex.obj \ -+ $(SLO)$/pq_xindexes.obj \ -+ $(SLO)$/pq_xindexcolumn.obj \ -+ $(SLO)$/pq_xindexcolumns.obj \ -+ $(SLO)$/pq_updateableresultset.obj \ -+ $(SLO)$/pq_fakedupdateableresultset.obj \ -+ $(SLO)$/pq_array.obj \ -+ $(SLO)$/pq_sequenceresultsetmetadata.obj -+ -+ -+SHL2STDLIBS= \ -+ $(CPPULIB) \ -+ $(CPPUHELPERLIB) \ -+ $(SALLIB) \ -+ $(SALHELPERLIB) \ -+ $(PQLIB) -+ -+SHL2LIBS= $(LIB2TARGET) -+SHL2DEF= $(MISC)$/$(SHL2TARGET).def -+DEF2NAME= $(SHL2TARGET) -+SHL2VERSIONMAP=$(SOLARENV)$/src$/component.map -+ -+ -+SLOFILES= $(LIB1OBJFILES) $(LIB2OBJFILES) -+ -+ -+DRIVERNAME=postgresql-sdbc-$(PQ_SDBC_MAJOR).$(PQ_SDBC_MINOR).$(PQ_SDBC_MICRO).zip -+ALLTAR : $(DLLDEST)$/$(DRIVERNAME) -+ -+# --- Targets ------------------------------------------------------ -+.INCLUDE : target.mk -+ -+.IF "$(GUI)" == "UNX" -+INI_EXT=rc -+.ELSE -+INI_EXT=.ini -+.ENDIF -+ -+$(DLLDEST)$/$(SHL1TARGET)$(INI_EXT): $(SHL1TARGET) -+ +cp $? $@ -+ -+ -+$(DLLDEST)$/$(DRIVERNAME): \ -+ $(DLLDEST)$/postgresql.xcu \ -+ $(DLLDEST)$/$(SHL1TARGET)$(DLLPOST) \ -+ $(DLLDEST)$/$(SHL2TARGET)$(DLLPOST) \ -+ $(DLLDEST)$/$(SHL1TARGET)$(INI_EXT) -+ +cd $(DLLDEST) && \ -+ zip -r $(DRIVERNAME) \ -+ $(SHL1TARGET)$(DLLPOST) \ -+ $(SHL2TARGET)$(DLLPOST) \ -+ $(SHL1TARGET)$(INI_EXT) \ -+ postgresql.xcu -+ -+$(DLLDEST)$/postgresql.xcu : postgresql.xcu -+ -rm -f $@ -+ cat postgresql.xcu > $@ -+ -+strip : -+.IF "$(GUI)"!="WNT" -+ strip $(DLLDEST)$/$(SHL1TARGET)$(DLLPOST) $(DLLDEST)$/$(SHL2TARGET)$(DLLPOST) -+.ENDIF -diff --git connectivity/source/drivers/postgresql/postgresql-sdbc.uno connectivity/source/drivers/postgresql/postgresql-sdbc.uno -new file mode 100644 -index 0000000..8d51ca2 ---- /dev/null -+++ connectivity/source/drivers/postgresql/postgresql-sdbc.uno -@@ -0,0 +1,2 @@ -+[Bootstrap] -+PQ_LOGLEVEL=NONE -diff --git connectivity/source/drivers/postgresql/postgresql.xcu connectivity/source/drivers/postgresql/postgresql.xcu -new file mode 100644 -index 0000000..3f3c93c ---- /dev/null -+++ connectivity/source/drivers/postgresql/postgresql.xcu -@@ -0,0 +1,50 @@ -+ -+ -+ -+ -+ -+ -+ org.openoffice.comp.connectivity.pq.Driver -+ -+ -+ postgresql -+ -+ -+ -+ -+ -+ -+ -+ -+ UserPassword -+ -+ -+ -+ -+ -+ -diff --git connectivity/source/drivers/postgresql/pq_allocator.hxx connectivity/source/drivers/postgresql/pq_allocator.hxx -new file mode 100644 -index 0000000..d03b424 ---- /dev/null -+++ connectivity/source/drivers/postgresql/pq_allocator.hxx -@@ -0,0 +1,225 @@ -+/************************************************************************* -+ * -+ * $RCSfile: pq_allocator.hxx,v $ -+ * -+ * $Revision: 1.1.2.3 $ -+ * -+ * last change: $Author: jbu $ $Date: 2007/08/28 21:24:00 $ -+ * -+ * The Contents of this file are made available subject to the terms of -+ * either of the following licenses -+ * -+ * - GNU Lesser General Public License Version 2.1 -+ * - Sun Industry Standards Source License Version 1.1 -+ * -+ * Sun Microsystems Inc., October, 2000 -+ * -+ * GNU Lesser General Public License Version 2.1 -+ * ============================================= -+ * Copyright 2000 by Sun Microsystems, Inc. -+ * 901 San Antonio Road, Palo Alto, CA 94303, USA -+ * -+ * This library is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License version 2.1, as published by the Free Software Foundation. -+ * -+ * This library is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public -+ * License along with this library; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, -+ * MA 02111-1307 USA -+ * -+ * -+ * Sun Industry Standards Source License Version 1.1 -+ * ================================================= -+ * The contents of this file are subject to the Sun Industry Standards -+ * Source License Version 1.1 (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.openoffice.org/license.html. -+ * -+ * Software provided under this License is provided on an "AS IS" basis, -+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, -+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, -+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. -+ * See the License for the specific provisions governing your rights and -+ * obligations concerning the Software. -+ * -+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc. -+ * -+ * Copyright: 2002 by Sun Microsystems, Inc. -+ * -+ * All Rights Reserved. -+ * -+ * Contributor(s): _______________________________________ -+ * -+ * -+ ************************************************************************/ -+ -+#ifndef _PQ_ALLOCATOR_ -+#define _PQ_ALLOCATOR_ -+ -+#include -+#include "sal/types.h" -+ -+/** jbu: This source has been copied from sal/inc/internal/allocator.hxx, -+ because it is not a public interface. Thx a lot for figuring this -+ out. -+ */ -+ -+//###################################################### -+// This is no general purpose STL allocator but one -+// necessary to use STL for some implementation but -+// avoid linking sal against the STLPort library!!! -+// For more information on when and how to define a -+// custom stl allocator have a look at Scott Meyers: -+// "Effective STL", Nicolai M. Josuttis: -+// "The C++ Standard Library - A Tutorial and Reference" -+// and at http://www.josuttis.com/cppcode/allocator.html -+ -+namespace pq_sdbc_driver { -+ -+template -+class Allocator -+{ -+public: -+ typedef T value_type; -+ typedef T* pointer; -+ typedef const T* const_pointer; -+ typedef T& reference; -+ typedef const T& const_reference; -+ typedef ::std::size_t size_type; -+ typedef ::std::ptrdiff_t difference_type; -+ -+ //----------------------------------------- -+ template -+ struct rebind -+ { -+ typedef Allocator other; -+ }; -+ -+ //----------------------------------------- -+ pointer address (reference value) const -+ { -+ return &value; -+ } -+ -+ //----------------------------------------- -+ const_pointer address (const_reference value) const -+ { -+ return &value; -+ } -+ -+ //----------------------------------------- -+ Allocator() SAL_THROW(()) -+ {} -+ -+ //----------------------------------------- -+ template -+ Allocator (const Allocator&) SAL_THROW(()) -+ {} -+ -+ //----------------------------------------- -+ Allocator(const Allocator&) SAL_THROW(()) -+ {} -+ -+ //----------------------------------------- -+ ~Allocator() SAL_THROW(()) -+ {} -+ -+ //----------------------------------------- -+ size_type max_size() const SAL_THROW(()) -+ { -+ return size_type(-1)/sizeof(T); -+ } -+ -+ //----------------------------------------- -+ /* Normally the code for allocate should -+ throw a std::bad_alloc exception if the -+ requested memory could not be allocated: -+ (C++ standard 20.4.1.1): -+ -+ pointer allocate (size_type n, const void* hint = 0) -+ { -+ pointer p = reinterpret_cast( -+ rtl_allocateMemory(sal_uInt32(n * sizeof(T)))); -+ -+ if (NULL == p) -+ throw ::std::bad_alloc(); -+ -+ return p; -+ } -+ -+ but some compilers do not compile it if exceptions -+ are not enabled, e.g. GCC under Linux and it is -+ in general not desired to compile sal with exceptions -+ enabled. */ -+ pointer allocate (size_type n, const void* hint = 0) -+ { -+ return reinterpret_cast( -+ rtl_allocateMemory(sal_uInt32(n * sizeof(T)))); -+ } -+ -+ //----------------------------------------- -+ void deallocate (pointer p, size_type n) -+ { -+ rtl_freeMemory(p); -+ } -+ -+ //----------------------------------------- -+ void construct (pointer p, const T& value) -+ { -+ new ((void*)p)T(value); -+ } -+ -+ //----------------------------------------- -+ void destroy (pointer p) -+ { -+ p->~T(); -+ } -+}; -+ -+//###################################################### -+// Custom STL allocators must be stateless (see -+// references above) that's why the operators below -+// return always true or false -+template -+inline bool operator== (const Allocator&, const Allocator&) SAL_THROW(()) -+{ -+ return true; -+} -+ -+template -+inline bool operator!= (const Allocator&, const Allocator&) SAL_THROW(()) -+{ -+ return false; -+} -+ -+} /* namespace sal */ -+ -+//###################################################### -+/* REQUIRED BY STLPort (see stlport '_alloc.h'): -+ Hack for compilers that do not support member -+ template classes (e.g. MSVC 6) */ -+#if defined (_MSC_VER) -+#if (_MSC_VER < 1400) // MSVC 6 -+namespace _STL -+{ -+#endif -+#endif -+ template -+ inline pq_sdbc_driver::Allocator & __stl_alloc_rebind ( -+ pq_sdbc_driver::Allocator & a, U const *) -+ { -+ return (pq_sdbc_driver::Allocator&)(a); -+ } -+#if defined (_MSC_VER) -+#if (_MSC_VER < 1400) // MSVC 6 -+} -+#endif -+#endif -+ -+#endif /* INCLUDED_SAL_INTERNAL_ALLOCATOR_HXX */ -diff --git connectivity/source/drivers/postgresql/pq_array.cxx connectivity/source/drivers/postgresql/pq_array.cxx -new file mode 100644 -index 0000000..b798d40 ---- /dev/null -+++ connectivity/source/drivers/postgresql/pq_array.cxx -@@ -0,0 +1,95 @@ -+#include -+ -+#include -+#include -+ -+ -+#include "pq_array.hxx" -+#include "pq_statics.hxx" -+#include "pq_sequenceresultset.hxx" -+ -+using rtl::OUString; -+ -+using com::sun::star::sdbc::SQLException; -+using com::sun::star::uno::Any; -+ -+using com::sun::star::uno::Sequence; -+namespace pq_sdbc_driver -+{ -+ -+ -+::rtl::OUString Array::getBaseTypeName( ) -+ throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) -+{ -+ return OUString( RTL_CONSTASCII_USTRINGPARAM( "varchar" ) ); -+} -+ -+sal_Int32 Array::getBaseType( ) -+ throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) -+{ -+ return com::sun::star::sdbc::DataType::VARCHAR; -+} -+ -+::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > Array::getArray( -+ const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& typeMap ) -+ throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) -+{ -+ return m_data; -+} -+ -+::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > Array::getArrayAtIndex( -+ sal_Int32 index, -+ sal_Int32 count, -+ const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& typeMap ) -+ throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) -+{ -+ checkRange( index, count ); -+ return Sequence< Any > ( &m_data[index-1], count ); -+} -+ -+::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > Array::getResultSet( -+ const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& typeMap ) -+ throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) -+{ -+ return getResultSetAtIndex( 0 , m_data.getLength() , typeMap ); -+} -+ -+::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > Array::getResultSetAtIndex( -+ sal_Int32 index, -+ sal_Int32 count, -+ const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& typeMap ) -+ throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) -+{ -+ checkRange( index, count ); -+ Sequence< Sequence< Any > > ret( count ); -+ -+ for( int i = 0 ; i < count ; i ++ ) -+ { -+ Sequence< Any > row( 2 ); -+ row[0] <<= (sal_Int32) ( i + index ); -+ row[1] = m_data[i+index-1]; -+ ret[i] = row; -+ } -+ -+ return new SequenceResultSet( -+ m_refMutex, m_owner, getStatics().resultSetArrayColumnNames, ret, m_tc ); -+} -+ -+ -+void Array::checkRange( sal_Int32 index, sal_Int32 count ) -+{ -+ if( index >= 1 && index -1 + count <= m_data.getLength() ) -+ return; -+ rtl::OUStringBuffer buf; -+ buf.appendAscii( RTL_CONSTASCII_STRINGPARAM( "Array::getArrayAtIndex(): allowed range for index + count " ) ); -+ buf.append( m_data.getLength() ); -+ buf.appendAscii( ", got " ); -+ buf.append( index ); -+ buf.appendAscii( " + " ); -+ buf.append( count ); -+ -+ throw SQLException( buf.makeStringAndClear() , *this, rtl::OUString(), 1, Any()); -+ -+} -+ -+} -diff --git connectivity/source/drivers/postgresql/pq_array.hxx connectivity/source/drivers/postgresql/pq_array.hxx -new file mode 100644 -index 0000000..d008ac2 ---- /dev/null -+++ connectivity/source/drivers/postgresql/pq_array.hxx -@@ -0,0 +1,128 @@ -+/************************************************************************* -+ * -+ * $RCSfile: pq_array.hxx,v $ -+ * -+ * $Revision: 1.1.2.1 $ -+ * -+ * last change: $Author: jbu $ $Date: 2004/08/29 08:33:28 $ -+ * -+ * The Contents of this file are made available subject to the terms of -+ * either of the following licenses -+ * -+ * - GNU Lesser General Public License Version 2.1 -+ * - Sun Industry Standards Source License Version 1.1 -+ * -+ * Sun Microsystems Inc., October, 2000 -+ * -+ * GNU Lesser General Public License Version 2.1 -+ * ============================================= -+ * Copyright 2000 by Sun Microsystems, Inc. -+ * 901 San Antonio Road, Palo Alto, CA 94303, USA -+ * -+ * This library is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License version 2.1, as published by the Free Software Foundation. -+ * -+ * This library is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public -+ * License along with this library; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, -+ * MA 02111-1307 USA -+ * -+ * -+ * Sun Industry Standards Source License Version 1.1 -+ * ================================================= -+ * The contents of this file are subject to the Sun Industry Standards -+ * Source License Version 1.1 (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.openoffice.org/license.html. -+ * -+ * Software provided under this License is provided on an "AS IS" basis, -+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, -+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, -+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. -+ * See the License for the specific provisions governing your rights and -+ * obligations concerning the Software. -+ * -+ * The Initial Developer of the Original Code is: Joerg Budischewski -+ * -+ * Copyright: 2000 by Sun Microsystems, Inc. -+ * -+ * All Rights Reserved. -+ * -+ * Contributor(s): Joerg Budischewski -+ * -+ * -+ ************************************************************************/ -+ -+#ifndef HEADER_PQ_ARRAY_HXX -+#define HEADER_PQ_ARRAY_HXX -+#include -+#include -+ -+#include "pq_connection.hxx" -+ -+namespace pq_sdbc_driver -+{ -+ -+class Array : public cppu::WeakImplHelper1< com::sun::star::sdbc::XArray > -+{ -+ com::sun::star::uno::Sequence< com::sun::star::uno::Any > m_data; -+ com::sun::star::uno::Reference< com::sun::star::uno::XInterface > m_owner; -+ com::sun::star::uno::Reference< com::sun::star::script::XTypeConverter > m_tc; -+ rtl::Reference< RefCountedMutex > m_refMutex; -+ -+public: -+ Array( -+ const rtl::Reference< RefCountedMutex > & mutex, -+ const com::sun::star::uno::Sequence< com::sun::star::uno::Any > & data, -+ const com::sun::star::uno::Reference< com::sun::star::uno::XInterface > & owner, -+ const com::sun::star::uno::Reference< com::sun::star::script::XTypeConverter > &tc) : -+ m_refMutex( mutex ), -+ m_data( data ), -+ m_owner( owner ), -+ m_tc( tc ) -+ {} -+ -+public: // XArray -+ -+ // Methods -+ virtual ::rtl::OUString SAL_CALL getBaseTypeName( ) -+ throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ -+ virtual sal_Int32 SAL_CALL getBaseType( ) -+ throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ -+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > SAL_CALL getArray( -+ const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& typeMap ) -+ throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ -+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > SAL_CALL getArrayAtIndex( -+ sal_Int32 index, -+ sal_Int32 count, -+ const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& typeMap ) -+ throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ -+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL -+ getResultSet( -+ const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& typeMap ) -+ throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ -+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getResultSetAtIndex( -+ sal_Int32 index, -+ sal_Int32 count, -+ const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& typeMap ) -+ throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ -+private: -+ void checkRange( sal_Int32 index, sal_Int32 count ); -+}; -+ -+ -+}; -+ -+#endif -diff --git connectivity/source/drivers/postgresql/pq_baseresultset.cxx connectivity/source/drivers/postgresql/pq_baseresultset.cxx -new file mode 100644 -index 0000000..aca40d7 ---- /dev/null -+++ connectivity/source/drivers/postgresql/pq_baseresultset.cxx -@@ -0,0 +1,742 @@ -+/************************************************************************* -+ * -+ * $RCSfile: pq_baseresultset.cxx,v $ -+ * -+ * $Revision: 1.1.2.4 $ -+ * -+ * last change: $Author: jbu $ $Date: 2004/08/29 08:33:28 $ -+ * -+ * The Contents of this file are made available subject to the terms of -+ * either of the following licenses -+ * -+ * - GNU Lesser General Public License Version 2.1 -+ * - Sun Industry Standards Source License Version 1.1 -+ * -+ * Sun Microsystems Inc., October, 2000 -+ * -+ * GNU Lesser General Public License Version 2.1 -+ * ============================================= -+ * Copyright 2000 by Sun Microsystems, Inc. -+ * 901 San Antonio Road, Palo Alto, CA 94303, USA -+ * -+ * This library is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License version 2.1, as published by the Free Software Foundation. -+ * -+ * This library is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public -+ * License along with this library; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, -+ * MA 02111-1307 USA -+ * -+ * -+ * Sun Industry Standards Source License Version 1.1 -+ * ================================================= -+ * The contents of this file are subject to the Sun Industry Standards -+ * Source License Version 1.1 (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.openoffice.org/license.html. -+ * -+ * Software provided under this License is provided on an "AS IS" basis, -+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, -+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, -+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. -+ * See the License for the specific provisions governing your rights and -+ * obligations concerning the Software. -+ * -+ * The Initial Developer of the Original Code is: Joerg Budischewski -+ * -+ * Copyright: 2000 by Sun Microsystems, Inc. -+ * -+ * All Rights Reserved. -+ * -+ * Contributor(s): Joerg Budischewski -+ * -+ * -+ ************************************************************************/ -+ -+#include -+ -+#include -+ -+#include -+#include -+ -+#include "pq_tools.hxx" -+#include "pq_array.hxx" -+#include "pq_statement.hxx" -+#include "pq_baseresultset.hxx" -+#include "pq_resultsetmetadata.hxx" -+ -+#include -+ -+using osl::Mutex; -+using osl::MutexGuard; -+ -+using rtl::OUString; -+using rtl::OUStringToOString; -+using rtl::OUStringBuffer; -+using rtl::OString; -+ -+using com::sun::star::beans::XPropertySetInfo; -+using com::sun::star::beans::XPropertySet; -+using com::sun::star::beans::XMultiPropertySet; -+using com::sun::star::beans::XFastPropertySet; -+ -+using com::sun::star::uno::Any; -+using com::sun::star::uno::makeAny; -+using com::sun::star::uno::Type; -+using com::sun::star::uno::RuntimeException; -+using com::sun::star::uno::Exception; -+using com::sun::star::uno::Sequence; -+using com::sun::star::uno::Reference; -+using com::sun::star::uno::XInterface; -+ -+using com::sun::star::lang::IllegalArgumentException; -+ -+using com::sun::star::sdbc::XWarningsSupplier; -+using com::sun::star::sdbc::XCloseable; -+using com::sun::star::sdbc::XStatement; -+using com::sun::star::sdbc::XResultSet; -+using com::sun::star::sdbc::XConnection; -+using com::sun::star::sdbc::SQLException; -+using com::sun::star::sdbc::XRow; -+using com::sun::star::sdbc::XColumnLocate; -+using com::sun::star::sdbc::XResultSetMetaData; -+using com::sun::star::sdbc::XResultSetMetaDataSupplier; -+ -+ -+using com::sun::star::beans::Property; -+ -+namespace pq_sdbc_driver -+{ -+#define ASCII_STR(x) OUString( RTL_CONSTASCII_USTRINGPARAM( x ) ) -+ -+static ::cppu::IPropertyArrayHelper & getResultSetPropertyArrayHelper() -+{ -+ static ::cppu::IPropertyArrayHelper *pArrayHelper; -+ if( ! pArrayHelper ) -+ { -+ MutexGuard guard( Mutex::getGlobalMutex() ); -+ if( ! pArrayHelper ) -+ { -+ static Property aTable[] = -+ { -+ Property( -+ OUString( RTL_CONSTASCII_USTRINGPARAM("CursorName") ), 0, -+ ::getCppuType( (OUString *)0) , 0 ), -+ Property( -+ OUString( RTL_CONSTASCII_USTRINGPARAM("EscapeProcessing") ), 0, -+ ::getBooleanCppuType() , 0 ), -+ Property( -+ OUString( RTL_CONSTASCII_USTRINGPARAM("FetchDirection") ), 0, -+ ::getCppuType( (sal_Int32 *)0) , 0 ), -+ Property( -+ OUString( RTL_CONSTASCII_USTRINGPARAM("FetchSize") ), 0, -+ ::getCppuType( (sal_Int32 *)0) , 0 ), -+ Property( -+ OUString( RTL_CONSTASCII_USTRINGPARAM("ResultSetConcurrency") ), 0, -+ ::getCppuType( (sal_Int32 *)0) , 0 ), -+ Property( -+ OUString( RTL_CONSTASCII_USTRINGPARAM("ResultSetType") ), 0, -+ ::getCppuType( (sal_Int32 *)0) , 0 ) -+ }; -+ OSL_ASSERT( sizeof(aTable) / sizeof(Property) == BASERESULTSET_SIZE ); -+ static ::cppu::OPropertyArrayHelper arrayHelper( aTable, BASERESULTSET_SIZE, sal_True ); -+ pArrayHelper = &arrayHelper; -+ } -+ } -+ return *pArrayHelper; -+} -+ -+BaseResultSet::BaseResultSet( -+ const ::rtl::Reference< RefCountedMutex > & refMutex, -+ const Reference< XInterface > & owner, -+ sal_Int32 rowCount, -+ sal_Int32 colCount, -+ const Reference< com::sun::star::script::XTypeConverter > & tc ) -+ : OComponentHelper( refMutex->mutex ), -+ OPropertySetHelper( OComponentHelper::rBHelper ), -+ m_refMutex( refMutex ), -+ m_owner( owner ), -+ m_row( -1 ), -+ m_rowCount( rowCount ), -+ m_fieldCount( colCount ), -+ m_tc( tc ) -+{ -+ POSTGRE_TRACE( "ctor BaseResultSet" ); -+} -+ -+BaseResultSet::~BaseResultSet() -+{ -+ POSTGRE_TRACE( "dtor BaseResultSet" ); -+} -+ -+Any BaseResultSet::queryInterface( const Type & reqType ) throw (RuntimeException) -+{ -+ Any ret; -+ -+ ret = OComponentHelper::queryInterface( reqType ); -+ if( ! ret.hasValue() ) -+ ret = ::cppu::queryInterface( reqType, -+ static_cast< XResultSet * > ( this ), -+ static_cast< XResultSetMetaDataSupplier * > ( this ), -+ static_cast< XRow * > ( this ), -+ static_cast< XColumnLocate * > ( this ), -+ static_cast< XCloseable * > ( this ), -+ static_cast< XPropertySet * > ( this ), -+ static_cast< XMultiPropertySet * > ( this ), -+ static_cast< XFastPropertySet * > ( this ) ); -+ return ret; -+} -+ -+// void BaseResultSet::close( ) throw (SQLException, RuntimeException) -+// { -+// Reference< XInterface > owner; -+// { -+// ResultSetGuard guard(*this); -+// if( m_result ) -+// { -+// PQclear(m_result ); -+// m_result = 0; -+// m_row = -1; -+// } -+// owner = m_owner; -+// m_owner.clear(); -+// } -+// } -+ -+Sequence BaseResultSet::getTypes() throw( RuntimeException ) -+{ -+ static cppu::OTypeCollection *pCollection; -+ if( ! pCollection ) -+ { -+ MutexGuard guard( osl::Mutex::getGlobalMutex() ); -+ if( !pCollection ) -+ { -+ static cppu::OTypeCollection collection( -+ getCppuType( (Reference< XResultSet> *) 0 ), -+ getCppuType( (Reference< XResultSetMetaDataSupplier> *) 0 ), -+ getCppuType( (Reference< XRow> *) 0 ), -+ getCppuType( (Reference< XColumnLocate> *) 0 ), -+ getCppuType( (Reference< XCloseable> *) 0 ), -+ getCppuType( (Reference< XPropertySet >*) 0 ), -+ getCppuType( (Reference< XFastPropertySet > *) 0 ), -+ getCppuType( (Reference< XMultiPropertySet > *) 0 ), -+ OComponentHelper::getTypes()); -+ pCollection = &collection; -+ } -+ } -+ return pCollection->getTypes(); -+} -+ -+Sequence< sal_Int8> BaseResultSet::getImplementationId() throw( RuntimeException ) -+{ -+ static cppu::OImplementationId *pId; -+ if( ! pId ) -+ { -+ MutexGuard guard( osl::Mutex::getGlobalMutex() ); -+ if( ! pId ) -+ { -+ static cppu::OImplementationId id(sal_False); -+ pId = &id; -+ } -+ } -+ return pId->getImplementationId(); -+} -+ -+// Reference< XResultSetMetaData > BaseResultSet::getMetaData( ) throw (SQLException, RuntimeException) -+// { -+// ResultSetGuard guard(*this); -+// checkClosed(); -+// return new ResultSetMetaData( m_refMutex, this, &m_result ); -+// } -+ -+sal_Bool BaseResultSet::next( ) throw (SQLException, RuntimeException) -+{ -+ MutexGuard guard( m_refMutex->mutex ); -+ checkClosed(); -+ m_row ++; -+ return m_row < m_rowCount; -+} -+ -+sal_Bool BaseResultSet::isBeforeFirst( ) throw (SQLException, RuntimeException) -+{ -+ MutexGuard guard( m_refMutex->mutex ); -+ checkClosed(); -+ return m_row == -1; -+} -+ -+sal_Bool BaseResultSet::isAfterLast( ) throw (SQLException, RuntimeException) -+{ -+ MutexGuard guard( m_refMutex->mutex ); -+ checkClosed(); -+ return m_row >= m_rowCount; -+} -+ -+sal_Bool BaseResultSet::isFirst( ) throw (SQLException, RuntimeException) -+{ -+ MutexGuard guard( m_refMutex->mutex ); -+ checkClosed(); -+ return m_row == 0 && m_rowCount; -+} -+ -+sal_Bool BaseResultSet::isLast( ) throw (SQLException, RuntimeException) -+{ -+ MutexGuard guard( m_refMutex->mutex ); -+ checkClosed(); -+ return m_row >= 0 && m_row + 1 == m_rowCount; -+} -+ -+void BaseResultSet::beforeFirst( ) throw (SQLException, RuntimeException) -+{ -+ MutexGuard guard( m_refMutex->mutex ); -+ checkClosed(); -+ m_row = -1; -+} -+ -+void BaseResultSet::afterLast( ) throw (SQLException, RuntimeException) -+{ -+ MutexGuard guard( m_refMutex->mutex ); -+ checkClosed(); -+ m_row = m_rowCount; -+} -+ -+sal_Bool BaseResultSet::first( ) throw (SQLException, RuntimeException) -+{ -+ MutexGuard guard( m_refMutex->mutex ); -+ checkClosed(); -+ sal_Bool bRet = ( m_rowCount > 0 ); -+ if( bRet ) -+ m_row = 0; -+ return bRet; -+} -+ -+sal_Bool BaseResultSet::last( ) throw (SQLException, RuntimeException) -+{ -+ MutexGuard guard( m_refMutex->mutex ); -+ checkClosed(); -+ sal_Bool bRet = ( m_rowCount > 0 ); -+ if( bRet ) -+ m_row = m_rowCount -1; -+ return bRet; -+} -+ -+sal_Int32 BaseResultSet::getRow( ) throw (SQLException, RuntimeException) -+{ -+ MutexGuard guard( m_refMutex->mutex ); -+ checkClosed(); -+ return m_row +1; -+} -+ -+sal_Bool BaseResultSet::absolute( sal_Int32 row ) throw (SQLException, RuntimeException) -+{ -+ MutexGuard guard( m_refMutex->mutex ); -+ checkClosed(); -+ if( row > 0 ) -+ { -+ m_row = row -1; -+ if( m_row > m_rowCount ) -+ m_row = m_rowCount; -+ } -+ else -+ { -+ m_row = m_rowCount + row; -+ if( m_row < -1 ) -+ m_row = -1; -+ } -+ return sal_True; -+} -+ -+sal_Bool BaseResultSet::relative( sal_Int32 rows ) throw (SQLException, RuntimeException) -+{ -+ MutexGuard guard( m_refMutex->mutex ); -+ checkClosed(); -+ m_row += rows; -+ -+ if( m_row > m_rowCount ) -+ m_row = m_rowCount; -+ else if ( m_row < -1 ) -+ m_row = -1; -+ return sal_True; -+} -+ -+sal_Bool BaseResultSet::previous( ) throw (SQLException, RuntimeException) -+{ -+ MutexGuard guard( m_refMutex->mutex ); -+ checkClosed(); -+ sal_Bool bRet = ( m_row != -1 ); -+ if( bRet ) -+ m_row --; -+ return bRet; -+} -+ -+void BaseResultSet::refreshRow( ) throw (SQLException, RuntimeException) -+{ -+ // TODO: not supported for now -+} -+ -+sal_Bool BaseResultSet::rowUpdated( ) throw (SQLException, RuntimeException) -+{ -+ return sal_False; -+} -+ -+sal_Bool BaseResultSet::rowInserted( ) throw (SQLException, RuntimeException) -+{ -+ return sal_False; -+} -+ -+sal_Bool BaseResultSet::rowDeleted( ) throw (SQLException, RuntimeException) -+{ -+ return sal_False; -+} -+ -+Reference< XInterface > BaseResultSet::getStatement() throw (SQLException, RuntimeException) -+{ -+ MutexGuard guard( m_refMutex->mutex ); -+ checkClosed(); -+ return m_owner; -+} -+ -+ -+//----------------- XRow interface ---------------------------------------------------- -+ -+sal_Bool BaseResultSet::wasNull( ) throw (SQLException, RuntimeException) -+{ -+ return m_wasNull; -+} -+ -+Any BaseResultSet::convertTo( const Any & val , const Type & type ) -+{ -+ Any aRet; -+ try -+ { -+ aRet = m_tc->convertTo( val , type ); -+ } -+ catch( com::sun::star::lang::IllegalArgumentException & e ) -+ {} -+ catch( com::sun::star::script::CannotConvertException & e ) -+ {} -+ return aRet; -+} -+ -+sal_Bool BaseResultSet::getBoolean( sal_Int32 columnIndex ) throw (SQLException, RuntimeException) -+{ -+ MutexGuard guard( m_refMutex->mutex ); -+ checkClosed(); -+ checkColumnIndex( columnIndex ); -+ checkRowIndex( sal_True /* must be on row */ ); -+ -+ sal_Bool b = sal_False; -+ -+ OUString str = getString( columnIndex ); -+ -+ if( str.getLength() > 0 ) -+ { -+ switch(str[0]) -+ { -+ case '1': -+ case 't': -+ case 'T': -+ case 'y': -+ case 'Y': -+ -+ return sal_True; -+ } -+ } -+ return sal_False; -+} -+ -+sal_Int8 BaseResultSet::getByte( sal_Int32 columnIndex ) -+ throw (SQLException, RuntimeException) -+{ -+ MutexGuard guard( m_refMutex->mutex ); -+ checkClosed(); -+ checkColumnIndex( columnIndex ); -+ checkRowIndex( sal_True /* must be on row */ ); -+ sal_Int8 b = 0; -+ convertTo( getValue( columnIndex ), getCppuType( &b )) >>= b; -+ return b; -+} -+ -+sal_Int16 BaseResultSet::getShort( sal_Int32 columnIndex ) -+ throw (SQLException, RuntimeException) -+{ -+ MutexGuard guard( m_refMutex->mutex ); -+ checkClosed(); -+ checkColumnIndex( columnIndex ); -+ checkRowIndex( sal_True /* must be on row */ ); -+ sal_Int16 i = 0; -+ convertTo( getValue( columnIndex ), getCppuType( &i )) >>= i; -+ return i; -+} -+ -+OUString BaseResultSet::getString( sal_Int32 columnIndex ) throw (SQLException, RuntimeException) -+{ -+ MutexGuard guard(m_refMutex->mutex); -+ checkClosed(); -+ checkColumnIndex( columnIndex ); -+ checkRowIndex( sal_True /* must be on row */ ); -+ OUString ret; -+ convertTo( getValue( columnIndex ), getCppuType( &ret ) ) >>= ret; -+// printf( "BaseResultSet::getString() %s\n" , OUStringToOString( ret, RTL_TEXTENCODING_ASCII_US ).getStr() ); -+ return ret; -+} -+ -+sal_Int32 BaseResultSet::getInt( sal_Int32 columnIndex ) -+ throw (SQLException, RuntimeException) -+{ -+ MutexGuard guard( m_refMutex->mutex ); -+ checkClosed(); -+ checkColumnIndex( columnIndex ); -+ checkRowIndex( sal_True /* must be on row */ ); -+ sal_Int32 i = 0; -+ convertTo( getValue( columnIndex ), getCppuType( &i )) >>= i; -+ return i; -+} -+ -+sal_Int64 BaseResultSet::getLong( sal_Int32 columnIndex ) -+ throw (SQLException, RuntimeException) -+{ -+ MutexGuard guard( m_refMutex->mutex ); -+ checkClosed(); -+ checkColumnIndex( columnIndex ); -+ checkRowIndex( sal_True /* must be on row */ ); -+ sal_Int64 i = 0; -+ convertTo( getValue( columnIndex ), getCppuType( &i )) >>= i; -+ return i; -+} -+ -+float BaseResultSet::getFloat( sal_Int32 columnIndex ) -+ throw (SQLException, RuntimeException) -+{ -+ MutexGuard guard( m_refMutex->mutex ); -+ checkClosed(); -+ checkColumnIndex( columnIndex ); -+ checkRowIndex( sal_True /* must be on row */ ); -+ float f = 0.; -+ convertTo( getValue( columnIndex ), getCppuType( &f )) >>= f; -+ return f; -+} -+ -+double BaseResultSet::getDouble( sal_Int32 columnIndex ) -+ throw (SQLException, RuntimeException) -+{ -+ MutexGuard guard( m_refMutex->mutex ); -+ checkClosed(); -+ checkColumnIndex( columnIndex ); -+ double d = 0.; -+ convertTo( getValue( columnIndex ), getCppuType( &d )) >>= d; -+ return d; -+} -+ -+Sequence< sal_Int8 > BaseResultSet::getBytes( sal_Int32 columnIndex ) -+ throw (SQLException, RuntimeException) -+{ -+ MutexGuard guard( m_refMutex->mutex ); -+ checkClosed(); -+ checkColumnIndex( columnIndex ); -+ checkRowIndex( sal_True /* must be on row */ ); -+ -+ Sequence< sal_Int8 > ret; -+ OUString ustr; -+ if( ! (getValue( columnIndex ) >>= ustr) ) -+ m_wasNull = true; -+ else -+ { -+ // if this is a binary, it must contain escaped data ! -+ OString val = rtl::OUStringToOString( ustr, RTL_TEXTENCODING_ASCII_US ); -+ -+ size_t length; -+ char * res = (char*) PQunescapeBytea( (unsigned char *)val.getStr() , &length); -+ ret = Sequence< sal_Int8 > ( (sal_Int8*)res, length ); -+ if( res ) -+ free( res ); -+ } -+ return ret; -+} -+ -+ -+::com::sun::star::util::Date BaseResultSet::getDate( sal_Int32 columnIndex ) -+ throw (SQLException, RuntimeException) -+{ -+ return string2Date( getString( columnIndex ) ); -+} -+ -+::com::sun::star::util::Time BaseResultSet::getTime( sal_Int32 columnIndex ) -+ throw (SQLException, RuntimeException) -+{ -+ return string2Time( getString( columnIndex ) ); -+} -+ -+::com::sun::star::util::DateTime BaseResultSet::getTimestamp( sal_Int32 columnIndex ) -+ throw (SQLException, RuntimeException) -+{ -+ return string2DateTime( getString( columnIndex ) ); -+} -+ -+Reference< ::com::sun::star::io::XInputStream > BaseResultSet::getBinaryStream( sal_Int32 columnIndex ) -+ throw (SQLException, RuntimeException) -+{ -+ return 0; -+} -+ -+Reference< ::com::sun::star::io::XInputStream > BaseResultSet::getCharacterStream( sal_Int32 columnIndex ) -+ throw (SQLException, RuntimeException) -+{ -+ return 0; -+} -+ -+Any BaseResultSet::getObject( -+ sal_Int32 columnIndex, -+ const Reference< ::com::sun::star::container::XNameAccess >& typeMap ) -+ throw (SQLException, RuntimeException) -+{ -+ return Any(); -+} -+ -+Reference< ::com::sun::star::sdbc::XRef > BaseResultSet::getRef( sal_Int32 columnIndex ) -+ throw (SQLException, RuntimeException) -+{ -+ return Reference< com::sun::star::sdbc::XRef > (); -+} -+ -+Reference< ::com::sun::star::sdbc::XBlob > BaseResultSet::getBlob( sal_Int32 columnIndex ) -+ throw (SQLException, RuntimeException) -+{ -+ return Reference< com::sun::star::sdbc::XBlob > (); -+} -+ -+Reference< ::com::sun::star::sdbc::XClob > BaseResultSet::getClob( sal_Int32 columnIndex ) -+ throw (SQLException, RuntimeException) -+{ -+ return Reference< com::sun::star::sdbc::XClob > (); -+} -+ -+Reference< ::com::sun::star::sdbc::XArray > BaseResultSet::getArray( sal_Int32 columnIndex ) -+ throw (SQLException, RuntimeException) -+{ -+ return new Array( m_refMutex, parseArray( getString( columnIndex ) ), *this, m_tc ); -+} -+ -+ -+::cppu::IPropertyArrayHelper & BaseResultSet::getInfoHelper() -+{ -+ return getResultSetPropertyArrayHelper(); -+} -+ -+ -+sal_Bool BaseResultSet::convertFastPropertyValue( -+ Any & rConvertedValue, Any & rOldValue, sal_Int32 nHandle, const Any& rValue ) -+ throw (IllegalArgumentException) -+{ -+ sal_Bool bRet; -+ switch( nHandle ) -+ { -+ case BASERESULTSET_CURSOR_NAME: -+ { -+ OUString val; -+ bRet = ( rValue >>= val ); -+ m_props[nHandle] = makeAny( val ); -+ break; -+ } -+ case BASERESULTSET_ESCAPE_PROCESSING: -+ { -+ sal_Bool val; -+ bRet = ( rValue >>= val ); -+ m_props[nHandle] = makeAny( val ); -+ break; -+ } -+ case BASERESULTSET_FETCH_DIRECTION: -+ case BASERESULTSET_FETCH_SIZE: -+ case BASERESULTSET_RESULT_SET_CONCURRENCY: -+ case BASERESULTSET_RESULT_SET_TYPE: -+ { -+ sal_Int32 val; -+ bRet = ( rValue >>= val ); -+ m_props[nHandle] = makeAny( val ); -+ break; -+ } -+ default: -+ { -+ OUStringBuffer buf(128); -+ buf.appendAscii( "pq_resultset: Invalid property handle (" ); -+ buf.append( nHandle ); -+ buf.appendAscii( ")" ); -+ throw IllegalArgumentException( buf.makeStringAndClear(), *this, 2 ); -+ } -+ } -+ return bRet; -+} -+ -+ -+void BaseResultSet::setFastPropertyValue_NoBroadcast( -+ sal_Int32 nHandle,const Any& rValue ) throw (Exception) -+{ -+ m_props[nHandle] = rValue; -+} -+ -+void BaseResultSet::getFastPropertyValue( Any& rValue, sal_Int32 nHandle ) const -+{ -+ rValue = m_props[nHandle]; -+} -+ -+Reference < XPropertySetInfo > BaseResultSet::getPropertySetInfo() -+ throw(RuntimeException) -+{ -+ return OPropertySetHelper::createPropertySetInfo( getResultSetPropertyArrayHelper() ); -+} -+ -+void BaseResultSet::disposing() -+{ -+ close(); -+} -+ -+void BaseResultSet::checkColumnIndex(sal_Int32 index ) throw ( SQLException, RuntimeException ) -+{ -+ if( index < 1 || index > m_fieldCount ) -+ { -+ OUStringBuffer buf(128); -+ buf.appendAscii( "pq_resultset: index out of range (" ); -+ buf.append( index ); -+ buf.appendAscii( ", allowed range is 1 to " ); -+ buf.append( m_fieldCount ); -+ buf.appendAscii( ")" ); -+ throw SQLException( buf.makeStringAndClear(), *this, OUString(), 1, Any() ); -+ } -+ -+} -+ -+void BaseResultSet::checkRowIndex( sal_Bool mustBeOnValidRow ) -+{ -+ OUStringBuffer buf( 128 ); -+ buf.appendAscii( "pq_baseresultset: row index out of range, allowed is " ); -+ if( mustBeOnValidRow ) -+ { -+ if( m_row < 0 || m_row >= m_rowCount ) -+ { -+ buf.appendAscii( "0 to " ); -+ buf.append( ((sal_Int32)(m_rowCount -1)) ); -+ buf.appendAscii( ", got " ); -+ buf.append( m_row ); -+ throw SQLException( buf.makeStringAndClear(), *this, OUString(),1, Any() ); -+ } -+ } -+ else -+ { -+ if( m_row < -1 || m_row > m_rowCount ) -+ { -+ buf.appendAscii( "-1 to " ); -+ buf.append( m_rowCount ); -+ buf.appendAscii( ", got " ); -+ buf.append( m_row ); -+ throw SQLException( buf.makeStringAndClear(), *this, OUString(),1, Any() ); -+ } -+ } -+} -+ -+} -diff --git connectivity/source/drivers/postgresql/pq_baseresultset.hxx connectivity/source/drivers/postgresql/pq_baseresultset.hxx -new file mode 100644 -index 0000000..d3a4f8b ---- /dev/null -+++ connectivity/source/drivers/postgresql/pq_baseresultset.hxx -@@ -0,0 +1,268 @@ -+/************************************************************************* -+ * -+ * $RCSfile: pq_baseresultset.hxx,v $ -+ * -+ * $Revision: 1.1.2.3 $ -+ * -+ * last change: $Author: jbu $ $Date: 2007/08/26 20:40:40 $ -+ * -+ * The Contents of this file are made available subject to the terms of -+ * either of the following licenses -+ * -+ * - GNU Lesser General Public License Version 2.1 -+ * - Sun Industry Standards Source License Version 1.1 -+ * -+ * Sun Microsystems Inc., October, 2000 -+ * -+ * GNU Lesser General Public License Version 2.1 -+ * ============================================= -+ * Copyright 2000 by Sun Microsystems, Inc. -+ * 901 San Antonio Road, Palo Alto, CA 94303, USA -+ * -+ * This library is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License version 2.1, as published by the Free Software Foundation. -+ * -+ * This library is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public -+ * License along with this library; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, -+ * MA 02111-1307 USA -+ * -+ * -+ * Sun Industry Standards Source License Version 1.1 -+ * ================================================= -+ * The contents of this file are subject to the Sun Industry Standards -+ * Source License Version 1.1 (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.openoffice.org/license.html. -+ * -+ * Software provided under this License is provided on an "AS IS" basis, -+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, -+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, -+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. -+ * See the License for the specific provisions governing your rights and -+ * obligations concerning the Software. -+ * -+ * The Initial Developer of the Original Code is: Joerg Budischewski -+ * -+ * Copyright: 2000 by Sun Microsystems, Inc. -+ * -+ * All Rights Reserved. -+ * -+ * Contributor(s): Joerg Budischewski -+ * -+ * -+ ************************************************************************/ -+ -+#ifndef _PG_BASERESULTSET_HXX_ -+#define _PG_BASERESULTSET_HXX_ -+ -+#include -+#include -+ -+#include -+#include -+#include -+#include -+#include "pq_connection.hxx" -+ -+namespace pq_sdbc_driver -+{ -+ -+static const sal_Int32 BASERESULTSET_CURSOR_NAME = 0; -+static const sal_Int32 BASERESULTSET_ESCAPE_PROCESSING = 1; -+static const sal_Int32 BASERESULTSET_FETCH_DIRECTION = 2; -+static const sal_Int32 BASERESULTSET_FETCH_SIZE = 3; -+static const sal_Int32 BASERESULTSET_RESULT_SET_CONCURRENCY = 4; -+static const sal_Int32 BASERESULTSET_RESULT_SET_TYPE = 5; -+ -+#define BASERESULTSET_SIZE 6 -+ -+class BaseResultSet : public cppu::OComponentHelper, -+ public cppu::OPropertySetHelper, -+ public com::sun::star::sdbc::XCloseable, -+ public com::sun::star::sdbc::XResultSetMetaDataSupplier, -+ public com::sun::star::sdbc::XResultSet, -+ public com::sun::star::sdbc::XRow, -+ public com::sun::star::sdbc::XColumnLocate -+{ -+protected: -+ com::sun::star::uno::Any m_props[BASERESULTSET_SIZE]; -+ com::sun::star::uno::Reference< com::sun::star::uno::XInterface > m_owner; -+ com::sun::star::uno::Reference< com::sun::star::script::XTypeConverter > m_tc; -+ ::rtl::Reference< RefCountedMutex > m_refMutex; -+ sal_Int32 m_row; -+ sal_Int32 m_rowCount; -+ sal_Int32 m_fieldCount; -+ sal_Bool m_wasNull; -+ -+public: -+ inline cppu::OBroadcastHelper & getRBHelper() { return OComponentHelper::rBHelper;} -+ -+protected: -+ /** mutex should be locked before called -+ */ -+ virtual void checkClosed() -+ throw ( com::sun::star::sdbc::SQLException, com::sun::star::uno::RuntimeException ) = 0; -+ virtual void checkColumnIndex( sal_Int32 index ) -+ throw ( com::sun::star::sdbc::SQLException, com::sun::star::uno::RuntimeException ); -+ virtual void checkRowIndex( sal_Bool mustBeOnValidRow ); -+ -+ virtual ::com::sun::star::uno::Any getValue( sal_Int32 columnIndex ) = 0; -+ com::sun::star::uno::Any convertTo( -+ const ::com::sun::star::uno::Any &str, const com::sun::star::uno::Type &type ); -+ -+protected: -+ BaseResultSet( -+ const ::rtl::Reference< RefCountedMutex > & mutex, -+ const com::sun::star::uno::Reference< com::sun::star::uno::XInterface > &owner, -+ sal_Int32 rowCount, -+ sal_Int32 columnCount, -+ const ::com::sun::star::uno::Reference< ::com::sun::star::script::XTypeConverter > &tc ); -+ ~BaseResultSet(); -+ -+public: // XInterface -+ virtual void SAL_CALL acquire() throw() { OComponentHelper::acquire(); } -+ virtual void SAL_CALL release() throw() { OComponentHelper::release(); } -+ virtual com::sun::star::uno::Any SAL_CALL queryInterface( -+ const com::sun::star::uno::Type & reqType ) -+ throw (com::sun::star::uno::RuntimeException); -+ -+public: // XCloseable -+// virtual void SAL_CALL close( ) -+// throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) = 0; -+ -+public: // XTypeProvider, first implemented by OPropertySetHelper -+ virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL getTypes() -+ throw( com::sun::star::uno::RuntimeException ); -+ virtual com::sun::star::uno::Sequence< sal_Int8> SAL_CALL getImplementationId() -+ throw( com::sun::star::uno::RuntimeException ); -+ -+public: // XResultSetMetaDataSupplier -+// virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData > SAL_CALL getMetaData( ) -+// throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) = 0; -+ -+public: // XResultSet -+ // Methods -+ virtual sal_Bool SAL_CALL next( ) -+ throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Bool SAL_CALL isBeforeFirst( ) -+ throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Bool SAL_CALL isAfterLast( ) -+ throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Bool SAL_CALL isFirst( ) -+ throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Bool SAL_CALL isLast( ) -+ throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual void SAL_CALL beforeFirst( ) -+ throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual void SAL_CALL afterLast( ) -+ throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Bool SAL_CALL first( ) -+ throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Bool SAL_CALL last( ) -+ throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Int32 SAL_CALL getRow( ) -+ throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Bool SAL_CALL absolute( sal_Int32 row ) -+ throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Bool SAL_CALL relative( sal_Int32 rows ) -+ throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Bool SAL_CALL previous( ) -+ throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual void SAL_CALL refreshRow( ) -+ throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Bool SAL_CALL rowUpdated( ) -+ throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Bool SAL_CALL rowInserted( ) -+ throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Bool SAL_CALL rowDeleted( ) -+ throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL getStatement() -+ throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ -+ -+public: // XRow -+ virtual sal_Bool SAL_CALL wasNull( ) -+ throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual ::rtl::OUString SAL_CALL getString( sal_Int32 columnIndex ) -+ throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Bool SAL_CALL getBoolean( sal_Int32 columnIndex ) -+ throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Int8 SAL_CALL getByte( sal_Int32 columnIndex ) -+ throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Int16 SAL_CALL getShort( sal_Int32 columnIndex ) -+ throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Int32 SAL_CALL getInt( sal_Int32 columnIndex ) -+ throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Int64 SAL_CALL getLong( sal_Int32 columnIndex ) -+ throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual float SAL_CALL getFloat( sal_Int32 columnIndex ) -+ throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual double SAL_CALL getDouble( sal_Int32 columnIndex ) -+ throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getBytes( sal_Int32 columnIndex ) -+ throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual ::com::sun::star::util::Date SAL_CALL getDate( sal_Int32 columnIndex ) -+ throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual ::com::sun::star::util::Time SAL_CALL getTime( sal_Int32 columnIndex ) -+ throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual ::com::sun::star::util::DateTime SAL_CALL getTimestamp( sal_Int32 columnIndex ) -+ throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL getBinaryStream( sal_Int32 columnIndex ) -+ throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL getCharacterStream( sal_Int32 columnIndex ) -+ throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual ::com::sun::star::uno::Any SAL_CALL getObject( -+ sal_Int32 columnIndex, -+ const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& typeMap ) -+ throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRef > SAL_CALL getRef( sal_Int32 columnIndex ) -+ throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XBlob > SAL_CALL getBlob( sal_Int32 columnIndex ) -+ throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XClob > SAL_CALL getClob( sal_Int32 columnIndex ) -+ throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XArray > SAL_CALL getArray( sal_Int32 columnIndex ) -+ throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ -+public: // XColumnLocate -+// virtual sal_Int32 SAL_CALL findColumn( const ::rtl::OUString& columnName ) -+// throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) = 0; -+ -+public: // OPropertySetHelper -+ virtual cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper(); -+ -+ virtual sal_Bool SAL_CALL convertFastPropertyValue( -+ ::com::sun::star::uno::Any & rConvertedValue, -+ ::com::sun::star::uno::Any & rOldValue, -+ sal_Int32 nHandle, -+ const ::com::sun::star::uno::Any& rValue ) -+ throw (::com::sun::star::lang::IllegalArgumentException); -+ -+ virtual void SAL_CALL setFastPropertyValue_NoBroadcast( -+ sal_Int32 nHandle, -+ const ::com::sun::star::uno::Any& rValue ) -+ throw (::com::sun::star::uno::Exception); -+ -+ virtual void SAL_CALL getFastPropertyValue( -+ ::com::sun::star::uno::Any& rValue, -+ sal_Int32 nHandle ) const; -+ -+ // XPropertySet -+ ::com::sun::star::uno::Reference < ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() -+ throw(com::sun::star::uno::RuntimeException); -+ -+public: // OComponentHelper -+ virtual void SAL_CALL disposing(); -+ -+ -+}; -+ -+} -+#endif -diff --git connectivity/source/drivers/postgresql/pq_connection.cxx connectivity/source/drivers/postgresql/pq_connection.cxx -new file mode 100644 -index 0000000..a3a0f58 ---- /dev/null -+++ connectivity/source/drivers/postgresql/pq_connection.cxx -@@ -0,0 +1,740 @@ -+/************************************************************************* -+ * -+ * $RCSfile: pq_connection.cxx,v $ -+ * -+ * $Revision: 1.1.2.5 $ -+ * -+ * last change: $Author: jbu $ $Date: 2007/01/07 13:50:37 $ -+ * -+ * The Contents of this file are made available subject to the terms of -+ * either of the following licenses -+ * -+ * - GNU Lesser General Public License Version 2.1 -+ * - Sun Industry Standards Source License Version 1.1 -+ * -+ * Sun Microsystems Inc., October, 2000 -+ * -+ * GNU Lesser General Public License Version 2.1 -+ * ============================================= -+ * Copyright 2000 by Sun Microsystems, Inc. -+ * 901 San Antonio Road, Palo Alto, CA 94303, USA -+ * -+ * This library is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License version 2.1, as published by the Free Software Foundation. -+ * -+ * This library is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public -+ * License along with this library; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, -+ * MA 02111-1307 USA -+ * -+ * -+ * Sun Industry Standards Source License Version 1.1 -+ * ================================================= -+ * The contents of this file are subject to the Sun Industry Standards -+ * Source License Version 1.1 (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.openoffice.org/license.html. -+ * -+ * Software provided under this License is provided on an "AS IS" basis, -+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, -+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, -+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. -+ * See the License for the specific provisions governing your rights and -+ * obligations concerning the Software. -+ * -+ * The Initial Developer of the Original Code is: Joerg Budischewski -+ * -+ * Copyright: 2000 by Sun Microsystems, Inc. -+ * -+ * All Rights Reserved. -+ * -+ * Contributor(s): Joerg Budischewski -+ * -+ * -+ ************************************************************************/ -+ -+#include -+#include -+#include -+#include -+ -+#include "pq_connection.hxx" -+#include "pq_statement.hxx" -+#include "pq_preparedstatement.hxx" -+#include "pq_databasemetadata.hxx" -+#include "pq_xcontainer.hxx" -+#include "pq_statics.hxx" -+#include "pq_xtables.hxx" -+#include "pq_xviews.hxx" -+#include "pq_xusers.hxx" -+ -+#include -+#include -+#include -+#include -+#include -+ -+#include -+#include -+ -+#include -+#include -+ -+using rtl::OUStringBuffer; -+using rtl::OUString; -+using rtl::OString; -+using rtl::OStringBuffer; -+using rtl::OUStringToOString; -+using osl::MutexGuard; -+ -+using com::sun::star::container::XNameAccess; -+ -+using com::sun::star::lang::XComponent; -+using com::sun::star::lang::XInitialization; -+using com::sun::star::lang::IllegalArgumentException; -+ -+using com::sun::star::script::XTypeConverter; -+ -+using com::sun::star::uno::RuntimeException; -+using com::sun::star::uno::Exception; -+using com::sun::star::uno::Sequence; -+using com::sun::star::uno::Reference; -+using com::sun::star::uno::XInterface; -+using com::sun::star::uno::UNO_QUERY; -+using com::sun::star::uno::XComponentContext; -+using com::sun::star::uno::Any; -+using com::sun::star::uno::makeAny; -+ -+using com::sun::star::beans::PropertyValue; -+using com::sun::star::beans::XPropertySet; -+ -+using com::sun::star::sdbc::XConnection; -+using com::sun::star::sdbc::XResultSet; -+using com::sun::star::sdbc::XRow; -+using com::sun::star::sdbc::XCloseable; -+using com::sun::star::sdbc::SQLException; -+using com::sun::star::sdbc::XWarningsSupplier; -+using com::sun::star::sdbc::XPreparedStatement; -+using com::sun::star::sdbc::XStatement; -+using com::sun::star::sdbc::XDatabaseMetaData; -+ -+namespace pq_sdbc_driver -+{ -+ -+#define ASCII_STR(x) OUString( RTL_CONSTASCII_USTRINGPARAM( x ) ) -+ -+ -+// ______________________________________________________________________________ -+// Helper class for statement lifetime management -+class ClosableReference : public cppu::WeakImplHelper1< com::sun::star::uno::XReference > -+{ -+ Connection *m_conn; -+ ::rtl::ByteSequence m_id; -+public: -+ ClosableReference( const ::rtl::ByteSequence & id , Connection *that ) -+ : m_id( id ), m_conn( that ) -+ { -+ that->acquire(); -+ } -+ -+ virtual ~ClosableReference() -+ { -+ if( m_conn ) -+ m_conn->release(); -+ } -+ -+ virtual void SAL_CALL dispose() throw () -+ { -+ if( m_conn ) -+ { -+ m_conn->removeFromWeakMap(m_id); -+ m_conn->release(); -+ m_conn = 0; -+ } -+ } -+}; -+ -+OUString ConnectionGetImplementationName() -+{ -+ return OUString( RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.comp.connectivity.pq.Connection" ) ); -+} -+com::sun::star::uno::Sequence ConnectionGetSupportedServiceNames(void) -+{ -+ OUString serv( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.sdbc.Connection" ) ); -+ return Sequence< OUString> (&serv,1); -+} -+ -+static sal_Int32 readLogLevelFromConfiguration() -+{ -+ sal_Int32 loglevel = LogLevel::NONE; -+ OUString fileName; -+ osl_getModuleURLFromAddress( -+ (void*) readLogLevelFromConfiguration, (rtl_uString **) &fileName ); -+ fileName = OUString( fileName.getStr(), fileName.lastIndexOf( '/' )+1 ); -+ fileName += OUString::createFromAscii( SAL_CONFIGFILE("postgresql-sdbc.uno") ); -+ rtl::Bootstrap bootstrapHandle( fileName ); -+ -+ OUString str; -+ if( bootstrapHandle.getFrom( ASCII_STR( "PQ_LOGLEVEL" ), str ) ) -+ { -+ if( str.equalsAscii( "NONE" ) ) -+ loglevel = LogLevel::NONE; -+ else if( str.equalsAscii( "ERROR" ) ) -+ loglevel = LogLevel::ERROR; -+ else if( str.equalsAscii( "SQL" ) ) -+ loglevel = LogLevel::SQL; -+ else if( str.equalsAscii( "INFO" ) ) -+ loglevel = LogLevel::SQL; -+ else -+ { -+ fprintf( stderr, "unknown loglevel %s\n", -+ OUStringToOString( str, RTL_TEXTENCODING_UTF8 ).getStr() ); -+ } -+ } -+ return loglevel; -+} -+ -+Connection::Connection( -+ const rtl::Reference< RefCountedMutex > &refMutex, -+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > & ctx ) -+ : ConnectionBase( refMutex->mutex ), -+ m_ctx( ctx ) , -+ m_refMutex( refMutex ) -+{ -+ m_settings.loglevel = readLogLevelFromConfiguration(); -+ -+ if( m_settings.loglevel > LogLevel::NONE ) -+ { -+ m_settings.logFile = fopen( "sdbc-pqsql.log", "a" ); -+ if( m_settings.logFile ) -+ { -+ setvbuf( m_settings.logFile, 0, _IONBF, 0 ); -+ log( &m_settings, m_settings.loglevel , "set this loglevel" ); -+ } -+ else -+ { -+ fprintf( stderr, "Couldn't open sdbc-pqsql.log file\n" ); -+ } -+ } -+} -+ -+Connection::~Connection() -+{ -+ POSTGRE_TRACE( "dtor connection" ); -+ if( m_settings.pConnection ) -+ { -+ PQfinish( m_settings.pConnection ); -+ m_settings.pConnection = 0; -+ } -+ if( m_settings.logFile ) -+ { -+ fclose( m_settings.logFile ); -+ m_settings.logFile = 0; -+ } -+} -+typedef ::std::list< ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XCloseable > , -+ ::pq_sdbc_driver::Allocator < ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XCloseable > > > CloseableList; -+ -+typedef ::std::list< ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > , -+ ::pq_sdbc_driver::Allocator < ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > > > DisposeableList; -+ -+void Connection::close() throw ( SQLException, RuntimeException ) -+{ -+ CloseableList lst; -+ DisposeableList lstDispose; -+ { -+ MutexGuard guard( m_refMutex->mutex ); -+ // silently ignore, if the connection has been closed already -+ if( m_settings.pConnection ) -+ { -+ log( &m_settings, LogLevel::INFO, "closing connection" ); -+ PQfinish( m_settings.pConnection ); -+ m_settings.pConnection = 0; -+ } -+ -+ lstDispose.push_back( Reference< XComponent > ( m_settings.users, UNO_QUERY ) ); -+ lstDispose.push_back( Reference< XComponent > ( m_settings.tables , UNO_QUERY ) ); -+ lstDispose.push_back( Reference< XComponent > ( m_meta, UNO_QUERY ) ); -+ m_meta.clear(); -+ m_settings.tables.clear(); -+ m_settings.users.clear(); -+ -+ for( WeakHashMap::iterator ii = m_myStatements.begin() ; -+ ii != m_myStatements.end() ; -+ ++ii ) -+ { -+ Reference< XCloseable > r = ii->second; -+ if( r.is() ) -+ lst.push_back( r ); -+ } -+ } -+ -+ // close all created statements -+ for( CloseableList::iterator ii = lst.begin(); ii != lst.end() ; ++ii ) -+ ii->get()->close(); -+ -+ // close all created statements -+ for( DisposeableList::iterator iiDispose = lstDispose.begin(); -+ iiDispose != lstDispose.end() ; ++iiDispose ) -+ { -+ if( iiDispose->is() ) -+ iiDispose->get()->dispose(); -+ } -+} -+ -+ -+void Connection::removeFromWeakMap( const ::rtl::ByteSequence & id ) -+{ -+ // shrink the list ! -+ MutexGuard guard( m_refMutex->mutex ); -+ WeakHashMap::iterator ii = m_myStatements.find( id ); -+ if( ii != m_myStatements.end() ) -+ m_myStatements.erase( ii ); -+} -+ -+Reference< XStatement > Connection::createStatement( ) throw (SQLException, RuntimeException) -+{ -+ MutexGuard guard( m_refMutex->mutex ); -+ checkClosed(); -+ -+ Statement *stmt = new Statement( m_refMutex, this , &m_settings ); -+ Reference< XStatement > ret( stmt ); -+ ::rtl::ByteSequence id( 16 ); -+ rtl_createUuid( (sal_uInt8*) id.getConstArray(), 0 , sal_False ); -+ m_myStatements[ id ] = Reference< XCloseable > ( stmt ); -+ stmt->queryAdapter()->addReference( new ClosableReference( id, this ) ); -+ return ret; -+} -+ -+Reference< XPreparedStatement > Connection::prepareStatement( const ::rtl::OUString& sql ) -+ throw (SQLException, RuntimeException) -+{ -+ MutexGuard guard( m_refMutex->mutex ); -+ checkClosed(); -+ -+ rtl::OString byteSql = OUStringToOString( sql, m_settings.encoding ); -+ PreparedStatement *stmt = new PreparedStatement( m_refMutex, this, &m_settings, byteSql ); -+ Reference< XPreparedStatement > ret = stmt; -+ -+ ::rtl::ByteSequence id( 16 ); -+ rtl_createUuid( (sal_uInt8*) id.getConstArray(), 0 , sal_False ); -+ m_myStatements[ id ] = Reference< XCloseable > ( stmt ); -+ stmt->queryAdapter()->addReference( new ClosableReference( id, this ) ); -+ return ret; -+} -+ -+Reference< XPreparedStatement > Connection::prepareCall( const ::rtl::OUString& sql ) -+ throw (SQLException, RuntimeException) -+{ -+ throw SQLException( -+ OUString( -+ RTL_CONSTASCII_USTRINGPARAM( "pq_driver: Callable statements not supported" ) ), -+ Reference< XInterface > (), OUString() , 1, Any() ); -+} -+ -+ -+::rtl::OUString Connection::nativeSQL( const ::rtl::OUString& sql ) -+ throw (SQLException, RuntimeException) -+{ -+ return sql; -+} -+ -+void Connection::setAutoCommit( sal_Bool autoCommit ) throw (SQLException, RuntimeException) -+{ -+ // UNSUPPORTED -+} -+ -+sal_Bool Connection::getAutoCommit( ) throw (SQLException, RuntimeException) -+{ -+ // UNSUPPORTED -+ return sal_True; -+} -+ -+void Connection::commit( ) throw (SQLException, RuntimeException) -+{ -+ // UNSUPPORTED -+} -+ -+void Connection::rollback( ) throw (SQLException, RuntimeException) -+{ -+ // UNSUPPORTED -+} -+ -+sal_Bool Connection::isClosed( ) throw (SQLException, RuntimeException) -+{ -+ return m_settings.pConnection == 0; -+} -+ -+Reference< XDatabaseMetaData > Connection::getMetaData( ) -+ throw (SQLException, RuntimeException) -+{ -+ MutexGuard guard( m_refMutex->mutex ); -+ checkClosed(); -+ if( ! m_meta.is() ) -+ m_meta = new DatabaseMetaData( m_refMutex, this, &m_settings ); -+ return m_meta; -+} -+ -+void Connection::setReadOnly( sal_Bool readOnly ) throw (SQLException, RuntimeException) -+{ -+ // UNSUPPORTED -+ -+} -+ -+sal_Bool Connection::isReadOnly( ) throw (SQLException, RuntimeException) -+{ -+ // UNSUPPORTED -+ return sal_False; -+} -+ -+void Connection::setCatalog( const ::rtl::OUString& catalog ) -+ throw (SQLException, RuntimeException) -+{ -+ // UNSUPPORTED -+} -+ -+::rtl::OUString Connection::getCatalog( ) throw (SQLException, RuntimeException) -+{ -+ OUString ret; -+ MutexGuard ( m_refMutex->mutex ); -+ if( m_settings.pConnection == 0 ) -+ { -+ throw SQLException( ASCII_STR( "pq_connection: connection is closed" ), *this, -+ OUString(), 1, Any() ); -+ } -+ char * p = PQdb(m_settings.pConnection ); -+ return OUString( p, strlen(p) , m_settings.encoding ); -+} -+ -+void Connection::setTransactionIsolation( sal_Int32 level ) -+ throw (SQLException, RuntimeException) -+{ -+ // UNSUPPORTED -+} -+ -+sal_Int32 Connection::getTransactionIsolation( ) throw (SQLException, RuntimeException) -+{ -+ // UNSUPPORTED -+ return 0; -+} -+ -+Reference< XNameAccess > Connection::getTypeMap( ) throw (SQLException, RuntimeException) -+{ -+ Reference< XNameAccess > t; -+ { -+ MutexGuard guard( m_refMutex->mutex ); -+ t = m_typeMap; -+ } -+ return t; -+} -+ -+void Connection::setTypeMap( const Reference< XNameAccess >& typeMap ) -+ throw (SQLException, RuntimeException) -+{ -+ MutexGuard guard( m_refMutex->mutex ); -+ m_typeMap = typeMap; -+} -+Any Connection::getWarnings( ) throw (SQLException, RuntimeException) -+{ -+ return Any(); -+} -+ -+void Connection::clearWarnings( ) throw (SQLException, RuntimeException) -+{ -+} -+ -+ -+static OString properties2String( const OString initialString, -+ const Sequence< PropertyValue > & args, -+ const Reference< XTypeConverter> &tc ) -+{ -+ OStringBuffer ret; -+ -+ ret.append( initialString ); -+ if( initialString.getLength() ) -+ ret.append( " " ); -+ -+ bool initial = false; -+ for( int i = 0; i < args.getLength() ; i ++) -+ { -+ bool append = true; -+ if( args[i].Name.matchIgnoreAsciiCaseAsciiL( RTL_CONSTASCII_STRINGPARAM( "password" ) ) ) -+ { -+ ret.append( "password=" ); -+ } -+ else if( args[i].Name.matchIgnoreAsciiCaseAsciiL( RTL_CONSTASCII_STRINGPARAM( "user" ) ) ) -+ { -+ ret.append( "user=" ); -+ } -+ else if( args[i].Name.matchIgnoreAsciiCaseAsciiL( RTL_CONSTASCII_STRINGPARAM( "port" ) ) ) -+ { -+ ret.append( "port=" ); -+ } -+ else if( args[i].Name.matchIgnoreAsciiCaseAsciiL( RTL_CONSTASCII_STRINGPARAM( "dbname" ) ) ) -+ { -+ ret.append( "dbname=" ); -+ } -+ else if( args[i].Name.matchIgnoreAsciiCaseAsciiL( RTL_CONSTASCII_STRINGPARAM( "connect_timeout" ) ) ) -+ { -+ ret.append( "connect_timeout=" ); -+ } -+ else if( args[i].Name.matchIgnoreAsciiCaseAsciiL( RTL_CONSTASCII_STRINGPARAM( "options" ) ) ) -+ { -+ ret.append( "options=" ); -+ } -+ else if( args[i].Name.matchIgnoreAsciiCaseAsciiL( RTL_CONSTASCII_STRINGPARAM( "requiressl" ) ) ) -+ { -+ ret.append( "requiressl=" ); -+ } -+ else -+ { -+ append = false; -+ // ignore for now -+ } -+ if( append ) -+ { -+ OUString value; -+ tc->convertTo( args[i].Value ,getCppuType( &value) ) >>= value; -+ ret.append( OUStringToOString( value, RTL_TEXTENCODING_UTF8) ); -+ ret.append( " " ); -+ } -+ } -+ -+ return ret.makeStringAndClear(); -+} -+ -+void Connection::initialize( const Sequence< Any >& aArguments ) -+ throw (Exception, RuntimeException) -+{ -+ OUString url; -+ Sequence< PropertyValue > args; -+ -+ Reference< XTypeConverter > tc( m_ctx->getServiceManager()->createInstanceWithContext( -+ OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.script.Converter" ) ), m_ctx ), -+ UNO_QUERY); -+ if( ! tc.is() ) -+ { -+ throw RuntimeException( -+ OUString( RTL_CONSTASCII_USTRINGPARAM("pq_driver: Couldn't instantiate converter service" )), -+ Reference< XInterface > () ); -+ } -+ if( aArguments.getLength() != 2 ) -+ { -+ OUStringBuffer buf(128); -+ buf.appendAscii( "pq_driver: expected 2 arguments, got " ); -+ buf.append( aArguments.getLength( ) ); -+ throw IllegalArgumentException(buf.makeStringAndClear(), Reference< XInterface > () , 0 ); -+ } -+ -+ if( ! (aArguments[0] >>= url) ) -+ { -+ OUStringBuffer buf(128); -+ buf.appendAscii( "pq_driver: expected string as first argument, got " ); -+ buf.append( aArguments[0].getValueType().getTypeName() ); -+ throw IllegalArgumentException( buf.makeStringAndClear() , *this, 0 ); -+ } -+ -+ tc->convertTo( aArguments[1], getCppuType( &args ) ) >>= args; -+ -+ OString o; -+ int nColon = url.indexOf( ':' ); -+ if( nColon != -1 ) -+ { -+ nColon = url.indexOf( ':' , 1+ nColon ); -+ if( nColon != -1 ) -+ { -+ o = OUStringToOString( url.getStr()+nColon+1, m_settings.encoding ); -+ } -+ } -+ o = properties2String( o , args , tc ); -+ -+ m_settings.pConnection = PQconnectdb( o.getStr() ); -+ if( ! m_settings.pConnection ) -+ throw RuntimeException( OUString( RTL_CONSTASCII_USTRINGPARAM( "pq_driver: out of memory" ) ), -+ Reference< XInterface > () ); -+ if( PQstatus( m_settings.pConnection ) == CONNECTION_BAD ) -+ { -+ OUStringBuffer buf( 128 ); -+ -+ const char * error = PQerrorMessage( m_settings.pConnection ); -+ OUString errorMessage( error, strlen( error) , RTL_TEXTENCODING_ASCII_US ); -+ buf.appendAscii( "Couldn't establish database connection to '" ); -+ buf.append( url ); -+ buf.appendAscii( "' (" ); -+ buf.append( errorMessage ); -+ buf.appendAscii( ")" ); -+ PQfinish( m_settings.pConnection ); -+ m_settings.pConnection = 0; -+ throw SQLException( buf.makeStringAndClear(), *this, errorMessage, CONNECTION_BAD, Any() ); -+ } -+ PQsetClientEncoding( m_settings.pConnection, "UNICODE" ); -+ char *p = PQuser( m_settings.pConnection ); -+ m_settings.user = OUString( p, strlen(p), RTL_TEXTENCODING_UTF8); -+ p = PQdb( m_settings.pConnection ); -+ m_settings.catalog = OUString( p, strlen(p), RTL_TEXTENCODING_UTF8); -+ m_settings.tc = tc; -+ -+ if( isLog( &m_settings, LogLevel::INFO ) ) -+ { -+ OUStringBuffer buf( 128 ); -+ buf.appendAscii( "connection to '" ); -+ buf.append( url ); -+ buf.appendAscii( "' successfully opened" ); -+ log( &m_settings, LogLevel::INFO, buf.makeStringAndClear() ); -+ } -+} -+ -+void Connection::disposing() -+{ -+ close(); -+} -+ -+void Connection::checkClosed() throw ( SQLException, RuntimeException ) -+{ -+ if( !m_settings.pConnection ) -+ throw SQLException( ASCII_STR( "pq_connection: Connection already closed" ), -+ *this, OUString(), 1, Any() ); -+} -+ -+Reference< XNameAccess > Connection::getTables( ) -+ throw (::com::sun::star::uno::RuntimeException) -+{ -+ if( isLog( &m_settings, LogLevel::INFO ) ) -+ { -+ log( &m_settings, LogLevel::INFO, "Connection::getTables() got called" ); -+ } -+ MutexGuard guard( m_refMutex->mutex ); -+ if( !m_settings.tables.is() ) -+ m_settings.tables = Tables::create( m_refMutex, this, &m_settings , &m_settings.pTablesImpl); -+ else -+ // TODO: how to overcome the performance problem ? -+ Reference< com::sun::star::util::XRefreshable > ( m_settings.tables, UNO_QUERY )->refresh(); -+ return m_settings.tables; -+} -+ -+Reference< XNameAccess > Connection::getViews( ) -+ throw (::com::sun::star::uno::RuntimeException) -+{ -+ if( isLog( &m_settings, LogLevel::INFO ) ) -+ { -+ log( &m_settings, LogLevel::INFO, "Connection::getViews() got called" ); -+ } -+ MutexGuard guard( m_refMutex->mutex ); -+ if( !m_settings.views.is() ) -+ m_settings.views = Views::create( m_refMutex, this, &m_settings, &(m_settings.pViewsImpl) ); -+ else -+ // TODO: how to overcome the performance problem ? -+ Reference< com::sun::star::util::XRefreshable > ( m_settings.views, UNO_QUERY )->refresh(); -+ return m_settings.views; -+} -+ -+ -+ -+Reference< XNameAccess > Connection::getUsers( ) -+ throw (::com::sun::star::uno::RuntimeException) -+{ -+ if( isLog( &m_settings, LogLevel::INFO ) ) -+ { -+ log( &m_settings, LogLevel::INFO, "Connection::getUsers() got called" ); -+ } -+ -+ MutexGuard guard( m_refMutex->mutex ); -+ if( !m_settings.users.is() ) -+ m_settings.users = Users::create( m_refMutex, this, &m_settings ); -+ return m_settings.users; -+} -+ -+ -+Reference< XInterface > ConnectionCreateInstance( -+ const Reference< XComponentContext > & ctx ) throw (Exception) -+{ -+ ::rtl::Reference< RefCountedMutex > ref = new RefCountedMutex(); -+ return * new Connection( ref, ctx ); -+} -+ -+ -+ -+bool isLog( ConnectionSettings *settings, int loglevel ) -+{ -+ return settings->loglevel >= loglevel && settings->logFile; -+} -+ -+void log( ConnectionSettings *settings, sal_Int32 level, const OUString &logString ) -+{ -+ log( settings, level, OUStringToOString( logString, settings->encoding ).getStr() ); -+} -+void log( ConnectionSettings *settings, sal_Int32 level, const char *str ) -+{ -+ if( isLog( settings, level ) ) -+ { -+ static const char *strLevel[] = { "NONE", "ERROR", "SQL", "INFO", "DATA" }; -+ -+ time_t t = ::time( 0 ); -+ char *pString; -+#ifdef SAL_W32 -+ pString = asctime( localtime( &t ) ); -+#else -+ struct tm timestruc; -+ char timestr[50]; -+ memset( timestr, 0 , 50); -+ pString = timestr; -+ ::localtime_r( &t , ×truc ); -+ asctime_r( ×truc, timestr ); -+#endif -+ for( int i = 0 ; pString[i] ; i ++ ) -+ { -+ if( pString[i] <= 13 ) -+ { -+ pString[i] = 0; -+ break; -+ } -+ } -+ fprintf( settings->logFile, "%s [%s]: %s\n", pString, strLevel[level], str ); -+ } -+} -+ -+ -+} -+ -+ -+ -+static struct cppu::ImplementationEntry g_entries[] = -+{ -+ { -+ pq_sdbc_driver::ConnectionCreateInstance, pq_sdbc_driver::ConnectionGetImplementationName, -+ pq_sdbc_driver::ConnectionGetSupportedServiceNames, cppu::createSingleComponentFactory, -+ 0 , 0 -+ }, -+ { 0, 0, 0, 0, 0, 0 } -+}; -+ -+ -+extern "C" -+{ -+ -+//================================================================================================== -+void SAL_CALL component_getImplementationEnvironment( -+ const sal_Char ** ppEnvTypeName, uno_Environment ** ppEnv ) -+{ -+ *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; -+} -+//================================================================================================== -+sal_Bool SAL_CALL component_writeInfo( -+ void * pServiceManager, void * pRegistryKey ) -+{ -+ return cppu::component_writeInfoHelper( pServiceManager, pRegistryKey, g_entries ); -+} -+//================================================================================================== -+void * SAL_CALL component_getFactory( -+ const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey ) -+{ -+ return cppu::component_getFactoryHelper( pImplName, pServiceManager, pRegistryKey , g_entries ); -+} -+ -+} -diff --git connectivity/source/drivers/postgresql/pq_connection.hxx connectivity/source/drivers/postgresql/pq_connection.hxx -new file mode 100644 -index 0000000..322e375 ---- /dev/null -+++ connectivity/source/drivers/postgresql/pq_connection.hxx -@@ -0,0 +1,285 @@ -+/************************************************************************* -+ * -+ * $RCSfile: pq_connection.hxx,v $ -+ * -+ * $Revision: 1.1.2.4 $ -+ * -+ * last change: $Author: jbu $ $Date: 2004/06/10 15:26:55 $ -+ * -+ * The Contents of this file are made available subject to the terms of -+ * either of the following licenses -+ * -+ * - GNU Lesser General Public License Version 2.1 -+ * - Sun Industry Standards Source License Version 1.1 -+ * -+ * Sun Microsystems Inc., October, 2000 -+ * -+ * GNU Lesser General Public License Version 2.1 -+ * ============================================= -+ * Copyright 2000 by Sun Microsystems, Inc. -+ * 901 San Antonio Road, Palo Alto, CA 94303, USA -+ * -+ * This library is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License version 2.1, as published by the Free Software Foundation. -+ * -+ * This library is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public -+ * License along with this library; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, -+ * MA 02111-1307 USA -+ * -+ * -+ * Sun Industry Standards Source License Version 1.1 -+ * ================================================= -+ * The contents of this file are subject to the Sun Industry Standards -+ * Source License Version 1.1 (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.openoffice.org/license.html. -+ * -+ * Software provided under this License is provided on an "AS IS" basis, -+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, -+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, -+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. -+ * See the License for the specific provisions governing your rights and -+ * obligations concerning the Software. -+ * -+ * The Initial Developer of the Original Code is: Joerg Budischewski -+ * -+ * Copyright: 2000 by Sun Microsystems, Inc. -+ * -+ * All Rights Reserved. -+ * -+ * Contributor(s): Joerg Budischewski -+ * -+ * -+ ************************************************************************/ -+ -+#ifndef _PQ_CONNECTION_HXX_ -+#define _PQ_CONNECTION_HXX_ -+#include -+#include -+ -+#include -+ -+#include -+ -+#include -+#include -+#include -+#include -+#include -+ -+#include -+ -+#include -+#include -+ -+#include -+ -+#include -+#include -+ -+#include -+#include "pq_allocator.hxx" -+ -+namespace pq_sdbc_driver -+{ -+#ifdef POSTGRE_TRACE -+#define POSTGRE_TRACE( x ) printf( "%s\n" , x ) -+#define POSTGRE_TRACE_1( x ,y) printf( "%s %s\n" , x ,y ) -+#else -+#define POSTGRE_TRACE(x) ((void)0) -+#define POSTGRE_TRACE_1(x,y) ((void)0) -+#endif -+ -+class RefCountedMutex : public salhelper::SimpleReferenceObject -+{ -+public: -+ osl::Mutex mutex; -+}; -+ -+struct ConnectionSettings; -+ -+ -+ -+//-------------------------------------------------- -+// Logging API -+//-------------------------------------------------- -+namespace LogLevel -+{ -+// when you add a loglevel, extend the log function ! -+static const sal_Int32 NONE = 0; -+static const sal_Int32 ERROR = 1; -+static const sal_Int32 SQL = 2; -+static const sal_Int32 INFO = 3; -+static const sal_Int32 DATA = 4; -+} -+bool isLog( ConnectionSettings *settings, int loglevel ); -+void log( ConnectionSettings *settings, sal_Int32 level, const rtl::OUString &logString ); -+void log( ConnectionSettings *settings, sal_Int32 level, const char *str ); -+//-------------------------------------------------- -+ -+class Tables; -+class Views; -+struct ConnectionSettings -+{ -+ ConnectionSettings() : -+ showSystemColumns( sal_False ), -+ pConnection(0), -+ encoding( RTL_TEXTENCODING_UTF8), -+ logFile( 0 ), -+ loglevel( LogLevel::INFO ) -+ {} -+ rtl_TextEncoding encoding; -+ PGconn *pConnection; -+ ::com::sun::star::uno::Reference< com::sun::star::script::XTypeConverter > tc; -+ ::com::sun::star::uno::Reference< com::sun::star::container::XNameAccess > tables; -+ ::com::sun::star::uno::Reference< com::sun::star::container::XNameAccess > users; -+ ::com::sun::star::uno::Reference< com::sun::star::container::XNameAccess > views; -+ Tables *pTablesImpl; // needed to implement renaming of tables / views -+ Views *pViewsImpl; // needed to implement renaming of tables / views -+ ::rtl::OUString user; -+ ::rtl::OUString catalog; -+ sal_Bool showSystemColumns; -+ FILE *logFile; -+ sal_Int32 loglevel; -+}; -+ -+//-------------------------------------------------- -+typedef cppu::WeakComponentImplHelper6< -+ com::sun::star::sdbc::XConnection, -+ com::sun::star::sdbc::XWarningsSupplier, -+ com::sun::star::lang::XInitialization, -+ com::sun::star::sdbcx::XTablesSupplier, -+ com::sun::star::sdbcx::XViewsSupplier, -+ com::sun::star::sdbcx::XUsersSupplier > ConnectionBase; -+ -+// some types -+struct HashByteSequence -+{ -+ sal_Int32 operator () ( const ::rtl::ByteSequence & seq ) const -+ { -+ return *(sal_Int32*) seq.getConstArray(); -+ } -+}; -+ -+typedef ::std::hash_map< -+ ::rtl::ByteSequence, -+ ::com::sun::star::uno::WeakReference< com::sun::star::sdbc::XCloseable >, -+ HashByteSequence, -+ ::std::equal_to< ::rtl::ByteSequence >, -+ Allocator< std::pair< const ::rtl::ByteSequence,::com::sun::star::uno::WeakReference< com::sun::star::sdbc::XCloseable > > > -+> WeakHashMap; -+typedef ::std::vector< rtl::OString, Allocator< ::rtl::OString > > OStringVector; -+ -+ -+ -+typedef std::hash_map -+< -+ const sal_Int32, -+ rtl::OUString, -+ ::std::hash< sal_Int32 >, -+ ::std::equal_to< sal_Int32 >, -+ Allocator< ::std::pair< sal_Int32, ::rtl::OUString > > -+> Int2StringMap; -+ -+class Connection : public ConnectionBase -+{ -+ ::com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > m_ctx; -+ ::com::sun::star::uno::Reference< com::sun::star::container::XNameAccess > m_typeMap; -+ ConnectionSettings m_settings; -+ ::rtl::Reference< RefCountedMutex > m_refMutex; -+ ::com::sun::star::uno::Reference< com::sun::star::sdbc::XDatabaseMetaData > m_meta; -+ WeakHashMap m_myStatements; -+ -+private: -+ void checkClosed() -+ throw ( com::sun::star::sdbc::SQLException, com::sun::star::uno::RuntimeException ); -+ -+public: -+ Connection( -+ const rtl::Reference< RefCountedMutex > &refMutex, -+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > & ctx ); -+ -+ ~Connection( ); -+ -+public: // XCloseable -+ virtual void SAL_CALL close() -+ throw ( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException ); -+ -+public: // XConnection -+ -+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XStatement > SAL_CALL createStatement( ) -+ throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) ; -+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XPreparedStatement > SAL_CALL prepareStatement( -+ const ::rtl::OUString& sql ) -+ throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XPreparedStatement > SAL_CALL prepareCall( -+ const ::rtl::OUString& sql ) -+ throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual ::rtl::OUString SAL_CALL nativeSQL( const ::rtl::OUString& sql ) -+ throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual void SAL_CALL setAutoCommit( sal_Bool autoCommit ) -+ throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Bool SAL_CALL getAutoCommit( ) -+ throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual void SAL_CALL commit( ) -+ throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual void SAL_CALL rollback( ) -+ throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Bool SAL_CALL isClosed( ) -+ throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual ::com::sun::star::uno::Reference< com::sun::star::sdbc::XDatabaseMetaData > SAL_CALL getMetaData( ) -+ throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual void SAL_CALL setReadOnly( sal_Bool readOnly ) -+ throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Bool SAL_CALL isReadOnly( ) -+ throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual void SAL_CALL setCatalog( const ::rtl::OUString& catalog ) -+ throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual ::rtl::OUString SAL_CALL getCatalog( ) -+ throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual void SAL_CALL setTransactionIsolation( sal_Int32 level ) -+ throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Int32 SAL_CALL getTransactionIsolation( ) -+ throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual ::com::sun::star::uno::Reference< com::sun::star::container::XNameAccess > SAL_CALL getTypeMap( ) -+ throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual void SAL_CALL setTypeMap( -+ const ::com::sun::star::uno::Reference< com::sun::star::container::XNameAccess >& typeMap ) -+ throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ -+public: // XWarningsSupplier -+ virtual ::com::sun::star::uno::Any SAL_CALL getWarnings( ) -+ throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual void SAL_CALL clearWarnings( ) -+ throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ -+public: // XInitialization -+ virtual void SAL_CALL initialize( -+ const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) -+ throw (com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); -+ -+public: // XTablesSupplier -+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL getTables( ) throw (::com::sun::star::uno::RuntimeException); -+ -+public: // XUsersSupplier -+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL getUsers( ) throw (::com::sun::star::uno::RuntimeException); -+ -+public: // XViewsSupplier -+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL getViews( ) throw (::com::sun::star::uno::RuntimeException); -+ -+public: -+ virtual void SAL_CALL disposing(); -+ -+public: // helper function -+ void removeFromWeakMap( const ::rtl::ByteSequence & seq ); -+}; -+ -+} -+#endif -diff --git connectivity/source/drivers/postgresql/pq_databasemetadata.cxx connectivity/source/drivers/postgresql/pq_databasemetadata.cxx -new file mode 100644 -index 0000000..b3c18d8 ---- /dev/null -+++ connectivity/source/drivers/postgresql/pq_databasemetadata.cxx -@@ -0,0 +1,2164 @@ -+/************************************************************************* -+ * -+ * $RCSfile: pq_databasemetadata.cxx,v $ -+ * -+ * $Revision: 1.1.2.11 $ -+ * -+ * last change: $Author: jbu $ $Date: 2007/02/15 20:04:47 $ -+ * -+ * The Contents of this file are made available subject to the terms of -+ * either of the following licenses -+ * -+ * - GNU Lesser General Public License Version 2.1 -+ * - Sun Industry Standards Source License Version 1.1 -+ * -+ * Sun Microsystems Inc., October, 2000 -+ * -+ * GNU Lesser General Public License Version 2.1 -+ * ============================================= -+ * Copyright 2000 by Sun Microsystems, Inc. -+ * 901 San Antonio Road, Palo Alto, CA 94303, USA -+ * -+ * This library is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License version 2.1, as published by the Free Software Foundation. -+ * -+ * This library is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public -+ * License along with this library; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, -+ * MA 02111-1307 USA -+ * -+ * -+ * Sun Industry Standards Source License Version 1.1 -+ * ================================================= -+ * The contents of this file are subject to the Sun Industry Standards -+ * Source License Version 1.1 (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.openoffice.org/license.html. -+ * -+ * Software provided under this License is provided on an "AS IS" basis, -+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, -+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, -+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. -+ * See the License for the specific provisions governing your rights and -+ * obligations concerning the Software. -+ * -+ * The Initial Developer of the Original Code is: Joerg Budischewski -+ * -+ * Copyright: 2000 by Sun Microsystems, Inc. -+ * -+ * All Rights Reserved. -+ * -+ * Contributor(s): Joerg Budischewski -+ * -+ * -+ ************************************************************************/ -+#include -+#include "pq_databasemetadata.hxx" -+#include "pq_driver.hxx" -+#include "pq_sequenceresultset.hxx" -+#include "pq_statics.hxx" -+#include "pq_tools.hxx" -+ -+#include -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+using ::osl::MutexGuard; -+ -+using ::rtl::OUString; -+ -+using com::sun::star::sdbc::SQLException; -+using com::sun::star::sdbc::XStatement; -+using com::sun::star::sdbc::XResultSet; -+using com::sun::star::sdbc::XRow; -+using com::sun::star::sdbc::XCloseable; -+using com::sun::star::sdbc::XParameters; -+using com::sun::star::sdbc::XPreparedStatement; -+// using com::sun::star::sdbc::IndexType; -+// using com::sun::star::sdbc::DataType; -+ -+using com::sun::star::uno::RuntimeException; -+using com::sun::star::uno::Sequence; -+ -+using com::sun::star::uno::Reference; -+using com::sun::star::uno::Sequence; -+using com::sun::star::uno::Any; -+using com::sun::star::uno::makeAny; -+using com::sun::star::uno::UNO_QUERY; -+ -+namespace pq_sdbc_driver -+{ -+typedef -+std::vector -+< -+ com::sun::star::uno::Sequence< com::sun::star::uno::Any >, -+ Allocator< com::sun::star::uno::Sequence< com::sun::star::uno::Any > > -+> SequenceAnyVector; -+ -+ -+#define ASCII_STR(x) OUString( RTL_CONSTASCII_USTRINGPARAM( x ) ) -+ -+static const int MAX_COLUMNS_IN_GROUPBY = 16; -+static const int MAX_COLUMNS_IN_INDEX = 32; -+static const int MAX_COLUMNS_IN_ORDER_BY = 16; -+static const int MAX_COLUMNS_IN_SELECT = 1024; -+static const int MAX_IDENTIFIER_LENGTH = 63; -+static const int MAX_COLUMNS_IN_TABLE = 1024; -+static const int MAX_CONNECTIONS = 0xffff; -+static const int MAX_STATEMENTS = 0xffff; -+static const int MAX_STATEMENT_LENGTH = -1; -+static const int MAX_TABLES_IN_SELECT = 0xffff; -+static const int MAX_USER_NAME_LENGTH = MAX_IDENTIFIER_LENGTH; -+ -+ -+// alphabetically ordered ! -+static const int PRIVILEGE_CREATE = 0x1; -+static const int PRIVILEGE_DELETE = 0x2; -+static const int PRIVILEGE_EXECUTE = 0x4; -+static const int PRIVILEGE_INSERT = 0x8; -+static const int PRIVILEGE_REFERENCES = 0x10; -+static const int PRIVILEGE_RULE = 0x20; -+static const int PRIVILEGE_SELECT = 0x40; -+static const int PRIVILEGE_TEMPORARY = 0x80; -+static const int PRIVILEGE_TRIGGER = 0x100; -+static const int PRIVILEGE_UPDATE = 0x200; -+static const int PRIVILEGE_USAGE = 0x400; -+static const int PRIVILEGE_MAX = PRIVILEGE_USAGE; -+ -+void DatabaseMetaData::checkClosed() -+ throw (SQLException, RuntimeException) -+{ -+} -+ -+DatabaseMetaData::DatabaseMetaData( -+ const ::rtl::Reference< RefCountedMutex > & refMutex, -+ const ::com::sun::star::uno::Reference< com::sun::star::sdbc::XConnection > & origin, -+ ConnectionSettings *pSettings ) -+ : m_pSettings( pSettings ), -+ m_origin( origin ), -+ m_refMutex( refMutex ) -+ -+{ -+ -+} -+ -+sal_Bool DatabaseMetaData::allProceduresAreCallable( ) throw (SQLException, RuntimeException) -+{ -+ // TODO -+ return sal_False; -+} -+ -+sal_Bool DatabaseMetaData::allTablesAreSelectable( ) throw (SQLException, RuntimeException) -+{ -+ return sal_True; -+} -+ -+OUString DatabaseMetaData::getURL( ) throw (SQLException, RuntimeException) -+{ -+ // TODO -+ return OUString(); -+} -+ -+OUString DatabaseMetaData::getUserName( ) throw (SQLException, RuntimeException) -+{ -+ return m_pSettings->user; -+} -+ -+sal_Bool DatabaseMetaData::isReadOnly( ) throw (SQLException, RuntimeException) -+{ -+ return sal_False; -+} -+ -+ -+sal_Bool DatabaseMetaData::nullsAreSortedHigh( ) throw (SQLException, RuntimeException) -+{ -+ return sal_False; -+} -+ -+sal_Bool DatabaseMetaData::nullsAreSortedLow( ) throw (SQLException, RuntimeException) -+{ -+ return ! nullsAreSortedHigh(); -+} -+ -+sal_Bool DatabaseMetaData::nullsAreSortedAtStart( ) throw (SQLException, RuntimeException) -+{ -+ return ! nullsAreSortedHigh(); -+} -+ -+sal_Bool DatabaseMetaData::nullsAreSortedAtEnd( ) throw (SQLException, RuntimeException) -+{ -+ return nullsAreSortedHigh(); -+} -+ -+OUString DatabaseMetaData::getDatabaseProductName( ) throw (SQLException, RuntimeException) -+{ -+ return ASCII_STR( "postgresql"); -+} -+ -+OUString DatabaseMetaData::getDatabaseProductVersion( ) throw (SQLException, RuntimeException) -+{ -+ return ASCII_STR( POSTGRESQL_VERSION ); -+} -+OUString DatabaseMetaData::getDriverName( ) throw (SQLException, RuntimeException) -+{ -+ return ASCII_STR( "postgresql-sdbc" ); -+} -+ -+OUString DatabaseMetaData::getDriverVersion( ) throw (SQLException, RuntimeException) -+{ -+ return ASCII_STR( PQ_SDBC_DRIVER_VERSION ); -+} -+ -+sal_Int32 DatabaseMetaData::getDriverMajorVersion( ) throw (RuntimeException) -+{ -+ return PQ_SDBC_MAJOR; -+} -+ -+sal_Int32 DatabaseMetaData::getDriverMinorVersion( ) throw (RuntimeException) -+{ -+ return PQ_SDBC_MINOR; -+} -+ -+sal_Bool DatabaseMetaData::usesLocalFiles( ) throw (SQLException, RuntimeException) -+{ -+ return sal_True; -+} -+ -+sal_Bool DatabaseMetaData::usesLocalFilePerTable( ) throw (SQLException, RuntimeException) -+{ -+ return sal_True; -+} -+ -+sal_Bool DatabaseMetaData::supportsMixedCaseIdentifiers( ) throw (SQLException, RuntimeException) -+{ -+ return sal_False; -+} -+ -+sal_Bool DatabaseMetaData::storesUpperCaseIdentifiers( ) throw (SQLException, RuntimeException) -+{ -+ return sal_False; -+} -+ -+sal_Bool DatabaseMetaData::storesLowerCaseIdentifiers( ) throw (SQLException, RuntimeException) -+{ -+ return sal_False; -+} -+ -+ -+sal_Bool DatabaseMetaData::storesMixedCaseIdentifiers( ) throw (SQLException, RuntimeException) -+{ -+ return sal_False; -+} -+ -+ -+sal_Bool DatabaseMetaData::supportsMixedCaseQuotedIdentifiers( ) throw (SQLException, RuntimeException) -+{ -+ return sal_False; -+} -+ -+sal_Bool DatabaseMetaData::storesUpperCaseQuotedIdentifiers( ) throw (SQLException, RuntimeException) -+{ -+ return sal_False; -+} -+ -+ -+sal_Bool DatabaseMetaData::storesLowerCaseQuotedIdentifiers( ) throw (SQLException, RuntimeException) -+{ -+ return sal_False; -+} -+ -+ -+sal_Bool DatabaseMetaData::storesMixedCaseQuotedIdentifiers( ) throw (SQLException, RuntimeException) -+{ -+ return sal_False; -+} -+ -+ -+OUString DatabaseMetaData::getIdentifierQuoteString( ) throw (SQLException, RuntimeException) -+{ -+ return ASCII_STR( "\"" ); -+} -+ -+OUString DatabaseMetaData::getSQLKeywords( ) throw (SQLException, RuntimeException) -+{ -+ return ASCII_STR( -+ "ANALYZE," -+ "ANALYSE," -+ "DO," -+ "ILIKE," -+ "LIMIT," -+ "NEW," -+ "OFFSET," -+ "OLD," -+ "PLACING" ); -+} -+OUString DatabaseMetaData::getNumericFunctions( ) throw (SQLException, RuntimeException) -+{ -+ // TODO -+ return OUString(); -+} -+ -+OUString DatabaseMetaData::getStringFunctions( ) throw (SQLException, RuntimeException) -+{ -+ // TODO -+ return OUString(); -+} -+ -+OUString DatabaseMetaData::getSystemFunctions( ) throw (SQLException, RuntimeException) -+{ -+ // TODO -+ return OUString(); -+} -+OUString DatabaseMetaData::getTimeDateFunctions( ) throw (SQLException, RuntimeException) -+{ -+ // TODO -+ return OUString(); -+} -+OUString DatabaseMetaData::getSearchStringEscape( ) throw (SQLException, RuntimeException) -+{ -+ return ASCII_STR( "\\" ); -+} -+OUString DatabaseMetaData::getExtraNameCharacters( ) throw (SQLException, RuntimeException) -+{ -+ // TODO -+ return OUString(); -+} -+ -+sal_Bool DatabaseMetaData::supportsAlterTableWithAddColumn( ) throw (SQLException, RuntimeException) -+{ -+ return sal_True; -+} -+ -+sal_Bool DatabaseMetaData::supportsAlterTableWithDropColumn( ) throw (SQLException, RuntimeException) -+{ -+ return sal_True; -+} -+ -+sal_Bool DatabaseMetaData::supportsColumnAliasing( ) throw (SQLException, RuntimeException) -+{ -+ return sal_True; -+} -+ -+sal_Bool DatabaseMetaData::nullPlusNonNullIsNull( ) throw (SQLException, RuntimeException) -+{ -+ return sal_True; -+} -+ -+sal_Bool DatabaseMetaData::supportsTypeConversion( ) throw (SQLException, RuntimeException) // TODO, DON'T KNOW -+{ -+ return sal_False; -+} -+ -+sal_Bool DatabaseMetaData::supportsConvert( sal_Int32 fromType, sal_Int32 toType ) throw (SQLException, RuntimeException) // TODO -+{ -+ return sal_False; -+} -+ -+sal_Bool DatabaseMetaData::supportsTableCorrelationNames( ) throw (SQLException, RuntimeException) // TODO, don't know -+{ -+ return sal_True; -+} -+ -+ -+sal_Bool DatabaseMetaData::supportsDifferentTableCorrelationNames( ) throw (SQLException, RuntimeException) // TODO, don't know -+{ -+ -+ return sal_True; -+} -+sal_Bool DatabaseMetaData::supportsExpressionsInOrderBy( ) throw (SQLException, RuntimeException) -+{ -+ return sal_True; -+} -+ -+sal_Bool DatabaseMetaData::supportsOrderByUnrelated( ) throw (SQLException, RuntimeException) -+{ -+ return sal_True; -+} -+ -+sal_Bool DatabaseMetaData::supportsGroupBy( ) throw (SQLException, RuntimeException) -+{ -+ return sal_True; -+} -+ -+sal_Bool DatabaseMetaData::supportsGroupByUnrelated( ) throw (SQLException, RuntimeException) // TODO, DONT know -+{ -+ -+ return sal_True; -+} -+ -+sal_Bool DatabaseMetaData::supportsGroupByBeyondSelect( ) throw (SQLException, RuntimeException) // TODO, DON'T know -+{ -+ -+ return sal_True; -+} -+ -+sal_Bool DatabaseMetaData::supportsLikeEscapeClause( ) throw (SQLException, RuntimeException) -+{ -+ return sal_True; -+} -+ -+sal_Bool DatabaseMetaData::supportsMultipleResultSets( ) throw (SQLException, RuntimeException) -+{ -+ return sal_True; -+} -+ -+sal_Bool DatabaseMetaData::supportsMultipleTransactions( ) throw (SQLException, RuntimeException) -+{ -+ return sal_False; -+} -+ -+sal_Bool DatabaseMetaData::supportsNonNullableColumns( ) throw (SQLException, RuntimeException) -+{ -+ return sal_True; -+} -+ -+ -+sal_Bool DatabaseMetaData::supportsMinimumSQLGrammar( ) throw (SQLException, RuntimeException) -+{ -+ return sal_True; -+} -+ -+sal_Bool DatabaseMetaData::supportsCoreSQLGrammar( ) throw (SQLException, RuntimeException) -+{ -+ return sal_True; -+} -+ -+sal_Bool DatabaseMetaData::supportsExtendedSQLGrammar( ) throw (SQLException, RuntimeException) -+{ -+ return sal_True; -+} -+ -+sal_Bool DatabaseMetaData::supportsANSI92EntryLevelSQL( ) throw (SQLException, RuntimeException) -+{ -+ return sal_True; -+} -+ -+sal_Bool DatabaseMetaData::supportsANSI92IntermediateSQL( ) throw (SQLException, RuntimeException) -+{ -+ return sal_True; -+} -+ -+sal_Bool DatabaseMetaData::supportsANSI92FullSQL( ) throw (SQLException, RuntimeException) -+{ -+ return sal_True; -+} -+ -+sal_Bool DatabaseMetaData::supportsIntegrityEnhancementFacility( ) throw (SQLException, RuntimeException) -+{ -+ // TODO -+ return sal_True; -+} -+ -+sal_Bool DatabaseMetaData::supportsOuterJoins( ) throw (SQLException, RuntimeException) -+{ -+ return sal_True; -+} -+ -+sal_Bool DatabaseMetaData::supportsFullOuterJoins( ) throw (SQLException, RuntimeException) -+{ -+ return sal_True; -+} -+ -+sal_Bool DatabaseMetaData::supportsLimitedOuterJoins( ) throw (SQLException, RuntimeException) -+{ -+ return sal_True; -+} -+ -+ -+OUString DatabaseMetaData::getSchemaTerm( ) throw (SQLException, RuntimeException) -+{ -+ return ASCII_STR( "SCHEMA" ); -+} -+ -+OUString DatabaseMetaData::getProcedureTerm( ) throw (SQLException, RuntimeException) -+{ -+ // don't know -+ return OUString(); -+} -+ -+OUString DatabaseMetaData::getCatalogTerm( ) throw (SQLException, RuntimeException) -+{ -+ // TODO is this correct ? -+ return ASCII_STR( "DATABASE" ); -+} -+ -+sal_Bool DatabaseMetaData::isCatalogAtStart( ) throw (SQLException, RuntimeException) // TODO don't know -+{ -+ -+ return sal_True; -+} -+ -+OUString DatabaseMetaData::getCatalogSeparator( ) throw (SQLException, RuntimeException) -+{ -+ // TODO don't know -+ return ASCII_STR( "." ); -+} -+ -+sal_Bool DatabaseMetaData::supportsSchemasInDataManipulation( ) throw (SQLException, RuntimeException) -+{ -+ return sal_True; -+} -+ -+sal_Bool DatabaseMetaData::supportsSchemasInProcedureCalls( ) throw (SQLException, RuntimeException) -+{ -+ return sal_True; -+} -+ -+sal_Bool DatabaseMetaData::supportsSchemasInTableDefinitions( ) throw (SQLException, RuntimeException) -+{ -+ return sal_True; -+} -+ -+sal_Bool DatabaseMetaData::supportsSchemasInIndexDefinitions( ) throw (SQLException, RuntimeException) -+{ -+ return sal_True; -+} -+ -+sal_Bool DatabaseMetaData::supportsSchemasInPrivilegeDefinitions( ) throw (SQLException, RuntimeException) -+{ -+ return sal_True; -+} -+ -+sal_Bool DatabaseMetaData::supportsCatalogsInDataManipulation( ) throw (SQLException, RuntimeException) -+{ -+ return sal_False; -+} -+ -+sal_Bool DatabaseMetaData::supportsCatalogsInProcedureCalls( ) throw (SQLException, RuntimeException) -+{ -+ return sal_False; -+} -+ -+sal_Bool DatabaseMetaData::supportsCatalogsInTableDefinitions( ) throw (SQLException, RuntimeException) -+{ -+ return sal_False; -+} -+ -+ -+sal_Bool DatabaseMetaData::supportsCatalogsInIndexDefinitions( ) throw (SQLException, RuntimeException) -+{ -+ return sal_False; -+} -+ -+ -+sal_Bool DatabaseMetaData::supportsCatalogsInPrivilegeDefinitions( ) throw (SQLException, RuntimeException) -+{ -+ return sal_False; -+} -+ -+ -+sal_Bool DatabaseMetaData::supportsPositionedDelete( ) throw (SQLException, RuntimeException) -+{ -+ // TODO -+ return sal_True; -+} -+ -+sal_Bool DatabaseMetaData::supportsPositionedUpdate( ) throw (SQLException, RuntimeException) -+{ -+ // TODO -+ return sal_True; -+} -+ -+ -+sal_Bool DatabaseMetaData::supportsSelectForUpdate( ) throw (SQLException, RuntimeException) -+{ -+ // TODO -+ return sal_False; -+} -+ -+ -+sal_Bool DatabaseMetaData::supportsStoredProcedures( ) throw (SQLException, RuntimeException) -+{ -+ // TODO -+ return sal_False; -+} -+ -+ -+sal_Bool DatabaseMetaData::supportsSubqueriesInComparisons( ) throw (SQLException, RuntimeException) -+{ -+ // TODO , don't know -+ return sal_True; -+} -+ -+sal_Bool DatabaseMetaData::supportsSubqueriesInExists( ) throw (SQLException, RuntimeException) -+{ -+ // TODO , don't know -+ return sal_True; -+} -+ -+sal_Bool DatabaseMetaData::supportsSubqueriesInIns( ) throw (SQLException, RuntimeException) -+{ -+ // TODO , don't know -+ return sal_True; -+} -+ -+sal_Bool DatabaseMetaData::supportsSubqueriesInQuantifieds( ) throw (SQLException, RuntimeException) -+{ -+ // TODO , don't know -+ return sal_True; -+} -+ -+sal_Bool DatabaseMetaData::supportsCorrelatedSubqueries( ) throw (SQLException, RuntimeException) -+{ -+ // TODO , don't know -+ return sal_True; -+} -+sal_Bool DatabaseMetaData::supportsUnion( ) throw (SQLException, RuntimeException) -+{ -+ return sal_True; -+} -+ -+sal_Bool DatabaseMetaData::supportsUnionAll( ) throw (SQLException, RuntimeException) -+{ -+ return sal_True; -+} -+ -+sal_Bool DatabaseMetaData::supportsOpenCursorsAcrossCommit( ) throw (SQLException, RuntimeException) -+{ -+ // TODO, don't know -+ return sal_False; -+} -+ -+sal_Bool DatabaseMetaData::supportsOpenCursorsAcrossRollback( ) throw (SQLException, RuntimeException) -+{ -+ // TODO, don't know -+ return sal_False; -+} -+ -+sal_Bool DatabaseMetaData::supportsOpenStatementsAcrossCommit( ) throw (SQLException, RuntimeException) -+{ -+ // TODO, don't know -+ return sal_False; -+} -+sal_Bool DatabaseMetaData::supportsOpenStatementsAcrossRollback( ) throw (SQLException, RuntimeException) -+{ -+ // TODO, don't know -+ return sal_False; -+} -+ -+sal_Int32 DatabaseMetaData::getMaxBinaryLiteralLength( ) throw (SQLException, RuntimeException) -+{ -+ // TODO, don't know -+ return -1; -+} -+ -+sal_Int32 DatabaseMetaData::getMaxCharLiteralLength( ) throw (SQLException, RuntimeException) -+{ -+ return -1; -+} -+ -+sal_Int32 DatabaseMetaData::getMaxColumnNameLength( ) throw (SQLException, RuntimeException) //TODO, don't know -+{ -+ return MAX_IDENTIFIER_LENGTH; -+} -+ -+sal_Int32 DatabaseMetaData::getMaxColumnsInGroupBy( ) throw (SQLException, RuntimeException) //TODO, don't know -+{ -+ return MAX_COLUMNS_IN_GROUPBY; -+} -+ -+sal_Int32 DatabaseMetaData::getMaxColumnsInIndex( ) throw (SQLException, RuntimeException) //TODO, don't know -+{ -+ return MAX_COLUMNS_IN_INDEX; -+} -+ -+sal_Int32 DatabaseMetaData::getMaxColumnsInOrderBy( ) throw (SQLException, RuntimeException) //TODO, don't know -+{ -+ return MAX_COLUMNS_IN_ORDER_BY; -+} -+ -+sal_Int32 DatabaseMetaData::getMaxColumnsInSelect( ) throw (SQLException, RuntimeException) //TODO, don't know -+{ -+ return MAX_COLUMNS_IN_SELECT; -+} -+ -+sal_Int32 DatabaseMetaData::getMaxColumnsInTable( ) throw (SQLException, RuntimeException) //TODO, don't know -+{ -+ return MAX_COLUMNS_IN_TABLE; -+} -+ -+sal_Int32 DatabaseMetaData::getMaxConnections( ) throw (SQLException, RuntimeException) //TODO, don't know -+{ -+ return MAX_CONNECTIONS; -+} -+ -+sal_Int32 DatabaseMetaData::getMaxCursorNameLength( ) throw (SQLException, RuntimeException) //TODO, don't know -+{ -+ return MAX_IDENTIFIER_LENGTH; -+} -+ -+sal_Int32 DatabaseMetaData::getMaxIndexLength( ) throw (SQLException, RuntimeException) //TODO, don't know -+{ -+ return MAX_IDENTIFIER_LENGTH; -+} -+ -+sal_Int32 DatabaseMetaData::getMaxSchemaNameLength( ) throw (SQLException, RuntimeException) -+{ -+ return MAX_IDENTIFIER_LENGTH; -+} -+ -+sal_Int32 DatabaseMetaData::getMaxProcedureNameLength( ) throw (SQLException, RuntimeException) -+{ -+ return MAX_IDENTIFIER_LENGTH; -+} -+ -+sal_Int32 DatabaseMetaData::getMaxCatalogNameLength( ) throw (SQLException, RuntimeException) -+{ -+ return MAX_IDENTIFIER_LENGTH; -+} -+ -+sal_Int32 DatabaseMetaData::getMaxRowSize( ) throw (SQLException, RuntimeException) -+{ -+ return -1; -+} -+ -+sal_Bool DatabaseMetaData::doesMaxRowSizeIncludeBlobs( ) throw (SQLException, RuntimeException) -+{ -+ return sal_False; -+} -+ -+sal_Int32 DatabaseMetaData::getMaxStatementLength( ) throw (SQLException, RuntimeException) //TODO, don't know -+{ -+ return MAX_STATEMENT_LENGTH; -+} -+ -+sal_Int32 DatabaseMetaData::getMaxStatements( ) throw (SQLException, RuntimeException) //TODO, don't know -+{ -+ return MAX_STATEMENTS; -+} -+ -+sal_Int32 DatabaseMetaData::getMaxTableNameLength( ) throw (SQLException, RuntimeException) -+{ -+ return MAX_IDENTIFIER_LENGTH; -+} -+ -+sal_Int32 DatabaseMetaData::getMaxTablesInSelect( ) throw (SQLException, RuntimeException) -+{ -+ return MAX_TABLES_IN_SELECT; -+} -+ -+sal_Int32 DatabaseMetaData::getMaxUserNameLength( ) throw (SQLException, RuntimeException) -+{ -+ return MAX_USER_NAME_LENGTH; -+} -+ -+sal_Int32 DatabaseMetaData::getDefaultTransactionIsolation( ) throw (SQLException, RuntimeException) -+{ -+ return com::sun::star::sdbc::TransactionIsolation::READ_COMMITTED; -+} -+ -+sal_Bool DatabaseMetaData::supportsTransactions( ) throw (SQLException, RuntimeException) -+{ -+ return sal_False; -+} -+ -+sal_Bool DatabaseMetaData::supportsTransactionIsolationLevel( sal_Int32 level ) throw (SQLException, RuntimeException) -+{ -+ return sal_False; -+} -+ -+sal_Bool DatabaseMetaData::supportsDataDefinitionAndDataManipulationTransactions( ) -+ throw (SQLException, RuntimeException) -+{ -+ return sal_True; -+} -+ -+sal_Bool DatabaseMetaData::supportsDataManipulationTransactionsOnly( ) throw (SQLException, RuntimeException) -+{ -+ return sal_False; -+} -+ -+sal_Bool DatabaseMetaData::dataDefinitionCausesTransactionCommit( ) throw (SQLException, RuntimeException) -+{ -+ // don't know -+ return sal_True; -+} -+ -+sal_Bool DatabaseMetaData::dataDefinitionIgnoredInTransactions( ) throw (SQLException, RuntimeException) -+{ -+ return sal_True; -+} -+ -+::com::sun::star::uno::Reference< XResultSet > DatabaseMetaData::getProcedures( -+ const ::com::sun::star::uno::Any& catalog, -+ const OUString& schemaPattern, -+ const OUString& procedureNamePattern ) throw (SQLException, RuntimeException) -+{ -+// 1. PROCEDURE_CAT string => procedure catalog (may be NULL ) -+// 2. PROCEDURE_SCHEM string => procedure schema (may be NULL ) -+// 3. PROCEDURE_NAME string => procedure name -+// 4. reserved for future use -+// 5. reserved for future use -+// 6. reserved for future use -+// 7. REMARKS string => explanatory comment on the procedure -+// 8. PROCEDURE_TYPE short => kind of procedure: -+// * UNKNOWN - May return a result -+// * NO - Does not return a result -+// * RETURN - Returns a result -+ -+ MutexGuard guard( m_refMutex->mutex ); -+ checkClosed(); -+ return new SequenceResultSet( -+ m_refMutex, *this, Sequence< OUString >(), Sequence< Sequence< Any > > (), m_pSettings->tc ); -+} -+ -+::com::sun::star::uno::Reference< XResultSet > DatabaseMetaData::getProcedureColumns( -+ const ::com::sun::star::uno::Any& catalog, -+ const OUString& schemaPattern, -+ const OUString& procedureNamePattern, -+ const OUString& columnNamePattern ) throw (SQLException, RuntimeException) -+{ -+ MutexGuard guard( m_refMutex->mutex ); -+ checkClosed(); -+ return new SequenceResultSet( -+ m_refMutex, *this, Sequence< OUString >(), Sequence< Sequence< Any > > (), m_pSettings->tc ); -+} -+ -+::com::sun::star::uno::Reference< XResultSet > DatabaseMetaData::getTables( -+ const ::com::sun::star::uno::Any& catalog, -+ const OUString& schemaPattern, -+ const OUString& tableNamePattern, -+ const ::com::sun::star::uno::Sequence< OUString >& types ) -+ throw (SQLException, RuntimeException) -+{ -+ Statics &statics = getStatics(); -+ -+ MutexGuard guard( m_refMutex->mutex ); -+ checkClosed(); -+ -+ if( isLog( m_pSettings, LogLevel::INFO ) ) -+ { -+ rtl::OUStringBuffer buf( 128 ); -+ buf.appendAscii( "DatabaseMetaData::getTables got called with " ); -+ buf.append( schemaPattern ); -+ buf.appendAscii( "." ); -+ buf.append( tableNamePattern ); -+ log( m_pSettings, LogLevel::INFO, buf.makeStringAndClear() ); -+ } -+ // ignore catalog, as a single pq connection does not support multiple catalogs -+ -+ Reference< XPreparedStatement > statement = m_origin->prepareStatement( -+ ASCII_STR( -+ "SELECT " -+ "DISTINCT ON (pg_namespace.nspname, relname ) " // avoid duplicates (pg_settings !) -+ "pg_namespace.nspname, relname, relkind, pg_description.description " -+ "FROM pg_namespace, pg_class LEFT JOIN pg_description ON pg_class.oid = pg_description.objoid " -+ "WHERE relnamespace = pg_namespace.oid " -+ "AND ( relkind = 'r' OR relkind = 'v') " -+ "AND pg_namespace.nspname LIKE ? " -+ "AND relname LIKE ? " -+// "ORDER BY pg_namespace.nspname || relname" -+ ) ); -+ -+ Reference< XParameters > parameters( statement, UNO_QUERY ); -+ parameters->setString( 1 , schemaPattern ); -+ parameters->setString( 2 , tableNamePattern ); -+ -+ Reference< XResultSet > rs = statement->executeQuery(); -+ Reference< XRow > xRow( rs, UNO_QUERY ); -+ SequenceAnyVector vec; -+ -+ while( rs->next() ) -+ { -+ Sequence< Any > row( 5 ); -+ -+ row[0] <<= m_pSettings->catalog; -+ row[1] <<= xRow->getString( 1 ); -+ row[2] <<= xRow->getString( 2 ); -+ OUString type = xRow->getString(3); -+ if( 0 == type.compareToAscii( "r" ) ) -+ { -+ if( 0 == xRow->getString(1).compareToAscii( "pg_catalog" ) ) -+ { -+ row[3] <<= statics.SYSTEM_TABLE; -+ } -+ else -+ { -+ row[3] <<= statics.TABLE; -+ } -+ } -+ else if( 0 == type.compareToAscii( "v" ) ) -+ { -+ row[3] <<= statics.VIEW; -+ } -+ else -+ { -+ row[3] <<= statics.UNKNOWN; -+ } -+ row[4] <<= xRow->getString(4); -+ -+ // no description in postgresql AFAIK -+ vec.push_back( row ); -+ } -+ Reference< XCloseable > closeable( statement, UNO_QUERY ); -+ if( closeable.is() ) -+ closeable->close(); -+ -+ return new SequenceResultSet( -+ m_refMutex, *this, statics.tablesRowNames, -+ Sequence< Sequence< Any > > ( &vec[0],vec.size() ), m_pSettings->tc ); -+} -+ -+struct SortInternalSchemasLastAndPublicFirst -+{ -+ bool operator () ( const Sequence< Any > & a, const Sequence< Any > & b ) -+ { -+ OUString valueA; -+ OUString valueB; -+ a[0] >>= valueA; -+ b[0] >>= valueB; -+ bool ret = false; -+ if( valueA.compareToAscii( RTL_CONSTASCII_STRINGPARAM( "public" ) ) == 0 ) -+ { -+ ret = true; -+ } -+ else if( valueB.compareToAscii( RTL_CONSTASCII_STRINGPARAM( "public" ) ) == 0 ) -+ { -+ ret = false; -+ } -+ else if( valueA.matchAsciiL( RTL_CONSTASCII_STRINGPARAM( "pg_" ) ) && -+ valueB.matchAsciiL( RTL_CONSTASCII_STRINGPARAM( "pg_" ) ) ) -+ { -+ ret = valueA.compareTo( valueB ) < 0; // sorts equal ! -+ } -+ else if( valueA.matchAsciiL( RTL_CONSTASCII_STRINGPARAM( "pg_" ) )) -+ { -+ ret = false; // sorts last ! -+ } -+ else if( valueB.matchAsciiL( RTL_CONSTASCII_STRINGPARAM( "pg_" ) ) ) -+ { -+ ret = true; // sorts dorst ! -+ -+ } -+ else -+ { -+ ret = (valueA.compareTo( valueB ) < 0); -+ } -+ return ret; -+ } -+}; -+ -+::com::sun::star::uno::Reference< XResultSet > DatabaseMetaData::getSchemas( ) -+ throw (SQLException, RuntimeException) -+{ -+ MutexGuard guard( m_refMutex->mutex ); -+ checkClosed(); -+ -+ if( isLog( m_pSettings, LogLevel::INFO ) ) -+ { -+ log( m_pSettings, LogLevel::INFO, "DatabaseMetaData::getSchemas() got called" ); -+ } -+ // TABLE_SCHEM string =&gt; schema name -+ Reference< XStatement > statement = m_origin->createStatement(); -+ Reference< XResultSet > rs = statement->executeQuery( -+ ASCII_STR("SELECT nspname from pg_namespace") ); -+ -+ Reference< XRow > xRow( rs, UNO_QUERY ); -+ SequenceAnyVector vec; -+ while( rs->next() ) -+ { -+ Sequence row(1); -+ row[0] <<= xRow->getString(1); -+ vec.push_back( row ); -+ } -+ -+ // sort public first, sort internal schemas last, sort rest in alphabetic order -+ std::sort( vec.begin(), vec.end(), SortInternalSchemasLastAndPublicFirst() ); -+ -+ Reference< XCloseable > closeable( statement, UNO_QUERY ); -+ if( closeable.is() ) -+ closeable->close(); -+ return new SequenceResultSet( -+ m_refMutex, *this, getStatics().schemaNames, -+ Sequence< Sequence< Any > > ( &vec[0], vec.size() ), m_pSettings->tc ); -+} -+ -+::com::sun::star::uno::Reference< XResultSet > DatabaseMetaData::getCatalogs( ) -+ throw (SQLException, RuntimeException) -+{ -+ MutexGuard guard( m_refMutex->mutex ); -+ checkClosed(); -+ return new SequenceResultSet( -+ m_refMutex, *this, Sequence< OUString >(), Sequence< Sequence< Any > > (), m_pSettings->tc ); -+} -+ -+::com::sun::star::uno::Reference< XResultSet > DatabaseMetaData::getTableTypes( ) -+ throw (SQLException, RuntimeException) -+{ -+ MutexGuard guard( m_refMutex->mutex ); -+ checkClosed(); -+ return new SequenceResultSet( -+ m_refMutex, *this, getStatics().tableTypeNames, getStatics().tableTypeData, -+ m_pSettings->tc ); -+} -+ -+ -+/** returns the constant from sdbc.DataType -+ */ -+sal_Int32 typeNameToDataType( const OUString &typeName, const OUString &typtype ) -+{ -+// sal_Int32 ret = com::sun::star::sdbc::DataType::DISTINCT; -+ // map all unknown types to memo (longvarchar). This allows to show them in -+ // string representation. Additionally, the edit-table-type-selection-box -+ // is not so unuseable anymore. -+ sal_Int32 ret = com::sun::star::sdbc::DataType::LONGVARCHAR; -+ if( 0 == typtype.compareToAscii( "b" ) ) -+ { -+ // as long as the OOo framework does not support arrays, -+ // the user is better of with interpreting arrays as strings ! -+// if( typeName.getLength() && '_' == typeName[0] ) -+// { -+// its just a naming convention, but as long as we don't have anything better, -+// we take it as granted -+// ret = com::sun::star::sdbc::DataType::ARRAY; -+// } -+ // base type -+ Statics &statics = getStatics(); -+ BaseTypeMap::iterator ii = statics.baseTypeMap.find( typeName ); -+ if( ii != statics.baseTypeMap.end() ) -+ { -+ ret = ii->second; -+ } -+ } -+ else if( 0 == typtype.compareToAscii( "c" ) ) -+ { -+ ret = com::sun::star::sdbc::DataType::STRUCT; -+ } -+ else if( 0 == typtype.compareToAscii( "d" ) ) -+ { -+ ret = com::sun::star::sdbc::DataType::LONGVARCHAR; -+ } -+ return ret; -+} -+ -+static bool isSystemColumn( const OUString &columnName ) -+{ -+ return -+ columnName.compareToAscii( "oid" ) == 0 || -+ columnName.compareToAscii( "tableoid" ) == 0 || -+ columnName.compareToAscii( "xmin" ) == 0 || -+ columnName.compareToAscii( "cmin" ) == 0 || -+ columnName.compareToAscii( "xmax" ) == 0 || -+ columnName.compareToAscii( "cmax" ) == 0 || -+ columnName.compareToAscii( "ctid" ) == 0; -+} -+ -+// is not exported by the postgres header -+const static int PQ_VARHDRSZ = sizeof( sal_Int32 ); -+ -+static void extractPrecisionAndScale( -+ sal_Int32 dataType, sal_Int32 atttypmod, sal_Int32 *precision, sal_Int32 *scale ) -+{ -+ if( atttypmod < PQ_VARHDRSZ ) -+ { -+ *precision = 0; -+ *scale = 0; -+ } -+ else -+ { -+ switch( dataType ) -+ { -+ case com::sun::star::sdbc::DataType::NUMERIC: -+ case com::sun::star::sdbc::DataType::DECIMAL: -+ { -+ *precision = ( ( atttypmod - PQ_VARHDRSZ ) >> 16 ) & 0xffff; -+ *scale = (atttypmod - PQ_VARHDRSZ ) & 0xffff; -+ break; -+ } -+ default: -+ *precision = atttypmod - PQ_VARHDRSZ; -+ *scale = 0; -+ } -+ } -+} -+ -+struct DatabaseTypeDescription -+{ -+ DatabaseTypeDescription() -+ {} -+ DatabaseTypeDescription( const OUString &name, const OUString & type ) : -+ typeName( name ), -+ typeType( type ) -+ {} -+ DatabaseTypeDescription( const DatabaseTypeDescription &source ) : -+ typeName( source.typeName ), -+ typeType( source.typeType ) -+ {} -+ DatabaseTypeDescription & operator = ( const DatabaseTypeDescription & source ) -+ { -+ typeName = source.typeName; -+ typeType = source.typeType; -+ return *this; -+ } -+ OUString typeName; -+ OUString typeType; -+}; -+ -+typedef std::hash_map -+< -+ sal_Int32, -+ DatabaseTypeDescription, -+ ::std::hash< sal_Int32 >, -+ ::std::equal_to< sal_Int32 >, -+ Allocator< ::std::pair< sal_Int32, DatabaseTypeDescription > > -+> Oid2DatabaseTypeDescriptionMap; -+ -+static void columnMetaData2DatabaseTypeDescription( -+ Oid2DatabaseTypeDescriptionMap &oidMap, -+ const Reference< XResultSet > &rs, -+ const Reference< XStatement > &stmt ) -+{ -+ Reference< XRow > row( rs, UNO_QUERY ); -+ int domains = 0; -+ rtl::OUStringBuffer queryBuf(128); -+ queryBuf.appendAscii( RTL_CONSTASCII_STRINGPARAM( "SELECT oid,typtype,typname FROM pg_TYPE WHERE " ) ); -+ while( rs->next() ) -+ { -+ if( row->getString( 9 ).equalsAscii( "d" ) && oidMap.find( row->getInt( 12 ) ) == oidMap.end() ) -+ { -+ oidMap[row->getInt(12)] = DatabaseTypeDescription(); -+ if( domains ) -+ queryBuf.appendAscii( " OR " ); -+ queryBuf.appendAscii( "oid = " ); -+ queryBuf.append( row->getInt(12 ), 10 ); -+ domains ++; -+ } -+ } -+ rs->beforeFirst(); -+ -+ if( domains ) -+ { -+ Reference< XResultSet > rsDomain = stmt->executeQuery( queryBuf.makeStringAndClear() ); -+ row = Reference< XRow >( rsDomain, UNO_QUERY ); -+ while( rsDomain->next() ) -+ { -+ oidMap[row->getInt(1)] = DatabaseTypeDescription(row->getString(3), row->getString(2) ); -+ } -+ disposeNoThrow( stmt ); -+ } -+ -+} -+ -+ -+ -+::com::sun::star::uno::Reference< XResultSet > DatabaseMetaData::getColumns( -+ const ::com::sun::star::uno::Any& catalog, -+ const OUString& schemaPattern, -+ const OUString& tableNamePattern, -+ const OUString& columnNamePattern ) throw (SQLException, RuntimeException) -+{ -+ Statics &statics = getStatics(); -+ -+ // continue ! -+ MutexGuard guard( m_refMutex->mutex ); -+ checkClosed(); -+ -+ if( isLog( m_pSettings, LogLevel::INFO ) ) -+ { -+ rtl::OUStringBuffer buf( 128 ); -+ buf.appendAscii( "DatabaseMetaData::getColumns got called with " ); -+ buf.append( schemaPattern ); -+ buf.appendAscii( "." ); -+ buf.append( tableNamePattern ); -+ buf.appendAscii( "." ); -+ buf.append( columnNamePattern ); -+ log( m_pSettings, LogLevel::INFO, buf.makeStringAndClear() ); -+ } -+ -+ // ignore catalog, as a single pq connection -+ // does not support multiple catalogs eitherway -+ -+ // 1. TABLE_CAT string => table catalog (may be NULL) -+ // => not supported -+ // 2. TABLE_SCHEM string => table schema (may be NULL) -+ // => pg_namespace.nspname -+ // 3. TABLE_NAME string => table name -+ // => pg_class.relname -+ // 4. COLUMN_NAME string => column name -+ // => pg_attribure.attname -+ // 5. DATA_TYPE short => SQL type from java.sql.Types -+ // => pg_type.typname => sdbc.DataType -+ // 6. TYPE_NAME string => Data source dependent type name, for a UDT the -+ // type name is fully qualified -+ // => pg_type.typname -+ // 7. COLUMN_SIZE long => column size. For char or date types this is -+ // the maximum number of characters, for numeric -+ // or decimal types this is precision. -+ // => pg_attribute.atttypmod -+ // 8. BUFFER_LENGTH is not used. -+ // => not used -+ // 9. DECIMAL_DIGITS long => the number of fractional digits -+ // => don't know ! TODO ! -+ // 10. NUM_PREC_RADIX long => Radix (typically either 10 or 2) -+ // => TODO ?? -+ // 11. NULLABLE long => is NULL allowed? -+ // NO_NULLS - might not allow NULL values -+ // NULABLE - definitely allows NULL values -+ // NULLABLE_UNKNOWN - nullability unknown -+ // => pg_attribute.attnotnull -+ // 12. REMARKS string => comment describing column (may be NULL ) -+ // => Don't know, there does not seem to exist something like -+ // that in postgres -+ // 13. COLUMN_DEF string => default value (may be NULL) -+ // => pg_type.typdefault -+ // 14. SQL_DATA_TYPE long => unused -+ // => empty -+ // 15. SQL_DATETIME_SUB long => unused -+ // => empty -+ // 16. CHAR_OCTET_LENGTH long => for char types the maximum number of -+ // bytes in the column -+ // => pg_type.typlen -+ // 17. ORDINAL_POSITION int => index of column in table (starting at 1) -+ // pg_attribute.attnum -+ // 18. IS_NULLABLE string => "NO" means column definitely does not allow -+ // NULL values; "YES" means the column might -+ // allow NULL values. An empty string means -+ // nobody knows. -+ // => pg_attribute.attnotnull -+// select objoid,description,objsubid,pg_attribute.attname from pg_attribute LEFT JOIN pg_description ON pg_attribute.attrelid=pg_description.objoid and pg_attribute.attnum = pg_description.objsubid -+ -+ Reference< XPreparedStatement > statement = m_origin->prepareStatement( -+ ASCII_STR( -+ -+ "SELECT pg_namespace.nspname, " // 1 -+ "pg_class.relname, " // 2 -+ "pg_attribute.attname, " // 3 -+ "pg_type.typname, " // 4 -+ "pg_attribute.atttypmod, " // 5 -+ "pg_attribute.attnotnull, " // 6 -+ "pg_type.typdefault, " // 7 -+ "pg_attribute.attnum, " // 8 -+ "pg_type.typtype, " // 9 -+ "pg_attrdef.adsrc, " // 10 -+ "pg_description.description, " // 11 -+ "pg_type.typbasetype " // 12 -+ "FROM pg_class, " -+ "pg_attribute LEFT JOIN pg_attrdef ON pg_attribute.attrelid = pg_attrdef.adrelid AND pg_attribute.attnum = pg_attrdef.adnum " -+ "LEFT JOIN pg_description ON pg_attribute.attrelid = pg_description.objoid AND pg_attribute.attnum=pg_description.objsubid," -+ " pg_type, pg_namespace " -+ "WHERE pg_attribute.attrelid = pg_class.oid " -+ "AND pg_attribute.atttypid = pg_type.oid " -+ "AND pg_class.relnamespace = pg_namespace.oid " -+ "AND pg_namespace.nspname LIKE ? " -+ "AND pg_class.relname LIKE ? " -+ "AND pg_attribute.attname LIKE ? " -+ "ORDER BY pg_namespace.nspname || pg_class.relname || pg_attribute.attnum" -+ ) ); -+ -+ Reference< XParameters > parameters( statement, UNO_QUERY ); -+ parameters->setString( 1 , schemaPattern ); -+ parameters->setString( 2 , tableNamePattern ); -+ parameters->setString( 3 , columnNamePattern ); -+ -+ Reference< XResultSet > rs = statement->executeQuery(); -+ Reference< XRow > xRow( rs, UNO_QUERY ); -+ SequenceAnyVector vec; -+ -+ Oid2DatabaseTypeDescriptionMap domainMap; -+ Reference< XStatement > domainTypeStmt = m_origin->createStatement(); -+ columnMetaData2DatabaseTypeDescription( domainMap, rs, domainTypeStmt ); -+ -+ while( rs->next() ) -+ { -+ OUString columnName = xRow->getString(3); -+ if( m_pSettings->showSystemColumns || ! isSystemColumn( columnName ) ) -+ { -+ sal_Int32 precision, scale, type; -+ Sequence< Any > row( 18 ); -+ row[0] <<= m_pSettings->catalog; -+ row[1] <<= xRow->getString(1); // -+ row[2] <<= xRow->getString(2); -+ row[3] <<= columnName; -+ if( xRow->getString(9).equalsAscii( "d" ) ) -+ { -+ DatabaseTypeDescription desc( domainMap[xRow->getInt(12)] ); -+ type = typeNameToDataType( desc.typeName, desc.typeType ); -+ } -+ else -+ { -+ type = typeNameToDataType( xRow->getString(4), xRow->getString(9) ); -+ } -+ extractPrecisionAndScale( type, xRow->getInt(5) , &precision, &scale ); -+ row[4] <<= type; -+ row[5] <<= xRow->getString(4); -+ row[6] <<= precision; -+ row[8] <<= scale; -+ if( xRow->getBoolean( 6 ) && ! isSystemColumn(xRow->getString(3)) ) -+ { -+ row[10] <<= OUString::valueOf(com::sun::star::sdbc::ColumnValue::NO_NULLS); -+ row[17] <<= statics.NO; -+ } -+ else -+ { -+ row[10] <<= OUString::valueOf(com::sun::star::sdbc::ColumnValue::NULLABLE); -+ row[17] <<= statics.YES; -+ } -+ -+ row[11] <<= xRow->getString( 11 ); // comment -+ row[12] <<= xRow->getString(10); // COLUMN_DEF = pg_type.typdefault -+ row[15] <<= precision; -+ row[16] <<= xRow->getString(8) ; -+ -+ // no description in postgresql AFAIK -+ vec.push_back( row ); -+ } -+ } -+ Reference< XCloseable > closeable( statement, UNO_QUERY ); -+ if( closeable.is() ) -+ closeable->close(); -+ -+ return new SequenceResultSet( -+ m_refMutex, *this, statics.columnRowNames, -+ Sequence< Sequence< Any > > ( &vec[0],vec.size() ), m_pSettings->tc ); -+} -+ -+::com::sun::star::uno::Reference< XResultSet > DatabaseMetaData::getColumnPrivileges( -+ const ::com::sun::star::uno::Any& catalog, -+ const OUString& schema, -+ const OUString& table, -+ const OUString& columnNamePattern ) throw (SQLException, RuntimeException) -+{ -+ MutexGuard guard( m_refMutex->mutex ); -+ checkClosed(); -+ return new SequenceResultSet( -+ m_refMutex, *this, Sequence< OUString >(), Sequence< Sequence< Any > > (), m_pSettings->tc ); -+} -+ -+static void addPrivilegesToVector( -+ sal_Int32 privilege, const OUString &catalog, const OUString & schema, -+ const OUString &tableName, const OUString &grantor, const OUString &grantee, -+ bool grantable, SequenceAnyVector &vec ) -+{ -+ Statics & statics = getStatics(); -+ for( int index = 1; index <= PRIVILEGE_MAX ; index = index << 1 ) -+ { -+ OUString privname; -+ switch( privilege & index ) -+ { -+ case PRIVILEGE_SELECT: -+ privname = statics.SELECT; break; -+ case PRIVILEGE_UPDATE: -+ privname = statics.UPDATE; break; -+ case PRIVILEGE_INSERT: -+ privname = statics.INSERT; break; -+ case PRIVILEGE_DELETE: -+ privname = statics.DELETE; break; -+ case PRIVILEGE_RULE: -+ privname = statics.RULE; break; -+ case PRIVILEGE_REFERENCES: -+ privname = statics.REFERENCES; break; -+ case PRIVILEGE_TRIGGER: -+ privname = statics.TRIGGER; break; -+ case PRIVILEGE_EXECUTE: -+ privname = statics.EXECUTE; break; -+ case PRIVILEGE_USAGE: -+ privname = statics.USAGE; break; -+ case PRIVILEGE_CREATE: -+ privname = statics.CREATE; break; -+ case PRIVILEGE_TEMPORARY: -+ privname = statics.TEMPORARY; break; -+ default: -+ break; -+ } -+ -+ Sequence< Any > seq( 7 ); -+ seq[0] <<= catalog; -+ seq[1] <<= schema; -+ seq[2] <<= tableName; -+ seq[3] <<= grantor; -+ seq[4] <<= grantee; -+ seq[5] <<= privname; -+ seq[6] <<= (grantable ? statics.YES : statics.NO ); -+ vec.push_back( seq ); -+ } -+} -+ -+ -+::com::sun::star::uno::Reference< XResultSet > DatabaseMetaData::getTablePrivileges( -+ const ::com::sun::star::uno::Any& catalog, -+ const OUString& schemaPattern, -+ const OUString& tableNamePattern ) throw (SQLException, RuntimeException) -+{ -+ MutexGuard guard( m_refMutex->mutex ); -+ checkClosed(); -+ -+ if( isLog( m_pSettings, LogLevel::INFO ) ) -+ { -+ rtl::OUStringBuffer buf( 128 ); -+ buf.appendAscii( "DatabaseMetaData::getTablePrivileges got called with " ); -+ buf.append( schemaPattern ); -+ buf.appendAscii( "." ); -+ buf.append( tableNamePattern ); -+ log( m_pSettings, LogLevel::INFO, buf.makeStringAndClear() ); -+ } -+ -+ // algorithm -+ -+ // get the pg_class.relact item for the concrete table -+ // get userid for username from pg_shadow (or pg_user view) -+ // get the group names mentioned in pg_class.relact from pg_group -+ // identify, which groups the current user belongs to -+ // calculate the union of all permissions (1 public, 1 user, n groups) -+ -+ // 1. TABLE_CAT string => table catalog (may be NULL ) -+ // 2. TABLE_SCHEM string => table schema (may be NULL ) -+ // 3. TABLE_NAME string => table name -+ // 4. GRANTOR => grantor of access (may be NULL ) -+ // 5. GRANTEE string => grantee of access -+ // 6. PRIVILEGE string => name of access (SELECT, INSERT, UPDATE, REFERENCES, ...) -+ // 7. IS_GRANTABLE string => "YES" if grantee is permitted to grant to -+ // others; "NO" if not; NULL if unknown -+ -+ Reference< XPreparedStatement > statement = m_origin->prepareStatement( -+ ASCII_STR( -+ "SELECT pg_namespace.nspname, " -+ "pg_class.relname, " -+ "pg_class.relacl, " -+ "pg_user.usename " -+ "FROM pg_class, pg_user, pg_namespace " -+ "WHERE pg_class.relowner = pg_user.usesysid " -+ "AND ( pg_class.relkind = 'r' OR pg_class.relkind = 'v' ) " -+ "AND pg_class.relnamespace = pg_namespace.oid " -+ "AND pg_namespace.nspname LIKE ? " -+ "AND pg_class.relname LIKE ?" -+ "ORDER BY pg_namespace.nspname || pg_class.relname " -+ ) ); -+ -+ Reference< XParameters > parameters( statement, UNO_QUERY ); -+ parameters->setString( 1 , schemaPattern ); -+ parameters->setString( 2 , tableNamePattern ); -+ -+ Reference< XResultSet > rs = statement->executeQuery(); -+ Reference< XRow > xRow( rs, UNO_QUERY ); -+ SequenceAnyVector vec; -+ while( rs->next() ) -+ { -+ // TODO calculate privileges ! -+ sal_Int32 privilege = 0; -+ privilege = -+ PRIVILEGE_SELECT | PRIVILEGE_UPDATE | PRIVILEGE_INSERT | -+ PRIVILEGE_DELETE | PRIVILEGE_RULE | PRIVILEGE_REFERENCES | -+ PRIVILEGE_TRIGGER| PRIVILEGE_EXECUTE| PRIVILEGE_USAGE | -+ PRIVILEGE_CREATE |PRIVILEGE_TEMPORARY; -+ -+ addPrivilegesToVector( privilege, -+ m_pSettings->catalog, -+ xRow->getString( 1 ), -+ xRow->getString( 2 ), -+ xRow->getString( 4 ), -+ m_pSettings->user, -+ m_pSettings->user == xRow->getString( 4 ), -+ vec ); -+ } -+ -+ return new SequenceResultSet( -+ m_refMutex, *this, getStatics().tablePrivilegesNames, -+ Sequence< Sequence< Any > > ( &vec[0], vec.size() ), m_pSettings->tc ); -+} -+ -+::com::sun::star::uno::Reference< XResultSet > DatabaseMetaData::getBestRowIdentifier( -+ const ::com::sun::star::uno::Any& catalog, -+ const OUString& schema, -+ const OUString& table, -+ sal_Int32 scope, -+ sal_Bool nullable ) throw (SQLException, RuntimeException) -+{ -+ MutexGuard guard( m_refMutex->mutex ); -+ checkClosed(); -+ return new SequenceResultSet( -+ m_refMutex, *this, Sequence< OUString >(), Sequence< Sequence< Any > > (), m_pSettings->tc ); -+} -+ -+::com::sun::star::uno::Reference< XResultSet > DatabaseMetaData::getVersionColumns( -+ const ::com::sun::star::uno::Any& catalog, -+ const OUString& schema, -+ const OUString& table ) throw (SQLException, RuntimeException) -+{ -+ MutexGuard guard( m_refMutex->mutex ); -+ checkClosed(); -+ return new SequenceResultSet( -+ m_refMutex, *this, Sequence< OUString >(), Sequence< Sequence< Any > > (), m_pSettings->tc ); -+} -+ -+::com::sun::star::uno::Reference< XResultSet > DatabaseMetaData::getPrimaryKeys( -+ const ::com::sun::star::uno::Any& catalog, -+ const OUString& schema, -+ const OUString& table ) throw (SQLException, RuntimeException) -+{ -+ MutexGuard guard( m_refMutex->mutex ); -+ checkClosed(); -+ -+// 1. TABLE_CAT string => table catalog (may be NULL ) -+// 2. TABLE_SCHEM string => table schema (may be NULL ) -+// 3. TABLE_NAME string => table name -+// 4. COLUMN_NAME string => column name -+// 5. KEY_SEQ short => sequence number within primary key -+// 6. PK_NAME string => primary key name (may be NULL ) -+ -+ if( isLog( m_pSettings, LogLevel::INFO ) ) -+ { -+ rtl::OUStringBuffer buf( 128 ); -+ buf.appendAscii( "DatabaseMetaData::getPrimaryKeys got called with " ); -+ buf.append( schema ); -+ buf.appendAscii( "." ); -+ buf.append( table ); -+ log( m_pSettings, LogLevel::INFO, buf.makeStringAndClear() ); -+ } -+ -+ Reference< XPreparedStatement > statement = m_origin->prepareStatement( -+ ASCII_STR( -+ "SELECT nmsp.nspname, " -+ "cl.relname, " -+ "con.conkey, " -+ "con.conname, " -+ "con.conrelid " -+ "FROM pg_constraint as con,pg_class as cl, pg_namespace as nmsp " -+ "WHERE con.connamespace = nmsp.oid AND con.conrelid = cl.oid AND con.contype = 'p' " -+ "AND nmsp.nspname LIKE ? AND cl.relname LIKE ?" ) ); -+ -+ Reference< XParameters > parameters( statement, UNO_QUERY ); -+ parameters->setString( 1 , schema ); -+ parameters->setString( 2 , table ); -+ -+ Reference< XResultSet > rs = statement->executeQuery(); -+ Reference< XRow > xRow( rs, UNO_QUERY ); -+ SequenceAnyVector vec; -+ -+ while( rs->next() ) -+ { -+ Sequence< Any > row( 6 ); -+ row[0] <<= m_pSettings->catalog; -+ row[1] <<= xRow->getString(1); // -+ row[2] <<= xRow->getString(2); -+ OUString array = xRow->getString(3); -+ row[4] <<= xRow->getString(5); // the relid -+ row[5] <<= xRow->getString(4); -+ -+ int i = 0; -+ // now retrieve the columns information -+ // unfortunately, postgresql does not allow array of variable size in -+ // WHERE clauses (in the default installation), so we have to choose -+ // this expensive and somewhat ugly way -+ // annotation: postgresql shouldn't have choosen an array here, instead they -+ // should have multiple rows per table -+ while( array[i] && '}' != array[i] ) -+ { -+ i++; -+ int start = i; -+ while( array[i] && array[i] != '}' && array[i] != ',' ) i++; -+ row[3] <<= OUString( &array[start], i - start ); -+ vec.push_back( row ); -+ } -+ } -+ -+ Reference< XCloseable > closeable( statement, UNO_QUERY ); -+ if( closeable.is() ) -+ closeable->close(); -+ -+ -+ SequenceAnyVector::iterator ii = vec.begin(); -+ OUString lastTableOid; -+ sal_Int32 index; -+ Sequence< Sequence< Any > > ret( vec.size() ); -+ int elements = 0; -+ for( ; ii != vec.end() ; ++ ii ) -+ { -+ -+ Sequence< Any > row = *ii; -+ OUString tableOid; -+ OUString attnum; -+ -+ row[4] >>= tableOid; -+ row[3] >>= attnum; -+ statement = m_origin->prepareStatement( -+ ASCII_STR( -+ "SELECT att.attname FROM " -+ "pg_attribute AS att, pg_class AS cl WHERE " -+ "att.attrelid = ? AND att.attnum = ?" )); -+ -+ parameters = Reference< XParameters >( statement, UNO_QUERY ); -+ parameters->setString( 1 , tableOid ); -+ parameters->setString( 2 , attnum ); -+ -+ rs = statement->executeQuery(); -+ xRow = Reference< XRow >( rs, UNO_QUERY ); -+ if( rs->next() ) -+ { -+ // column name -+ row[3] <<= xRow->getString( 1 ); -+ if( tableOid != lastTableOid ) -+ index = 1; -+ lastTableOid = tableOid; -+ row[4] <<= OUString::valueOf( index ); -+ index ++; -+ } -+ Reference< XCloseable > closeable( statement, UNO_QUERY ); -+ if( closeable.is() ) -+ closeable->close(); -+ ret[elements] = row; -+ elements ++; -+ } -+ return new SequenceResultSet( -+ m_refMutex, *this, getStatics().primaryKeyNames, ret , m_pSettings->tc ); -+} -+ -+::com::sun::star::uno::Reference< XResultSet > DatabaseMetaData::getImportedKeys( -+ const ::com::sun::star::uno::Any& catalog, -+ const OUString& schema, -+ const OUString& table ) throw (SQLException, RuntimeException) -+{ -+// MutexGuard guard( m_refMutex->mutex ); -+// checkClosed(); -+ -+// Statics &st = getStatics(); -+// Int2StringMap mainMap; -+// fillAttnum2attnameMap( mainMap, m_origin, m_schemaName, m_tableName ); -+ -+// Reference< XPreparedStatement > stmt = m_origin->prepareStatement( -+// ASCII_STR( -+// "SELECT conname, " // 1 -+// "confupdtype, " // 2 -+// "confdeltype, " // 3 -+// "class2.relname, " // 4 -+// "nmsp2.nspname, " // 5 -+// "conkey," // 6 -+// "confkey " // 7 -+// "FROM pg_constraint INNER JOIN pg_class ON conrelid = pg_class.oid " -+// "INNER JOIN pg_namespace ON pg_class.relnamespace = pg_namespace.oid " -+// "LEFT JOIN pg_class AS class2 ON confrelid = class2.oid " -+// "LEFT JOIN pg_namespace AS nmsp2 ON class2.relnamespace=nmsp2.oid " -+// "WHERE pg_class.relname = ? AND " -+// "pg_namespace.nspname = ? " -+// "AND contype = 'f'")); -+ -+// Reference< XResultSet > rs = stmt->executeQuery(); -+// Reference< XRow > row( rs, UNO_QUERY ); -+// while( rs->next() ) -+// { -+ -+// static const PKTABLE_CAT = 0; -+// static const PKTABLE_SCHEM = 1; -+// static const PKTABLE_NAME = 2; -+// static const PKCOLUMN_NAME = 3; -+// static const FKTABLE_CAT = 4; -+// static const FKTABLE_SCHEM = 5; -+// static const FKTABLE_NAME = 6; -+// static const FKCOLUMN_NAME = 7; -+// static const KEY_SEQ = 8; -+// static const UPDATE_RULE = 9; -+// static const DELETE_RULE = 10; -+// static const FK_NAME = 11; -+// static const PK_NAME = 12; -+// static const DEFERRABILITY = 13; -+ -+// OUString pkSchema = xRow->getString(6); -+// OUString pkTable = xRow->getString(5); -+ -+// Int2StringMap foreignMap; -+// fillAttnum2attnameMap( foreignMap, m_origin,pkSchema, pkTable); -+ -+// Sequence< rtl::OUString > pkColNames = -+// convertMappedIntArray2StringArray( -+// foreignMap, string2intarray( row->getString( 7 ) ) ); -+// Sequence< rtl::OUString > fkColNames = -+// convertMappedIntArray2StringArray( -+// mainMap, string2intarray( row->getString( 6 ) ) ); -+ -+// for( sal_Int32 i = 0 ; i < pkColNames.getLength() ; i ++ ) -+// { -+// Sequence< Any > theRow( 14 ); -+ -+// theRow[PKTABLE_SCHEM] = makeAny( pkSchema ); -+// theRow[PKTABLE_NAME] = makeAny( pkTable ); -+// theRow[PKCOLUMN_NAME] = makeAny( pkColNames[i] ); -+// theRow[FKTABLE_SCHEM] = makeAny( schema ); -+// theRow[FKTABLE_NAME] = makeAny( table ); -+// theRow[FKCOLUMN_NAME] = makeAny( fkColNames[i] ); -+// theRow[KEY_SEQ] = makeAny( OUString::valueOf( i ) ); -+// theRow[ -+ -+ -+// pKey->setPropertyValue_NoBroadcast_public( -+// st.PRIVATE_FOREIGN_COLUMNS, -+// makeAny( resolveColumnNames(foreignMap, xRow->getString(8) ) ) ); -+ -+// } -+ // fake the getImportedKey() function call in -+ // dbaccess/source/ui/relationdesigin/RelationController.cxx -+ // it seems to be the only place in the office, where this function is needed -+ return new SequenceResultSet( -+ m_refMutex, *this, Sequence< OUString >(), Sequence< Sequence< Any > > (1), m_pSettings->tc ); -+} -+ -+::com::sun::star::uno::Reference< XResultSet > DatabaseMetaData::getExportedKeys( -+ const ::com::sun::star::uno::Any& catalog, -+ const OUString& schema, -+ const OUString& table ) throw (SQLException, RuntimeException) -+{ -+ throw ::com::sun::star::sdbc::SQLException( -+ ASCII_STR( "pq_databasemetadata: imported keys from tables not supported " ), -+ *this, -+ OUString(), 1, Any() ); -+} -+ -+::com::sun::star::uno::Reference< XResultSet > DatabaseMetaData::getCrossReference( -+ const ::com::sun::star::uno::Any& primaryCatalog, -+ const OUString& primarySchema, -+ const OUString& primaryTable, -+ const ::com::sun::star::uno::Any& foreignCatalog, -+ const OUString& foreignSchema, -+ const OUString& foreignTable ) throw (SQLException, RuntimeException) -+{ -+ MutexGuard guard( m_refMutex->mutex ); -+ checkClosed(); -+ return new SequenceResultSet( -+ m_refMutex, *this, Sequence< OUString >(), Sequence< Sequence< Any > > (), m_pSettings->tc ); -+} -+ -+ -+struct TypeInfoByDataTypeSorter -+{ -+ bool operator () ( const Sequence< Any > & a, const Sequence< Any > & b ) -+ { -+ OUString valueA; -+ OUString valueB; -+ a[1 /*DATA_TYPE*/] >>= valueA; -+ b[1 /*DATA_TYPE*/] >>= valueB; -+ if( valueB.toInt32() == valueA.toInt32() ) -+ { -+ OUString nameA; -+ OUString nameB; -+ a[0 /*TYPE_NAME*/] >>= nameA; -+ b[0 /*TYPE_NAME*/] >>= nameB; -+ if( nameA.compareToAscii( RTL_CONSTASCII_STRINGPARAM( "int4" ) ) == 0 ) -+ return 1; -+ if( nameB.compareToAscii( RTL_CONSTASCII_STRINGPARAM( "int4" ) ) == 0 ) -+ return 0; -+ return nameA.compareTo( nameB ) < 0; -+ } -+ -+ return valueA.toInt32() < valueB.toInt32(); -+// sal_Int32 valueA; -+// sal_Int32 valueB; -+// a[1 /*DATA_TYPE*/] >>= valueA; -+// b[1 /*DATA_TYPE*/] >>= valueB; -+// if( valueB == valueA ) -+// { -+// OUString nameA; -+// OUString nameB; -+// a[0 /*TYPE_NAME*/] >>= nameA; -+// b[0 /*TYPE_NAME*/] >>= nameB; -+// return nameA.compareTo( nameB ) < 0; -+// } -+ -+// return valueA < valueB; -+ } -+}; -+ -+static sal_Int32 calcSearchable( sal_Int32 dataType ) -+{ -+ sal_Int32 ret = com::sun::star::sdbc::ColumnSearch::FULL; -+ if( com::sun::star::sdbc::DataType::BINARY == dataType || -+ com::sun::star::sdbc::DataType::VARBINARY == dataType || -+ com::sun::star::sdbc::DataType::LONGVARBINARY == dataType ) -+ sal_Int32 ret = com::sun::star::sdbc::ColumnSearch::NONE; -+ -+ return ret; -+} -+ -+static sal_Int32 getMaxScale( sal_Int32 dataType ) -+{ -+ sal_Int32 ret = 0; -+ if( dataType == com::sun::star::sdbc::DataType::NUMERIC ) -+ ret = 1000; // see pg-docs DataType/numeric -+// else if( dataType == DataType::DOUBLE ) -+// ret = 308; -+// else if( dataType == DataType::FLOAT ) -+// ret = -+ return ret; -+} -+ -+ -+struct RawType -+{ -+ const char * typeName; -+ const char * createParam; -+ sal_Int32 sdbcType; -+ sal_Int32 precision; -+ sal_Int32 nullable; -+ bool caseSensitive; -+ sal_Int32 searchable; -+}; -+ -+static void pgTypeInfo2ResultSet( -+ SequenceAnyVector &vec, -+ const Reference< XResultSet > &rs ) -+{ -+ static const sal_Int32 TYPE_NAME = 0; // string Type name -+ static const sal_Int32 DATA_TYPE = 1; // short SQL data type from java.sql.Types -+ static const sal_Int32 PRECISION = 2; // long maximum precision -+ static const sal_Int32 CREATE_PARAMS = 5; // string => parameters used in creating the type (may be NULL ) -+ static const sal_Int32 NULLABLE = 6; // short ==> can you use NULL for this type? -+ // - NO_NULLS - does not allow NULL values -+ // - NULLABLE - allows NULL values -+ // - NULLABLE_UNKNOWN - nullability unknown -+ -+ static const sal_Int32 CASE_SENSITIVE = 7; // boolean==> is it case sensitive -+ static const sal_Int32 SEARCHABLE = 8; // short ==>; can you use -+ // "WHERE" based on this type: -+ // - NONE - No support -+ // - CHAR - Only supported with WHERE .. LIKE -+ // - BASIC - Supported except for WHERE .. LIKE -+ // - FULL - Supported for all WHERE .. -+ static const sal_Int32 UNSIGNED_ATTRIBUTE = 9; // boolean ==> is it unsigned? -+ static const sal_Int32 FIXED_PREC_SCALE = 10; // boolean ==> can it be a money value? -+ static const sal_Int32 AUTO_INCREMENT = 11; // boolean ==> can it be used for -+ // an auto-increment value? -+ static const sal_Int32 MINIMUM_SCALE = 13; // short ==> minimum scale supported -+ static const sal_Int32 MAXIMUM_SCALE = 14; // short ==> maximum scale supported -+ static const sal_Int32 NUM_PREC_RADIX = 17; // long ==> usually 2 or 10 -+ -+ /* not filled so far -+ 3. LITERAL_PREFIX string ==> prefix used to quote a literal -+ (may be ) -+ 4, LITERAL_SUFFIX string ==> suffix used to quote a literal -+ (may be ) -+ 5. CREATE_PARAMS string ==> parameters used in creating thw type (may be ) -+ 12. LOCAL_TYPE_NAME string ==> localized version of type name (may be ) -+ 15, SQL_DATA_TYPE long ==> unused -+ 16. SQL_DATETIME_SUB long ==> unused -+ */ -+ Reference< XRow > xRow( rs, UNO_QUERY ); -+ while( rs->next() ) -+ { -+ Sequence< Any > row(18); -+ -+ sal_Int32 dataType =typeNameToDataType(xRow->getString(5),xRow->getString(2)); -+ sal_Int32 precision = xRow->getString(3).toInt32(); -+ -+ if( dataType == com::sun::star::sdbc::DataType::CHAR || -+ dataType == com::sun::star::sdbc::DataType::VARCHAR && -+ xRow->getString(TYPE_NAME+1).equalsIgnoreAsciiCaseAscii( "varchar") ) -+ { -+ // reflect varchar as varchar with upper limit ! -+ //NOTE: the sql spec requires varchar to have an upper limit, however -+ // in postgresql the upper limit is optional, no limit means unlimited -+ // length (=1GB). -+ precision = 0x40000000; // about 1 GB, see character type docs in postgresql -+ row[CREATE_PARAMS] <<= ASCII_STR( "length" ); -+ } -+ else if( dataType == com::sun::star::sdbc::DataType::NUMERIC ) -+ { -+ precision = 1000; -+ row[CREATE_PARAMS] <<= ASCII_STR( "length, scale" ); -+ } -+ -+ row[TYPE_NAME] <<= xRow->getString(1); -+ row[DATA_TYPE] <<= OUString::valueOf(dataType); -+ row[PRECISION] <<= OUString::valueOf( precision ); -+ sal_Int32 nullable = xRow->getBoolean(4) ? -+ com::sun::star::sdbc::ColumnValue::NO_NULLS : -+ com::sun::star::sdbc::ColumnValue::NULLABLE; -+ row[NULLABLE] <<= OUString::valueOf(nullable); -+ row[CASE_SENSITIVE] <<= OUString::valueOf((sal_Int32)1); -+ row[SEARCHABLE] <<= OUString::valueOf( calcSearchable( dataType ) ); -+ row[UNSIGNED_ATTRIBUTE] <<= ASCII_STR( "0" ); // -+ if( com::sun::star::sdbc::DataType::INTEGER == dataType || -+ com::sun::star::sdbc::DataType::BIGINT == dataType ) -+ row[AUTO_INCREMENT] <<= ASCII_STR( "1" ); // TODO -+ else -+ row[AUTO_INCREMENT] <<= ASCII_STR( "0" ); // TODO -+ row[MINIMUM_SCALE] <<= ASCII_STR( "0" ); // TODO: what is this ? -+ row[MAXIMUM_SCALE] <<= OUString::valueOf( getMaxScale( dataType ) ); -+ row[NUM_PREC_RADIX] <<= ASCII_STR( "10" ); // TODO: what is this ? -+ vec.push_back( row ); -+ } -+ -+} -+ -+ -+::com::sun::star::uno::Reference< XResultSet > DatabaseMetaData::getTypeInfo( ) -+ throw (SQLException, RuntimeException) -+{ -+ // Note: Indexes start at 0 (in the API doc, they start at 1) -+ MutexGuard guard( m_refMutex->mutex ); -+ checkClosed(); -+ -+ if( isLog( m_pSettings, LogLevel::INFO ) ) -+ { -+ log( m_pSettings, LogLevel::INFO, "DatabaseMetaData::getTypeInfo() got called" ); -+ } -+ -+ Reference< XStatement > statement = m_origin->createStatement(); -+ Reference< XResultSet > rs = statement->executeQuery( -+ ASCII_STR( -+ "SELECT pg_type.typname AS typname," //1 -+ "pg_type.typtype AS typtype," //2 -+ "pg_type.typlen AS typlen," //3 -+ "pg_type.typnotnull AS typnotnull," //4 -+ "pg_type.typname AS typname " //5 -+ "FROM pg_type " -+ "WHERE pg_type.typtype = 'b' " -+ "OR pg_type.typtype = 'p'" -+ ) ); -+ -+ SequenceAnyVector vec; -+ pgTypeInfo2ResultSet( vec, rs ); -+ -+ // check for domain types -+ rs = statement->executeQuery( -+ ASCII_STR( -+ "SELECT t1.typname as typname," -+ "t2.typtype AS typtype," -+ "t2.typlen AS typlen," -+ "t2.typnotnull AS typnotnull," -+ "t2.typname as realtypname " -+ "FROM pg_type as t1 LEFT JOIN pg_type AS t2 ON t1.typbasetype=t2.oid " -+ "WHERE t1.typtype = 'd'" ) ); -+ pgTypeInfo2ResultSet( vec, rs ); -+ -+ std::sort( vec.begin(), vec.end(), TypeInfoByDataTypeSorter() ); -+ -+ return new SequenceResultSet( -+ m_refMutex, -+ *this, -+ getStatics().typeinfoColumnNames, -+ Sequence< Sequence< Any > > ( &vec[0] , vec.size() ), -+ m_pSettings->tc, -+ &( getStatics().typeInfoMetaData )); -+} -+ -+ -+static sal_Int32 seqContains( const Sequence< sal_Int32 > &seq, sal_Int32 value ) -+{ -+ sal_Int32 ret = -1; -+ for( int i = 0; i < seq.getLength(); i ++ ) -+ { -+ if( seq[i] == value ) -+ { -+ ret = i; -+ break; -+ } -+ } -+ return ret; -+} -+ -+::com::sun::star::uno::Reference< XResultSet > DatabaseMetaData::getIndexInfo( -+ const ::com::sun::star::uno::Any& catalog, -+ const OUString& schema, -+ const OUString& table, -+ sal_Bool unique, -+ sal_Bool approximate ) throw (SQLException, RuntimeException) -+{ -+ MutexGuard guard( m_refMutex->mutex ); -+ checkClosed(); -+ -+ /* -+ 1. TABLE_CAT string -> table catalog (may be NULL ) -+ 2. TABLE_SCHEM string -> table schema (may be NULL ) -+ 3. TABLE_NAME string -> table name -+ 4. NON_UNIQUE boolean -> Can index values be non-unique? -+ false when TYPE is tableIndexStatistic -+ 5. INDEX_QUALIFIER string -> index catalog (may be NULL ); -+ NULL when TYPE is tableIndexStatistic -+ 6. INDEX_NAME string -> index name; NULL when TYPE is tableIndexStatistic -+ 7. TYPE short -> index type: -+ * 0 - this identifies table statistics that are returned -+ in conjuction with a table's index descriptions -+ * CLUSTERED - this is a clustered index -+ * HASHED - this is a hashed index -+ * OTHER - this is some other style of index -+ 8. ORDINAL_POSITION short -> column sequence number within index; -+ zero when TYPE is tableIndexStatistic -+ 9. COLUMN_NAME string -> column name; NULL when TYPE is tableIndexStatistic -+ 10. ASC_OR_DESC string -> column sort sequence, "A"= ascending, -+ "D" = descending, may be NULL if sort sequence -+ is not supported; NULL when TYPE is tableIndexStatistic -+ 11. CARDINALITY long -> When TYPE is tableIndexStatistic, then this is -+ the number of rows in the table; otherwise, it -+ is the number of unique values in the index. -+ 12. PAGES long -> When TYPE is tableIndexStatisic then this is -+ the number of pages used for the table, otherwise -+ it is the number of pages used for the current index. -+ 13. FILTER_CONDITION string -> Filter condition, if any. (may be NULL ) -+ -+ */ -+ static const sal_Int32 C_SCHEMA = 1; -+ static const sal_Int32 C_TABLENAME = 2; -+ static const sal_Int32 C_INDEXNAME = 3; -+ static const sal_Int32 C_IS_CLUSTERED = 4; -+ static const sal_Int32 C_IS_UNIQUE = 5; -+ static const sal_Int32 C_IS_PRIMARY = 6; -+ static const sal_Int32 C_COLUMNS = 7; -+ -+ static const sal_Int32 R_TABLE_SCHEM = 1; -+ static const sal_Int32 R_TABLE_NAME = 2; -+ static const sal_Int32 R_NON_UNIQUE = 3; -+ static const sal_Int32 R_INDEX_NAME = 5; -+ static const sal_Int32 R_TYPE = 6; -+ static const sal_Int32 R_ORDINAL_POSITION = 7; -+ static const sal_Int32 R_COLUMN_NAME = 8; -+ -+ Reference< XPreparedStatement > stmt = m_origin->prepareStatement( -+ ASCII_STR( -+ "SELECT nspname, " // 1 -+ "pg_class.relname, " // 2 -+ "class2.relname, " // 3 -+ "indisclustered, " // 4 -+ "indisunique, " // 5 -+ "indisprimary, " // 6 -+ "indkey " // 7 -+ "FROM pg_index INNER JOIN pg_class ON indrelid = pg_class.oid " -+ "INNER JOIN pg_namespace ON pg_class.relnamespace = pg_namespace.oid " -+ "INNER JOIN pg_class as class2 ON pg_index.indexrelid = class2.oid " -+ "WHERE nspname = ? AND pg_class.relname = ?" ) ); -+ -+ Reference< XParameters > param ( stmt, UNO_QUERY ); -+ param->setString( 1, schema ); -+ param->setString( 2, table ); -+ Reference< XResultSet > rs = stmt->executeQuery(); -+ Reference< XRow > xRow ( rs, UNO_QUERY ); -+ -+ SequenceAnyVector vec; -+ while( rs->next() ) -+ { -+ Sequence< sal_Int32 > columns = parseIntArray( xRow->getString(C_COLUMNS) ); -+ Reference< XPreparedStatement > columnsStmt = m_origin->prepareStatement( -+ ASCII_STR( -+ "SELECT attnum, attname " -+ "FROM pg_attribute " -+ " INNER JOIN pg_class ON attrelid = pg_class.oid " -+ " INNER JOIN pg_namespace ON pg_class.relnamespace=pg_namespace.oid " -+ " WHERE pg_namespace.nspname=? AND pg_class.relname=?" ) ); -+ Reference< XParameters > paramColumn ( columnsStmt, UNO_QUERY ); -+ OUString currentSchema = xRow->getString( C_SCHEMA ); -+ OUString currentTable = xRow->getString( C_TABLENAME ); -+ OUString currentIndexName = xRow->getString( C_INDEXNAME ); -+ sal_Bool isNonUnique = ! xRow->getBoolean( C_IS_UNIQUE ); -+ sal_Bool isPrimary = xRow->getBoolean( C_IS_PRIMARY ); -+ sal_Int32 indexType = xRow->getBoolean( C_IS_CLUSTERED ) ? -+ com::sun::star::sdbc::IndexType::CLUSTERED : -+ com::sun::star::sdbc::IndexType::HASHED; -+ -+ paramColumn->setString( C_SCHEMA, currentSchema ); -+ paramColumn->setString( C_TABLENAME, currentTable ); -+ -+ Reference< XResultSet > rsColumn = columnsStmt->executeQuery(); -+ Reference< XRow > rowColumn( rsColumn, UNO_QUERY ); -+ while( rsColumn->next() ) -+ { -+ sal_Int32 pos = seqContains( columns, rowColumn->getInt( 1 ) ); -+ if( pos >= 0 && ( ! isNonUnique || ! unique ) ) -+ { -+ Sequence< Any > result( 13 ); -+ result[R_TABLE_SCHEM] = makeAny(currentSchema); -+ result[R_TABLE_NAME] = makeAny(currentTable); -+ result[R_INDEX_NAME] = makeAny(currentIndexName); -+ result[R_NON_UNIQUE] = -+ Any( &isNonUnique, getBooleanCppuType() ); -+ result[R_TYPE] = makeAny( indexType ); -+ result[R_COLUMN_NAME] = makeAny( rowColumn->getString(2) ); -+ sal_Int32 nPos = ((sal_Int32)pos+1); // MSVC++ nonsense -+ result[R_ORDINAL_POSITION] = makeAny( nPos ); -+ vec.push_back( result ); -+ } -+ } -+ } -+ return new SequenceResultSet( -+ m_refMutex, *this, getStatics().indexinfoColumnNames, -+ Sequence< Sequence< Any > > ( &vec[0] , vec.size() ), -+ m_pSettings->tc ); -+} -+ -+sal_Bool DatabaseMetaData::supportsResultSetType( sal_Int32 setType ) -+ throw (SQLException, RuntimeException) -+{ -+ return -+ setType == com::sun::star::sdbc::ResultSetType::SCROLL_INSENSITIVE || -+ setType == com::sun::star::sdbc::ResultSetType::FORWARD_ONLY; -+} -+ -+sal_Bool DatabaseMetaData::supportsResultSetConcurrency( -+ sal_Int32 setType, sal_Int32 concurrency ) throw (SQLException, RuntimeException) -+{ -+ return supportsResultSetType( setType ) && -+ (concurrency == com::sun::star::sdbc::TransactionIsolation::READ_COMMITTED || -+ concurrency == com::sun::star::sdbc::TransactionIsolation::SERIALIZABLE ); -+} -+ -+sal_Bool DatabaseMetaData::ownUpdatesAreVisible( sal_Int32 setType ) throw (SQLException, RuntimeException) -+{ -+ return sal_False; -+} -+ -+sal_Bool DatabaseMetaData::ownDeletesAreVisible( sal_Int32 setType ) throw (SQLException, RuntimeException) -+{ -+ return sal_False; -+} -+ -+sal_Bool DatabaseMetaData::ownInsertsAreVisible( sal_Int32 setType ) throw (SQLException, RuntimeException) -+{ -+ return sal_False; -+} -+ -+sal_Bool DatabaseMetaData::othersUpdatesAreVisible( sal_Int32 setType ) throw (SQLException, RuntimeException) -+{ -+ return sal_False; -+} -+ -+sal_Bool DatabaseMetaData::othersDeletesAreVisible( sal_Int32 setType ) throw (SQLException, RuntimeException) -+{ -+ return sal_False; -+} -+ -+sal_Bool DatabaseMetaData::othersInsertsAreVisible( sal_Int32 setType ) throw (SQLException, RuntimeException) -+{ -+ return sal_False; -+} -+ -+sal_Bool DatabaseMetaData::updatesAreDetected( sal_Int32 setType ) throw (SQLException, RuntimeException) -+{ -+ return sal_False; -+} -+ -+sal_Bool DatabaseMetaData::deletesAreDetected( sal_Int32 setType ) throw (SQLException, RuntimeException) -+{ -+ return sal_False; -+} -+sal_Bool DatabaseMetaData::insertsAreDetected( sal_Int32 setType ) throw (SQLException, RuntimeException) -+{ -+ return sal_False; -+} -+ -+sal_Bool DatabaseMetaData::supportsBatchUpdates( ) throw (SQLException, RuntimeException) -+{ -+ return sal_False; -+} -+ -+::com::sun::star::uno::Reference< XResultSet > DatabaseMetaData::getUDTs( const ::com::sun::star::uno::Any& catalog, const OUString& schemaPattern, const OUString& typeNamePattern, const ::com::sun::star::uno::Sequence< sal_Int32 >& types ) throw (SQLException, RuntimeException) -+{ -+ MutexGuard guard( m_refMutex->mutex ); -+ checkClosed(); -+ return new SequenceResultSet( -+ m_refMutex, *this, Sequence< OUString >(), Sequence< Sequence< Any > > (), m_pSettings->tc ); -+} -+ -+::com::sun::star::uno::Reference< com::sun::star::sdbc::XConnection > DatabaseMetaData::getConnection() -+ throw (SQLException, RuntimeException) -+{ -+ return m_origin; -+} -+} -diff --git connectivity/source/drivers/postgresql/pq_databasemetadata.hxx connectivity/source/drivers/postgresql/pq_databasemetadata.hxx -new file mode 100644 -index 0000000..b5dea7d ---- /dev/null -+++ connectivity/source/drivers/postgresql/pq_databasemetadata.hxx -@@ -0,0 +1,244 @@ -+/************************************************************************* -+ * -+ * $RCSfile: pq_databasemetadata.hxx,v $ -+ * -+ * $Revision: 1.1.2.1 $ -+ * -+ * last change: $Author: jbu $ $Date: 2003/06/03 21:48:28 $ -+ * -+ * The Contents of this file are made available subject to the terms of -+ * either of the following licenses -+ * -+ * - GNU Lesser General Public License Version 2.1 -+ * - Sun Industry Standards Source License Version 1.1 -+ * -+ * Sun Microsystems Inc., October, 2000 -+ * -+ * GNU Lesser General Public License Version 2.1 -+ * ============================================= -+ * Copyright 2000 by Sun Microsystems, Inc. -+ * 901 San Antonio Road, Palo Alto, CA 94303, USA -+ * -+ * This library is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License version 2.1, as published by the Free Software Foundation. -+ * -+ * This library is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public -+ * License along with this library; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, -+ * MA 02111-1307 USA -+ * -+ * -+ * Sun Industry Standards Source License Version 1.1 -+ * ================================================= -+ * The contents of this file are subject to the Sun Industry Standards -+ * Source License Version 1.1 (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.openoffice.org/license.html. -+ * -+ * Software provided under this License is provided on an "AS IS" basis, -+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, -+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, -+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. -+ * See the License for the specific provisions governing your rights and -+ * obligations concerning the Software. -+ * -+ * The Initial Developer of the Original Code is: Joerg Budischewski -+ * -+ * Copyright: 2000 by Sun Microsystems, Inc. -+ * -+ * All Rights Reserved. -+ * -+ * Contributor(s): Joerg Budischewski -+ * -+ * -+ ************************************************************************/ -+ -+#ifndef _PQ_DATABASEMETADATA_HXX_ -+#define _PQ_DATABASEMETADATA_HXX_ -+ -+#include "pq_connection.hxx" -+#include -+ -+#include -+ -+namespace pq_sdbc_driver -+{ -+ -+class DatabaseMetaData : -+ public ::cppu::WeakImplHelper1 < com::sun::star::sdbc::XDatabaseMetaData > -+{ -+ ::rtl::Reference< RefCountedMutex > m_refMutex; -+ ConnectionSettings *m_pSettings; -+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > m_origin; -+ -+ void checkClosed() -+ throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+public: -+ DatabaseMetaData( -+ const ::rtl::Reference< RefCountedMutex > & reMutex, -+ const ::com::sun::star::uno::Reference< com::sun::star::sdbc::XConnection > & origin, -+ ConnectionSettings *pSettings -+ ); -+ -+public: -+ // Methods -+ virtual sal_Bool SAL_CALL allProceduresAreCallable( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Bool SAL_CALL allTablesAreSelectable( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual ::rtl::OUString SAL_CALL getURL( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual ::rtl::OUString SAL_CALL getUserName( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Bool SAL_CALL isReadOnly( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Bool SAL_CALL nullsAreSortedHigh( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Bool SAL_CALL nullsAreSortedLow( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Bool SAL_CALL nullsAreSortedAtStart( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Bool SAL_CALL nullsAreSortedAtEnd( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual ::rtl::OUString SAL_CALL getDatabaseProductName( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual ::rtl::OUString SAL_CALL getDatabaseProductVersion( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual ::rtl::OUString SAL_CALL getDriverName( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual ::rtl::OUString SAL_CALL getDriverVersion( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Int32 SAL_CALL getDriverMajorVersion( ) throw (::com::sun::star::uno::RuntimeException); -+ virtual sal_Int32 SAL_CALL getDriverMinorVersion( ) throw (::com::sun::star::uno::RuntimeException); -+ virtual sal_Bool SAL_CALL usesLocalFiles( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Bool SAL_CALL usesLocalFilePerTable( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Bool SAL_CALL supportsMixedCaseIdentifiers( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Bool SAL_CALL storesUpperCaseIdentifiers( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Bool SAL_CALL storesLowerCaseIdentifiers( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Bool SAL_CALL storesMixedCaseIdentifiers( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Bool SAL_CALL supportsMixedCaseQuotedIdentifiers( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Bool SAL_CALL storesUpperCaseQuotedIdentifiers( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Bool SAL_CALL storesLowerCaseQuotedIdentifiers( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Bool SAL_CALL storesMixedCaseQuotedIdentifiers( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual ::rtl::OUString SAL_CALL getIdentifierQuoteString( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual ::rtl::OUString SAL_CALL getSQLKeywords( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual ::rtl::OUString SAL_CALL getNumericFunctions( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual ::rtl::OUString SAL_CALL getStringFunctions( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual ::rtl::OUString SAL_CALL getSystemFunctions( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual ::rtl::OUString SAL_CALL getTimeDateFunctions( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual ::rtl::OUString SAL_CALL getSearchStringEscape( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual ::rtl::OUString SAL_CALL getExtraNameCharacters( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Bool SAL_CALL supportsAlterTableWithAddColumn( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Bool SAL_CALL supportsAlterTableWithDropColumn( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Bool SAL_CALL supportsColumnAliasing( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Bool SAL_CALL nullPlusNonNullIsNull( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Bool SAL_CALL supportsTypeConversion( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Bool SAL_CALL supportsConvert( sal_Int32 fromType, sal_Int32 toType ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Bool SAL_CALL supportsTableCorrelationNames( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Bool SAL_CALL supportsDifferentTableCorrelationNames( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Bool SAL_CALL supportsExpressionsInOrderBy( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Bool SAL_CALL supportsOrderByUnrelated( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Bool SAL_CALL supportsGroupBy( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Bool SAL_CALL supportsGroupByUnrelated( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Bool SAL_CALL supportsGroupByBeyondSelect( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Bool SAL_CALL supportsLikeEscapeClause( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Bool SAL_CALL supportsMultipleResultSets( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Bool SAL_CALL supportsMultipleTransactions( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Bool SAL_CALL supportsNonNullableColumns( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Bool SAL_CALL supportsMinimumSQLGrammar( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Bool SAL_CALL supportsCoreSQLGrammar( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Bool SAL_CALL supportsExtendedSQLGrammar( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Bool SAL_CALL supportsANSI92EntryLevelSQL( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Bool SAL_CALL supportsANSI92IntermediateSQL( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Bool SAL_CALL supportsANSI92FullSQL( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Bool SAL_CALL supportsIntegrityEnhancementFacility( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Bool SAL_CALL supportsOuterJoins( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Bool SAL_CALL supportsFullOuterJoins( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Bool SAL_CALL supportsLimitedOuterJoins( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual ::rtl::OUString SAL_CALL getSchemaTerm( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual ::rtl::OUString SAL_CALL getProcedureTerm( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual ::rtl::OUString SAL_CALL getCatalogTerm( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Bool SAL_CALL isCatalogAtStart( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual ::rtl::OUString SAL_CALL getCatalogSeparator( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Bool SAL_CALL supportsSchemasInDataManipulation( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Bool SAL_CALL supportsSchemasInProcedureCalls( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Bool SAL_CALL supportsSchemasInTableDefinitions( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Bool SAL_CALL supportsSchemasInIndexDefinitions( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Bool SAL_CALL supportsSchemasInPrivilegeDefinitions( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Bool SAL_CALL supportsCatalogsInDataManipulation( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Bool SAL_CALL supportsCatalogsInProcedureCalls( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Bool SAL_CALL supportsCatalogsInTableDefinitions( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Bool SAL_CALL supportsCatalogsInIndexDefinitions( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Bool SAL_CALL supportsCatalogsInPrivilegeDefinitions( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Bool SAL_CALL supportsPositionedDelete( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Bool SAL_CALL supportsPositionedUpdate( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Bool SAL_CALL supportsSelectForUpdate( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Bool SAL_CALL supportsStoredProcedures( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Bool SAL_CALL supportsSubqueriesInComparisons( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Bool SAL_CALL supportsSubqueriesInExists( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Bool SAL_CALL supportsSubqueriesInIns( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Bool SAL_CALL supportsSubqueriesInQuantifieds( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Bool SAL_CALL supportsCorrelatedSubqueries( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Bool SAL_CALL supportsUnion( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Bool SAL_CALL supportsUnionAll( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Bool SAL_CALL supportsOpenCursorsAcrossCommit( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Bool SAL_CALL supportsOpenCursorsAcrossRollback( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Bool SAL_CALL supportsOpenStatementsAcrossCommit( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Bool SAL_CALL supportsOpenStatementsAcrossRollback( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Int32 SAL_CALL getMaxBinaryLiteralLength( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Int32 SAL_CALL getMaxCharLiteralLength( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Int32 SAL_CALL getMaxColumnNameLength( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Int32 SAL_CALL getMaxColumnsInGroupBy( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Int32 SAL_CALL getMaxColumnsInIndex( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Int32 SAL_CALL getMaxColumnsInOrderBy( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Int32 SAL_CALL getMaxColumnsInSelect( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Int32 SAL_CALL getMaxColumnsInTable( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Int32 SAL_CALL getMaxConnections( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Int32 SAL_CALL getMaxCursorNameLength( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Int32 SAL_CALL getMaxIndexLength( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Int32 SAL_CALL getMaxSchemaNameLength( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Int32 SAL_CALL getMaxProcedureNameLength( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Int32 SAL_CALL getMaxCatalogNameLength( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Int32 SAL_CALL getMaxRowSize( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Bool SAL_CALL doesMaxRowSizeIncludeBlobs( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Int32 SAL_CALL getMaxStatementLength( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Int32 SAL_CALL getMaxStatements( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Int32 SAL_CALL getMaxTableNameLength( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Int32 SAL_CALL getMaxTablesInSelect( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Int32 SAL_CALL getMaxUserNameLength( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Int32 SAL_CALL getDefaultTransactionIsolation( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Bool SAL_CALL supportsTransactions( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Bool SAL_CALL supportsTransactionIsolationLevel( sal_Int32 level ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Bool SAL_CALL supportsDataDefinitionAndDataManipulationTransactions( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Bool SAL_CALL supportsDataManipulationTransactionsOnly( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Bool SAL_CALL dataDefinitionCausesTransactionCommit( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Bool SAL_CALL dataDefinitionIgnoredInTransactions( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getProcedures( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& procedureNamePattern ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getProcedureColumns( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& procedureNamePattern, const ::rtl::OUString& columnNamePattern ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getTables( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& tableNamePattern, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& types ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getSchemas( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getCatalogs( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getTableTypes( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getColumns( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& tableNamePattern, const ::rtl::OUString& columnNamePattern ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getColumnPrivileges( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table, const ::rtl::OUString& columnNamePattern ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getTablePrivileges( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& tableNamePattern ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getBestRowIdentifier( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table, sal_Int32 scope, sal_Bool nullable ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getVersionColumns( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getPrimaryKeys( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getImportedKeys( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getExportedKeys( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getCrossReference( const ::com::sun::star::uno::Any& primaryCatalog, const ::rtl::OUString& primarySchema, const ::rtl::OUString& primaryTable, const ::com::sun::star::uno::Any& foreignCatalog, const ::rtl::OUString& foreignSchema, const ::rtl::OUString& foreignTable ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getTypeInfo( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getIndexInfo( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table, sal_Bool unique, sal_Bool approximate ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Bool SAL_CALL supportsResultSetType( sal_Int32 setType ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Bool SAL_CALL supportsResultSetConcurrency( sal_Int32 setType, sal_Int32 concurrency ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Bool SAL_CALL ownUpdatesAreVisible( sal_Int32 setType ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Bool SAL_CALL ownDeletesAreVisible( sal_Int32 setType ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Bool SAL_CALL ownInsertsAreVisible( sal_Int32 setType ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Bool SAL_CALL othersUpdatesAreVisible( sal_Int32 setType ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Bool SAL_CALL othersDeletesAreVisible( sal_Int32 setType ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Bool SAL_CALL othersInsertsAreVisible( sal_Int32 setType ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Bool SAL_CALL updatesAreDetected( sal_Int32 setType ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Bool SAL_CALL deletesAreDetected( sal_Int32 setType ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Bool SAL_CALL insertsAreDetected( sal_Int32 setType ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Bool SAL_CALL supportsBatchUpdates( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getUDTs( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& typeNamePattern, const ::com::sun::star::uno::Sequence< sal_Int32 >& types ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > SAL_CALL getConnection( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+}; -+ -+} -+ -+#endif -diff --git connectivity/source/drivers/postgresql/pq_driver.cxx connectivity/source/drivers/postgresql/pq_driver.cxx -new file mode 100644 -index 0000000..ad74c57 ---- /dev/null -+++ connectivity/source/drivers/postgresql/pq_driver.cxx -@@ -0,0 +1,406 @@ -+/************************************************************************* -+ * -+ * $RCSfile: pq_driver.cxx,v $ -+ * -+ * $Revision: 1.1.2.2 $ -+ * -+ * last change: $Author: jbu $ $Date: 2004/05/09 19:47:13 $ -+ * -+ * The Contents of this file are made available subject to the terms of -+ * either of the following licenses -+ * -+ * - GNU Lesser General Public License Version 2.1 -+ * - Sun Industry Standards Source License Version 1.1 -+ * -+ * Sun Microsystems Inc., October, 2000 -+ * -+ * GNU Lesser General Public License Version 2.1 -+ * ============================================= -+ * Copyright 2000 by Sun Microsystems, Inc. -+ * 901 San Antonio Road, Palo Alto, CA 94303, USA -+ * -+ * This library is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License version 2.1, as published by the Free Software Foundation. -+ * -+ * This library is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public -+ * License along with this library; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, -+ * MA 02111-1307 USA -+ * -+ * -+ * Sun Industry Standards Source License Version 1.1 -+ * ================================================= -+ * The contents of this file are subject to the Sun Industry Standards -+ * Source License Version 1.1 (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.openoffice.org/license.html. -+ * -+ * Software provided under this License is provided on an "AS IS" basis, -+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, -+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, -+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. -+ * See the License for the specific provisions governing your rights and -+ * obligations concerning the Software. -+ * -+ * The Initial Developer of the Original Code is: Joerg Budischewski -+ * -+ * Copyright: 2000 by Sun Microsystems, Inc. -+ * -+ * All Rights Reserved. -+ * -+ * Contributor(s): Joerg Budischewski -+ * -+ * -+ ************************************************************************/ -+ -+#include -+ -+#include -+#include -+#include -+#include -+ -+#include -+ -+#include "pq_driver.hxx" -+ -+using rtl::OUString; -+using rtl::OUStringToOString; -+using osl::MutexGuard; -+ -+using cppu::WeakComponentImplHelper2; -+ -+using com::sun::star::lang::XSingleComponentFactory; -+using com::sun::star::lang::XServiceInfo; -+using com::sun::star::lang::XComponent; -+ -+using com::sun::star::uno::RuntimeException; -+using com::sun::star::uno::Exception; -+using com::sun::star::uno::Sequence; -+using com::sun::star::uno::Reference; -+using com::sun::star::uno::XInterface; -+using com::sun::star::uno::UNO_QUERY; -+using com::sun::star::uno::XComponentContext; -+using com::sun::star::uno::Any; -+ -+using com::sun::star::beans::PropertyValue; -+using com::sun::star::beans::XPropertySet; -+ -+using com::sun::star::sdbc::XConnection; -+using com::sun::star::sdbc::SQLException; -+using com::sun::star::sdbc::DriverPropertyInfo; -+ -+using com::sun::star::sdbcx::XTablesSupplier; -+ -+ -+namespace pq_sdbc_driver -+{ -+#define ASCII_STR(x) OUString( RTL_CONSTASCII_USTRINGPARAM( x ) ) -+ -+OUString DriverGetImplementationName() -+{ -+ static OUString *p; -+ if (! p ) -+ { -+ MutexGuard guard( osl::Mutex::getGlobalMutex() ); -+ static OUString instance( -+ RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.comp.connectivity.pq.Driver" ) ); -+ p = &instance; -+ } -+ return *p; -+} -+ -+Sequence< OUString > DriverGetSupportedServiceNames() -+{ -+ static Sequence< OUString > *p; -+ if( ! p ) -+ { -+ MutexGuard guard( osl::Mutex::getGlobalMutex() ); -+ OUString tmp( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.sdbc.Driver" ) ); -+ static Sequence< OUString > instance( &tmp,1 ); -+ p = &instance; -+ } -+ return *p; -+} -+ -+Reference< XConnection > Driver::connect( -+ const OUString& url,const Sequence< PropertyValue >& info ) -+ throw (SQLException, RuntimeException) -+{ -+ if( ! acceptsURL( url ) ) // XDriver spec tells me to do so ... -+ return Reference< XConnection > (); -+ -+ Sequence< Any > seq ( 2 ); -+ seq[0] <<= url; -+ seq[1] <<= info; -+ return Reference< XConnection> ( -+ m_smgr->createInstanceWithArgumentsAndContext( -+ OUString(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.comp.connectivity.pq.Connection" ) ), -+ seq, m_ctx ), -+ UNO_QUERY ); -+} -+ -+sal_Bool Driver::acceptsURL( const ::rtl::OUString& url ) -+ throw (SQLException, RuntimeException) -+{ -+ return url.compareToAscii( RTL_CONSTASCII_STRINGPARAM( "sdbc:postgresql:" ) ) == 0; -+} -+ -+Sequence< DriverPropertyInfo > Driver::getPropertyInfo( -+ const OUString& url,const Sequence< PropertyValue >& info ) -+ throw (SQLException, RuntimeException) -+{ -+ return Sequence< DriverPropertyInfo > (); -+} -+ -+sal_Int32 Driver::getMajorVersion( ) throw (RuntimeException) -+{ -+ return PQ_SDBC_MAJOR; -+} -+ -+ -+sal_Int32 Driver::getMinorVersion( ) throw (RuntimeException) -+{ -+ return PQ_SDBC_MINOR; -+} -+ -+ // XServiceInfo -+OUString SAL_CALL Driver::getImplementationName() -+ throw(::com::sun::star::uno::RuntimeException) -+{ -+ return DriverGetImplementationName(); -+} -+ -+sal_Bool Driver::supportsService(const OUString& ServiceName) -+ throw(::com::sun::star::uno::RuntimeException) -+{ -+ Sequence< OUString > serviceNames = DriverGetSupportedServiceNames(); -+ for( int i = 0 ; i < serviceNames.getLength() ; i ++ ) -+ if( serviceNames[i] == ServiceName ) -+ return sal_True; -+ return sal_False; -+} -+ -+Sequence< OUString > Driver::getSupportedServiceNames(void) -+ throw(::com::sun::star::uno::RuntimeException) -+{ -+ return DriverGetSupportedServiceNames(); -+} -+ -+// XComponent -+void Driver::disposing() -+{ -+ -+} -+ -+ -+Reference< XTablesSupplier > Driver::getDataDefinitionByConnection( -+ const Reference< XConnection >& connection ) -+ throw (SQLException, RuntimeException) -+{ -+ return Reference< XTablesSupplier >( connection , UNO_QUERY ); -+} -+ -+Reference< XTablesSupplier > Driver::getDataDefinitionByURL( -+ const ::rtl::OUString& url, const Sequence< PropertyValue >& info ) -+ throw (SQLException, RuntimeException) -+{ -+ return Reference< XTablesSupplier > ( connect( url, info ), UNO_QUERY ); -+} -+ -+ -+Reference< XInterface > DriverCreateInstance( const Reference < XComponentContext > & ctx ) -+{ -+ Reference< XInterface > ret = * new Driver( ctx ); -+ return ret; -+} -+ -+ -+ -+ -+class OOneInstanceComponentFactory : -+ public MutexHolder, -+ public WeakComponentImplHelper2< XSingleComponentFactory, XServiceInfo > -+{ -+public: -+ OOneInstanceComponentFactory( -+ const OUString & rImplementationName_, -+ cppu::ComponentFactoryFunc fptr, -+ const Sequence< OUString > & serviceNames, -+ const Reference< XComponentContext > & defaultContext) : -+ WeakComponentImplHelper2< XSingleComponentFactory, XServiceInfo >( this->m_mutex ), -+ m_implName( rImplementationName_ ), -+ m_create( fptr ), -+ m_serviceNames( serviceNames ), -+ m_defaultContext( defaultContext ) -+ { -+ } -+ -+ // XSingleComponentFactory -+ virtual Reference< XInterface > SAL_CALL createInstanceWithContext( -+ Reference< XComponentContext > const & xContext ) -+ throw (Exception, RuntimeException); -+ virtual Reference< XInterface > SAL_CALL createInstanceWithArgumentsAndContext( -+ Sequence< Any > const & rArguments, -+ Reference< XComponentContext > const & xContext ) -+ throw (Exception, RuntimeException); -+ -+ // XServiceInfo -+ OUString SAL_CALL getImplementationName() -+ throw(::com::sun::star::uno::RuntimeException) -+ { -+ return m_implName; -+ } -+ sal_Bool SAL_CALL supportsService(const OUString& ServiceName) -+ throw(::com::sun::star::uno::RuntimeException) -+ { -+ for( int i = 0 ; i < m_serviceNames.getLength() ; i ++ ) -+ if( m_serviceNames[i] == ServiceName ) -+ return sal_True; -+ return sal_False; -+ } -+ Sequence< OUString > SAL_CALL getSupportedServiceNames(void) -+ throw(::com::sun::star::uno::RuntimeException) -+ { -+ return m_serviceNames; -+ } -+ -+ // XComponent -+ virtual void SAL_CALL disposing(); -+ -+private: -+ cppu::ComponentFactoryFunc m_create; -+ Sequence< OUString > m_serviceNames; -+ OUString m_implName; -+ Reference< XInterface > m_theInstance; -+ Reference< XComponentContext > m_defaultContext; -+}; -+ -+Reference< XInterface > OOneInstanceComponentFactory::createInstanceWithArgumentsAndContext( -+ Sequence< Any > const &rArguments, const Reference< XComponentContext > & ctx ) -+ throw( RuntimeException, Exception ) -+{ -+ return createInstanceWithContext( ctx ); -+} -+ -+Reference< XInterface > OOneInstanceComponentFactory::createInstanceWithContext( -+ const Reference< XComponentContext > & ctx ) -+ throw( RuntimeException, Exception ) -+{ -+ if( ! m_theInstance.is() ) -+ { -+ // work around the problem in sdbc -+ Reference< XComponentContext > useCtx = ctx; -+ if( ! useCtx.is() ) -+ useCtx = m_defaultContext; -+ Reference< XInterface > theInstance = m_create( useCtx ); -+ MutexGuard guard( osl::Mutex::getGlobalMutex() ); -+ if( ! m_theInstance.is () ) -+ { -+ m_theInstance = theInstance; -+ } -+ } -+ return m_theInstance; -+} -+ -+void OOneInstanceComponentFactory::disposing() -+{ -+ Reference< XComponent > rComp; -+ { -+ MutexGuard guard( osl::Mutex::getGlobalMutex() ); -+ rComp = Reference< XComponent >( m_theInstance, UNO_QUERY ); -+ m_theInstance.clear(); -+ } -+ if( rComp.is() ) -+ rComp->dispose(); -+} -+ -+// Reference< XSingleComponentFactory > createOneInstanceComponentFactory( -+// cppu::ComponentFactoryFunc fptr, -+// ::rtl::OUString const & rImplementationName, -+// ::com::sun::star::uno::Sequence< ::rtl::OUString > const & rServiceNames, -+// rtl_ModuleCount * pModCount = 0 ) -+// SAL_THROW( () ) -+// { -+// return new OOneInstanceComponentFactory( rImplementationName, fptr , rServiceNames); -+// } -+ -+} -+ -+static struct cppu::ImplementationEntry g_entries[] = -+{ -+ { -+ pq_sdbc_driver::DriverCreateInstance, pq_sdbc_driver::DriverGetImplementationName, -+ pq_sdbc_driver::DriverGetSupportedServiceNames, 0, -+ 0 , 0 -+ }, -+ { 0, 0, 0, 0, 0, 0 } -+}; -+ -+extern "C" -+{ -+ -+//================================================================================================== -+void SAL_CALL component_getImplementationEnvironment( -+ const sal_Char ** ppEnvTypeName, uno_Environment ** ppEnv ) -+{ -+ *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; -+} -+//================================================================================================== -+sal_Bool SAL_CALL component_writeInfo( -+ void * pServiceManager, void * pRegistryKey ) -+{ -+ return cppu::component_writeInfoHelper( pServiceManager, pRegistryKey, g_entries ); -+} -+//================================================================================================== -+void * SAL_CALL component_getFactory( -+ const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey ) -+{ -+ // need to extract the defaultcontext, because the way, sdbc -+ // bypasses the servicemanager, does not allow to use the -+ // XSingleComponentFactory interface ... -+ void * pRet = 0; -+ Reference< XSingleComponentFactory > xFactory; -+ Reference< XInterface > xSmgr( (XInterface * ) pServiceManager ); -+ -+ for( sal_Int32 i = 0 ; g_entries[i].create ; i ++ ) -+ { -+ OUString implName = g_entries[i].getImplementationName(); -+ if( 0 == implName.compareToAscii( pImplName ) ) -+ { -+ Reference< XComponentContext > defaultContext; -+ Reference< XPropertySet > propSet( xSmgr, UNO_QUERY ); -+ if( propSet.is() ) -+ { -+ try -+ { -+ propSet->getPropertyValue( ASCII_STR( "DefaultContext" ) ) >>= defaultContext; -+ } -+ catch( com::sun::star::uno::Exception &e ) -+ { -+ // if there is no default context, ignore it -+ } -+ } -+ xFactory = new pq_sdbc_driver::OOneInstanceComponentFactory( -+ implName, -+ g_entries[i].create, -+ g_entries[i].getSupportedServiceNames(), -+ defaultContext ); -+ } -+ } -+ -+ if( xFactory.is() ) -+ { -+ xFactory->acquire(); -+ pRet = xFactory.get(); -+ } -+ return pRet; -+} -+ -+} -diff --git connectivity/source/drivers/postgresql/pq_driver.hxx connectivity/source/drivers/postgresql/pq_driver.hxx -new file mode 100644 -index 0000000..6151ce1 ---- /dev/null -+++ connectivity/source/drivers/postgresql/pq_driver.hxx -@@ -0,0 +1,161 @@ -+/************************************************************************* -+ * -+ * $RCSfile: pq_driver.hxx,v $ -+ * -+ * $Revision: 1.1.2.2 $ -+ * -+ * last change: $Author: jbu $ $Date: 2004/05/09 19:47:14 $ -+ * -+ * The Contents of this file are made available subject to the terms of -+ * either of the following licenses -+ * -+ * - GNU Lesser General Public License Version 2.1 -+ * - Sun Industry Standards Source License Version 1.1 -+ * -+ * Sun Microsystems Inc., October, 2000 -+ * -+ * GNU Lesser General Public License Version 2.1 -+ * ============================================= -+ * Copyright 2000 by Sun Microsystems, Inc. -+ * 901 San Antonio Road, Palo Alto, CA 94303, USA -+ * -+ * This library is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License version 2.1, as published by the Free Software Foundation. -+ * -+ * This library is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public -+ * License along with this library; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, -+ * MA 02111-1307 USA -+ * -+ * -+ * Sun Industry Standards Source License Version 1.1 -+ * ================================================= -+ * The contents of this file are subject to the Sun Industry Standards -+ * Source License Version 1.1 (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.openoffice.org/license.html. -+ * -+ * Software provided under this License is provided on an "AS IS" basis, -+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, -+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, -+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. -+ * See the License for the specific provisions governing your rights and -+ * obligations concerning the Software. -+ * -+ * The Initial Developer of the Original Code is: Joerg Budischewski -+ * -+ * Copyright: 2000 by Sun Microsystems, Inc. -+ * -+ * All Rights Reserved. -+ * -+ * Contributor(s): Joerg Budischewski -+ * -+ * -+ ************************************************************************/ -+#ifndef _PG_DRIVER_HXX_ -+#define _PG_DRIVER_HXX_ -+ -+#include -+ -+#include -+#include -+ -+#include -+ -+#include -+#include -+ -+#include -+ -+namespace pq_sdbc_driver -+{ -+ -+#define MY_STRINGIFY( x ) #x -+ -+#define PQ_SDBC_DRIVER_VERSION MY_STRINGIFY(PQ_SDBC_MAJOR) "." \ -+ MY_STRINGIFY(PQ_SDBC_MINOR) "." \ -+ MY_STRINGIFY(PQ_SDBC_MICRO) -+ -+#define POSTGRES_MAJOR 7 -+#define POSTGRES_MINOR 3 -+#define POSTGRES_MICRO 2 -+#define POSTGRESQL_VERSION MY_STRINGIFY(POSTGRESQL_MAJOR) "." \ -+ MY_STRINGIFY(POSTGRESQL_MINOR) "." \ -+ MY_STRINGIFY(POSTGRESQL_MICRO) -+ -+ -+struct MutexHolder { osl::Mutex m_mutex; }; -+// use this to switch off sdbc support ! -+// typedef cppu::WeakComponentImplHelper2< -+// com::sun::star::sdbc::XDriver, -+// com::sun::star::lang::XServiceInfo -+// > DriverBase ; -+typedef cppu::WeakComponentImplHelper3< -+ com::sun::star::sdbc::XDriver, -+ com::sun::star::lang::XServiceInfo, -+ com::sun::star::sdbcx::XDataDefinitionSupplier > DriverBase ; -+class Driver : public MutexHolder, public DriverBase -+{ -+ com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > m_ctx; -+ com::sun::star::uno::Reference< com::sun::star::lang::XMultiComponentFactory > m_smgr; -+ -+public: -+ Driver ( const com::sun::star::uno::Reference < com::sun::star::uno::XComponentContext > & ctx ) -+ : DriverBase( this->m_mutex ), -+ m_ctx( ctx ), -+ m_smgr( ctx->getServiceManager() ) -+ {} -+ -+public: // XDriver -+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > SAL_CALL connect( -+ const ::rtl::OUString& url, -+ const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& info ) -+ throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ -+ virtual sal_Bool SAL_CALL acceptsURL( const ::rtl::OUString& url ) -+ throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ -+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::sdbc::DriverPropertyInfo > SAL_CALL getPropertyInfo( -+ const ::rtl::OUString& url, -+ const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& info ) -+ throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ -+ virtual sal_Int32 SAL_CALL getMajorVersion( ) throw (::com::sun::star::uno::RuntimeException); -+ virtual sal_Int32 SAL_CALL getMinorVersion( ) throw (::com::sun::star::uno::RuntimeException); -+ -+public: // XServiceInfo -+ // XServiceInfo -+ virtual rtl::OUString SAL_CALL getImplementationName() -+ throw(::com::sun::star::uno::RuntimeException); -+ virtual sal_Bool SAL_CALL supportsService(const rtl::OUString& ServiceName) -+ throw(::com::sun::star::uno::RuntimeException); -+ -+ virtual com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames(void) -+ throw(::com::sun::star::uno::RuntimeException); -+ -+public: // XDataDefinitionSupplier -+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XTablesSupplier > SAL_CALL -+ getDataDefinitionByConnection( -+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& connection ) -+ throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XTablesSupplier > SAL_CALL -+ getDataDefinitionByURL( -+ const ::rtl::OUString& url, -+ const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& info ) -+ throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ -+ // XComponent -+ virtual void SAL_CALL disposing(); -+ -+}; -+ -+ -+} -+ -+#endif -diff --git connectivity/source/drivers/postgresql/pq_fakedupdateableresultset.cxx connectivity/source/drivers/postgresql/pq_fakedupdateableresultset.cxx -new file mode 100644 -index 0000000..898e9e2 ---- /dev/null -+++ connectivity/source/drivers/postgresql/pq_fakedupdateableresultset.cxx -@@ -0,0 +1,206 @@ -+#include "pq_fakedupdateableresultset.hxx" -+#include -+#include -+ -+using osl::MutexGuard; -+ -+using rtl::OUString; -+ -+using com::sun::star::uno::Reference; -+using com::sun::star::uno::makeAny; -+using com::sun::star::uno::Sequence; -+using com::sun::star::uno::UNO_QUERY; -+using com::sun::star::uno::Any; -+using com::sun::star::uno::Type; -+using com::sun::star::uno::RuntimeException; -+ -+using com::sun::star::sdbc::SQLException; -+using com::sun::star::sdbc::XResultSet; -+using com::sun::star::sdbc::XResultSetUpdate; -+using com::sun::star::sdbc::XRowUpdate; -+using com::sun::star::sdbc::XRow; -+using com::sun::star::sdbc::XStatement; -+ -+namespace pq_sdbc_driver -+{ -+ -+FakedUpdateableResultSet::FakedUpdateableResultSet( -+ const ::rtl::Reference< RefCountedMutex > & mutex, -+ const com::sun::star::uno::Reference< com::sun::star::uno::XInterface > &owner, -+ ConnectionSettings **pSettings, -+ PGresult *result, -+ const rtl::OUString &schema, -+ const rtl::OUString &table, -+ const rtl::OUString &aReason ) -+ : ResultSet( mutex, owner, pSettings, result, schema, table ), -+ m_aReason( aReason ) -+{} -+ -+ -+com::sun::star::uno::Any FakedUpdateableResultSet::queryInterface( -+ const com::sun::star::uno::Type & reqType ) -+ throw (com::sun::star::uno::RuntimeException) -+{ -+ Any ret = ResultSet::queryInterface( reqType ); -+ if( ! ret.hasValue() ) -+ ret = ::cppu::queryInterface( -+ reqType, -+ static_cast< XResultSetUpdate * > ( this ), -+ static_cast< XRowUpdate * > ( this ) ); -+ return ret; -+} -+ -+ -+com::sun::star::uno::Sequence< com::sun::star::uno::Type > FakedUpdateableResultSet::getTypes() -+ throw( com::sun::star::uno::RuntimeException ) -+{ -+ static cppu::OTypeCollection *pCollection; -+ if( ! pCollection ) -+ { -+ MutexGuard guard( osl::Mutex::getGlobalMutex() ); -+ if( !pCollection ) -+ { -+ static cppu::OTypeCollection collection( -+ getCppuType( (Reference< XResultSetUpdate> *) 0 ), -+ getCppuType( (Reference< XRowUpdate> *) 0 ), -+ ResultSet::getTypes()); -+ pCollection = &collection; -+ } -+ } -+ return pCollection->getTypes(); -+ -+} -+ -+com::sun::star::uno::Sequence< sal_Int8> FakedUpdateableResultSet::getImplementationId() -+ throw( com::sun::star::uno::RuntimeException ) -+{ -+ static cppu::OImplementationId *pId; -+ if( ! pId ) -+ { -+ MutexGuard guard( osl::Mutex::getGlobalMutex() ); -+ if( ! pId ) -+ { -+ static cppu::OImplementationId id(sal_False); -+ pId = &id; -+ } -+ } -+ return pId->getImplementationId(); -+} -+ -+void FakedUpdateableResultSet::insertRow( ) throw (SQLException, RuntimeException) -+{ -+ throw SQLException( m_aReason, *this, OUString(),1,Any() ); -+} -+ -+void FakedUpdateableResultSet::updateRow( ) throw (SQLException, RuntimeException) -+{ -+ throw SQLException( m_aReason, *this, OUString(),1,Any() ); -+} -+ -+void FakedUpdateableResultSet::deleteRow( ) throw (SQLException, RuntimeException) -+{ -+ throw SQLException( m_aReason, *this, OUString(),1,Any() ); -+ } -+ -+void FakedUpdateableResultSet::cancelRowUpdates( ) throw (SQLException, RuntimeException) -+{ -+ throw SQLException( m_aReason, *this, OUString(),1,Any() ); -+} -+ -+void FakedUpdateableResultSet::moveToInsertRow( ) throw (SQLException, RuntimeException) -+{ -+ throw SQLException( m_aReason, *this, OUString(),1,Any() ); -+} -+ -+void FakedUpdateableResultSet::moveToCurrentRow( ) throw (SQLException, RuntimeException) -+{ -+ throw SQLException( m_aReason, *this, OUString(),1,Any() ); -+} -+ -+ -+void FakedUpdateableResultSet::updateNull( sal_Int32 columnIndex ) throw (SQLException, RuntimeException) -+{ -+ throw SQLException( m_aReason, *this, OUString(),1,Any() ); -+} -+ -+void FakedUpdateableResultSet::updateBoolean( sal_Int32 columnIndex, sal_Bool x ) throw (SQLException, RuntimeException) -+{ -+ throw SQLException( m_aReason, *this, OUString(),1,Any() ); -+} -+ -+void FakedUpdateableResultSet::updateByte( sal_Int32 columnIndex, sal_Int8 x ) throw (SQLException, RuntimeException) -+{ -+ throw SQLException( m_aReason, *this, OUString(),1,Any() ); -+} -+ -+void FakedUpdateableResultSet::updateShort( sal_Int32 columnIndex, sal_Int16 x ) throw (SQLException, RuntimeException) -+{ -+ throw SQLException( m_aReason, *this, OUString(),1,Any() ); -+} -+ -+void FakedUpdateableResultSet::updateInt( sal_Int32 columnIndex, sal_Int32 x ) throw (SQLException, RuntimeException) -+{ -+ throw SQLException( m_aReason, *this, OUString(),1,Any() ); -+} -+ -+void FakedUpdateableResultSet::updateLong( sal_Int32 columnIndex, sal_Int64 x ) throw (SQLException, RuntimeException) -+{ -+ throw SQLException( m_aReason, *this, OUString(),1,Any() ); -+} -+ -+void FakedUpdateableResultSet::updateFloat( sal_Int32 columnIndex, float x ) throw (SQLException, RuntimeException) -+{ -+ throw SQLException( m_aReason, *this, OUString(),1,Any() ); -+} -+ -+void FakedUpdateableResultSet::updateDouble( sal_Int32 columnIndex, double x ) throw (SQLException, RuntimeException) -+{ -+ throw SQLException( m_aReason, *this, OUString(),1,Any() ); -+} -+ -+void FakedUpdateableResultSet::updateString( sal_Int32 columnIndex, const ::rtl::OUString& x ) throw (SQLException, RuntimeException) -+{ -+ throw SQLException( m_aReason, *this, OUString(),1,Any() ); -+} -+ -+void FakedUpdateableResultSet::updateBytes( sal_Int32 columnIndex, const ::com::sun::star::uno::Sequence< sal_Int8 >& x ) throw (SQLException, RuntimeException) -+{ -+ throw SQLException( m_aReason, *this, OUString(),1,Any() ); -+} -+ -+void FakedUpdateableResultSet::updateDate( sal_Int32 columnIndex, const ::com::sun::star::util::Date& x ) throw (SQLException, RuntimeException) -+{ -+ throw SQLException( m_aReason, *this, OUString(),1,Any() ); -+} -+ -+void FakedUpdateableResultSet::updateTime( sal_Int32 columnIndex, const ::com::sun::star::util::Time& x ) throw (SQLException, RuntimeException) -+{ -+ throw SQLException( m_aReason, *this, OUString(),1,Any() ); -+} -+ -+void FakedUpdateableResultSet::updateTimestamp( sal_Int32 columnIndex, const ::com::sun::star::util::DateTime& x ) throw (SQLException, RuntimeException) -+{ -+ throw SQLException( m_aReason, *this, OUString(),1,Any() ); -+} -+ -+void FakedUpdateableResultSet::updateBinaryStream( sal_Int32 columnIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw (SQLException, RuntimeException) -+{ -+ throw SQLException( m_aReason, *this, OUString(),1,Any() ); -+} -+ -+void FakedUpdateableResultSet::updateCharacterStream( sal_Int32 columnIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw (SQLException, RuntimeException) -+{ -+ throw SQLException( m_aReason, *this, OUString(),1,Any() ); -+} -+ -+void FakedUpdateableResultSet::updateObject( sal_Int32 columnIndex, const ::com::sun::star::uno::Any& x ) throw (SQLException, RuntimeException) -+{ -+ throw SQLException( m_aReason, *this, OUString(),1,Any() ); -+} -+ -+void FakedUpdateableResultSet::updateNumericObject( sal_Int32 columnIndex, const ::com::sun::star::uno::Any& x, sal_Int32 scale ) throw (SQLException, RuntimeException) -+{ -+ throw SQLException( m_aReason, *this, OUString(),1,Any() ); -+} -+ -+} -diff --git connectivity/source/drivers/postgresql/pq_fakedupdateableresultset.hxx connectivity/source/drivers/postgresql/pq_fakedupdateableresultset.hxx -new file mode 100644 -index 0000000..6eb387b ---- /dev/null -+++ connectivity/source/drivers/postgresql/pq_fakedupdateableresultset.hxx -@@ -0,0 +1,133 @@ -+/************************************************************************* -+ * -+ * $RCSfile: pq_fakedupdateableresultset.hxx,v $ -+ * -+ * $Revision: 1.1.2.1 $ -+ * -+ * last change: $Author: jbu $ $Date: 2004/05/09 19:47:14 $ -+ * -+ * The Contents of this file are made available subject to the terms of -+ * either of the following licenses -+ * -+ * - GNU Lesser General Public License Version 2.1 -+ * - Sun Industry Standards Source License Version 1.1 -+ * -+ * Sun Microsystems Inc., October, 2000 -+ * -+ * GNU Lesser General Public License Version 2.1 -+ * ============================================= -+ * Copyright 2000 by Sun Microsystems, Inc. -+ * 901 San Antonio Road, Palo Alto, CA 94303, USA -+ * -+ * This library is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License version 2.1, as published by the Free Software Foundation. -+ * -+ * This library is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public -+ * License along with this library; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, -+ * MA 02111-1307 USA -+ * -+ * -+ * Sun Industry Standards Source License Version 1.1 -+ * ================================================= -+ * The contents of this file are subject to the Sun Industry Standards -+ * Source License Version 1.1 (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.openoffice.org/license.html. -+ * -+ * Software provided under this License is provided on an "AS IS" basis, -+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, -+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, -+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. -+ * See the License for the specific provisions governing your rights and -+ * obligations concerning the Software. -+ * -+ * The Initial Developer of the Original Code is: Joerg Budischewski -+ * -+ * Copyright: 2000 by Sun Microsystems, Inc. -+ * -+ * All Rights Reserved. -+ * -+ * Contributor(s): Joerg Budischewski -+ * -+ * -+ ************************************************************************/ -+#ifndef PG_UPDATEABLERESULTSET_HXX_ -+#define PG_UPDATEABLERESULTSET_HXX_ -+ -+#include -+#include -+ -+#include "pq_resultset.hxx" -+ -+namespace pq_sdbc_driver -+{ -+/** necessary to avoid crashes in OOo, when an updateable result set is requested, -+ but cannot be delivered. -+ */ -+class FakedUpdateableResultSet : -+ public ResultSet, -+ public com::sun::star::sdbc::XResultSetUpdate, -+ public com::sun::star::sdbc::XRowUpdate -+{ -+ ::rtl::OUString m_aReason; -+ -+public: -+ FakedUpdateableResultSet( -+ const ::rtl::Reference< RefCountedMutex > & mutex, -+ const com::sun::star::uno::Reference< com::sun::star::uno::XInterface > &owner, -+ ConnectionSettings **pSettings, -+ PGresult *result, -+ const rtl::OUString &schema, -+ const rtl::OUString &table, -+ const rtl::OUString &aReason ); -+ -+public: // XInterface -+ virtual void SAL_CALL acquire() throw() { ResultSet::acquire(); } -+ virtual void SAL_CALL release() throw() { ResultSet::release(); } -+ virtual com::sun::star::uno::Any SAL_CALL queryInterface( -+ const com::sun::star::uno::Type & reqType ) -+ throw (com::sun::star::uno::RuntimeException); -+ -+public: // XTypeProvider -+ virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL getTypes() -+ throw( com::sun::star::uno::RuntimeException ); -+ virtual com::sun::star::uno::Sequence< sal_Int8> SAL_CALL getImplementationId() -+ throw( com::sun::star::uno::RuntimeException ); -+ -+public: // XResultSetUpdate -+ virtual void SAL_CALL insertRow( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual void SAL_CALL updateRow( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual void SAL_CALL deleteRow( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual void SAL_CALL cancelRowUpdates( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual void SAL_CALL moveToInsertRow( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual void SAL_CALL moveToCurrentRow( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ -+public: // XRowUpdate -+ virtual void SAL_CALL updateNull( sal_Int32 columnIndex ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual void SAL_CALL updateBoolean( sal_Int32 columnIndex, sal_Bool x ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual void SAL_CALL updateByte( sal_Int32 columnIndex, sal_Int8 x ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual void SAL_CALL updateShort( sal_Int32 columnIndex, sal_Int16 x ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual void SAL_CALL updateInt( sal_Int32 columnIndex, sal_Int32 x ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual void SAL_CALL updateLong( sal_Int32 columnIndex, sal_Int64 x ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual void SAL_CALL updateFloat( sal_Int32 columnIndex, float x ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual void SAL_CALL updateDouble( sal_Int32 columnIndex, double x ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual void SAL_CALL updateString( sal_Int32 columnIndex, const ::rtl::OUString& x ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual void SAL_CALL updateBytes( sal_Int32 columnIndex, const ::com::sun::star::uno::Sequence< sal_Int8 >& x ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual void SAL_CALL updateDate( sal_Int32 columnIndex, const ::com::sun::star::util::Date& x ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual void SAL_CALL updateTime( sal_Int32 columnIndex, const ::com::sun::star::util::Time& x ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual void SAL_CALL updateTimestamp( sal_Int32 columnIndex, const ::com::sun::star::util::DateTime& x ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual void SAL_CALL updateBinaryStream( sal_Int32 columnIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual void SAL_CALL updateCharacterStream( sal_Int32 columnIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual void SAL_CALL updateObject( sal_Int32 columnIndex, const ::com::sun::star::uno::Any& x ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual void SAL_CALL updateNumericObject( sal_Int32 columnIndex, const ::com::sun::star::uno::Any& x, sal_Int32 scale ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ -+}; -+} -+#endif -diff --git connectivity/source/drivers/postgresql/pq_preparedstatement.cxx connectivity/source/drivers/postgresql/pq_preparedstatement.cxx -new file mode 100644 -index 0000000..1d66a8a ---- /dev/null -+++ connectivity/source/drivers/postgresql/pq_preparedstatement.cxx -@@ -0,0 +1,881 @@ -+/************************************************************************* -+ * -+ * $RCSfile: pq_preparedstatement.cxx,v $ -+ * -+ * $Revision: 1.1.2.10 $ -+ * -+ * last change: $Author: jbu $ $Date: 2008/07/07 21:37:11 $ -+ * -+ * The Contents of this file are made available subject to the terms of -+ * either of the following licenses -+ * -+ * - GNU Lesser General Public License Version 2.1 -+ * - Sun Industry Standards Source License Version 1.1 -+ * -+ * Sun Microsystems Inc., October, 2000 -+ * -+ * GNU Lesser General Public License Version 2.1 -+ * ============================================= -+ * Copyright 2000 by Sun Microsystems, Inc. -+ * 901 San Antonio Road, Palo Alto, CA 94303, USA -+ * -+ * This library is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License version 2.1, as published by the Free Software Foundation. -+ * -+ * This library is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public -+ * License along with this library; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, -+ * MA 02111-1307 USA -+ * -+ * -+ * Sun Industry Standards Source License Version 1.1 -+ * ================================================= -+ * The contents of this file are subject to the Sun Industry Standards -+ * Source License Version 1.1 (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.openoffice.org/license.html. -+ * -+ * Software provided under this License is provided on an "AS IS" basis, -+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, -+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, -+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. -+ * See the License for the specific provisions governing your rights and -+ * obligations concerning the Software. -+ * -+ * The Initial Developer of the Original Code is: Joerg Budischewski -+ * -+ * Copyright: 2000 by Sun Microsystems, Inc. -+ * -+ * All Rights Reserved. -+ * -+ * Contributor(s): Joerg Budischewski -+ * -+ * -+ ************************************************************************/ -+ -+#include "pq_preparedstatement.hxx" -+#include "pq_resultset.hxx" -+#include "pq_tools.hxx" -+#include "pq_statics.hxx" -+#include "pq_statement.hxx" -+ -+#include -+#include -+ -+ -+#include -+#include -+ -+#include -+ -+#include -+#include -+ -+using osl::Mutex; -+using osl::MutexGuard; -+ -+using rtl::OUString; -+using rtl::OUStringToOString; -+using rtl::OStringToOUString; -+using rtl::OUStringBuffer; -+using rtl::OStringBuffer; -+using rtl::OString; -+ -+using com::sun::star::uno::Any; -+using com::sun::star::uno::makeAny; -+using com::sun::star::uno::Type; -+using com::sun::star::uno::RuntimeException; -+using com::sun::star::uno::Exception; -+using com::sun::star::uno::Sequence; -+using com::sun::star::uno::Reference; -+using com::sun::star::uno::XInterface; -+using com::sun::star::uno::UNO_QUERY; -+ -+using com::sun::star::lang::IllegalArgumentException; -+ -+using com::sun::star::sdbc::XWarningsSupplier; -+using com::sun::star::sdbc::XCloseable; -+using com::sun::star::sdbc::XPreparedStatement; -+using com::sun::star::sdbc::XParameters; -+using com::sun::star::sdbc::XResultSet; -+using com::sun::star::sdbc::XRef; -+using com::sun::star::sdbc::XBlob; -+using com::sun::star::sdbc::XClob; -+using com::sun::star::sdbc::XArray; -+using com::sun::star::sdbc::XConnection; -+using com::sun::star::sdbc::XGeneratedResultSet; -+using com::sun::star::sdbc::SQLException; -+ -+using com::sun::star::beans::Property; -+using com::sun::star::beans::XPropertySetInfo; -+using com::sun::star::beans::XPropertySet; -+using com::sun::star::beans::XMultiPropertySet; -+using com::sun::star::beans::XFastPropertySet; -+ -+#define ASCII_STR(x) OUString( RTL_CONSTASCII_USTRINGPARAM( x ) ) -+namespace pq_sdbc_driver -+{ -+static ::cppu::IPropertyArrayHelper & getPreparedStatementPropertyArrayHelper() -+{ -+ static ::cppu::IPropertyArrayHelper *pArrayHelper; -+ if( ! pArrayHelper ) -+ { -+ MutexGuard guard( Mutex::getGlobalMutex() ); -+ if( ! pArrayHelper ) -+ { -+ static Property aTable[] = -+ { -+ Property( -+ OUString( RTL_CONSTASCII_USTRINGPARAM("CursorName") ), 0, -+ ::getCppuType( (OUString *)0) , 0 ), -+ Property( -+ OUString( RTL_CONSTASCII_USTRINGPARAM("EscapeProcessing") ), 1, -+ ::getBooleanCppuType() , 0 ), -+ Property( -+ OUString( RTL_CONSTASCII_USTRINGPARAM("FetchDirection") ), 2, -+ ::getCppuType( (sal_Int32 *)0) , 0 ), -+ Property( -+ OUString( RTL_CONSTASCII_USTRINGPARAM("FetchSize") ), 3, -+ ::getCppuType( (sal_Int32 *)0) , 0 ), -+ Property( -+ OUString( RTL_CONSTASCII_USTRINGPARAM("MaxFieldSize") ), 4, -+ ::getCppuType( (sal_Int32 *)0) , 0 ), -+ Property( -+ OUString( RTL_CONSTASCII_USTRINGPARAM("MaxRows") ), 5, -+ ::getCppuType( (sal_Int32 *)0) , 0 ), -+ Property( -+ OUString( RTL_CONSTASCII_USTRINGPARAM("QueryTimeOut") ), 6, -+ ::getCppuType( (sal_Int32 *)0) , 0 ), -+ Property( -+ OUString( RTL_CONSTASCII_USTRINGPARAM("ResultSetConcurrency") ), 7, -+ ::getCppuType( (sal_Int32 *)0) , 0 ), -+ Property( -+ OUString( RTL_CONSTASCII_USTRINGPARAM("ResultSetType") ), 8, -+ ::getCppuType( (sal_Int32 *)0) , 0 ) -+ }; -+ OSL_ASSERT( sizeof(aTable)/ sizeof(Property) == PREPARED_STATEMENT_SIZE ); -+ static ::cppu::OPropertyArrayHelper arrayHelper( aTable, PREPARED_STATEMENT_SIZE, sal_True ); -+ pArrayHelper = &arrayHelper; -+ } -+ } -+ return *pArrayHelper; -+} -+ -+static bool isOperator( char c ) -+{ -+ static const char * operators = "<>=()!/&%.,;"; -+ -+ const char * w = operators; -+ for( ; *w && *w != c ; w ++); -+ return *w != 0; -+} -+ -+static bool isNamedParameterStart( const rtl::OString & o , int index ) -+{ -+ return o[index] == ':' && ( -+ isWhitespace( o[index-1] ) || isOperator(o[index-1]) ); -+} -+ -+static bool isQuoted( const rtl::OString & str ) -+{ -+ return str[0] == '"' || str[0] == '\''; -+} -+ -+PreparedStatement::PreparedStatement( -+ const ::rtl::Reference< RefCountedMutex > & refMutex, -+ const Reference< XConnection > & conn, -+ struct ConnectionSettings *pSettings, -+ const ::rtl::OString & stmt ) -+ : OComponentHelper( refMutex->mutex ), -+ OPropertySetHelper( OComponentHelper::rBHelper ), -+ m_refMutex( refMutex ), -+ m_connection( conn ), -+ m_pSettings( pSettings ), -+ m_stmt( stmt ), -+ m_lastOidInserted( InvalidOid ) -+{ -+ m_props[PREPARED_STATEMENT_QUERY_TIME_OUT] = makeAny( (sal_Int32)0 ); -+ m_props[PREPARED_STATEMENT_MAX_ROWS] = makeAny( (sal_Int32)0 ); -+ m_props[PREPARED_STATEMENT_RESULT_SET_CONCURRENCY] = makeAny( -+ com::sun::star::sdbc::ResultSetConcurrency::READ_ONLY ); -+ m_props[PREPARED_STATEMENT_RESULT_SET_TYPE] = makeAny( -+ com::sun::star::sdbc::ResultSetType::SCROLL_INSENSITIVE ); -+ -+ splitSQL( m_stmt, m_splittedStatement ); -+ int elements = 0; -+ for( int i = 0, max = m_splittedStatement.size(); i < max ; i ++ ) -+ { -+ const OString &str = m_splittedStatement[i]; -+ // ignore quoted strings .... -+ if( ! isQuoted( str ) ) -+ { -+ // the ':' cannot be the first or the last part of the -+ // token, -+ // the ? cannot be the first part of the token , so we start -+ // at one -+ for( int index = 1 ; index < str.getLength() ; index ++ ) -+ { -+ if( str[index] == '?' || -+ isNamedParameterStart( str , index ) -+ ) -+ { -+ elements ++; -+ } -+ } -+ } -+ } -+ m_vars = OStringVector ( elements ); -+} -+ -+PreparedStatement::~PreparedStatement() -+{ -+ POSTGRE_TRACE( "dtor PreparedStatement" ); -+} -+ -+void PreparedStatement::checkColumnIndex( sal_Int32 parameterIndex ) -+{ -+ if( parameterIndex < 1 || parameterIndex > (sal_Int32) m_vars.size() ) -+ { -+ OUStringBuffer buf( 128 ); -+ buf.appendAscii( "pq_preparedstatement: parameter index out of range (expected 1 to " ); -+ buf.append( (sal_Int32 ) m_vars.size() ); -+ buf.appendAscii( ", got " ); -+ buf.append( parameterIndex ); -+ buf.appendAscii( ", statement '" ); -+ buf.append( OStringToOUString( m_stmt, m_pSettings->encoding ) ); -+ buf.appendAscii( "')" ); -+ throw SQLException( buf.makeStringAndClear(), *this, OUString(), 1, Any () ); -+ } -+} -+void PreparedStatement::checkClosed() throw (SQLException, RuntimeException ) -+{ -+ if( ! m_pSettings || ! m_pSettings->pConnection ) -+ throw SQLException( -+ ASCII_STR("pq_driver: PreparedStatement or connection has already been closed !" ), -+ *this, OUString(),1,Any()); -+} -+ -+Any PreparedStatement::queryInterface( const Type & reqType ) throw (RuntimeException) -+{ -+ Any ret; -+ -+ ret = OComponentHelper::queryInterface( reqType ); -+ if( ! ret.hasValue() ) -+ ret = ::cppu::queryInterface( reqType, -+ static_cast< XWarningsSupplier * > ( this ), -+ static_cast< XPreparedStatement * > ( this ), -+ static_cast< com::sun::star::sdbc::XResultSetMetaDataSupplier * > ( this ), -+ static_cast< XParameters * > ( this ), -+ static_cast< XCloseable * > ( this ), -+ static_cast< XGeneratedResultSet * > ( this ), -+ static_cast< XPropertySet * > ( this ), -+ static_cast< XMultiPropertySet * > ( this ), -+ static_cast< XFastPropertySet * > ( this ) ); -+ return ret; -+} -+ -+ -+Sequence< Type > PreparedStatement::getTypes() throw ( RuntimeException ) -+{ -+ static cppu::OTypeCollection *pCollection; -+ if( ! pCollection ) -+ { -+ MutexGuard guard( osl::Mutex::getGlobalMutex() ); -+ if( !pCollection ) -+ { -+ static cppu::OTypeCollection collection( -+ getCppuType( (Reference< XWarningsSupplier> *) 0 ), -+ getCppuType( (Reference< XPreparedStatement> *) 0 ), -+ getCppuType( (Reference< com::sun::star::sdbc::XResultSetMetaDataSupplier> *) 0 ), -+ getCppuType( (Reference< XParameters> *) 0 ), -+ getCppuType( (Reference< XCloseable> *) 0 ), -+ getCppuType( (Reference< XGeneratedResultSet> *) 0 ), -+ getCppuType( (Reference< XPropertySet >*) 0 ), -+ getCppuType( (Reference< XFastPropertySet > *) 0 ), -+ getCppuType( (Reference< XMultiPropertySet > *) 0 ), -+ OComponentHelper::getTypes()); -+ pCollection = &collection; -+ } -+ } -+ return pCollection->getTypes(); -+} -+ -+Sequence< sal_Int8> PreparedStatement::getImplementationId() throw ( RuntimeException ) -+{ -+ static cppu::OImplementationId *pId; -+ if( ! pId ) -+ { -+ MutexGuard guard( osl::Mutex::getGlobalMutex() ); -+ if( ! pId ) -+ { -+ static cppu::OImplementationId id(sal_False); -+ pId = &id; -+ } -+ } -+ return pId->getImplementationId(); -+} -+ -+void PreparedStatement::close( ) throw (SQLException, RuntimeException) -+{ -+ // let the connection die without acquired mutex ! -+ Reference< XConnection > r; -+ Reference< XCloseable > resultSet; -+ { -+ MutexGuard guard( m_refMutex->mutex ); -+ m_pSettings = 0; -+ r = m_connection; -+ m_connection.clear(); -+ -+ resultSet = m_lastResultset; -+ m_lastResultset.clear(); -+ } -+ if( resultSet.is() ) -+ { -+ resultSet->close(); -+ } -+} -+ -+void PreparedStatement::raiseSQLException( -+ const char * errorMsg, const char *errorType ) -+ throw( SQLException ) -+{ -+ OUStringBuffer buf(128); -+ buf.appendAscii( "pq_driver: "); -+ if( errorType ) -+ { -+ buf.appendAscii( "[" ); -+ buf.appendAscii( errorType ); -+ buf.appendAscii( "]" ); -+ } -+ buf.append( -+ rtl::OUString( errorMsg, strlen(errorMsg) , m_pSettings->encoding ) ); -+ buf.appendAscii( " (caused by statement '" ); -+ buf.appendAscii( m_executedStatement ); -+ buf.appendAscii( "')" ); -+ OUString error = buf.makeStringAndClear(); -+ log( m_pSettings, LogLevel::ERROR, error ); -+ throw SQLException( buf.makeStringAndClear(), *this, OUString(), 1, Any() ); -+} -+ -+Reference< XResultSet > PreparedStatement::executeQuery( ) -+ throw (SQLException, RuntimeException) -+{ -+ Reference< XCloseable > lastResultSet = m_lastResultset; -+ if( lastResultSet.is() ) -+ lastResultSet->close(); -+ -+ if( ! execute( ) ) -+ { -+ raiseSQLException( "not a query" ); -+ } -+ return Reference< XResultSet > ( m_lastResultset, com::sun::star::uno::UNO_QUERY ); -+} -+ -+sal_Int32 PreparedStatement::executeUpdate( ) -+ throw (SQLException, RuntimeException) -+{ -+ if( execute( ) ) -+ { -+ raiseSQLException( "not a command" ); -+ } -+ return m_multipleResultUpdateCount; -+} -+ -+sal_Bool PreparedStatement::execute( ) -+ throw (SQLException, RuntimeException) -+{ -+ osl::MutexGuard guard( m_refMutex->mutex ); -+ -+ OStringBuffer buf( m_stmt.getLength() *2 ); -+ -+ int vars = 0; -+ for( int i = 0 ; i < m_splittedStatement.size() ; i ++ ) -+ { -+ const OString &str = m_splittedStatement[i]; -+// printf( "Splitted %d %s\n" , i , str.getStr() ); -+ if( isQuoted( str ) ) -+ { -+ buf.append( str ); -+ } -+ else -+ { -+ int start = 0,index; -+ for( index = 1 ; index < str.getLength() ; index ++ ) -+ { -+ if( str[index] == '?' ) -+ { -+ buf.append( str.getStr()+start, index - start ); -+ buf.append( m_vars[vars] ); -+ vars ++; -+ start =index+1; -+ } -+ else -+ { -+ if ( isNamedParameterStart( str, index ) ) -+ { -+ buf.append( str.getStr()+start, index -start ); -+ buf.append( m_vars[vars] ); -+ -+ // skip to the end of the named parameter -+ for( ; index < str.getLength() && -+ ! ( isWhitespace( str[index] ) || isOperator( str[index] ) ) ; index ++ ); -+ start = index; -+ vars ++; -+ } -+ } -+ } -+// if( index +1 >= str.getLength() ) -+// { -+ buf.append( str.getStr() + start, index -start ); -+// } -+ } -+ } -+ -+ m_executedStatement = buf.makeStringAndClear(); -+ -+ m_lastResultset.clear(); -+ m_lastTableInserted = rtl::OUString(); -+ -+ struct CommandData data; -+ data.refMutex = m_refMutex; -+ data.ppSettings = &m_pSettings; -+ data.pLastOidInserted = &m_lastOidInserted; -+ data.pLastQuery = &m_lastQuery; -+ data.pMultipleResultUpdateCount = &m_multipleResultUpdateCount; -+ data.pMultipleResultAvailable = &m_multipleResultAvailable; -+ data.pLastTableInserted = &m_lastTableInserted; -+ data.pLastResultset = &m_lastResultset; -+ data.owner = *this; -+ data.tableSupplier = Reference< com::sun::star::sdbcx::XTablesSupplier >( m_connection, UNO_QUERY ); -+ data.concurrency = extractIntProperty( this, getStatics().RESULT_SET_CONCURRENCY ); -+ -+ return executePostgresCommand( m_executedStatement , &data ); // see pq_statement.cxx -+} -+ -+Reference< XConnection > PreparedStatement::getConnection( ) -+ throw (SQLException, RuntimeException) -+{ -+ Reference< XConnection > ret; -+ { -+ MutexGuard guard( m_refMutex->mutex ); -+ checkClosed(); -+ ret = m_connection; -+ } -+ return ret; -+} -+ -+ -+void PreparedStatement::setNull( sal_Int32 parameterIndex, sal_Int32 sqlType ) -+ throw (SQLException, RuntimeException) -+{ -+ MutexGuard guard( m_refMutex->mutex ); -+ checkClosed(); -+ checkColumnIndex( parameterIndex ); -+ m_vars[parameterIndex-1] = OString( "NULL" ); -+} -+ -+void PreparedStatement::setObjectNull( -+ sal_Int32 parameterIndex, sal_Int32 sqlType, const ::rtl::OUString& typeName ) -+ throw (SQLException, RuntimeException) -+{ -+ MutexGuard guard( m_refMutex->mutex ); -+ checkClosed(); -+ checkColumnIndex( parameterIndex ); -+ m_vars[parameterIndex-1] = OString( "NULL" ); -+} -+ -+ -+void PreparedStatement::setBoolean( sal_Int32 parameterIndex, sal_Bool x ) -+ throw (SQLException, RuntimeException) -+{ -+ MutexGuard guard(m_refMutex->mutex ); -+ checkClosed(); -+ checkColumnIndex( parameterIndex ); -+ if( x ) -+ m_vars[parameterIndex-1] = OString( "'t'" ); -+ else -+ m_vars[parameterIndex-1] = OString( "'f'" ); -+} -+ -+void PreparedStatement::setByte( sal_Int32 parameterIndex, sal_Int8 x ) -+ throw (SQLException, RuntimeException) -+{ -+ setInt(parameterIndex,x); -+} -+ -+void PreparedStatement::setShort( sal_Int32 parameterIndex, sal_Int16 x ) -+ throw (SQLException, RuntimeException) -+{ -+ setInt(parameterIndex, x ); -+} -+ -+void PreparedStatement::setInt( sal_Int32 parameterIndex, sal_Int32 x ) -+ throw (SQLException, RuntimeException) -+{ -+// printf( "setString %d %d\n ", parameterIndex, x); -+ MutexGuard guard(m_refMutex->mutex ); -+ checkClosed(); -+ checkColumnIndex( parameterIndex ); -+ OStringBuffer buf( 20 ); -+ buf.append( "'" ); -+ buf.append( (sal_Int32) x ); -+ buf.append( "'" ); -+ m_vars[parameterIndex-1] = buf.makeStringAndClear(); -+} -+ -+void PreparedStatement::setLong( sal_Int32 parameterIndex, sal_Int64 x ) -+ throw (SQLException, RuntimeException) -+{ -+ MutexGuard guard(m_refMutex->mutex ); -+ checkClosed(); -+ checkColumnIndex( parameterIndex ); -+ OStringBuffer buf( 20 ); -+ buf.append( "'" ); -+ buf.append( (sal_Int64) x ); -+ buf.append( "'" ); -+ m_vars[parameterIndex-1] = buf.makeStringAndClear(); -+} -+ -+void PreparedStatement::setFloat( sal_Int32 parameterIndex, float x ) -+ throw (SQLException, RuntimeException) -+{ -+ MutexGuard guard(m_refMutex->mutex ); -+ checkClosed(); -+ checkColumnIndex( parameterIndex ); -+ OStringBuffer buf( 20 ); -+ buf.append( "'" ); -+ buf.append( x ); -+ buf.append( "'" ); -+ m_vars[parameterIndex-1] = buf.makeStringAndClear(); -+} -+ -+void PreparedStatement::setDouble( sal_Int32 parameterIndex, double x ) -+ throw (SQLException, RuntimeException) -+{ -+ MutexGuard guard(m_refMutex->mutex ); -+ checkClosed(); -+ checkColumnIndex( parameterIndex ); -+ OStringBuffer buf( 20 ); -+ buf.append( "'" ); -+ buf.append( x ); -+ buf.append( "'" ); -+ m_vars[parameterIndex-1] = buf.makeStringAndClear(); -+} -+ -+void PreparedStatement::setString( sal_Int32 parameterIndex, const ::rtl::OUString& x ) -+ throw (SQLException, RuntimeException) -+{ -+// printf( "setString %d %s\n ", parameterIndex, -+// OUStringToOString( x , RTL_TEXTENCODING_ASCII_US ).getStr()); -+ MutexGuard guard(m_refMutex->mutex ); -+ checkClosed(); -+ checkColumnIndex( parameterIndex ); -+ OStringBuffer buf( 20 ); -+ buf.append( "'" ); -+ OString y = OUStringToOString( x, m_pSettings->encoding ); -+ buf.ensureCapacity( y.getLength() * 2 + 2 ); -+ int len = PQescapeString( ((char*)buf.getStr())+1, y.getStr() , y.getLength() ); -+ buf.setLength( 1 + len ); -+ buf.append( "'" ); -+ m_vars[parameterIndex-1] = buf.makeStringAndClear(); -+} -+ -+void PreparedStatement::setBytes( -+ sal_Int32 parameterIndex, const Sequence< sal_Int8 >& x ) -+ throw (SQLException, RuntimeException) -+{ -+ MutexGuard guard(m_refMutex->mutex ); -+ checkClosed(); -+ checkColumnIndex( parameterIndex ); -+ OStringBuffer buf( 20 ); -+ buf.append( "'" ); -+ size_t len; -+ unsigned char * escapedString = -+ PQescapeBytea( (unsigned char *)x.getConstArray(), x.getLength(), &len); -+ if( ! escapedString ) -+ { -+ throw SQLException( -+ ASCII_STR("pq_preparedstatement.setBytes: Error during converting bytesequence to an SQL conform string" ), -+ *this, OUString(), 1, Any() ); -+ } -+ buf.append( (const sal_Char *)escapedString, len -1 ); -+ free( escapedString ); -+ buf.append( "'" ); -+ m_vars[parameterIndex-1] = buf.makeStringAndClear(); -+} -+ -+ -+void PreparedStatement::setDate( sal_Int32 parameterIndex, const ::com::sun::star::util::Date& x ) -+ throw (SQLException, RuntimeException) -+{ -+ setString( parameterIndex, date2String( x ) ); -+} -+ -+void PreparedStatement::setTime( sal_Int32 parameterIndex, const ::com::sun::star::util::Time& x ) -+ throw (SQLException, RuntimeException) -+{ -+ setString( parameterIndex, time2String( x ) ); -+} -+ -+void PreparedStatement::setTimestamp( -+ sal_Int32 parameterIndex, const ::com::sun::star::util::DateTime& x ) -+ throw (SQLException, RuntimeException) -+{ -+ setString( parameterIndex, dateTime2String( x ) ); -+} -+ -+void PreparedStatement::setBinaryStream( -+ sal_Int32 parameterIndex, -+ const Reference< ::com::sun::star::io::XInputStream >& x, -+ sal_Int32 length ) -+ throw (SQLException, RuntimeException) -+{ -+ throw SQLException( -+ ASCII_STR( "pq_preparedstatement: setBinaryStream not implemented" ), -+ *this, OUString(), 1, Any () ); -+} -+ -+void PreparedStatement::setCharacterStream( -+ sal_Int32 parameterIndex, -+ const Reference< ::com::sun::star::io::XInputStream >& x, -+ sal_Int32 length ) -+ throw (SQLException, RuntimeException) -+{ -+ throw SQLException( -+ ASCII_STR( "pq_preparedstatement: setCharacterStream not implemented" ), -+ *this, OUString(), 1, Any () ); -+} -+ -+void PreparedStatement::setObject( sal_Int32 parameterIndex, const Any& x ) -+ throw (SQLException, RuntimeException) -+{ -+ if( ! implSetObject( this, parameterIndex, x )) -+ { -+ OUStringBuffer buf; -+ buf.append( ASCII_STR("pq_preparedstatement::setObject: can't convert value of type " ) ); -+ buf.append( x.getValueTypeName() ); -+ throw SQLException( buf.makeStringAndClear(), *this, OUString(), 1, Any () ); -+ } -+} -+ -+void PreparedStatement::setObjectWithInfo( -+ sal_Int32 parameterIndex, -+ const Any& x, -+ sal_Int32 targetSqlType, -+ sal_Int32 scale ) -+ throw (SQLException, RuntimeException) -+{ -+ if( com::sun::star::sdbc::DataType::DECIMAL == targetSqlType || -+ com::sun::star::sdbc::DataType::NUMERIC == targetSqlType ) -+ { -+ double myDouble; -+ OUString myString; -+ if( x >>= myDouble ) -+ { -+ myString = OUString::valueOf( myDouble ); -+ } -+ else -+ { -+ x >>= myString; -+ } -+ if( myString.getLength() ) -+ { -+// printf( "setObjectWithInfo %s\n", OUStringToOString(myString,RTL_TEXTENCODING_ASCII_US).getStr()); -+ setString( parameterIndex, myString ); -+ } -+ else -+ { -+ OUStringBuffer buf; -+ buf.append( ASCII_STR("pq_preparedstatement::setObjectWithInfo: can't convert value of type " ) ); -+ buf.append( x.getValueTypeName() ); -+ buf.append( ASCII_STR(" to type DECIMAL or NUMERIC" ) ); -+ throw SQLException( buf.makeStringAndClear(), *this, OUString(), 1, Any () ); -+ } -+ } -+ else -+ { -+ setObject( parameterIndex, x ); -+ } -+ -+} -+ -+void PreparedStatement::setRef( -+ sal_Int32 parameterIndex, -+ const Reference< XRef >& x ) -+ throw (SQLException, RuntimeException) -+{ -+ throw SQLException( -+ ASCII_STR( "pq_preparedstatement: setRef not implemented" ), -+ *this, OUString(), 1, Any () ); -+ -+} -+ -+void PreparedStatement::setBlob( -+ sal_Int32 parameterIndex, -+ const Reference< XBlob >& x ) -+ throw (SQLException, RuntimeException) -+{ -+ throw SQLException( -+ ASCII_STR( "pq_preparedstatement: setBlob not implemented" ), -+ *this, OUString(), 1, Any () ); -+} -+ -+void PreparedStatement::setClob( -+ sal_Int32 parameterIndex, -+ const Reference< XClob >& x ) -+ throw (SQLException, RuntimeException) -+{ -+ throw SQLException( -+ ASCII_STR( "pq_preparedstatement: setClob not implemented" ), -+ *this, OUString(), 1, Any () ); -+} -+ -+void PreparedStatement::setArray( -+ sal_Int32 parameterIndex, -+ const Reference< XArray >& x ) -+ throw (SQLException, RuntimeException) -+{ -+ setString( parameterIndex, array2String( x->getArray( 0 ) ) ); -+ -+// throw SQLException( -+// ASCII_STR( "pq_preparedstatement: setArray not implemented" ), -+// *this, OUString(), 1, Any () ); -+} -+ -+void PreparedStatement::clearParameters( ) -+ throw (SQLException, RuntimeException) -+{ -+ MutexGuard guard(m_refMutex->mutex ); -+ m_vars = OStringVector ( m_vars.size() ); -+} -+ -+Any PreparedStatement::getWarnings( ) -+ throw (SQLException,RuntimeException) -+{ -+ return Any(); -+} -+ -+void PreparedStatement::clearWarnings( ) -+ throw (SQLException, RuntimeException) -+{ -+} -+ -+Reference< ::com::sun::star::sdbc::XResultSetMetaData > PreparedStatement::getMetaData() -+ throw (SQLException,RuntimeException) -+{ -+ Reference< com::sun::star::sdbc::XResultSetMetaData > ret; -+ Reference< com::sun::star::sdbc::XResultSetMetaDataSupplier > supplier( m_lastResultset, UNO_QUERY ); -+ if( supplier.is() ) -+ ret = supplier->getMetaData(); -+ return ret; -+} -+ -+::cppu::IPropertyArrayHelper & PreparedStatement::getInfoHelper() -+{ -+ return getPreparedStatementPropertyArrayHelper(); -+} -+ -+ -+sal_Bool PreparedStatement::convertFastPropertyValue( -+ Any & rConvertedValue, Any & rOldValue, sal_Int32 nHandle, const Any& rValue ) -+ throw (IllegalArgumentException) -+{ -+ sal_Bool bRet; -+ rOldValue = m_props[nHandle]; -+ switch( nHandle ) -+ { -+ case PREPARED_STATEMENT_CURSOR_NAME: -+ { -+ OUString val; -+ bRet = ( rValue >>= val ); -+ rConvertedValue = makeAny( val ); -+ break; -+ } -+ case PREPARED_STATEMENT_ESCAPE_PROCESSING: -+ { -+ sal_Bool val; -+ bRet = ( rValue >>= val ); -+ rConvertedValue = makeAny( val ); -+ break; -+ } -+ case PREPARED_STATEMENT_FETCH_DIRECTION: -+ case PREPARED_STATEMENT_FETCH_SIZE: -+ case PREPARED_STATEMENT_MAX_FIELD_SIZE: -+ case PREPARED_STATEMENT_MAX_ROWS: -+ case PREPARED_STATEMENT_QUERY_TIME_OUT: -+ case PREPARED_STATEMENT_RESULT_SET_CONCURRENCY: -+ case PREPARED_STATEMENT_RESULT_SET_TYPE: -+ { -+ sal_Int32 val; -+ bRet = ( rValue >>= val ); -+ rConvertedValue = makeAny( val ); -+ break; -+ } -+ default: -+ { -+ OUStringBuffer buf(128); -+ buf.appendAscii( "pq_statement: Invalid property handle (" ); -+ buf.append( nHandle ); -+ buf.appendAscii( ")" ); -+ throw IllegalArgumentException( buf.makeStringAndClear(), *this, 2 ); -+ } -+ } -+ return bRet; -+} -+ -+ -+void PreparedStatement::setFastPropertyValue_NoBroadcast( -+ sal_Int32 nHandle,const Any& rValue ) throw (Exception) -+{ -+ m_props[nHandle] = rValue; -+} -+ -+void PreparedStatement::getFastPropertyValue( Any& rValue, sal_Int32 nHandle ) const -+{ -+ rValue = m_props[nHandle]; -+} -+ -+Reference < XPropertySetInfo > PreparedStatement::getPropertySetInfo() -+ throw(RuntimeException) -+{ -+ return OPropertySetHelper::createPropertySetInfo( getPreparedStatementPropertyArrayHelper() ); -+} -+ -+void PreparedStatement::disposing() -+{ -+ close(); -+} -+ -+ -+Reference< XResultSet > PreparedStatement::getResultSet( ) -+ throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) -+{ -+ return Reference< XResultSet > ( m_lastResultset, com::sun::star::uno::UNO_QUERY ); -+} -+sal_Int32 PreparedStatement::getUpdateCount( ) -+ throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) -+{ -+ return m_multipleResultUpdateCount; -+} -+sal_Bool PreparedStatement::getMoreResults( ) -+ throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) -+{ -+ return sal_False; -+} -+ -+Reference< XResultSet > PreparedStatement::getGeneratedValues( ) -+ throw (SQLException, RuntimeException) -+{ -+ osl::MutexGuard guard( m_refMutex->mutex ); -+ return getGeneratedValuesFromLastInsert( -+ m_pSettings, m_connection, m_lastOidInserted, m_lastTableInserted, m_lastQuery ); -+} -+ -+ -+} -diff --git connectivity/source/drivers/postgresql/pq_preparedstatement.hxx connectivity/source/drivers/postgresql/pq_preparedstatement.hxx -new file mode 100644 -index 0000000..55f2a6f ---- /dev/null -+++ connectivity/source/drivers/postgresql/pq_preparedstatement.hxx -@@ -0,0 +1,284 @@ -+/************************************************************************* -+ * -+ * $RCSfile: pq_preparedstatement.hxx,v $ -+ * -+ * $Revision: 1.1.2.5 $ -+ * -+ * last change: $Author: jbu $ $Date: 2006/01/22 15:14:29 $ -+ * -+ * The Contents of this file are made available subject to the terms of -+ * either of the following licenses -+ * -+ * - GNU Lesser General Public License Version 2.1 -+ * - Sun Industry Standards Source License Version 1.1 -+ * -+ * Sun Microsystems Inc., October, 2000 -+ * -+ * GNU Lesser General Public License Version 2.1 -+ * ============================================= -+ * Copyright 2000 by Sun Microsystems, Inc. -+ * 901 San Antonio Road, Palo Alto, CA 94303, USA -+ * -+ * This library is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License version 2.1, as published by the Free Software Foundation. -+ * -+ * This library is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public -+ * License along with this library; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, -+ * MA 02111-1307 USA -+ * -+ * -+ * Sun Industry Standards Source License Version 1.1 -+ * ================================================= -+ * The contents of this file are subject to the Sun Industry Standards -+ * Source License Version 1.1 (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.openoffice.org/license.html. -+ * -+ * Software provided under this License is provided on an "AS IS" basis, -+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, -+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, -+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. -+ * See the License for the specific provisions governing your rights and -+ * obligations concerning the Software. -+ * -+ * The Initial Developer of the Original Code is: Joerg Budischewski -+ * -+ * Copyright: 2000 by Sun Microsystems, Inc. -+ * -+ * All Rights Reserved. -+ * -+ * Contributor(s): Joerg Budischewski -+ * -+ * -+ ************************************************************************/ -+ -+#ifndef _PQ_PREPARED_STATEMENT_HXX_ -+#define _PQ_PREPARED_STATEMENT_HXX_ -+#include -+ -+#include -+ -+#include -+#include -+ -+#include -+#include -+#include -+#include -+ -+#include "pq_connection.hxx" -+namespace rtl { class OString; } -+namespace pq_sdbc_driver -+{ -+ -+static const sal_Int32 PREPARED_STATEMENT_CURSOR_NAME = 0; -+static const sal_Int32 PREPARED_STATEMENT_ESCAPE_PROCESSING = 1; -+static const sal_Int32 PREPARED_STATEMENT_FETCH_DIRECTION = 2; -+static const sal_Int32 PREPARED_STATEMENT_FETCH_SIZE = 3; -+static const sal_Int32 PREPARED_STATEMENT_MAX_FIELD_SIZE = 4; -+static const sal_Int32 PREPARED_STATEMENT_MAX_ROWS = 5; -+static const sal_Int32 PREPARED_STATEMENT_QUERY_TIME_OUT = 6; -+static const sal_Int32 PREPARED_STATEMENT_RESULT_SET_CONCURRENCY = 7; -+static const sal_Int32 PREPARED_STATEMENT_RESULT_SET_TYPE = 8; -+ -+#define PREPARED_STATEMENT_SIZE 9 -+class ResultSet; -+ -+class PreparedStatement : public cppu::OComponentHelper, -+ public cppu::OPropertySetHelper, -+ public com::sun::star::sdbc::XPreparedStatement, -+ public com::sun::star::sdbc::XParameters, -+ public com::sun::star::sdbc::XCloseable, -+ public com::sun::star::sdbc::XWarningsSupplier, -+ public com::sun::star::sdbc::XMultipleResults, -+ public com::sun::star::sdbc::XGeneratedResultSet, -+ public com::sun::star::sdbc::XResultSetMetaDataSupplier -+{ -+private: -+ com::sun::star::uno::Any m_props[PREPARED_STATEMENT_SIZE]; -+ com::sun::star::uno::Reference< com::sun::star::sdbc::XConnection > m_connection; -+ ConnectionSettings *m_pSettings; -+ ::com::sun::star::uno::Reference< com::sun::star::sdbc::XCloseable > m_lastResultset; -+ ::rtl::OString m_stmt; -+ ::rtl::OString m_executedStatement; -+ ::rtl::Reference< RefCountedMutex > m_refMutex; -+ OStringVector m_vars; -+ OStringVector m_splittedStatement; -+ sal_Bool m_multipleResultAvailable; -+ sal_Int32 m_multipleResultUpdateCount; -+ sal_Int32 m_lastOidInserted; -+ rtl::OUString m_lastTableInserted; -+ rtl::OString m_lastQuery; -+ -+public: -+ /** -+ * @param ppConnection The piece of memory, pConnection points to, is accessisble -+ * as long as a reference to paramenter con is held. -+ */ -+ PreparedStatement( const rtl::Reference< RefCountedMutex > & refMutex, -+ const com::sun::star::uno::Reference< com::sun::star::sdbc::XConnection> & con, -+ struct ConnectionSettings *pSettings, -+ const rtl::OString &stmt ); -+ -+ virtual ~PreparedStatement(); -+public: // XInterface -+ virtual void SAL_CALL acquire() throw() { OComponentHelper::acquire(); } -+ virtual void SAL_CALL release() throw() { OComponentHelper::release(); } -+ virtual com::sun::star::uno::Any SAL_CALL queryInterface( const com::sun::star::uno::Type & reqType ) -+ throw (com::sun::star::uno::RuntimeException); -+ -+public: // XCloseable -+ virtual void SAL_CALL close( ) -+ throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ -+public: // XPreparedStatement -+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL executeQuery() -+ throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Int32 SAL_CALL executeUpdate( ) -+ throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Bool SAL_CALL execute( ) -+ throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > SAL_CALL getConnection( ) -+ throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+public: // XParameters -+ virtual void SAL_CALL setNull( sal_Int32 parameterIndex, sal_Int32 sqlType ) -+ throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual void SAL_CALL setObjectNull( -+ sal_Int32 parameterIndex, sal_Int32 sqlType, const ::rtl::OUString& typeName ) -+ throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual void SAL_CALL setBoolean( sal_Int32 parameterIndex, sal_Bool x ) -+ throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual void SAL_CALL setByte( sal_Int32 parameterIndex, sal_Int8 x ) -+ throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual void SAL_CALL setShort( sal_Int32 parameterIndex, sal_Int16 x ) -+ throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual void SAL_CALL setInt( sal_Int32 parameterIndex, sal_Int32 x ) -+ throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual void SAL_CALL setLong( sal_Int32 parameterIndex, sal_Int64 x ) -+ throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual void SAL_CALL setFloat( sal_Int32 parameterIndex, float x ) -+ throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual void SAL_CALL setDouble( sal_Int32 parameterIndex, double x ) -+ throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual void SAL_CALL setString( sal_Int32 parameterIndex, const ::rtl::OUString& x ) -+ throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual void SAL_CALL setBytes( -+ sal_Int32 parameterIndex, const ::com::sun::star::uno::Sequence< sal_Int8 >& x ) -+ throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual void SAL_CALL setDate( sal_Int32 parameterIndex, const ::com::sun::star::util::Date& x ) -+ throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual void SAL_CALL setTime( sal_Int32 parameterIndex, const ::com::sun::star::util::Time& x ) -+ throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual void SAL_CALL setTimestamp( -+ sal_Int32 parameterIndex, const ::com::sun::star::util::DateTime& x ) -+ throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual void SAL_CALL setBinaryStream( -+ sal_Int32 parameterIndex, -+ const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& x, -+ sal_Int32 length ) -+ throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual void SAL_CALL setCharacterStream( -+ sal_Int32 parameterIndex, -+ const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& x, -+ sal_Int32 length ) -+ throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual void SAL_CALL setObject( sal_Int32 parameterIndex, const ::com::sun::star::uno::Any& x ) -+ throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual void SAL_CALL setObjectWithInfo( -+ sal_Int32 parameterIndex, -+ const ::com::sun::star::uno::Any& x, -+ sal_Int32 targetSqlType, -+ sal_Int32 scale ) -+ throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual void SAL_CALL setRef( -+ sal_Int32 parameterIndex, -+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRef >& x ) -+ throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual void SAL_CALL setBlob( -+ sal_Int32 parameterIndex, -+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XBlob >& x ) -+ throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual void SAL_CALL setClob( -+ sal_Int32 parameterIndex, -+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XClob >& x ) -+ throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual void SAL_CALL setArray( -+ sal_Int32 parameterIndex, -+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XArray >& x ) -+ throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual void SAL_CALL clearParameters( ) -+ throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ -+public: // XWarningsSupplier -+ virtual ::com::sun::star::uno::Any SAL_CALL getWarnings( ) -+ throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual void SAL_CALL clearWarnings( ) -+ throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ -+public: // XTypeProvider, first implemented by OPropertySetHelper -+ virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL getTypes() -+ throw( com::sun::star::uno::RuntimeException ); -+ virtual com::sun::star::uno::Sequence< sal_Int8> SAL_CALL getImplementationId() -+ throw( com::sun::star::uno::RuntimeException ); -+ -+public: // OPropertySetHelper -+ virtual cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper(); -+ -+ virtual sal_Bool SAL_CALL convertFastPropertyValue( -+ ::com::sun::star::uno::Any & rConvertedValue, -+ ::com::sun::star::uno::Any & rOldValue, -+ sal_Int32 nHandle, -+ const ::com::sun::star::uno::Any& rValue ) -+ throw (::com::sun::star::lang::IllegalArgumentException); -+ -+ virtual void SAL_CALL setFastPropertyValue_NoBroadcast( -+ sal_Int32 nHandle, -+ const ::com::sun::star::uno::Any& rValue ) -+ throw (::com::sun::star::uno::Exception); -+ -+ virtual void SAL_CALL getFastPropertyValue( -+ ::com::sun::star::uno::Any& rValue, -+ sal_Int32 nHandle ) const; -+ -+ // XPropertySet -+ ::com::sun::star::uno::Reference < ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() -+ throw(com::sun::star::uno::RuntimeException); -+ -+public: // XGeneratedResultSet -+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL -+ getGeneratedValues( ) -+ throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ -+public: // XMultipleResults -+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getResultSet( ) -+ throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Int32 SAL_CALL getUpdateCount( ) -+ throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Bool SAL_CALL getMoreResults( ) -+ throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ -+public: // XResultSetMetaDataSupplier (is required by framework (see -+ // dbaccess/source/core/api/preparedstatement.cxx::getMetaData() ) -+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData > SAL_CALL getMetaData( ) -+ throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ -+public: // OComponentHelper -+ virtual void SAL_CALL disposing(); -+ -+private: -+ void checkColumnIndex( sal_Int32 parameterIndex ); -+ void checkClosed() throw (com::sun::star::sdbc::SQLException, com::sun::star::uno::RuntimeException); -+ void raiseSQLException( const char * errorMsg, const char *errorType = 0 ) -+ throw ( com::sun::star::sdbc::SQLException ); -+// PGresult *pgExecute( ::rtl::OString *pQuery ); -+}; -+ -+} -+#endif -diff --git connectivity/source/drivers/postgresql/pq_resultset.cxx connectivity/source/drivers/postgresql/pq_resultset.cxx -new file mode 100644 -index 0000000..07db701 ---- /dev/null -+++ connectivity/source/drivers/postgresql/pq_resultset.cxx -@@ -0,0 +1,257 @@ -+#include "pq_resultset.hxx" -+#include "pq_resultsetmetadata.hxx" -+ -+#include -+#include -+ -+using rtl::OUString; -+using rtl::OUStringToOString; -+ -+using osl::MutexGuard; -+ -+using com::sun::star::uno::RuntimeException; -+using com::sun::star::uno::Any; -+using com::sun::star::uno::makeAny; -+using com::sun::star::uno::Reference; -+using com::sun::star::uno::XInterface; -+ -+using com::sun::star::sdbc::SQLException; -+using com::sun::star::sdbc::XResultSetMetaData; -+ -+ -+namespace pq_sdbc_driver -+{ -+#define ASCII_STR(x) OUString( RTL_CONSTASCII_USTRINGPARAM( x ) ) -+ -+void ResultSet::checkClosed() -+ throw ( com::sun::star::sdbc::SQLException, com::sun::star::uno::RuntimeException ) -+{ -+ if( ! m_result ) -+ { -+ throw SQLException( ASCII_STR( "pq_resultset: already closed" ), -+ *this, OUString(), 1, Any() ); -+ } -+ -+ if( ! m_ppSettings || ! *m_ppSettings || ! (*m_ppSettings)->pConnection ) -+ { -+ throw SQLException( ASCII_STR( "pq_resultset: statement has been closed already" ), -+ *this, OUString(), 1, Any() ); -+ } -+ -+} -+ -+ResultSet::ResultSet( const ::rtl::Reference< RefCountedMutex > & refMutex, -+ const Reference< XInterface > & owner, -+ ConnectionSettings **ppSettings, -+ PGresult * result, -+ const rtl::OUString &schema, -+ const rtl::OUString &table) -+ : BaseResultSet( -+ refMutex, owner, PQntuples( result ), -+ PQnfields( result ),(*ppSettings)->tc ), -+ m_ppSettings( ppSettings ), -+ m_result( result ), -+ m_schema( schema ), -+ m_table( table ) -+{ -+ sal_Bool b = sal_True; -+// m_props[RESULTSET_IS_BOOKMARKABLE] = Any( &b, getBooleanCppuType() ); -+ m_props[ BASERESULTSET_RESULT_SET_TYPE] = makeAny( -+ com::sun::star::sdbc::ResultSetType::SCROLL_INSENSITIVE ); -+} -+ -+ -+Any ResultSet::getValue( sal_Int32 columnIndex ) -+{ -+ Any ret; -+ if( PQgetisnull( m_result, m_row, columnIndex -1 ) ) -+ { -+ m_wasNull = true; -+ } -+ else -+ { -+ m_wasNull = false; -+ ret <<= ::rtl::OUString( -+ PQgetvalue( m_result, m_row , columnIndex -1 ) , -+ PQgetlength( m_result, m_row , columnIndex -1 ) , -+ (*m_ppSettings)->encoding ); -+ -+ } -+ return ret; -+} -+ -+ResultSet::~ResultSet() -+{} -+ -+void ResultSet::close( ) throw (SQLException, RuntimeException) -+{ -+ Reference< XInterface > owner; -+ { -+ MutexGuard guard( m_refMutex->mutex ); -+ if( m_result ) -+ { -+ PQclear(m_result ); -+ m_result = 0; -+ m_row = -1; -+ } -+ owner = m_owner; -+ m_owner.clear(); -+ } -+} -+ -+Reference< XResultSetMetaData > ResultSet::getMetaData( ) throw (SQLException, RuntimeException) -+{ -+ MutexGuard guard( m_refMutex->mutex ); -+ checkClosed(); -+ return new ResultSetMetaData( -+ m_refMutex, this, this, m_ppSettings, m_result, m_schema, m_table ); -+} -+ -+sal_Int32 ResultSet::findColumn( const ::rtl::OUString& columnName ) -+ throw (SQLException, RuntimeException) -+{ -+ MutexGuard guard( m_refMutex->mutex ); -+ checkClosed(); -+ return PQfnumber( -+ m_result, -+ OUStringToOString( columnName, (*m_ppSettings)->encoding ).getStr()) -+ +1; -+} -+ -+static bool isNumber( const char * data, sal_Int32 len ) -+{ -+ bool ret = false; -+ if( len ) -+ { -+ ret = true; -+ for( int i = 0 ; i < len ; i ++ ) -+ { -+ if( ( data[i] >= '0' && data[i] <= '9' ) || -+ data[i] == '-' || data[i] == '+' || data[i] == '.' || data[i] == ',' ) -+ { -+ if( data[i] == '-' && i != 0 && i != len-1 ) -+ { -+ // no number, maybe a date -+ ret = false; -+ break; -+ } -+ } -+ else -+ { -+ ret = false; -+ break; -+ } -+ } -+ } -+ return ret; -+} -+ -+static bool isInteger( const char * data, sal_Int32 len ) -+{ -+ bool ret = false; -+ if( len ) -+ { -+ ret = true; -+ for( int i = 0 ; i < len ; i ++ ) -+ { -+ if( ( data[i] >= '0' && data[i] <= '9' ) || -+ data[i] == '-' || data[i] == '+' ) -+ { -+ if( data[i] == '-' && i != 0 && i != len-1 ) -+ { -+ // no number, maybe a date -+ ret = false; -+ break; -+ } -+ } -+ else -+ { -+ ret = false; -+ break; -+ } -+ } -+ } -+ return ret; -+} -+ -+static bool isDate( const char * data, sal_Int32 len ) -+{ -+ bool ret = false; -+ return 10 == len && -+ '-' == data[4] && -+ '-' == data[7] && -+ isInteger( &(data[0]),4 ) && -+ isInteger( &(data[5]),2) && -+ isInteger( &(data[8]),2 ); -+} -+ -+static bool isTime( const char * data, sal_Int32 len ) -+{ -+ bool ret = false; -+ return 8 == len && -+ ':' == data[2] && -+ ':' == data[5] && -+ isInteger( &(data[0]),2 ) && -+ isInteger( &(data[3]),2) && -+ isInteger( &(data[6]),2 ); -+ -+} -+ -+static bool isTimestamp( const char * data, sal_Int32 len ) -+{ -+ return len == 19 && isDate( data, 10) && isTime( &(data[11]),8 ); -+} -+ -+sal_Int32 ResultSet::guessDataType( sal_Int32 column ) -+{ -+ // we don't look into more than 100 rows ... -+ sal_Int32 ret = com::sun::star::sdbc::DataType::INTEGER; -+ -+ int maxRows = ( m_rowCount > 100 ? 100 : m_rowCount ); -+ for( int i = 0 ; i < maxRows ; i ++ ) -+ { -+ if( ! PQgetisnull( m_result, i , column-1 ) ) -+ { -+ const char * p = PQgetvalue( m_result, i , column -1 ); -+ int len = PQgetlength( m_result, i , column -1 ); -+ -+ if( com::sun::star::sdbc::DataType::INTEGER == ret ) -+ { -+ if( ! isInteger( p,len ) ) -+ ret = com::sun::star::sdbc::DataType::NUMERIC; -+ } -+ if( com::sun::star::sdbc::DataType::NUMERIC == ret ) -+ { -+ if( ! isNumber( p,len ) ) -+ { -+ ret = com::sun::star::sdbc::DataType::DATE; -+ } -+ } -+ if( com::sun::star::sdbc::DataType::DATE == ret ) -+ { -+ if( ! isDate( p,len ) ) -+ { -+ ret = com::sun::star::sdbc::DataType::TIME; -+ } -+ } -+ if( com::sun::star::sdbc::DataType::TIME == ret ) -+ { -+ if( ! isTime( p,len ) ) -+ { -+ ret = com::sun::star::sdbc::DataType::TIMESTAMP; -+ } -+ } -+ if( com::sun::star::sdbc::DataType::TIMESTAMP == ret ) -+ { -+ if( ! isTimestamp( p,len ) ) -+ { -+ ret = com::sun::star::sdbc::DataType::LONGVARCHAR; -+ break; -+ } -+ } -+ } -+ } -+ return ret; -+} -+ -+} -diff --git connectivity/source/drivers/postgresql/pq_resultset.hxx connectivity/source/drivers/postgresql/pq_resultset.hxx -new file mode 100644 -index 0000000..0d0e8b7 ---- /dev/null -+++ connectivity/source/drivers/postgresql/pq_resultset.hxx -@@ -0,0 +1,122 @@ -+/************************************************************************* -+ * -+ * $RCSfile: pq_resultset.hxx,v $ -+ * -+ * $Revision: 1.1.2.3 $ -+ * -+ * last change: $Author: jbu $ $Date: 2006/05/01 19:19:06 $ -+ * -+ * The Contents of this file are made available subject to the terms of -+ * either of the following licenses -+ * -+ * - GNU Lesser General Public License Version 2.1 -+ * - Sun Industry Standards Source License Version 1.1 -+ * -+ * Sun Microsystems Inc., October, 2000 -+ * -+ * GNU Lesser General Public License Version 2.1 -+ * ============================================= -+ * Copyright 2000 by Sun Microsystems, Inc. -+ * 901 San Antonio Road, Palo Alto, CA 94303, USA -+ * -+ * This library is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License version 2.1, as published by the Free Software Foundation. -+ * -+ * This library is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public -+ * License along with this library; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, -+ * MA 02111-1307 USA -+ * -+ * -+ * Sun Industry Standards Source License Version 1.1 -+ * ================================================= -+ * The contents of this file are subject to the Sun Industry Standards -+ * Source License Version 1.1 (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.openoffice.org/license.html. -+ * -+ * Software provided under this License is provided on an "AS IS" basis, -+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, -+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, -+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. -+ * See the License for the specific provisions governing your rights and -+ * obligations concerning the Software. -+ * -+ * The Initial Developer of the Original Code is: Joerg Budischewski -+ * -+ * Copyright: 2000 by Sun Microsystems, Inc. -+ * -+ * All Rights Reserved. -+ * -+ * Contributor(s): Joerg Budischewski -+ * -+ * -+ ************************************************************************/ -+#ifndef _PG_RESULTSET_HXX_ -+#define _PG_RESULTSET_HXX_ -+ -+#include -+#include -+ -+#include -+#include -+#include -+#include -+#include "pq_connection.hxx" -+#include "pq_baseresultset.hxx" -+ -+namespace pq_sdbc_driver -+{ -+ -+class ResultSet : public BaseResultSet -+{ -+protected: -+ PGresult *m_result; -+ ::rtl::OUString m_schema; -+ ::rtl::OUString m_table; -+ ConnectionSettings **m_ppSettings; -+ -+protected: -+ /** mutex should be locked before called -+ */ -+ virtual void checkClosed() -+ throw ( com::sun::star::sdbc::SQLException, com::sun::star::uno::RuntimeException ); -+ -+ /** unchecked, acquire mutex before calling -+ */ -+ virtual ::com::sun::star::uno::Any getValue( sal_Int32 columnIndex ); -+ -+public: -+ ResultSet( -+ const ::rtl::Reference< RefCountedMutex > & mutex, -+ const com::sun::star::uno::Reference< com::sun::star::uno::XInterface > &owner, -+ ConnectionSettings **pSettings, -+ PGresult *result, -+ const rtl::OUString &schema, -+ const rtl::OUString &table ); -+ ~ResultSet(); -+ -+public: // XCloseable -+ virtual void SAL_CALL close( ) -+ throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ -+public: // XResultSetMetaDataSupplier -+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData > SAL_CALL getMetaData( ) -+ throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ -+public: // XColumnLocate -+ virtual sal_Int32 SAL_CALL findColumn( const ::rtl::OUString& columnName ) -+ throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ -+public: -+ sal_Int32 guessDataType( sal_Int32 column ); -+}; -+ -+} -+#endif -diff --git connectivity/source/drivers/postgresql/pq_resultsetmetadata.cxx connectivity/source/drivers/postgresql/pq_resultsetmetadata.cxx -new file mode 100644 -index 0000000..d351b4c ---- /dev/null -+++ connectivity/source/drivers/postgresql/pq_resultsetmetadata.cxx -@@ -0,0 +1,523 @@ -+/************************************************************************* -+ * -+ * $RCSfile: pq_resultsetmetadata.cxx,v $ -+ * -+ * $Revision: 1.1.2.7 $ -+ * -+ * last change: $Author: jbu $ $Date: 2006/05/27 11:32:13 $ -+ * -+ * The Contents of this file are made available subject to the terms of -+ * either of the following licenses -+ * -+ * - GNU Lesser General Public License Version 2.1 -+ * - Sun Industry Standards Source License Version 1.1 -+ * -+ * Sun Microsystems Inc., October, 2000 -+ * -+ * GNU Lesser General Public License Version 2.1 -+ * ============================================= -+ * Copyright 2000 by Sun Microsystems, Inc. -+ * 901 San Antonio Road, Palo Alto, CA 94303, USA -+ * -+ * This library is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License version 2.1, as published by the Free Software Foundation. -+ * -+ * This library is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public -+ * License along with this library; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, -+ * MA 02111-1307 USA -+ * -+ * -+ * Sun Industry Standards Source License Version 1.1 -+ * ================================================= -+ * The contents of this file are subject to the Sun Industry Standards -+ * Source License Version 1.1 (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.openoffice.org/license.html. -+ * -+ * Software provided under this License is provided on an "AS IS" basis, -+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, -+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, -+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. -+ * See the License for the specific provisions governing your rights and -+ * obligations concerning the Software. -+ * -+ * The Initial Developer of the Original Code is: Joerg Budischewski -+ * -+ * Copyright: 2000 by Sun Microsystems, Inc. -+ * -+ * All Rights Reserved. -+ * -+ * Contributor(s): Joerg Budischewski -+ * -+ * -+ ************************************************************************/ -+#include -+ -+#include "pq_resultsetmetadata.hxx" -+#include "pq_resultset.hxx" -+#include "pq_tools.hxx" -+#include "pq_statics.hxx" -+ -+#include -+#include -+#include -+ -+ -+using osl::Mutex; -+using osl::MutexGuard; -+ -+using rtl::OUString; -+using rtl::OUStringBuffer; -+using rtl::OString; -+ -+using com::sun::star::uno::Any; -+using com::sun::star::uno::RuntimeException; -+using com::sun::star::uno::Exception; -+using com::sun::star::uno::Reference; -+using com::sun::star::uno::XInterface; -+using com::sun::star::uno::UNO_QUERY; -+ -+using com::sun::star::lang::IllegalArgumentException; -+ -+using com::sun::star::sdbc::SQLException; -+using com::sun::star::sdbc::XStatement; -+using com::sun::star::sdbc::XRow; -+using com::sun::star::sdbc::XResultSet; -+// using com::sun::star::sdbc::XRow; -+using com::sun::star::sdbc::XResultSet; -+using com::sun::star::sdbcx::XColumnsSupplier; -+using com::sun::star::sdbcx::XTablesSupplier; -+ -+using com::sun::star::beans::XPropertySet; -+using com::sun::star::container::XNameAccess; -+ -+ -+#define ASCII_STR(x) OUString( RTL_CONSTASCII_USTRINGPARAM( x ) ) -+ -+namespace pq_sdbc_driver -+{ -+ -+// struct ColumnMetaData -+// { -+// rtl::OUString tableName; -+// rtl::OUString schemaTableName; -+// rtl::OUString typeName; -+// com::sun::star::sdbc::DataType type; -+// sal_Int32 precision; -+// sal_Int32 scale; -+// sal_Bool isCurrency; -+// sal_Bool isNullable; -+// sal_Bool isAutoIncrement; -+// sal_Bool isReadOnly; -+// sal_Bool isSigned; -+// }; -+ -+// is not exported by the postgres header -+const static int PQ_VARHDRSZ = sizeof( sal_Int32 ); -+ -+static void extractPrecisionAndScale( sal_Int32 atttypmod, sal_Int32 *precision, sal_Int32 *scale ) -+{ -+ if( atttypmod < PQ_VARHDRSZ ) -+ { -+ *precision = 0; -+ *scale = 0; -+ } -+ else -+ { -+ if( atttypmod & 0xffff0000 ) -+ { -+ *precision = ( ( atttypmod - PQ_VARHDRSZ ) >> 16 ) & 0xffff; -+ *scale = (atttypmod - PQ_VARHDRSZ ) & 0xffff; -+ } -+ else -+ { -+ *precision = atttypmod - PQ_VARHDRSZ; -+ *scale = 0; -+ } -+ } -+} -+ -+ResultSetMetaData::ResultSetMetaData( -+ const ::rtl::Reference< RefCountedMutex > & refMutex, -+ const ::com::sun::star::uno::Reference< com::sun::star::sdbc::XResultSet > & origin, -+ ResultSet * pResultSet, -+ ConnectionSettings **ppSettings, -+ PGresult *pResult, -+ const rtl::OUString &schemaName, -+ const rtl::OUString &tableName ) : -+ m_refMutex( refMutex ), -+ m_origin( origin ), -+ m_ppSettings( ppSettings ), -+ m_colCount( PQnfields( pResult ) ), -+ m_tableName( tableName ), -+ m_schemaName( schemaName ), -+ m_checkedForTable( false ), -+ m_checkedForTypes( false ), -+ m_colDesc( PQnfields( pResult ) ), -+ m_pResultSet( pResultSet ) -+{ -+ -+ // extract all needed information from the result object, so that we don't -+ // need it anymore after this call ! -+ for( int col = 0; col < m_colCount ; col ++ ) -+ { -+ sal_Int32 size = PQfsize( pResult, col ); -+ size = -1 == size ? 25 : size; -+ m_colDesc[col].displaySize = size; -+ -+ extractPrecisionAndScale( -+ PQfmod( pResult, col ), -+ & ( m_colDesc[col].precision ), -+ & ( m_colDesc[col].scale ) ); -+ char *name = PQfname( pResult, col ); -+ m_colDesc[col].name = OUString( name, strlen(name) , (*m_ppSettings)->encoding ); -+ m_colDesc[col].typeOid = PQftype( pResult, col ); -+ m_colDesc[col].type = com::sun::star::sdbc::DataType::LONGVARCHAR; -+ } -+} -+ -+// typedef std::hash_map< -+// Oid, -+// rtl::OUString, -+// std::hash< Oid >, -+// std::equal_to< Oid >, -+// Allocator < std::pair< Oid, rtl::OUString > > > PqTypeMap; -+ -+ -+void ResultSetMetaData::checkForTypes() -+{ -+ if( ! m_checkedForTypes ) -+ { -+ Reference< XStatement > stmt = -+ extractConnectionFromStatement( m_origin->getStatement() )->createStatement(); -+ DisposeGuard guard( stmt ); -+ OUStringBuffer buf(128); -+ buf.appendAscii( "SELECT oid, typname, typtype FROM pg_type WHERE "); -+ for( int i = 0 ; i < m_colCount ; i ++ ) -+ { -+ if( i > 0 ) -+ buf.appendAscii( " OR " ); -+ int oid = m_colDesc[i].typeOid; -+ buf.appendAscii( "oid=" ); -+ buf.append( (sal_Int32) oid, 10 ); -+ } -+ Reference< XResultSet > rs = stmt->executeQuery( buf.makeStringAndClear() ); -+ Reference< XRow > xRow( rs, UNO_QUERY ); -+ while( rs->next() ) -+ { -+ sal_Int32 oid = xRow->getInt( 1 ); -+ OUString typeName = xRow->getString( 2 ); -+ OUString typType = xRow->getString( 3 ); -+ -+ sal_Int32 type = typeNameToDataType( typeName, typType ); -+ -+ for( int j = 0; j < m_colCount ; j ++ ) -+ { -+ if( m_colDesc[j].typeOid == oid ) -+ { -+ m_colDesc[j].typeName = typeName; -+ m_colDesc[j].type = type; -+ } -+ } -+ } -+ m_checkedForTypes = true; -+ } -+} -+ -+void ResultSetMetaData::checkTable() -+{ -+ if( ! m_checkedForTable ) -+ { -+ m_checkedForTable = true; -+ if( m_tableName.getLength() ) -+ { -+ -+ Reference< com::sun::star::container::XNameAccess > tables = (*m_ppSettings)->tables; -+ if( ! tables.is() ) -+ { -+ -+ Reference< XTablesSupplier > supplier = -+ Reference< XTablesSupplier > ( -+ extractConnectionFromStatement( m_origin->getStatement() ), UNO_QUERY); -+ if( supplier.is() ) -+ tables = supplier->getTables(); -+ } -+ if( tables.is() ) -+ { -+ OUString name = getTableName( 1 ); -+// if( tables->hasByName( name ) ) -+ tables->getByName( name ) >>= m_table; -+ } -+ } -+ } -+} -+ -+sal_Int32 ResultSetMetaData::getIntColumnProperty( const rtl::OUString & name, int index, int def ) -+{ -+ sal_Int32 ret = def; // give defensive answers, when data is not available -+ try -+ { -+ MutexGuard guard( m_refMutex->mutex ); -+ checkColumnIndex( index ); -+ Reference< XPropertySet > set = getColumnByIndex( index ); -+ -+ if( set.is() ) -+ { -+ set->getPropertyValue( name ) >>= ret; -+ } -+ } -+ catch( com::sun::star::uno::Exception & e ) -+ { -+ } -+ return ret; -+} -+ -+sal_Bool ResultSetMetaData::getBoolColumnProperty( const rtl::OUString & name, int index, sal_Bool def ) -+{ -+ sal_Bool ret = def; -+ try -+ { -+ MutexGuard guard( m_refMutex->mutex ); -+ checkColumnIndex( index ); -+ Reference< XPropertySet > set = getColumnByIndex( index ); -+ if( set.is() ) -+ { -+ set->getPropertyValue( name ) >>= ret; -+ } -+ } -+ catch( com::sun::star::uno::Exception & e ) -+ { -+ } -+ -+ return ret; -+} -+ -+Reference< com::sun::star::beans::XPropertySet > ResultSetMetaData::getColumnByIndex( int index ) -+{ -+ Reference< XPropertySet > ret; -+ checkTable(); -+ if( m_table.is() ) -+ { -+ OUString columnName = getColumnName( index ); -+ Reference< XColumnsSupplier > supplier( m_table, UNO_QUERY ); -+ if( supplier.is() ) -+ { -+ Reference< XNameAccess > columns = supplier->getColumns(); -+ if( columns.is() && columns->hasByName( columnName ) ) -+ { -+ columns->getByName( columnName ) >>= ret; -+ } -+ } -+ } -+ return ret; -+} -+ -+// Methods -+sal_Int32 ResultSetMetaData::getColumnCount( ) -+ throw (SQLException, RuntimeException) -+{ -+ return m_colCount; -+} -+ -+sal_Bool ResultSetMetaData::isAutoIncrement( sal_Int32 column ) -+ throw (SQLException, RuntimeException) -+{ -+ -+ sal_Bool ret = getBoolColumnProperty( getStatics().IS_AUTO_INCREMENT, column, sal_False ); -+ return ret; -+} -+ -+sal_Bool ResultSetMetaData::isCaseSensitive( sal_Int32 column ) -+ throw (SQLException, RuntimeException) -+{ -+ -+ return sal_True; // ??? hmm, numeric types or -+} -+ -+sal_Bool ResultSetMetaData::isSearchable( sal_Int32 column ) throw (SQLException, RuntimeException) -+{ -+ return sal_True; // mmm, what types are not searchable ? -+} -+ -+sal_Bool ResultSetMetaData::isCurrency( sal_Int32 column ) throw (SQLException, RuntimeException) -+{ -+ return getBoolColumnProperty( getStatics().IS_CURRENCY, column, sal_False ); -+} -+ -+sal_Int32 ResultSetMetaData::isNullable( sal_Int32 column ) -+ throw (SQLException, RuntimeException) -+{ -+ return getIntColumnProperty( -+ getStatics().IS_NULLABLE, column, com::sun::star::sdbc::ColumnValue::NULLABLE_UNKNOWN ); -+} -+ -+sal_Bool ResultSetMetaData::isSigned( sal_Int32 column ) -+ throw (SQLException, RuntimeException) -+{ -+ return sal_True; // -+} -+ -+sal_Int32 ResultSetMetaData::getColumnDisplaySize( sal_Int32 column ) -+ throw (SQLException, RuntimeException) -+{ -+ MutexGuard guard( m_refMutex->mutex ); -+ checkClosed(); -+ checkColumnIndex( column ); -+ return m_colDesc[column-1].displaySize; -+} -+ -+::rtl::OUString ResultSetMetaData::getColumnLabel( sal_Int32 column ) -+ throw (SQLException, RuntimeException) -+{ -+ return getColumnName( column); -+} -+ -+::rtl::OUString ResultSetMetaData::getColumnName( sal_Int32 column ) throw (SQLException, RuntimeException) -+{ -+ MutexGuard guard( m_refMutex->mutex ); -+ checkClosed(); -+ checkColumnIndex( column ); -+ -+ return m_colDesc[column-1].name; -+} -+ -+::rtl::OUString ResultSetMetaData::getSchemaName( sal_Int32 column ) throw (SQLException, RuntimeException) -+{ -+ return m_schemaName; -+} -+ -+ -+ -+sal_Int32 ResultSetMetaData::getPrecision( sal_Int32 column ) -+ throw (SQLException, RuntimeException) -+{ -+ MutexGuard guard( m_refMutex->mutex ); -+ checkClosed(); -+ checkColumnIndex( column ); -+ return m_colDesc[column-1].precision; -+} -+ -+sal_Int32 ResultSetMetaData::getScale( sal_Int32 column ) -+ throw (SQLException, RuntimeException) -+{ -+ MutexGuard guard( m_refMutex->mutex ); -+ checkClosed(); -+ checkColumnIndex( column ); -+ return m_colDesc[column-1].scale; -+} -+ -+::rtl::OUString ResultSetMetaData::getTableName( sal_Int32 column ) -+ throw (SQLException, RuntimeException) -+{ -+ rtl::OUString ret; -+ if( m_tableName.getLength() ) -+ { -+ OUStringBuffer buf( 128 ); -+ buf.append( m_schemaName ); -+ buf.appendAscii( "." ); -+ buf.append( m_tableName ); -+ ret = buf.makeStringAndClear(); -+ } -+ return ret; -+} -+ -+::rtl::OUString ResultSetMetaData::getCatalogName( sal_Int32 column ) -+ throw (SQLException, RuntimeException) -+{ -+ // can do this through XConnection.getCatalog() ! -+ return OUString(); -+} -+sal_Int32 ResultSetMetaData::getColumnType( sal_Int32 column ) -+ throw (SQLException, RuntimeException) -+{ -+ int ret = getIntColumnProperty( getStatics().TYPE, column, -100 ); -+ if( -100 == ret ) -+ { -+ checkForTypes(); -+ if( com::sun::star::sdbc::DataType::LONGVARCHAR == m_colDesc[column-1].type && m_pResultSet ) -+ m_colDesc[column-1].type = m_pResultSet->guessDataType( column ); -+ ret = m_colDesc[column-1].type; -+ } -+ return ret; -+} -+ -+::rtl::OUString ResultSetMetaData::getColumnTypeName( sal_Int32 column ) -+ throw (SQLException, RuntimeException) -+{ -+ ::rtl::OUString ret; // give defensive answers, when data is not available -+ try -+ { -+ MutexGuard guard( m_refMutex->mutex ); -+ checkColumnIndex( column ); -+ Reference< XPropertySet > set = getColumnByIndex( column ); -+ -+ if( set.is() ) -+ { -+ set->getPropertyValue( getStatics().TYPE_NAME ) >>= ret; -+ } -+ else -+ { -+ checkForTypes(); -+ ret = m_colDesc[column-1].typeName; -+ } -+ } -+ catch( com::sun::star::uno::Exception & e ) -+ { -+ } -+ return ret; -+} -+ -+ -+sal_Bool ResultSetMetaData::isReadOnly( sal_Int32 column ) -+ throw (SQLException, RuntimeException) -+{ -+ return sal_False; -+} -+ -+sal_Bool ResultSetMetaData::isWritable( sal_Int32 column ) -+ throw (SQLException, RuntimeException) -+{ -+ return ! isReadOnly( column ); // what's the sense if this method ? -+} -+ -+sal_Bool ResultSetMetaData::isDefinitelyWritable( sal_Int32 column ) -+ throw (SQLException, RuntimeException) -+{ -+ return isWritable(column); // uhh, now it becomes really esoteric .... -+} -+::rtl::OUString ResultSetMetaData::getColumnServiceName( sal_Int32 column ) -+ throw (SQLException, RuntimeException) -+{ -+ return OUString(); -+} -+ -+void ResultSetMetaData::checkClosed() -+ throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) -+{ -+ // we never close -+} -+ -+void ResultSetMetaData::checkColumnIndex(sal_Int32 columnIndex) -+ throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) -+{ -+ if( columnIndex < 1 || columnIndex > m_colCount ) -+ { -+ OUStringBuffer buf(128); -+ -+ buf.appendAscii( "pq_resultsetmetadata: index out of range (expected 1 to " ); -+ buf.append( m_colCount ); -+ buf.appendAscii( ", got " ); -+ buf.append( columnIndex ); -+ throw SQLException( -+ buf.makeStringAndClear(), *this, OUString(), 1, Any() ); -+ } -+} -+ -+} -diff --git connectivity/source/drivers/postgresql/pq_resultsetmetadata.hxx connectivity/source/drivers/postgresql/pq_resultsetmetadata.hxx -new file mode 100644 -index 0000000..1c2eb43 ---- /dev/null -+++ connectivity/source/drivers/postgresql/pq_resultsetmetadata.hxx -@@ -0,0 +1,156 @@ -+/************************************************************************* -+ * -+ * $RCSfile: pq_resultsetmetadata.hxx,v $ -+ * -+ * $Revision: 1.1.2.3 $ -+ * -+ * last change: $Author: jbu $ $Date: 2006/05/01 19:19:07 $ -+ * -+ * The Contents of this file are made available subject to the terms of -+ * either of the following licenses -+ * -+ * - GNU Lesser General Public License Version 2.1 -+ * - Sun Industry Standards Source License Version 1.1 -+ * -+ * Sun Microsystems Inc., October, 2000 -+ * -+ * GNU Lesser General Public License Version 2.1 -+ * ============================================= -+ * Copyright 2000 by Sun Microsystems, Inc. -+ * 901 San Antonio Road, Palo Alto, CA 94303, USA -+ * -+ * This library is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License version 2.1, as published by the Free Software Foundation. -+ * -+ * This library is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public -+ * License along with this library; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, -+ * MA 02111-1307 USA -+ * -+ * -+ * Sun Industry Standards Source License Version 1.1 -+ * ================================================= -+ * The contents of this file are subject to the Sun Industry Standards -+ * Source License Version 1.1 (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.openoffice.org/license.html. -+ * -+ * Software provided under this License is provided on an "AS IS" basis, -+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, -+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, -+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. -+ * See the License for the specific provisions governing your rights and -+ * obligations concerning the Software. -+ * -+ * The Initial Developer of the Original Code is: Joerg Budischewski -+ * -+ * Copyright: 2000 by Sun Microsystems, Inc. -+ * -+ * All Rights Reserved. -+ * -+ * Contributor(s): Joerg Budischewski -+ * -+ * -+ ************************************************************************/ -+#ifndef _PQ_RESULTSETMETADATA_HXX_ -+#define _PQ_RESULTSETMETADATA_HXX_ -+#include -+ -+#include "pq_connection.hxx" -+ -+#include -+#include -+ -+#include -+ -+namespace pq_sdbc_driver -+{ -+ -+struct ColDesc -+{ -+ rtl::OUString name; -+ sal_Int32 precision; -+ sal_Int32 scale; -+ sal_Int32 displaySize; -+ Oid typeOid; -+ rtl::OUString typeName; -+ sal_Int32 type; -+}; -+ -+class ResultSet; -+ -+typedef std::vector< ColDesc, Allocator< ColDesc > > ColDescVector; -+ -+ -+class ResultSetMetaData : -+ public ::cppu::WeakImplHelper1 < com::sun::star::sdbc::XResultSetMetaData > -+{ -+ ::rtl::Reference< RefCountedMutex > m_refMutex; -+ ConnectionSettings **m_ppSettings; -+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > m_origin; -+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > m_table; -+ ::rtl::OUString m_tableName; -+ ::rtl::OUString m_schemaName; -+ ColDescVector m_colDesc; -+ ResultSet *m_pResultSet; -+ -+ bool m_checkedForTable; -+ bool m_checkedForTypes; -+ -+ sal_Int32 m_colCount; -+ -+ void checkClosed() -+ throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ void checkColumnIndex( sal_Int32 columnIndex ) -+ throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ void checkTable(); -+ void checkForTypes(); -+ com::sun::star::uno::Reference< com::sun::star::beans::XPropertySet > getColumnByIndex( int index ); -+ -+ sal_Int32 getIntColumnProperty( const rtl::OUString & name, int index, int def ); -+ sal_Bool getBoolColumnProperty( const rtl::OUString & name, int index, sal_Bool def ); -+ -+public: -+ ResultSetMetaData( -+ const ::rtl::Reference< RefCountedMutex > & reMutex, -+ const ::com::sun::star::uno::Reference< com::sun::star::sdbc::XResultSet > & origin, -+ ResultSet *pResultSet, -+ ConnectionSettings **pSettings, -+ PGresult *pResult, -+ const rtl::OUString &schemaName, -+ const rtl::OUString &tableName ); -+ -+public: -+ // Methods -+ virtual sal_Int32 SAL_CALL getColumnCount( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Bool SAL_CALL isAutoIncrement( sal_Int32 column ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Bool SAL_CALL isCaseSensitive( sal_Int32 column ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Bool SAL_CALL isSearchable( sal_Int32 column ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Bool SAL_CALL isCurrency( sal_Int32 column ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Int32 SAL_CALL isNullable( sal_Int32 column ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Bool SAL_CALL isSigned( sal_Int32 column ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Int32 SAL_CALL getColumnDisplaySize( sal_Int32 column ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual ::rtl::OUString SAL_CALL getColumnLabel( sal_Int32 column ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual ::rtl::OUString SAL_CALL getColumnName( sal_Int32 column ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual ::rtl::OUString SAL_CALL getSchemaName( sal_Int32 column ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Int32 SAL_CALL getPrecision( sal_Int32 column ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Int32 SAL_CALL getScale( sal_Int32 column ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual ::rtl::OUString SAL_CALL getTableName( sal_Int32 column ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual ::rtl::OUString SAL_CALL getCatalogName( sal_Int32 column ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Int32 SAL_CALL getColumnType( sal_Int32 column ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual ::rtl::OUString SAL_CALL getColumnTypeName( sal_Int32 column ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Bool SAL_CALL isReadOnly( sal_Int32 column ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Bool SAL_CALL isWritable( sal_Int32 column ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Bool SAL_CALL isDefinitelyWritable( sal_Int32 column ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual ::rtl::OUString SAL_CALL getColumnServiceName( sal_Int32 column ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+}; -+ -+} -+ -+#endif -diff --git connectivity/source/drivers/postgresql/pq_sequenceresultset.cxx connectivity/source/drivers/postgresql/pq_sequenceresultset.cxx -new file mode 100644 -index 0000000..584fafc ---- /dev/null -+++ connectivity/source/drivers/postgresql/pq_sequenceresultset.cxx -@@ -0,0 +1,150 @@ -+/************************************************************************* -+ * -+ * $RCSfile: pq_sequenceresultset.cxx,v $ -+ * -+ * $Revision: 1.1.2.3 $ -+ * -+ * last change: $Author: jbu $ $Date: 2006/01/22 15:14:31 $ -+ * -+ * The Contents of this file are made available subject to the terms of -+ * either of the following licenses -+ * -+ * - GNU Lesser General Public License Version 2.1 -+ * - Sun Industry Standards Source License Version 1.1 -+ * -+ * Sun Microsystems Inc., October, 2000 -+ * -+ * GNU Lesser General Public License Version 2.1 -+ * ============================================= -+ * Copyright 2000 by Sun Microsystems, Inc. -+ * 901 San Antonio Road, Palo Alto, CA 94303, USA -+ * -+ * This library is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License version 2.1, as published by the Free Software Foundation. -+ * -+ * This library is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public -+ * License along with this library; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, -+ * MA 02111-1307 USA -+ * -+ * -+ * Sun Industry Standards Source License Version 1.1 -+ * ================================================= -+ * The contents of this file are subject to the Sun Industry Standards -+ * Source License Version 1.1 (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.openoffice.org/license.html. -+ * -+ * Software provided under this License is provided on an "AS IS" basis, -+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, -+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, -+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. -+ * See the License for the specific provisions governing your rights and -+ * obligations concerning the Software. -+ * -+ * The Initial Developer of the Original Code is: Joerg Budischewski -+ * -+ * Copyright: 2000 by Sun Microsystems, Inc. -+ * -+ * All Rights Reserved. -+ * -+ * Contributor(s): Joerg Budischewski -+ * -+ * -+ ************************************************************************/ -+ -+#include "pq_sequenceresultset.hxx" -+#include "pq_sequenceresultsetmetadata.hxx" -+ -+ -+using rtl::OUString; -+ -+using com::sun::star::sdbc::XResultSetMetaData; -+ -+using com::sun::star::uno::Sequence; -+using com::sun::star::uno::Reference; -+using com::sun::star::uno::Any; -+ -+namespace pq_sdbc_driver -+{ -+#define ASCII_STR(x) OUString( RTL_CONSTASCII_USTRINGPARAM( x ) ) -+ -+void SequenceResultSet::checkClosed() -+ throw ( com::sun::star::sdbc::SQLException, -+ com::sun::star::uno::RuntimeException ) -+{ -+ // we never close :o) -+} -+ -+ -+Any SequenceResultSet::getValue( sal_Int32 columnIndex ) -+{ -+ m_wasNull = ! m_data[m_row][columnIndex -1 ].hasValue(); -+ return m_data[m_row][columnIndex -1 ]; -+} -+ -+SequenceResultSet::SequenceResultSet( -+ const ::rtl::Reference< RefCountedMutex > & mutex, -+ const com::sun::star::uno::Reference< com::sun::star::uno::XInterface > &owner, -+ const Sequence< OUString > &colNames, -+ const Sequence< Sequence< Any > > &data, -+ const Reference< com::sun::star::script::XTypeConverter > & tc, -+ const ColumnMetaDataVector *pVec) : -+ BaseResultSet( mutex, owner, data.getLength(), colNames.getLength(),tc ), -+ m_data(data ), -+ m_columnNames( colNames ) -+{ -+ if( pVec ) -+ { -+ m_meta = new SequenceResultSetMetaData( mutex, *pVec, m_columnNames.getLength() ); -+ } -+} -+ -+SequenceResultSet::~SequenceResultSet() -+{ -+ -+} -+ -+void SequenceResultSet::close( ) -+ throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) -+{ -+ // a noop -+} -+ -+Reference< XResultSetMetaData > SAL_CALL SequenceResultSet::getMetaData( ) -+ throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) -+{ -+ if( ! m_meta.is() ) -+ { -+ // Oh no, not again -+ throw ::com::sun::star::sdbc::SQLException( -+ ASCII_STR( "pq_sequenceresultset: no meta supported " ), *this, -+ OUString(), 1, Any() ); -+ } -+ return m_meta; -+} -+ -+ -+sal_Int32 SAL_CALL SequenceResultSet::findColumn( -+ const ::rtl::OUString& columnName ) -+ throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) -+{ -+ // no need to guard, as all members are readonly ! -+ sal_Int32 ret = -1; -+ for( int i = 0 ;i < m_fieldCount ; i ++ ) -+ { -+ if( columnName == m_columnNames[i] ) -+ { -+ ret = i+1; -+ break; -+ } -+ } -+ return ret; -+} -+} -diff --git connectivity/source/drivers/postgresql/pq_sequenceresultset.hxx connectivity/source/drivers/postgresql/pq_sequenceresultset.hxx -new file mode 100644 -index 0000000..5eb5402 ---- /dev/null -+++ connectivity/source/drivers/postgresql/pq_sequenceresultset.hxx -@@ -0,0 +1,130 @@ -+/************************************************************************* -+ * -+ * $RCSfile: pq_sequenceresultset.hxx,v $ -+ * -+ * $Revision: 1.1.2.3 $ -+ * -+ * last change: $Author: jbu $ $Date: 2006/01/22 15:14:32 $ -+ * -+ * The Contents of this file are made available subject to the terms of -+ * either of the following licenses -+ * -+ * - GNU Lesser General Public License Version 2.1 -+ * - Sun Industry Standards Source License Version 1.1 -+ * -+ * Sun Microsystems Inc., October, 2000 -+ * -+ * GNU Lesser General Public License Version 2.1 -+ * ============================================= -+ * Copyright 2000 by Sun Microsystems, Inc. -+ * 901 San Antonio Road, Palo Alto, CA 94303, USA -+ * -+ * This library is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License version 2.1, as published by the Free Software Foundation. -+ * -+ * This library is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public -+ * License along with this library; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, -+ * MA 02111-1307 USA -+ * -+ * -+ * Sun Industry Standards Source License Version 1.1 -+ * ================================================= -+ * The contents of this file are subject to the Sun Industry Standards -+ * Source License Version 1.1 (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.openoffice.org/license.html. -+ * -+ * Software provided under this License is provided on an "AS IS" basis, -+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, -+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, -+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. -+ * See the License for the specific provisions governing your rights and -+ * obligations concerning the Software. -+ * -+ * The Initial Developer of the Original Code is: Joerg Budischewski -+ * -+ * Copyright: 2000 by Sun Microsystems, Inc. -+ * -+ * All Rights Reserved. -+ * -+ * Contributor(s): Joerg Budischewski -+ * -+ * -+ ************************************************************************/ -+#ifndef _PG_SEQUENCERESULTSET_HXX_ -+#define _PG_SEQUENCERESULTSET_HXX_ -+ -+#include -+#include -+ -+#include -+#include -+#include -+#include -+#include "pq_connection.hxx" -+#include "pq_baseresultset.hxx" -+#include "pq_statics.hxx" -+ -+namespace pq_sdbc_driver -+{ -+ -+// static const sal_Int32 RESULTSET_CURSOR_NAME = 0; -+// static const sal_Int32 RESULTSET_ESCAPE_PROCESSING = 1; -+// static const sal_Int32 RESULTSET_FETCH_DIRECTION = 2; -+// static const sal_Int32 RESULTSET_FETCH_SIZE = 3; -+// static const sal_Int32 RESULTSET_RESULT_SET_CONCURRENCY = 4; -+// static const sal_Int32 RESULTSET_RESULT_SET_TYPE = 5; -+ -+//#define RESULTSET_SIZE 6 -+class ResultSetGuard; -+ -+class SequenceResultSet : public BaseResultSet -+{ -+protected: -+ ::com::sun::star::uno::Sequence< com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > > m_data; -+ -+ ::com::sun::star::uno::Sequence< ::rtl::OUString > m_columnNames; -+ ::com::sun::star::uno::Reference< com::sun::star::sdbc::XResultSetMetaData > m_meta; -+ -+protected: -+ /** mutex should be locked before called -+ */ -+ virtual void checkClosed() -+ throw ( com::sun::star::sdbc::SQLException, com::sun::star::uno::RuntimeException ); -+ -+ /** unchecked, acquire mutex before calling -+ */ -+ virtual ::com::sun::star::uno::Any getValue( sal_Int32 columnIndex ); -+ -+public: -+ SequenceResultSet( -+ const ::rtl::Reference< RefCountedMutex > & mutex, -+ const com::sun::star::uno::Reference< com::sun::star::uno::XInterface > &owner, -+ const com::sun::star::uno::Sequence< rtl::OUString > &colNames, -+ const com::sun::star::uno::Sequence< com::sun::star::uno::Sequence< com::sun::star::uno::Any > > &data, -+ const com::sun::star::uno::Reference< com::sun::star::script::XTypeConverter > &tc, -+ const ColumnMetaDataVector *pVec = 0); -+ ~SequenceResultSet(); -+ -+public: // XCloseable -+ virtual void SAL_CALL close( ) -+ throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ -+public: // XResultSetMetaDataSupplier -+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData > SAL_CALL getMetaData( ) -+ throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ -+public: // XColumnLocate -+ virtual sal_Int32 SAL_CALL findColumn( const ::rtl::OUString& columnName ) -+ throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+}; -+ -+} -+#endif -diff --git connectivity/source/drivers/postgresql/pq_sequenceresultsetmetadata.cxx connectivity/source/drivers/postgresql/pq_sequenceresultsetmetadata.cxx -new file mode 100644 -index 0000000..d94a3be ---- /dev/null -+++ connectivity/source/drivers/postgresql/pq_sequenceresultsetmetadata.cxx -@@ -0,0 +1,182 @@ -+#include "pq_sequenceresultsetmetadata.hxx" -+ -+#include -+ -+using rtl::OUStringBuffer; -+using rtl::OUString; -+using com::sun::star::uno::Any; -+ -+using com::sun::star::uno::RuntimeException; -+ -+using com::sun::star::sdbc::SQLException; -+ -+namespace pq_sdbc_driver -+{ -+ -+SequenceResultSetMetaData::SequenceResultSetMetaData( -+ const ::rtl::Reference< RefCountedMutex > & refMutex, -+ const ColumnMetaDataVector &metaDataVector, -+ int colCount ) : -+ m_refMutex( refMutex ), -+ m_colCount( colCount ), -+ m_columnData( metaDataVector ) -+{ -+} -+ -+ -+// Methods -+sal_Int32 SequenceResultSetMetaData::getColumnCount( ) -+ throw (SQLException, RuntimeException) -+{ -+ return m_colCount; -+} -+ -+sal_Bool SequenceResultSetMetaData::isAutoIncrement( sal_Int32 column ) -+ throw (SQLException, RuntimeException) -+{ -+ checkColumnIndex( column ); -+ return m_columnData[column-1].isAutoIncrement; -+} -+ -+sal_Bool SequenceResultSetMetaData::isCaseSensitive( sal_Int32 column ) -+ throw (SQLException, RuntimeException) -+{ -+ -+ return sal_True; // ??? hmm, numeric types or -+} -+ -+sal_Bool SequenceResultSetMetaData::isSearchable( sal_Int32 column ) throw (SQLException, RuntimeException) -+{ -+ return sal_True; // mmm, what types are not searchable ? -+} -+ -+sal_Bool SequenceResultSetMetaData::isCurrency( sal_Int32 column ) throw (SQLException, RuntimeException) -+{ -+ checkColumnIndex( column ); -+ return m_columnData[column-1].isCurrency; -+} -+ -+sal_Int32 SequenceResultSetMetaData::isNullable( sal_Int32 column ) -+ throw (SQLException, RuntimeException) -+{ -+ checkColumnIndex( column ); -+ return m_columnData[column-1].isNullable; -+} -+ -+sal_Bool SequenceResultSetMetaData::isSigned( sal_Int32 column ) -+ throw (SQLException, RuntimeException) -+{ -+ return sal_True; // -+} -+ -+sal_Int32 SequenceResultSetMetaData::getColumnDisplaySize( sal_Int32 column ) -+ throw (SQLException, RuntimeException) -+{ -+ return 50; -+} -+ -+::rtl::OUString SequenceResultSetMetaData::getColumnLabel( sal_Int32 column ) -+ throw (SQLException, RuntimeException) -+{ -+ checkColumnIndex( column ); -+ return m_columnData[column-1].columnName; -+} -+ -+::rtl::OUString SequenceResultSetMetaData::getColumnName( sal_Int32 column ) throw (SQLException, RuntimeException) -+{ -+ checkColumnIndex( column ); -+ return m_columnData[column-1].columnName; -+} -+ -+::rtl::OUString SequenceResultSetMetaData::getSchemaName( sal_Int32 column ) throw (SQLException, RuntimeException) -+{ -+ checkColumnIndex( column ); -+ return m_columnData[column-1].schemaTableName; -+} -+ -+ -+ -+sal_Int32 SequenceResultSetMetaData::getPrecision( sal_Int32 column ) -+ throw (SQLException, RuntimeException) -+{ -+ checkColumnIndex( column ); -+ return m_columnData[column-1].precision; -+} -+ -+sal_Int32 SequenceResultSetMetaData::getScale( sal_Int32 column ) -+ throw (SQLException, RuntimeException) -+{ -+ checkColumnIndex( column ); -+ return m_columnData[column-1].scale; -+} -+ -+::rtl::OUString SequenceResultSetMetaData::getTableName( sal_Int32 column ) -+ throw (SQLException, RuntimeException) -+{ -+ checkColumnIndex( column ); -+ return m_columnData[column-1].tableName; -+} -+ -+::rtl::OUString SequenceResultSetMetaData::getCatalogName( sal_Int32 column ) -+ throw (SQLException, RuntimeException) -+{ -+ // can do this through XConnection.getCatalog() ! -+ return OUString(); -+} -+sal_Int32 SequenceResultSetMetaData::getColumnType( sal_Int32 column ) -+ throw (SQLException, RuntimeException) -+{ -+ checkColumnIndex( column ); -+ return m_columnData[column-1].type; -+} -+ -+::rtl::OUString SequenceResultSetMetaData::getColumnTypeName( sal_Int32 column ) -+ throw (SQLException, RuntimeException) -+{ -+ checkColumnIndex( column ); -+ return m_columnData[column-1].typeName; -+} -+ -+ -+sal_Bool SequenceResultSetMetaData::isReadOnly( sal_Int32 column ) -+ throw (SQLException, RuntimeException) -+{ -+ return sal_False; -+} -+ -+sal_Bool SequenceResultSetMetaData::isWritable( sal_Int32 column ) -+ throw (SQLException, RuntimeException) -+{ -+ return ! isReadOnly( column ); // what's the sense if this method ? -+} -+ -+sal_Bool SequenceResultSetMetaData::isDefinitelyWritable( sal_Int32 column ) -+ throw (SQLException, RuntimeException) -+{ -+ return isWritable(column); // uhh, now it becomes really esoteric .... -+} -+::rtl::OUString SequenceResultSetMetaData::getColumnServiceName( sal_Int32 column ) -+ throw (SQLException, RuntimeException) -+{ -+ return OUString(); -+} -+ -+ -+void SequenceResultSetMetaData::checkColumnIndex(sal_Int32 columnIndex) -+ throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) -+{ -+ if( columnIndex < 1 || columnIndex > m_colCount ) -+ { -+ OUStringBuffer buf(128); -+ -+ buf.appendAscii( "pq_sequenceresultsetmetadata: index out of range (expected 1 to " ); -+ buf.append( m_colCount ); -+ buf.appendAscii( ", got " ); -+ buf.append( columnIndex ); -+ throw SQLException( -+ buf.makeStringAndClear(), *this, OUString(), 1, Any() ); -+ } -+} -+ -+ -+} -diff --git connectivity/source/drivers/postgresql/pq_sequenceresultsetmetadata.hxx connectivity/source/drivers/postgresql/pq_sequenceresultsetmetadata.hxx -new file mode 100644 -index 0000000..533863c ---- /dev/null -+++ connectivity/source/drivers/postgresql/pq_sequenceresultsetmetadata.hxx -@@ -0,0 +1,53 @@ -+#include -+#include -+ -+#include "pq_connection.hxx" -+#include "pq_statics.hxx" -+ -+namespace pq_sdbc_driver -+{ -+ class SequenceResultSetMetaData : -+ public ::cppu::WeakImplHelper1 < com::sun::star::sdbc::XResultSetMetaData > -+ { -+ ::rtl::Reference< RefCountedMutex > m_refMutex; -+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > m_origin; -+ ::rtl::OUString m_tableName; -+ ::rtl::OUString m_schemaName; -+ ColumnMetaDataVector m_columnData; -+ sal_Int32 m_colCount; -+ -+ void checkColumnIndex( sal_Int32 columnIndex ) -+ throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ -+ public: -+ SequenceResultSetMetaData( -+ const ::rtl::Reference< RefCountedMutex > & reMutex, -+ const ColumnMetaDataVector &vec, -+ int colCount ); -+ -+ public: -+ // Methods -+ virtual sal_Int32 SAL_CALL getColumnCount( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Bool SAL_CALL isAutoIncrement( sal_Int32 column ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Bool SAL_CALL isCaseSensitive( sal_Int32 column ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Bool SAL_CALL isSearchable( sal_Int32 column ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Bool SAL_CALL isCurrency( sal_Int32 column ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Int32 SAL_CALL isNullable( sal_Int32 column ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Bool SAL_CALL isSigned( sal_Int32 column ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Int32 SAL_CALL getColumnDisplaySize( sal_Int32 column ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual ::rtl::OUString SAL_CALL getColumnLabel( sal_Int32 column ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual ::rtl::OUString SAL_CALL getColumnName( sal_Int32 column ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual ::rtl::OUString SAL_CALL getSchemaName( sal_Int32 column ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Int32 SAL_CALL getPrecision( sal_Int32 column ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Int32 SAL_CALL getScale( sal_Int32 column ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual ::rtl::OUString SAL_CALL getTableName( sal_Int32 column ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual ::rtl::OUString SAL_CALL getCatalogName( sal_Int32 column ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Int32 SAL_CALL getColumnType( sal_Int32 column ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual ::rtl::OUString SAL_CALL getColumnTypeName( sal_Int32 column ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Bool SAL_CALL isReadOnly( sal_Int32 column ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Bool SAL_CALL isWritable( sal_Int32 column ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Bool SAL_CALL isDefinitelyWritable( sal_Int32 column ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual ::rtl::OUString SAL_CALL getColumnServiceName( sal_Int32 column ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ }; -+ -+} -diff --git connectivity/source/drivers/postgresql/pq_statement.cxx connectivity/source/drivers/postgresql/pq_statement.cxx -new file mode 100644 -index 0000000..b60edfc ---- /dev/null -+++ connectivity/source/drivers/postgresql/pq_statement.cxx -@@ -0,0 +1,1063 @@ -+/************************************************************************* -+ * -+ * $RCSfile: pq_statement.cxx,v $ -+ * -+ * $Revision: 1.1.2.7 $ -+ * -+ * last change: $Author: jbu $ $Date: 2007/08/26 20:40:40 $ -+ * -+ * The Contents of this file are made available subject to the terms of -+ * either of the following licenses -+ * -+ * - GNU Lesser General Public License Version 2.1 -+ * - Sun Industry Standards Source License Version 1.1 -+ * -+ * Sun Microsystems Inc., October, 2000 -+ * -+ * GNU Lesser General Public License Version 2.1 -+ * ============================================= -+ * Copyright 2000 by Sun Microsystems, Inc. -+ * 901 San Antonio Road, Palo Alto, CA 94303, USA -+ * -+ * This library is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License version 2.1, as published by the Free Software Foundation. -+ * -+ * This library is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public -+ * License along with this library; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, -+ * MA 02111-1307 USA -+ * -+ * -+ * Sun Industry Standards Source License Version 1.1 -+ * ================================================= -+ * The contents of this file are subject to the Sun Industry Standards -+ * Source License Version 1.1 (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.openoffice.org/license.html. -+ * -+ * Software provided under this License is provided on an "AS IS" basis, -+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, -+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, -+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. -+ * See the License for the specific provisions governing your rights and -+ * obligations concerning the Software. -+ * -+ * The Initial Developer of the Original Code is: Joerg Budischewski -+ * -+ * Copyright: 2000 by Sun Microsystems, Inc. -+ * -+ * All Rights Reserved. -+ * -+ * Contributor(s): Joerg Budischewski -+ * -+ * -+ ************************************************************************/ -+#include "pq_statement.hxx" -+#include "pq_fakedupdateableresultset.hxx" -+#include "pq_updateableresultset.hxx" -+#include "pq_tools.hxx" -+#include "pq_statics.hxx" -+ -+#include -+#include -+ -+#include -+#include -+ -+#include -+#include -+ -+#include -+ -+#include -+#include -+#include -+ -+#include -+#include -+#include -+ -+#include -+#include -+ -+ -+using osl::Mutex; -+using osl::MutexGuard; -+ -+using rtl::OUString; -+using rtl::OUStringBuffer; -+using rtl::OUStringToOString; -+using rtl::OStringToOUString; -+using rtl::OString; -+ -+using com::sun::star::uno::Any; -+using com::sun::star::uno::makeAny; -+using com::sun::star::uno::Type; -+using com::sun::star::uno::RuntimeException; -+using com::sun::star::uno::Exception; -+using com::sun::star::uno::Sequence; -+using com::sun::star::uno::Reference; -+using com::sun::star::uno::XInterface; -+using com::sun::star::uno::UNO_QUERY; -+ -+using com::sun::star::lang::IllegalArgumentException; -+ -+using com::sun::star::sdbc::XWarningsSupplier; -+using com::sun::star::sdbc::XCloseable; -+using com::sun::star::sdbc::XStatement; -+using com::sun::star::sdbc::XPreparedStatement; -+using com::sun::star::sdbc::XParameters; -+using com::sun::star::sdbc::XRow; -+using com::sun::star::sdbc::XResultSet; -+using com::sun::star::sdbc::XGeneratedResultSet; -+using com::sun::star::sdbc::XConnection; -+using com::sun::star::sdbc::SQLException; -+ -+using com::sun::star::sdbcx::XColumnsSupplier; -+using com::sun::star::sdbcx::XTablesSupplier; -+using com::sun::star::sdbcx::XKeysSupplier; -+ -+using com::sun::star::beans::Property; -+using com::sun::star::beans::XPropertySetInfo; -+using com::sun::star::beans::XPropertySet; -+using com::sun::star::beans::XFastPropertySet; -+using com::sun::star::beans::XMultiPropertySet; -+ -+using com::sun::star::container::XNameAccess; -+using com::sun::star::container::XEnumerationAccess; -+using com::sun::star::container::XEnumeration; -+using com::sun::star::container::XIndexAccess; -+ -+#define ASCII_STR(x) OUString( RTL_CONSTASCII_USTRINGPARAM( x ) ) -+namespace pq_sdbc_driver -+{ -+static ::cppu::IPropertyArrayHelper & getStatementPropertyArrayHelper() -+{ -+ static ::cppu::IPropertyArrayHelper *pArrayHelper; -+ if( ! pArrayHelper ) -+ { -+ MutexGuard guard( Mutex::getGlobalMutex() ); -+ if( ! pArrayHelper ) -+ { -+ static Property aTable[] = -+ { -+ Property( -+ OUString( RTL_CONSTASCII_USTRINGPARAM("CursorName") ), 0, -+ ::getCppuType( (OUString *)0) , 0 ), -+ Property( -+ OUString( RTL_CONSTASCII_USTRINGPARAM("EscapeProcessing") ), 1, -+ ::getBooleanCppuType() , 0 ), -+ Property( -+ OUString( RTL_CONSTASCII_USTRINGPARAM("FetchDirection") ), 2, -+ ::getCppuType( (sal_Int32 *)0) , 0 ), -+ Property( -+ OUString( RTL_CONSTASCII_USTRINGPARAM("FetchSize") ), 3, -+ ::getCppuType( (sal_Int32 *)0) , 0 ), -+ Property( -+ OUString( RTL_CONSTASCII_USTRINGPARAM("MaxFieldSize") ), 4, -+ ::getCppuType( (sal_Int32 *)0) , 0 ), -+ Property( -+ OUString( RTL_CONSTASCII_USTRINGPARAM("MaxRows") ), 5, -+ ::getCppuType( (sal_Int32 *)0) , 0 ), -+ Property( -+ OUString( RTL_CONSTASCII_USTRINGPARAM("QueryTimeOut") ), 6, -+ ::getCppuType( (sal_Int32 *)0) , 0 ), -+ Property( -+ OUString( RTL_CONSTASCII_USTRINGPARAM("ResultSetConcurrency") ), 7, -+ ::getCppuType( (sal_Int32 *)0) , 0 ), -+ Property( -+ OUString( RTL_CONSTASCII_USTRINGPARAM("ResultSetType") ), 8, -+ ::getCppuType( (sal_Int32 *)0) , 0 ) -+ }; -+ OSL_ASSERT( sizeof(aTable)/ sizeof(Property) == STATEMENT_SIZE ); -+ static ::cppu::OPropertyArrayHelper arrayHelper( aTable, STATEMENT_SIZE, sal_True ); -+ pArrayHelper = &arrayHelper; -+ } -+ } -+ return *pArrayHelper; -+} -+ -+Statement::Statement( const ::rtl::Reference< RefCountedMutex > & refMutex, -+ const Reference< XConnection > & conn, -+ struct ConnectionSettings *pSettings ) -+ : OComponentHelper( refMutex->mutex ), -+ OPropertySetHelper( OComponentHelper::rBHelper ), -+ m_refMutex( refMutex ), -+ m_connection( conn ), -+ m_pSettings( pSettings ), -+ m_lastOidInserted( InvalidOid ) -+{ -+ m_props[STATEMENT_QUERY_TIME_OUT] = makeAny( (sal_Int32)0 ); -+ m_props[STATEMENT_MAX_ROWS] = makeAny( (sal_Int32)0 ); -+ m_props[STATEMENT_RESULT_SET_CONCURRENCY] = makeAny( -+ com::sun::star::sdbc::ResultSetConcurrency::READ_ONLY ); -+ m_props[STATEMENT_RESULT_SET_TYPE] = makeAny( -+ com::sun::star::sdbc::ResultSetType::SCROLL_INSENSITIVE ); -+} -+ -+Statement::~Statement() -+{ -+ POSTGRE_TRACE( "dtor Statement" ); -+} -+ -+void Statement::checkClosed() throw (SQLException, RuntimeException ) -+{ -+ if( ! m_pSettings || ! m_pSettings->pConnection ) -+ throw SQLException( -+ ASCII_STR("pq_driver: Statement or connection has already been closed !" ), -+ *this, OUString(),1,Any()); -+} -+ -+Any Statement::queryInterface( const Type & reqType ) throw (RuntimeException) -+{ -+ Any ret; -+ -+ ret = OComponentHelper::queryInterface( reqType ); -+ if( ! ret.hasValue() ) -+ ret = ::cppu::queryInterface( reqType, -+ static_cast< XWarningsSupplier * > ( this ), -+ static_cast< XStatement * > ( this ), -+ static_cast< com::sun::star::sdbc::XResultSetMetaDataSupplier * > ( this ), -+ static_cast< XCloseable * > ( this ), -+ static_cast< XPropertySet * > ( this ), -+ static_cast< XMultiPropertySet * > ( this ), -+ static_cast< XGeneratedResultSet * > ( this ), -+ static_cast< XFastPropertySet * > ( this ) ); -+ return ret; -+} -+ -+ -+Sequence< Type > Statement::getTypes() throw ( RuntimeException ) -+{ -+ static cppu::OTypeCollection *pCollection; -+ if( ! pCollection ) -+ { -+ MutexGuard guard( osl::Mutex::getGlobalMutex() ); -+ if( !pCollection ) -+ { -+ static cppu::OTypeCollection collection( -+ getCppuType( (Reference< XWarningsSupplier> *) 0 ), -+ getCppuType( (Reference< XStatement> *) 0 ), -+ getCppuType( (Reference< com::sun::star::sdbc::XResultSetMetaDataSupplier> *) 0 ), -+ getCppuType( (Reference< XCloseable> *) 0 ), -+ getCppuType( (Reference< XPropertySet >*) 0 ), -+ getCppuType( (Reference< XFastPropertySet > *) 0 ), -+ getCppuType( (Reference< XMultiPropertySet > *) 0 ), -+ getCppuType( (Reference< XGeneratedResultSet > *) 0 ), -+ OComponentHelper::getTypes()); -+ pCollection = &collection; -+ } -+ } -+ return pCollection->getTypes(); -+} -+ -+Sequence< sal_Int8> Statement::getImplementationId() throw ( RuntimeException ) -+{ -+ static cppu::OImplementationId *pId; -+ if( ! pId ) -+ { -+ MutexGuard guard( osl::Mutex::getGlobalMutex() ); -+ if( ! pId ) -+ { -+ static cppu::OImplementationId id(sal_False); -+ pId = &id; -+ } -+ } -+ return pId->getImplementationId(); -+} -+ -+void Statement::close( ) throw (SQLException, RuntimeException) -+{ -+ // let the connection die without acquired mutex ! -+ Reference< XConnection > r; -+ Reference< XCloseable > resultSet; -+ { -+ MutexGuard guard( m_refMutex->mutex ); -+ m_pSettings = 0; -+ r = m_connection; -+ m_connection.clear(); -+ -+ resultSet = m_lastResultset; -+ m_lastResultset.clear(); -+ } -+ if( resultSet.is() ) -+ { -+ resultSet->close(); -+ POSTGRE_TRACE( "statement closed" ); -+ } -+ -+} -+ -+void Statement::raiseSQLException( -+ const OUString & sql, const char * errorMsg, const char *errorType ) -+ throw( SQLException ) -+{ -+ OUStringBuffer buf(128); -+ buf.appendAscii( "pq_driver: "); -+ if( errorType ) -+ { -+ buf.appendAscii( "[" ); -+ buf.appendAscii( errorType ); -+ buf.appendAscii( "]" ); -+ } -+ buf.append( -+ rtl::OUString( errorMsg, strlen(errorMsg) , m_pSettings->encoding ) ); -+ buf.appendAscii( " (caused by statement '" ); -+ buf.append( sql ); -+ buf.appendAscii( "')" ); -+ OUString error = buf.makeStringAndClear(); -+ log( m_pSettings, LogLevel::ERROR, error ); -+ throw SQLException( error, *this, OUString(), 1, Any() ); -+} -+ -+Reference< XResultSet > Statement::executeQuery(const OUString& sql ) -+ throw (SQLException, RuntimeException) -+{ -+ Reference< XCloseable > lastResultSetHolder = m_lastResultset; -+ if( lastResultSetHolder.is() ) -+ lastResultSetHolder->close(); -+ -+ if( ! execute( sql ) ) -+ { -+ raiseSQLException( sql, "not a query" ); -+ } -+ return Reference< XResultSet > ( m_lastResultset, com::sun::star::uno::UNO_QUERY ); -+} -+ -+sal_Int32 Statement::executeUpdate( const OUString& sql ) -+ throw (SQLException, RuntimeException) -+{ -+ if( execute( sql ) ) -+ { -+ raiseSQLException( sql, "not a command" ); -+ } -+ return m_multipleResultUpdateCount; -+} -+ -+ -+static void raiseSQLException( -+ ConnectionSettings *pSettings, -+ const Reference< XInterface> & owner, -+ const OString & sql, -+ const char * errorMsg, -+ const char *errorType = 0 ) -+ throw( SQLException ) -+{ -+ OUStringBuffer buf(128); -+ buf.appendAscii( "pq_driver: "); -+ if( errorType ) -+ { -+ buf.appendAscii( "[" ); -+ buf.appendAscii( errorType ); -+ buf.appendAscii( "]" ); -+ } -+ buf.append( -+ rtl::OUString( errorMsg, strlen(errorMsg) , pSettings->encoding ) ); -+ buf.appendAscii( " (caused by statement '" ); -+ buf.append( rtl::OStringToOUString( sql, pSettings->encoding ) ); -+ buf.appendAscii( "')" ); -+ OUString error = buf.makeStringAndClear(); -+ log( pSettings, LogLevel::ERROR, error ); -+ throw SQLException( error, owner, OUString(), 1, Any() ); -+} -+ -+ -+// returns the elements of the primary key of the given table -+// static Sequence< Reference< com::sun::star::beans::XPropertySet > > lookupKeys( -+static Sequence< ::rtl::OUString > lookupKeys( -+ const Reference< com::sun::star::container::XNameAccess > &tables, -+ const OUString & table, -+ OUString *pSchema, -+ OUString *pTable, -+ ConnectionSettings *pSettings) -+{ -+ Sequence< ::rtl::OUString > ret; -+ Reference< XKeysSupplier > keySupplier; -+ Statics & st = getStatics(); -+ -+ if( tables->hasByName( table ) ) -+ tables->getByName( table ) >>= keySupplier; -+ else if( -1 == table.indexOf( '.' ) ) -+ { -+ // it wasn't a fully qualified name. Now need to skip through all tables. -+ Reference< XEnumerationAccess > enumerationAccess = -+ Reference< XEnumerationAccess > ( tables, UNO_QUERY ); -+ -+ Reference< com::sun::star::container::XEnumeration > enumeration = -+ enumerationAccess->createEnumeration(); -+ while( enumeration->hasMoreElements() ) -+ { -+ Reference< XPropertySet > set; -+ enumeration->nextElement() >>= set; -+ OUString name; -+// ::rtl::OUString schema; -+ -+ if( set->getPropertyValue( st.NAME ) >>= name ) -+ { -+// printf( "searching %s %s\n", -+// OUStringToOString( schema, RTL_TEXTENCODING_ASCII_US ).getStr(), -+// OUStringToOString( name, RTL_TEXTENCODING_ASCII_US ).getStr() ); -+ if( name == table ) -+ { -+ -+ if( keySupplier.is() ) -+ { -+ // is ambigous, as I don't know postgresql searchpath, -+ // I can't continue here, as I may write to a different table -+ keySupplier.clear(); -+ if( isLog( pSettings, LogLevel::INFO ) ) -+ { -+ rtl::OStringBuffer buf( 128 ); -+ buf.append( "Can't offer updateable result set because table " ); -+ buf.append( OUStringToOString(name, pSettings->encoding) ); -+ buf.append( " is duplicated, add schema to resolve ambiguity" ); -+ log( pSettings, LogLevel::INFO, buf.makeStringAndClear().getStr() ); -+ } -+ break; -+ } -+ keySupplier = Reference< XKeysSupplier > ( set, UNO_QUERY ); -+ } -+ } -+ } -+ } -+ else -+ { -+ if( isLog( pSettings, LogLevel::INFO ) ) -+ { -+ rtl::OStringBuffer buf( 128 ); -+ buf.append( "Can't offer updateable result set ( table " ); -+ buf.append( OUStringToOString(table, pSettings->encoding) ); -+ buf.append( " is unknown)" ); -+ log( pSettings, LogLevel::INFO, buf.makeStringAndClear().getStr() ); -+ } -+ } -+ -+ if( keySupplier.is() ) -+ { -+ Reference< XPropertySet > set( keySupplier, UNO_QUERY ); -+ set->getPropertyValue( getStatics().NAME ) >>= (*pTable); -+ set->getPropertyValue( getStatics().SCHEMA_NAME ) >>= (*pSchema ); -+ set.clear(); -+ -+ Reference< XEnumerationAccess > keys ( keySupplier->getKeys(), UNO_QUERY ); -+ Reference< XEnumeration > enumeration = keys->createEnumeration(); -+ while( enumeration->hasMoreElements() ) -+ { -+ enumeration->nextElement() >>= set; -+ sal_Int32 keyType; -+ if( (set->getPropertyValue( st.TYPE ) >>= keyType ) && -+ keyType == com::sun::star::sdbcx::KeyType::PRIMARY ) -+ { -+ Reference< XColumnsSupplier > columns( set, UNO_QUERY ); -+ Reference< XIndexAccess > indexAccess = -+ Reference< XIndexAccess > ( columns->getColumns(), UNO_QUERY ); -+ -+ int length = indexAccess->getCount(); -+ ret.realloc( length ); -+// printf( "primary key for Table %s is ", -+// OUStringToOString( table, RTL_TEXTENCODING_ASCII_US ).getStr() ); -+ for( int i = 0 ; i < length ; i ++ ) -+ { -+ indexAccess->getByIndex( i ) >>= set; -+ OUString name; -+ set->getPropertyValue( st.NAME ) >>= name; -+ ret[i] = name; -+// printf( "%s," , OUStringToOString( name, RTL_TEXTENCODING_ASCII_US ).getStr() ); -+ } -+// printf( "\n" ); -+ } -+ } -+ if( ! ret.getLength() ) -+ { -+ if( isLog( pSettings, LogLevel::INFO ) ) -+ { -+ rtl::OStringBuffer buf( 128 ); -+ buf.append( "Can't offer updateable result set ( table " ); -+ buf.append( OUStringToOString(table, pSettings->encoding) ); -+ buf.append( " does not have a primary key)" ); -+ log( pSettings, LogLevel::INFO, buf.makeStringAndClear().getStr() ); -+ } -+ } -+ } -+ return ret; -+} -+ -+bool executePostgresCommand( const rtl::OString & cmd, struct CommandData *data ) -+{ -+ ConnectionSettings *pSettings = *(data->ppSettings); -+ -+ sal_Int32 duration = osl_getGlobalTimer(); -+ PGresult *result = PQexec( pSettings->pConnection, cmd.getStr() ); -+ duration = osl_getGlobalTimer() - duration; -+ if( ! result ) -+ raiseSQLException( -+ pSettings, data->owner, cmd, PQerrorMessage( pSettings->pConnection ) ); -+ -+ ExecStatusType state = PQresultStatus( result ); -+ *(data->pLastOidInserted) = 0; -+ *(data->pLastTableInserted) = rtl::OUString(); -+ *(data->pLastQuery) = cmd; -+ -+ sal_Bool ret = sal_False; -+ switch( state ) -+ { -+ case PGRES_COMMAND_OK: -+ { -+ *(data->pMultipleResultUpdateCount) = atoi( PQcmdTuples( result ) ); -+ *(data->pMultipleResultAvailable) = sal_False; -+ -+ // in case an oid value is available, we retrieve it -+ *(data->pLastOidInserted) = PQoidValue( result ); -+ -+ // in case it was a single insert, extract the name of the table, -+ // otherwise the table name is empty -+ *(data->pLastTableInserted) = -+ extractTableFromInsert( OStringToOUString( cmd, pSettings->encoding ) ); -+ if( isLog( pSettings, LogLevel::SQL ) ) -+ { -+ rtl::OStringBuffer buf( 128 ); -+ buf.append( "executed command '" ); -+ buf.append( cmd.getStr() ); -+ buf.append( "' sucessfully (" ); -+ buf.append( *( data->pMultipleResultUpdateCount ) ); -+ buf.append( ")" ); -+ buf.append( ", duration=" ); -+ buf.append( duration ); -+ buf.append( "ms" ); -+ if( *(data->pLastOidInserted) ) -+ { -+ buf.append( ", usedOid=" ); -+ buf.append( *(data->pLastOidInserted) , 10 ); -+ buf.append( ", diagnosedTable=" ); -+ buf.append( -+ OUStringToOString( *data->pLastTableInserted, pSettings->encoding ) ); -+ } -+ log( pSettings, LogLevel::SQL, buf.makeStringAndClear().getStr() ); -+ } -+ PQclear( result ); -+ break; -+ } -+ case PGRES_TUPLES_OK: // success -+ { -+ // In case it is a single table, it has a primary key and all columns -+ // belonging to the primary key are in the result set, allow updateable result sets -+ // otherwise, don't -+ rtl::OUString table, schema; -+ Sequence< OUString > sourceTableKeys; -+ OStringVector vec; -+ tokenizeSQL( cmd, vec ); -+ OUString sourceTable = -+ OStringToOUString( -+ extractSingleTableFromSelect( vec ), pSettings->encoding ); -+ -+ if( data->concurrency == -+ com::sun::star::sdbc::ResultSetConcurrency::UPDATABLE ) -+ { -+ OString aReason; -+ if( sourceTable.getLength() ) -+ { -+ sourceTableKeys = lookupKeys( -+ pSettings->tables.is() ? -+ pSettings->tables : data->tableSupplier->getTables() , -+ sourceTable, -+ &schema, -+ &table, -+ pSettings); -+ -+ // check, whether the columns are in the result set (required !) -+ int i; -+ for( i = 0 ; i < sourceTableKeys.getLength() ; i ++ ) -+ { -+ if( -1 == PQfnumber( -+ result, -+ OUStringToOString( sourceTableKeys[i] , -+ pSettings->encoding ).getStr()) ) -+ { -+ break; -+ } -+ } -+ -+ if( sourceTableKeys.getLength() && i == sourceTableKeys.getLength() ) -+ { -+ *(data->pLastResultset) = -+ UpdateableResultSet::createFromPGResultSet( -+ data->refMutex, data->owner, data->ppSettings, result, -+ schema, table,sourceTableKeys ); -+ } -+ else if( ! table.getLength() ) -+ { -+ rtl::OStringBuffer buf( 128 ); -+ buf.append( -+ RTL_CONSTASCII_STRINGPARAM( -+ "can't support updateable resultset, because a single table in the " -+ "WHERE part of the statement could not be identified (" ) ); -+ buf.append( cmd ); -+ buf.append( RTL_CONSTASCII_STRINGPARAM( "." ) ); -+ aReason = buf.makeStringAndClear(); -+ } -+ else if( sourceTableKeys.getLength() ) -+ { -+ ::rtl::OStringBuffer buf( 128 ); -+ buf.append( -+ RTL_CONSTASCII_STRINGPARAM( -+ "can't support updateable resultset for table " ) ); -+ buf.append( rtl::OUStringToOString( schema, pSettings->encoding ) ); -+ buf.append( RTL_CONSTASCII_STRINGPARAM( "." ) ); -+ buf.append( rtl::OUStringToOString( table, pSettings->encoding ) ); -+ buf.append( RTL_CONSTASCII_STRINGPARAM( ", because resultset does not contain a part of the primary key ( column " ) ); -+ buf.append( rtl::OUStringToOString( sourceTableKeys[i], pSettings->encoding ) ); -+ buf.append( RTL_CONSTASCII_STRINGPARAM( " is missing )") ); -+ aReason = buf.makeStringAndClear(); -+ } -+ else -+ { -+ -+ ::rtl::OStringBuffer buf( 128 ); -+ buf.append( -+ RTL_CONSTASCII_STRINGPARAM( -+ "can't support updateable resultset for table " ) ); -+ buf.append( rtl::OUStringToOString( schema, pSettings->encoding ) ); -+ buf.append( RTL_CONSTASCII_STRINGPARAM( "." ) ); -+ buf.append( rtl::OUStringToOString( table, pSettings->encoding ) ); -+ buf.append( RTL_CONSTASCII_STRINGPARAM( ", because resultset table does not have a primary key " ) ); -+ aReason = buf.makeStringAndClear(); -+ } -+ } -+ else -+ { -+ ::rtl::OStringBuffer buf( 128 ); -+ buf.append( -+ RTL_CONSTASCII_STRINGPARAM( -+ "can't support updateable result for selects with multiple tables (" ) ); -+ buf.append( cmd ); -+ buf.append( RTL_CONSTASCII_STRINGPARAM( ")" ) ); -+ log( pSettings, LogLevel::SQL, buf.makeStringAndClear().getStr() ); -+ } -+ if( ! (*(data->pLastResultset)).is() ) -+ { -+ if( isLog( pSettings, LogLevel::ERROR ) ) -+ { -+ log( pSettings, LogLevel::ERROR, aReason.getStr()); -+ } -+ -+ // TODO: How to react here correctly ? -+ // remove this piece of code -+ *(data->pLastResultset) = -+ new FakedUpdateableResultSet( -+ data->refMutex, data->owner, -+ data->ppSettings,result, schema, table, -+ OStringToOUString( aReason, pSettings->encoding) ); -+ } -+ -+ } -+ else if( sourceTable.getLength() && -1 != sourceTable.indexOf( '.' ) ) -+ { -+ splitConcatenatedIdentifier( sourceTable, &schema, &table ); -+ } -+ -+ sal_Int32 returnedRows = PQntuples( result ); -+ if( ! data->pLastResultset->is() ) -+ *(data->pLastResultset) = -+ Reference< XCloseable > ( -+ new ResultSet( -+ data->refMutex, data->owner, -+ data->ppSettings,result, schema, table ) ); -+ *(data->pMultipleResultAvailable) = sal_True; -+ ret = sal_True; -+ if( isLog( pSettings, LogLevel::SQL ) ) -+ { -+ rtl::OStringBuffer buf( 128 ); -+ buf.append( RTL_CONSTASCII_STRINGPARAM("executed query '") ); -+ buf.append( cmd ); -+ buf.append( RTL_CONSTASCII_STRINGPARAM("' sucessfully") ); -+ buf.append( RTL_CONSTASCII_STRINGPARAM(", duration=") ); -+ buf.append( duration ); -+ buf.append( RTL_CONSTASCII_STRINGPARAM("ms, returnedRows=") ); -+ buf.append( returnedRows ); -+ buf.append( RTL_CONSTASCII_STRINGPARAM("." ) ); -+ log( pSettings, LogLevel::SQL, buf.makeStringAndClear().getStr() ); -+ } -+ break; -+ } -+ case PGRES_EMPTY_QUERY: -+ case PGRES_COPY_OUT: -+ case PGRES_COPY_IN: -+ case PGRES_BAD_RESPONSE: -+ case PGRES_NONFATAL_ERROR: -+ case PGRES_FATAL_ERROR: -+ default: -+ raiseSQLException( -+ pSettings, data->owner, cmd, PQresultErrorMessage( result ) , PQresStatus( state ) ); -+ } -+ return ret; -+ -+} -+ -+static Sequence< OUString > getPrimaryKeyColumnNames( -+ const Reference< XConnection > & connection, const OUString &schemaName, const OUString &tableName ) -+{ -+ Sequence< OUString > ret; -+ -+ Int2StringMap mapIndex2Name; -+ fillAttnum2attnameMap( mapIndex2Name, connection, schemaName, tableName ); -+ -+ // retrieve the primary key ... -+ Reference< XPreparedStatement > stmt = connection->prepareStatement( -+ ASCII_STR( -+ "SELECT conkey " // 7 -+ "FROM pg_constraint INNER JOIN pg_class ON conrelid = pg_class.oid " -+ "INNER JOIN pg_namespace ON pg_class.relnamespace = pg_namespace.oid " -+ "LEFT JOIN pg_class AS class2 ON confrelid = class2.oid " -+ "LEFT JOIN pg_namespace AS nmsp2 ON class2.relnamespace=nmsp2.oid " -+ "WHERE pg_class.relname = ? AND pg_namespace.nspname = ? AND pg_constraint.contype='p'" ) ); -+ DisposeGuard guard( stmt ); -+ Reference< XParameters > paras( stmt, UNO_QUERY ); -+ paras->setString( 1 , tableName ); -+ paras->setString( 2 , schemaName ); -+ Reference< XResultSet > rs = stmt->executeQuery(); -+ Reference< XRow > xRow( rs , UNO_QUERY ); -+ -+ if( rs->next() ) -+ { -+ ret = convertMappedIntArray2StringArray( mapIndex2Name, string2intarray(xRow->getString( 1 ) ) ); -+ } -+ return ret; -+} -+ -+static void getAutoValues( -+ String2StringMap & result, -+ const Reference< XConnection > & connection, -+ const OUString &schemaName, -+ const OUString & tableName ) -+{ -+ Reference< XPreparedStatement > stmt = connection->prepareStatement( -+ ASCII_STR("SELECT pg_attribute.attname, pg_attrdef.adsrc " -+ "FROM pg_class, pg_namespace, pg_attribute " -+ "LEFT JOIN pg_attrdef ON pg_attribute.attrelid = pg_attrdef.adrelid AND " -+ "pg_attribute.attnum = pg_attrdef.adnum " -+ "WHERE pg_attribute.attrelid = pg_class.oid AND " -+ "pg_class.relnamespace = pg_namespace.oid AND " -+ "pg_namespace.nspname = ? AND " -+ "pg_class.relname LIKE ? AND " -+ "pg_attrdef.adsrc != ''" -+ ) ); -+ DisposeGuard guard( stmt ); -+ Reference< XParameters > paras( stmt, UNO_QUERY ); -+ paras->setString( 1 , schemaName ); -+ paras->setString( 2 , tableName ); -+ Reference< XResultSet > rs = stmt->executeQuery(); -+ Reference< XRow > xRow( rs , UNO_QUERY ); -+ -+ while( rs->next() ) -+ { -+ result[ OUStringToOString( xRow->getString( 1 ), RTL_TEXTENCODING_ASCII_US) ] = -+ OUStringToOString( xRow->getString(2), RTL_TEXTENCODING_ASCII_US ); -+ } -+} -+ -+Reference< XResultSet > getGeneratedValuesFromLastInsert( -+ ConnectionSettings *pConnectionSettings, -+ const Reference< XConnection > &connection, -+ sal_Int32 nLastOid, -+ const rtl::OUString & lastTableInserted, -+ const rtl::OString & lastQuery ) -+{ -+ Reference< XResultSet > ret; -+ OUString query; -+ OUString schemaName, tableName; -+ splitConcatenatedIdentifier( -+ lastTableInserted, &schemaName, &tableName ); -+ -+ if( nLastOid && lastTableInserted.getLength() ) -+ { -+ OUStringBuffer buf( 128 ); -+ buf.appendAscii( RTL_CONSTASCII_STRINGPARAM( "SELECT * FROM " ) ); -+ if( schemaName.getLength() ) -+ bufferQuoteQualifiedIdentifier(buf, schemaName,tableName ); -+ else -+ bufferQuoteIdentifier( buf, lastTableInserted ); -+ buf.appendAscii( RTL_CONSTASCII_STRINGPARAM( " WHERE oid = " ) ); -+ buf.append( nLastOid , 10 ); -+ query = buf.makeStringAndClear(); -+ } -+ else if ( lastTableInserted.getLength() && lastQuery.getLength() ) -+ { -+ // extract nameValue Pairs -+ String2StringMap namedValues; -+ extractNameValuePairsFromInsert( namedValues, lastQuery ); -+ -+ // debug ... -+// rtl::OStringBuffer buf( 128); -+// buf.append( "extracting name/value from '" ); -+// buf.append( lastQuery.getStr() ); -+// buf.append( "' to [" ); -+// for( String2StringMap::iterator ii = namedValues.begin() ; ii != namedValues.end() ; ++ii ) -+// { -+// buf.append( ii->first.getStr() ); -+// buf.append( "=" ); -+// buf.append( ii->second.getStr() ); -+// buf.append( "," ); -+// } -+// buf.append( "]\n" ); -+// printf( buf.makeStringAndClear() ); -+ -+ // TODO: make also unqualified tables names work here. Have a look at 2.8.3. The Schema Search Path -+ // in postgresql doc -+ -+ Sequence< OUString > keyColumnNames = getPrimaryKeyColumnNames( connection, schemaName, tableName ); -+ if( keyColumnNames.getLength() ) -+ { -+ OUStringBuffer buf( 128 ); -+ buf.appendAscii( RTL_CONSTASCII_STRINGPARAM( "SELECT * FROM " ) ); -+ bufferQuoteQualifiedIdentifier(buf, schemaName,tableName ); -+ buf.appendAscii( RTL_CONSTASCII_STRINGPARAM( " WHERE " ) ); -+ bool additionalCondition = false; -+ String2StringMap autoValues; -+ for( int i = 0 ; i < keyColumnNames.getLength() ; i ++ ) -+ { -+ OUString value; -+ OString columnName = OUStringToOString( keyColumnNames[i], pConnectionSettings->encoding ); -+ String2StringMap::iterator ii = namedValues.begin(); -+ for( ; ii != namedValues.end() ; ++ii ) -+ { -+ if( columnName.equalsIgnoreAsciiCase( ii->first ) ) -+ { -+ value = OStringToOUString( ii->second , pConnectionSettings->encoding ); -+ break; -+ } -+ } -+ -+ // check, if a column of the primary key was not inserted explicitly, -+ if( ii == namedValues.end() ) -+ { -+ -+ if( autoValues.begin() == autoValues.end() ) -+ { -+ getAutoValues( autoValues, connection, schemaName, tableName ); -+ } -+ // this could mean, that the column is a default or auto value, check this ... -+ String2StringMap::iterator ii = autoValues.begin(); -+ for( ; ii != autoValues.end() ; ++ii ) -+ { -+ if( columnName.equalsIgnoreAsciiCase( ii->first ) ) -+ { -+ // it is indeed an auto value. -+ value = OStringToOUString(ii->second, RTL_TEXTENCODING_ASCII_US ); -+ // check, whether it is a sequence -+ -+ if( rtl_str_shortenedCompare_WithLength( -+ ii->second.getStr(), ii->second.getLength(), -+ RTL_CONSTASCII_STRINGPARAM( "nextval(" ), 8 ) == 0 ) -+ { -+ // retrieve current sequence value: -+ OUStringBuffer myBuf(128 ); -+ myBuf.appendAscii( RTL_CONSTASCII_STRINGPARAM( "SELECT currval(" ) ); -+ myBuf.appendAscii( &(ii->second.getStr()[8])); -+ value = querySingleValue( connection, myBuf.makeStringAndClear() ); -+ } -+ break; -+ } -+ } -+ if( ii == autoValues.end() ) -+ { -+ // it even was no autovalue, no sense to continue as we can't query the -+ // inserted row -+ buf = OUStringBuffer(); -+ break; -+ } -+ } -+ -+ if( additionalCondition ) -+ buf.appendAscii( RTL_CONSTASCII_STRINGPARAM( " AND " ) ); -+ bufferQuoteIdentifier( buf, keyColumnNames[i] ); -+ buf.appendAscii( RTL_CONSTASCII_STRINGPARAM( " = " ) ); -+ buf.append( value ); -+ additionalCondition = true; -+ } -+ query = buf.makeStringAndClear(); -+ } -+ } -+ -+ if( query.getLength() ) -+ { -+ Reference< com::sun::star::sdbc::XStatement > stmt = connection->createStatement(); -+ ret = stmt->executeQuery( query ); -+ } -+ -+ return ret; -+ -+} -+ -+sal_Bool Statement::execute( const OUString& sql ) -+ throw (SQLException, RuntimeException) -+{ -+ osl::MutexGuard guard( m_refMutex->mutex ); -+ checkClosed(); -+ OString cmd = rtl::OUStringToOString( sql, m_pSettings->encoding ); -+ -+ m_lastResultset.clear(); -+ m_lastTableInserted = rtl::OUString(); -+ -+ struct CommandData data; -+ data.refMutex = m_refMutex; -+ data.ppSettings = &m_pSettings; -+ data.pLastOidInserted = &m_lastOidInserted; -+ data.pLastQuery = &m_lastQuery; -+ data.pMultipleResultUpdateCount = &m_multipleResultUpdateCount; -+ data.pMultipleResultAvailable = &m_multipleResultAvailable; -+ data.pLastTableInserted = &m_lastTableInserted; -+ data.pLastResultset = &m_lastResultset; -+ data.owner = *this; -+ data.tableSupplier = Reference< com::sun::star::sdbcx::XTablesSupplier >( m_connection, UNO_QUERY ); -+ data.concurrency = -+ extractIntProperty( this, getStatics().RESULT_SET_CONCURRENCY ); -+ return executePostgresCommand( cmd , &data ); -+} -+ -+Reference< XConnection > Statement::getConnection( ) -+ throw (SQLException, RuntimeException) -+{ -+ Reference< XConnection > ret; -+ { -+ MutexGuard guard( m_refMutex->mutex ); -+ checkClosed(); -+ ret = m_connection; -+ } -+ return ret; -+} -+ -+ -+Any Statement::getWarnings( ) -+ throw (SQLException,RuntimeException) -+{ -+ return Any(); -+} -+ -+void Statement::clearWarnings( ) -+ throw (SQLException, RuntimeException) -+{ -+} -+ -+Reference< ::com::sun::star::sdbc::XResultSetMetaData > Statement::getMetaData() -+ throw (SQLException,RuntimeException) -+{ -+ Reference< com::sun::star::sdbc::XResultSetMetaData > ret; -+ Reference< com::sun::star::sdbc::XResultSetMetaDataSupplier > supplier( m_lastResultset, UNO_QUERY ); -+ if( supplier.is() ) -+ ret = supplier->getMetaData(); -+ return ret; -+} -+ -+ -+::cppu::IPropertyArrayHelper & Statement::getInfoHelper() -+{ -+ return getStatementPropertyArrayHelper(); -+} -+ -+ -+sal_Bool Statement::convertFastPropertyValue( -+ Any & rConvertedValue, Any & rOldValue, sal_Int32 nHandle, const Any& rValue ) -+ throw (IllegalArgumentException) -+{ -+ rOldValue = m_props[nHandle]; -+ sal_Bool bRet; -+ switch( nHandle ) -+ { -+ case STATEMENT_CURSOR_NAME: -+ { -+ OUString val; -+ bRet = ( rValue >>= val ); -+ rConvertedValue = makeAny( val ); -+ break; -+ } -+ case STATEMENT_ESCAPE_PROCESSING: -+ { -+ sal_Bool val; -+ bRet = ( rValue >>= val ); -+ rConvertedValue = makeAny( val ); -+ break; -+ } -+ case STATEMENT_FETCH_DIRECTION: -+ case STATEMENT_FETCH_SIZE: -+ case STATEMENT_MAX_FIELD_SIZE: -+ case STATEMENT_MAX_ROWS: -+ case STATEMENT_QUERY_TIME_OUT: -+ case STATEMENT_RESULT_SET_CONCURRENCY: -+ case STATEMENT_RESULT_SET_TYPE: -+ { -+ sal_Int32 val; -+ bRet = ( rValue >>= val ); -+ rConvertedValue = makeAny( val ); -+ break; -+ } -+ default: -+ { -+ OUStringBuffer buf(128); -+ buf.appendAscii( "pq_statement: Invalid property handle (" ); -+ buf.append( nHandle ); -+ buf.appendAscii( ")" ); -+ throw IllegalArgumentException( buf.makeStringAndClear(), *this, 2 ); -+ } -+ } -+ return bRet; -+} -+ -+ -+void Statement::setFastPropertyValue_NoBroadcast( -+ sal_Int32 nHandle,const Any& rValue ) throw (Exception) -+{ -+ m_props[nHandle] = rValue; -+} -+ -+void Statement::getFastPropertyValue( Any& rValue, sal_Int32 nHandle ) const -+{ -+ rValue = m_props[nHandle]; -+} -+ -+Reference < XPropertySetInfo > Statement::getPropertySetInfo() -+ throw(RuntimeException) -+{ -+ return OPropertySetHelper::createPropertySetInfo( getStatementPropertyArrayHelper() ); -+} -+ -+ -+Reference< XResultSet > Statement::getResultSet( ) -+ throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) -+{ -+ return Reference< XResultSet > ( m_lastResultset, com::sun::star::uno::UNO_QUERY ); -+} -+ -+sal_Int32 Statement::getUpdateCount( ) -+ throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) -+{ -+ return m_multipleResultUpdateCount; -+} -+ -+sal_Bool Statement::getMoreResults( ) -+ throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) -+{ -+ return sal_False; -+} -+ -+ -+ -+void Statement::disposing() -+{ -+ close(); -+} -+ -+Reference< XResultSet > Statement::getGeneratedValues( ) -+ throw (SQLException, RuntimeException) -+{ -+ osl::MutexGuard guard( m_refMutex->mutex ); -+ return getGeneratedValuesFromLastInsert( -+ m_pSettings, m_connection, m_lastOidInserted, m_lastTableInserted, m_lastQuery ); -+} -+ -+} -diff --git connectivity/source/drivers/postgresql/pq_statement.hxx connectivity/source/drivers/postgresql/pq_statement.hxx -new file mode 100644 -index 0000000..ba64ac5 ---- /dev/null -+++ connectivity/source/drivers/postgresql/pq_statement.hxx -@@ -0,0 +1,229 @@ -+/************************************************************************* -+ * -+ * $RCSfile: pq_statement.hxx,v $ -+ * -+ * $Revision: 1.1.2.3 $ -+ * -+ * last change: $Author: jbu $ $Date: 2006/01/22 15:14:34 $ -+ * -+ * The Contents of this file are made available subject to the terms of -+ * either of the following licenses -+ * -+ * - GNU Lesser General Public License Version 2.1 -+ * - Sun Industry Standards Source License Version 1.1 -+ * -+ * Sun Microsystems Inc., October, 2000 -+ * -+ * GNU Lesser General Public License Version 2.1 -+ * ============================================= -+ * Copyright 2000 by Sun Microsystems, Inc. -+ * 901 San Antonio Road, Palo Alto, CA 94303, USA -+ * -+ * This library is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License version 2.1, as published by the Free Software Foundation. -+ * -+ * This library is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public -+ * License along with this library; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, -+ * MA 02111-1307 USA -+ * -+ * -+ * Sun Industry Standards Source License Version 1.1 -+ * ================================================= -+ * The contents of this file are subject to the Sun Industry Standards -+ * Source License Version 1.1 (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.openoffice.org/license.html. -+ * -+ * Software provided under this License is provided on an "AS IS" basis, -+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, -+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, -+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. -+ * See the License for the specific provisions governing your rights and -+ * obligations concerning the Software. -+ * -+ * The Initial Developer of the Original Code is: Joerg Budischewski -+ * -+ * Copyright: 2000 by Sun Microsystems, Inc. -+ * -+ * All Rights Reserved. -+ * -+ * Contributor(s): Joerg Budischewski -+ * -+ * -+ ************************************************************************/ -+#ifndef _PQ_STATEMENT_HXX_ -+#define _PQ_STATEMENT_HXX_ -+#include -+#include -+ -+#include -+ -+#include "pq_connection.hxx" -+#include -+#include -+#include -+ -+namespace pq_sdbc_driver -+{ -+ -+static const sal_Int32 STATEMENT_CURSOR_NAME = 0; -+static const sal_Int32 STATEMENT_ESCAPE_PROCESSING = 1; -+static const sal_Int32 STATEMENT_FETCH_DIRECTION = 2; -+static const sal_Int32 STATEMENT_FETCH_SIZE = 3; -+static const sal_Int32 STATEMENT_MAX_FIELD_SIZE = 4; -+static const sal_Int32 STATEMENT_MAX_ROWS = 5; -+static const sal_Int32 STATEMENT_QUERY_TIME_OUT = 6; -+static const sal_Int32 STATEMENT_RESULT_SET_CONCURRENCY = 7; -+static const sal_Int32 STATEMENT_RESULT_SET_TYPE = 8; -+ -+#define STATEMENT_SIZE 9 -+class ResultSet; -+ -+class Statement : public cppu::OComponentHelper, -+ public cppu::OPropertySetHelper, -+ public com::sun::star::sdbc::XStatement, -+ public com::sun::star::sdbc::XCloseable, -+ public com::sun::star::sdbc::XWarningsSupplier, -+ public com::sun::star::sdbc::XMultipleResults, -+ public com::sun::star::sdbc::XGeneratedResultSet, -+ public com::sun::star::sdbc::XResultSetMetaDataSupplier -+{ -+private: -+ com::sun::star::uno::Any m_props[STATEMENT_SIZE]; -+ com::sun::star::uno::Reference< com::sun::star::sdbc::XConnection > m_connection; -+ ConnectionSettings *m_pSettings; -+ com::sun::star::uno::Reference< com::sun::star::sdbc::XCloseable > m_lastResultset; -+ ::rtl::Reference< RefCountedMutex > m_refMutex; -+ sal_Bool m_multipleResultAvailable; -+ sal_Int32 m_multipleResultUpdateCount; -+ sal_Int32 m_lastOidInserted; -+ rtl::OUString m_lastTableInserted; -+ rtl::OString m_lastQuery; -+ -+public: -+ /** -+ * @param ppConnection The piece of memory, pConnection points to, is accessisble -+ * as long as a reference to paramenter con is held. -+ */ -+ Statement( const rtl::Reference< RefCountedMutex > & refMutex, -+ const com::sun::star::uno::Reference< com::sun::star::sdbc::XConnection> & con, -+ struct ConnectionSettings *pSettings ); -+ -+ virtual ~Statement(); -+public: // XInterface -+ virtual void SAL_CALL acquire() throw() { OComponentHelper::acquire(); } -+ virtual void SAL_CALL release() throw() { OComponentHelper::release(); } -+ virtual com::sun::star::uno::Any SAL_CALL queryInterface( const com::sun::star::uno::Type & reqType ) -+ throw (com::sun::star::uno::RuntimeException); -+ -+public: // XCloseable -+ virtual void SAL_CALL close( ) -+ throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ -+public: // XStatement -+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL executeQuery( -+ const ::rtl::OUString& sql ) -+ throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Int32 SAL_CALL executeUpdate( const ::rtl::OUString& sql ) -+ throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Bool SAL_CALL execute( const ::rtl::OUString& sql ) -+ throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > SAL_CALL getConnection( ) -+ throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ -+public: // XWarningsSupplier -+ virtual ::com::sun::star::uno::Any SAL_CALL getWarnings( ) -+ throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual void SAL_CALL clearWarnings( ) -+ throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ -+public: // XTypeProvider, first implemented by OPropertySetHelper -+ virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL getTypes() -+ throw( com::sun::star::uno::RuntimeException ); -+ virtual com::sun::star::uno::Sequence< sal_Int8> SAL_CALL getImplementationId() -+ throw( com::sun::star::uno::RuntimeException ); -+ -+public: // OPropertySetHelper -+ virtual cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper(); -+ -+ virtual sal_Bool SAL_CALL convertFastPropertyValue( -+ ::com::sun::star::uno::Any & rConvertedValue, -+ ::com::sun::star::uno::Any & rOldValue, -+ sal_Int32 nHandle, -+ const ::com::sun::star::uno::Any& rValue ) -+ throw (::com::sun::star::lang::IllegalArgumentException); -+ -+ virtual void SAL_CALL setFastPropertyValue_NoBroadcast( -+ sal_Int32 nHandle, -+ const ::com::sun::star::uno::Any& rValue ) -+ throw (::com::sun::star::uno::Exception); -+ -+ virtual void SAL_CALL getFastPropertyValue( -+ ::com::sun::star::uno::Any& rValue, -+ sal_Int32 nHandle ) const; -+ -+ // XPropertySet -+ ::com::sun::star::uno::Reference < ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() -+ throw(com::sun::star::uno::RuntimeException); -+ -+public: // XGeneratedResultSet -+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL -+ getGeneratedValues( ) -+ throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ -+public: // XMultipleResults -+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getResultSet( ) -+ throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Int32 SAL_CALL getUpdateCount( ) -+ throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Bool SAL_CALL getMoreResults( ) -+ throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ -+public: // OComponentHelper -+ virtual void SAL_CALL disposing(); -+ -+public: // XResultSetMetaDataSupplier (is required by framework (see -+ // dbaccess/source/core/api/preparedstatement.cxx::getMetaData() ) -+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData > SAL_CALL getMetaData( ) -+ throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ -+private: -+ void checkClosed() throw (com::sun::star::sdbc::SQLException, com::sun::star::uno::RuntimeException); -+ void raiseSQLException( const ::rtl::OUString & sql, const char * errorMsg, const char *errorType = 0 ) -+ throw ( com::sun::star::sdbc::SQLException ); -+}; -+ -+ -+struct CommandData -+{ -+ ConnectionSettings **ppSettings; -+ sal_Int32 *pLastOidInserted; -+ sal_Int32 *pMultipleResultUpdateCount; -+ sal_Bool *pMultipleResultAvailable; -+ ::rtl::OUString *pLastTableInserted; -+ ::com::sun::star::uno::Reference< com::sun::star::sdbc::XCloseable > *pLastResultset; -+ ::rtl::OString *pLastQuery; -+ ::rtl::Reference< RefCountedMutex > refMutex; -+ ::com::sun::star::uno::Reference< com::sun::star::uno::XInterface > owner; -+ ::com::sun::star::uno::Reference< com::sun::star::sdbcx::XTablesSupplier > tableSupplier; -+ sal_Int32 concurrency; -+}; -+ -+bool executePostgresCommand( const rtl::OString & cmd, struct CommandData *data ); -+com::sun::star::uno::Reference< com::sun::star::sdbc::XResultSet > getGeneratedValuesFromLastInsert( -+ ConnectionSettings *pConnectionSettings, -+ const com::sun::star::uno::Reference< com::sun::star::sdbc::XConnection > &connection, -+ sal_Int32 nLastOid, -+ const rtl::OUString & lastTableInserted, -+ const rtl::OString & lastQuery ); -+ -+ -+} -+#endif -diff --git connectivity/source/drivers/postgresql/pq_statics.cxx connectivity/source/drivers/postgresql/pq_statics.cxx -new file mode 100644 -index 0000000..177571d ---- /dev/null -+++ connectivity/source/drivers/postgresql/pq_statics.cxx -@@ -0,0 +1,758 @@ -+/************************************************************************* -+ * -+ * $RCSfile: pq_statics.cxx,v $ -+ * -+ * $Revision: 1.1.2.6 $ -+ * -+ * last change: $Author: jbu $ $Date: 2007/02/15 20:04:48 $ -+ * -+ * The Contents of this file are made available subject to the terms of -+ * either of the following licenses -+ * -+ * - GNU Lesser General Public License Version 2.1 -+ * - Sun Industry Standards Source License Version 1.1 -+ * -+ * Sun Microsystems Inc., October, 2000 -+ * -+ * GNU Lesser General Public License Version 2.1 -+ * ============================================= -+ * Copyright 2000 by Sun Microsystems, Inc. -+ * 901 San Antonio Road, Palo Alto, CA 94303, USA -+ * -+ * This library is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License version 2.1, as published by the Free Software Foundation. -+ * -+ * This library is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public -+ * License along with this library; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, -+ * MA 02111-1307 USA -+ * -+ * -+ * Sun Industry Standards Source License Version 1.1 -+ * ================================================= -+ * The contents of this file are subject to the Sun Industry Standards -+ * Source License Version 1.1 (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.openoffice.org/license.html. -+ * -+ * Software provided under this License is provided on an "AS IS" basis, -+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, -+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, -+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. -+ * See the License for the specific provisions governing your rights and -+ * obligations concerning the Software. -+ * -+ * The Initial Developer of the Original Code is: Joerg Budischewski -+ * -+ * Copyright: 2000 by Sun Microsystems, Inc. -+ * -+ * All Rights Reserved. -+ * -+ * Contributor(s): Joerg Budischewski -+ * -+ * -+ ************************************************************************/ -+ -+#include "pq_statics.hxx" -+#include "pq_updateableresultset.hxx" -+#include -+#include -+ -+using rtl::OUString; -+using com::sun::star::uno::Sequence; -+using com::sun::star::uno::Any; -+using com::sun::star::uno::Type; -+ -+using com::sun::star::beans::PropertyAttribute::READONLY; -+using com::sun::star::beans::PropertyAttribute::BOUND; -+using com::sun::star::beans::Property; -+ -+namespace pq_sdbc_driver -+{ -+ -+struct DefColumnMetaData -+{ -+ sal_Char * columnName; -+ sal_Char * tableName; -+ sal_Char * schemaTableName; -+ sal_Char * typeName; -+ sal_Int32 type; -+ sal_Int32 precision; -+ sal_Int32 scale; -+ sal_Bool isCurrency; -+ sal_Bool isNullable; -+ sal_Bool isAutoIncrement; -+ sal_Bool isReadOnly; -+ sal_Bool isSigned; -+}; -+ -+#define ASCII_STR(x) OUString( RTL_CONSTASCII_USTRINGPARAM( x ) ) -+struct BaseTypeDef { const char * typeName; sal_Int32 value; }; -+ -+static Sequence< OUString > createStringSequence( const char * name[] ) -+{ -+ int length; -+ for( length = 0; name[length] ; length ++ ); -+ -+ Sequence< OUString > seq( length ); -+ for( int i = 0; i < length; i ++ ) -+ { -+ seq[i] = OUString( name[i] , strlen( name[i] ), RTL_TEXTENCODING_ASCII_US ); -+ } -+ return seq; -+} -+ -+static Sequence< sal_Int8 > generateImplementationId() -+{ -+ Sequence< sal_Int8 > seq( 16 ); -+ rtl_createUuid( (sal_uInt8*)seq.getArray(), 0 , sal_False ); -+ return seq; -+} -+ -+struct PropertyDef -+{ -+ PropertyDef( const OUString &str, const Type &t ) -+ : name( str ) , type( t ) {} -+ ::rtl::OUString name; -+ com::sun::star::uno::Type type; -+}; -+ -+struct PropertyDefEx : public PropertyDef -+{ -+ PropertyDefEx( const OUString & str, const Type &t , sal_Int32 a ) -+ : PropertyDef( str, t ) , attribute( a ) -+ {} -+ sal_Int32 attribute; -+}; -+ -+static cppu::IPropertyArrayHelper * createPropertyArrayHelper( -+ PropertyDef *props, int count , sal_Int16 attr ) -+{ -+ Sequence< Property > seq( count ); -+ for( int i = 0 ; i < count ; i ++ ) -+ { -+ seq[i] = Property( props[i].name, i, props[i].type, attr ); -+ } -+ return new cppu::OPropertyArrayHelper( seq, sal_True ); -+} -+ -+static cppu::IPropertyArrayHelper * createPropertyArrayHelper( -+ PropertyDefEx *props, int count ) -+{ -+ Sequence< Property > seq( count ); -+ for( int i = 0 ; i < count ; i ++ ) -+ { -+ seq[i] = Property( props[i].name, i, props[i].type, props[i].attribute ); -+ } -+ return new cppu::OPropertyArrayHelper( seq, sal_True ); -+} -+ -+Statics & getStatics() -+{ -+ static Statics * p; -+ if( ! p ) -+ { -+ ::osl::MutexGuard guard( ::osl::Mutex::getGlobalMutex() ); -+ if( ! p ) -+ { -+ static Statics statics ; -+ statics.SYSTEM_TABLE = ASCII_STR( "SYSTEM TABLE" ); -+ statics.TABLE = ASCII_STR( "TABLE" ); -+ statics.VIEW = ASCII_STR( "VIEW" ); -+ statics.UNKNOWN = ASCII_STR( "UNKNOWN" ); -+ statics.YES = ASCII_STR( "YES" ); -+ statics.NO = ASCII_STR( "NO" ); -+ statics.NO_NULLS = ASCII_STR( "NO_NULLS" ); -+ statics.NULABLE = ASCII_STR( "NULABLE" ); -+ statics.NULLABLE_UNKNOWN = ASCII_STR( "NULLABLE_UNKNOWN" ); -+ statics.cPERCENT = ASCII_STR( "%" ); -+ -+ statics.TYPE = ASCII_STR( "Type" ); -+ statics.TYPE_NAME = ASCII_STR( "TypeName" ); -+ statics.NAME = ASCII_STR( "Name" ); -+ statics.SCHEMA_NAME = ASCII_STR( "SchemaName" ); -+ statics.CATALOG_NAME = ASCII_STR( "CatalogName" ); -+ statics.DESCRIPTION = ASCII_STR( "Description" ); -+ statics.PRIVILEGES = ASCII_STR( "Privileges" ); -+ -+ statics.DEFAULT_VALUE = ASCII_STR( "DefaultValue" ); -+ statics.IS_AUTO_INCREMENT = ASCII_STR( "IsAutoIncrement" ); -+ statics.IS_CURRENCY = ASCII_STR( "IsCurrency" ); -+ statics.IS_NULLABLE = ASCII_STR( "IsNullable" ); -+ statics.IS_ROW_VERSISON = ASCII_STR( "IsRowVersion" ); -+ statics.PRECISION = ASCII_STR( "Precision" ); -+ statics.SCALE = ASCII_STR( "Scale" ); -+ -+ statics.cPERCENT = ASCII_STR( "%" ); -+ statics.BEGIN = ASCII_STR( "BEGIN" ); -+ statics.COMMIT = ASCII_STR( "COMMIT" ); -+ statics.ROLLBACK = ASCII_STR( "ROLLBACK" ); -+ -+ statics.KEY = ASCII_STR( "Key" ); -+ statics.REFERENCED_TABLE = ASCII_STR( "ReferencedTable" ); -+ statics.UPDATE_RULE = ASCII_STR( "UpdateRule" ); -+ statics.DELETE_RULE = ASCII_STR( "DeleteRule" ); -+ statics.PRIVATE_COLUMNS = ASCII_STR( "PrivateColumns" ); -+ statics.PRIVATE_FOREIGN_COLUMNS = ASCII_STR( "PrivateForeignColumns" ); -+ -+ statics.KEY_COLUMN = ASCII_STR( "KeyColumn" ); -+ statics.RELATED_COLUMN = ASCII_STR( "RelatedColumn" ); -+ statics.PASSWORD = ASCII_STR( "Password" ); -+ statics.USER = ASCII_STR( "User" ); -+ -+ statics.CURSOR_NAME = ASCII_STR( "CursorName" ); -+ statics.ESCAPE_PROCESSING = ASCII_STR( "EscapeProcessing" ); -+ statics.FETCH_DIRECTION = ASCII_STR( "FetchDirection" ); -+ statics.FETCH_SIZE = ASCII_STR( "FetchSize" ); -+ statics.IS_BOOKMARKABLE = ASCII_STR( "IsBookmarkable" ); -+ statics.RESULT_SET_CONCURRENCY = ASCII_STR( "ResultSetConcurrency" ); -+ statics.RESULT_SET_TYPE = ASCII_STR( "ResultSetType" ); -+ -+ statics.COMMAND = ASCII_STR( "Command" ); -+ statics.CHECK_OPTION = ASCII_STR( "CheckOption" ); -+ -+ statics.TRUE = ASCII_STR( "t" ); -+ statics.FALSE = ASCII_STR( "f" ); -+ statics.IS_PRIMARY_KEY_INDEX = ASCII_STR( "IsPrimaryKeyIndex" ); -+ statics.IS_CLUSTERED = ASCII_STR( "IsClustered" ); -+ statics.IS_UNIQUE = ASCII_STR( "IsUnique" ); -+ statics.IS_ASCENDING = ASCII_STR( "IsAscending" ); -+ statics.PRIVATE_COLUMN_INDEXES = ASCII_STR( "PrivateColumnIndexes" ); -+ statics.HELP_TEXT = ASCII_STR( "HelpText" ); -+ -+ statics.CATALOG = ASCII_STR( "Catalog" ); -+ -+ Type tString = getCppuType( (rtl::OUString *) 0 ); -+ Type tInt = getCppuType( (sal_Int32 * ) 0 ); -+ Type tBool = getBooleanCppuType(); -+ Type tStringSequence = getCppuType( (com::sun::star::uno::Sequence< ::rtl::OUString > *) 0); -+ -+ // Table props set -+ ImplementationStatics &ist = statics.refl.table; -+ ist.implName = ASCII_STR( "org.openoffice.comp.pq.sdbcx.Table" ); -+ ist.serviceNames = Sequence< OUString > ( 1 ); -+ ist.serviceNames[0] = ASCII_STR( "com.sun.star.sdbcx.Table" ); -+ PropertyDef tableDef[] = -+ { -+ PropertyDef( statics.CATALOG_NAME , tString ), -+ PropertyDef( statics.DESCRIPTION , tString ), -+ PropertyDef( statics.NAME , tString ), -+ PropertyDef( statics.PRIVILEGES , tInt ), -+ PropertyDef( statics.SCHEMA_NAME , tString ), -+ PropertyDef( statics.TYPE , tString ) -+ }; -+ ist.pProps = createPropertyArrayHelper( -+ tableDef, sizeof(tableDef)/sizeof(PropertyDef), READONLY ); -+ -+ statics.refl.tableDescriptor.implName = -+ ASCII_STR( "org.openoffice.comp.pq.sdbcx.TableDescriptor" ); -+ statics.refl.tableDescriptor.serviceNames = Sequence< OUString > (1); -+ statics.refl.tableDescriptor.serviceNames[0] = -+ ASCII_STR( "com.sun.star.sdbcx.TableDescriptor" ); -+ PropertyDef tableDescDef[] = -+ { -+ PropertyDef( statics.CATALOG_NAME , tString ), -+ PropertyDef( statics.DESCRIPTION , tString ), -+ PropertyDef( statics.NAME , tString ), -+ PropertyDef( statics.PRIVILEGES , tInt ), -+ PropertyDef( statics.SCHEMA_NAME , tString ) -+ }; -+ statics.refl.tableDescriptor.pProps = createPropertyArrayHelper( -+ tableDescDef, sizeof(tableDescDef)/sizeof(PropertyDef), 0 ); -+ -+ // Column props set -+ statics.refl.column.implName = ASCII_STR( "org.openoffice.comp.pq.sdbcx.Column" ); -+ statics.refl.column.serviceNames = Sequence< OUString > ( 1 ); -+ statics.refl.column.serviceNames[0] = ASCII_STR( "com.sun.star.sdbcx.Column" ); -+ PropertyDefEx columnDef[] = -+ { -+ PropertyDefEx( statics.CATALOG_NAME , tString, READONLY ), -+ PropertyDefEx( statics.DEFAULT_VALUE, tString, READONLY ), -+ PropertyDefEx( statics.DESCRIPTION , tString, READONLY ), -+// PropertyDefEx( statics.HELP_TEXT , tString, BOUND ), -+ PropertyDefEx( statics.IS_AUTO_INCREMENT, tBool, READONLY ), -+ PropertyDefEx( statics.IS_CURRENCY, tBool, READONLY ), -+ PropertyDefEx( statics.IS_NULLABLE, tInt, READONLY ), -+ PropertyDefEx( statics.IS_ROW_VERSISON, tBool,READONLY ), -+ PropertyDefEx( statics.NAME , tString,READONLY ), -+ PropertyDefEx( statics.PRECISION , tInt, READONLY ), -+ PropertyDefEx( statics.SCALE , tInt ,READONLY), -+ PropertyDefEx( statics.TYPE , tInt ,READONLY), -+ PropertyDefEx( statics.TYPE_NAME , tString ,READONLY) -+ }; -+ statics.refl.column.pProps = createPropertyArrayHelper( -+ columnDef, sizeof(columnDef)/sizeof(PropertyDefEx) ); -+ -+ statics.refl.columnDescriptor.implName = -+ ASCII_STR( "org.openoffice.comp.pq.sdbcx.ColumnDescriptor" ); -+ statics.refl.columnDescriptor.serviceNames = Sequence< OUString > ( 1 ); -+ statics.refl.columnDescriptor.serviceNames[0] = -+ ASCII_STR( "com.sun.star.sdbcx.ColumnDescriptor" ); -+ PropertyDef columnDescDef[] = -+ { -+ PropertyDef( statics.CATALOG_NAME , tString ), -+ PropertyDef( statics.DEFAULT_VALUE, tString ), -+ PropertyDef( statics.DESCRIPTION , tString ), -+// PropertyDef( statics.HELP_TEXT , tString ), -+ PropertyDef( statics.IS_AUTO_INCREMENT, tBool ), -+ PropertyDef( statics.IS_CURRENCY, tBool ), -+ PropertyDef( statics.IS_NULLABLE, tInt ), -+ PropertyDef( statics.IS_ROW_VERSISON, tBool ), -+ PropertyDef( statics.NAME , tString ), -+ PropertyDef( statics.PRECISION , tInt ), -+ PropertyDef( statics.SCALE , tInt ), -+ PropertyDef( statics.TYPE , tInt ), -+ PropertyDef( statics.TYPE_NAME , tString ) -+ }; -+ -+ statics.refl.columnDescriptor.pProps = createPropertyArrayHelper( -+ columnDescDef, sizeof(columnDescDef)/sizeof(PropertyDef), 0 ); -+ -+ // Key properties -+ statics.refl.key.implName = ASCII_STR( "org.openoffice.comp.pq.sdbcx.Key" ); -+ statics.refl.key.serviceNames = Sequence< OUString > ( 1 ); -+ statics.refl.key.serviceNames[0] = ASCII_STR( "com.sun.star.sdbcx.Key" ); -+ PropertyDef keyDef[] = -+ { -+ PropertyDef( statics.DELETE_RULE, tInt ), -+ PropertyDef( statics.NAME, tString ), -+ PropertyDef( statics.PRIVATE_COLUMNS, tStringSequence ), -+ PropertyDef( statics.PRIVATE_FOREIGN_COLUMNS, tStringSequence ), -+ PropertyDef( statics.REFERENCED_TABLE, tString ), -+ PropertyDef( statics.TYPE, tInt ), -+ PropertyDef( statics.UPDATE_RULE, tInt ) -+ }; -+ statics.refl.key.pProps = createPropertyArrayHelper( -+ keyDef, sizeof(keyDef)/sizeof(PropertyDef), READONLY ); -+ -+ -+ // Key properties -+ statics.refl.keyDescriptor.implName = -+ ASCII_STR( "org.openoffice.comp.pq.sdbcx.KeyDescriptor" ); -+ statics.refl.keyDescriptor.serviceNames = Sequence< OUString > ( 1 ); -+ statics.refl.keyDescriptor.serviceNames[0] = -+ ASCII_STR( "com.sun.star.sdbcx.KeyDescriptor" ); -+ PropertyDef keyDescDef[] = -+ { -+ PropertyDef( statics.DELETE_RULE, tInt ), -+ PropertyDef( statics.NAME, tString ), -+ PropertyDef( statics.REFERENCED_TABLE, tString ), -+ PropertyDef( statics.TYPE, tInt ), -+ PropertyDef( statics.UPDATE_RULE, tInt ) -+ }; -+ statics.refl.keyDescriptor.pProps = createPropertyArrayHelper( -+ keyDescDef, sizeof(keyDescDef)/sizeof(PropertyDef), 0 ); -+ -+ -+ -+ // KeyColumn props set -+ statics.refl.keycolumn.implName = ASCII_STR( "org.openoffice.comp.pq.sdbcx.KeyColumn" ); -+ statics.refl.keycolumn.serviceNames = Sequence< OUString > ( 1 ); -+ statics.refl.keycolumn.serviceNames[0] = ASCII_STR( "com.sun.star.sdbcx.KeyColumn" ); -+ PropertyDef keycolumnDef[] = -+ { -+ PropertyDef( statics.CATALOG_NAME , tString ), -+ PropertyDef( statics.DEFAULT_VALUE, tString ), -+ PropertyDef( statics.DESCRIPTION , tString ), -+ PropertyDef( statics.IS_AUTO_INCREMENT, tBool ), -+ PropertyDef( statics.IS_CURRENCY, tBool ), -+ PropertyDef( statics.IS_NULLABLE, tInt ), -+ PropertyDef( statics.IS_ROW_VERSISON, tBool ), -+ PropertyDef( statics.NAME , tString ), -+ PropertyDef( statics.PRECISION , tInt ), -+ PropertyDef( statics.RELATED_COLUMN, tString ), -+ PropertyDef( statics.SCALE , tInt ), -+ PropertyDef( statics.TYPE , tInt ), -+ PropertyDef( statics.TYPE_NAME , tString ) -+ }; -+ statics.refl.keycolumn.pProps = createPropertyArrayHelper( -+ keycolumnDef, sizeof(keycolumnDef)/sizeof(PropertyDef), READONLY ); -+ -+ // KeyColumn props set -+ statics.refl.keycolumnDescriptor.implName = -+ ASCII_STR( "org.openoffice.comp.pq.sdbcx.KeyColumnDescriptor" ); -+ statics.refl.keycolumnDescriptor.serviceNames = Sequence< OUString > ( 1 ); -+ statics.refl.keycolumnDescriptor.serviceNames[0] = -+ ASCII_STR( "com.sun.star.sdbcx.KeyColumnDescriptor" ); -+ PropertyDef keycolumnDescDef[] = -+ { -+ PropertyDef( statics.NAME , tString ), -+ PropertyDef( statics.RELATED_COLUMN, tString ) -+ }; -+ statics.refl.keycolumnDescriptor.pProps = createPropertyArrayHelper( -+ keycolumnDescDef, sizeof(keycolumnDescDef)/sizeof(PropertyDef), 0 ); -+ -+ // view props set -+ statics.refl.view.implName = ASCII_STR( "org.openoffice.comp.pq.sdbcx.View"); -+ statics.refl.view.serviceNames = Sequence< OUString > ( 1 ); -+ statics.refl.view.serviceNames[0] = ASCII_STR( "com.sun.star.sdbcx.View" ); -+ PropertyDef viewDef[] = -+ { -+ PropertyDef( statics.CATALOG_NAME , tString ), -+ PropertyDef( statics.CHECK_OPTION , tInt ), -+ PropertyDef( statics.COMMAND , tString ), -+ PropertyDef( statics.NAME , tString ), -+ PropertyDef( statics.SCHEMA_NAME , tString ) -+ }; -+ statics.refl.view.pProps = createPropertyArrayHelper( -+ viewDef, sizeof(viewDef)/sizeof(PropertyDef), READONLY ); -+ -+ // view props set -+ statics.refl.viewDescriptor.implName = ASCII_STR( "org.openoffice.comp.pq.sdbcx.ViewDescriptor"); -+ statics.refl.viewDescriptor.serviceNames = Sequence< OUString > ( 1 ); -+ statics.refl.viewDescriptor.serviceNames[0] = ASCII_STR( "com.sun.star.sdbcx.ViewDescriptor" ); -+ statics.refl.viewDescriptor.pProps = createPropertyArrayHelper( -+ viewDef, sizeof(viewDef)/sizeof(PropertyDef), 0 ); // reuse view, as it is identical -+ // user props set -+ statics.refl.user.implName = ASCII_STR( "org.openoffice.comp.pq.sdbcx.User"); -+ statics.refl.user.serviceNames = Sequence< OUString > ( 1 ); -+ statics.refl.user.serviceNames[0] = ASCII_STR( "com.sun.star.sdbcx.User" ); -+ PropertyDef userDefRO[] = -+ { -+ PropertyDef( statics.NAME , tString ) -+ }; -+ statics.refl.user.pProps = createPropertyArrayHelper( -+ userDefRO, sizeof(userDefRO)/sizeof(PropertyDef), READONLY ); -+ -+ // user props set -+ statics.refl.userDescriptor.implName = -+ ASCII_STR( "org.openoffice.comp.pq.sdbcx.UserDescriptor"); -+ statics.refl.userDescriptor.serviceNames = Sequence< OUString > ( 1 ); -+ statics.refl.userDescriptor.serviceNames[0] = -+ ASCII_STR( "com.sun.star.sdbcx.UserDescriptor" ); -+ PropertyDef userDefWR[] = -+ { -+ PropertyDef( statics.NAME , tString ), -+ PropertyDef( statics.PASSWORD , tString ) -+ }; -+ statics.refl.userDescriptor.pProps = createPropertyArrayHelper( -+ userDefWR, sizeof(userDefWR)/sizeof(PropertyDef), 0 ); -+ -+ // index props set -+ statics.refl.index.implName = ASCII_STR( "org.openoffice.comp.pq.sdbcx.Index"); -+ statics.refl.index.serviceNames = Sequence< OUString > ( 1 ); -+ statics.refl.index.serviceNames[0] = ASCII_STR( "com.sun.star.sdbcx.Index" ); -+ PropertyDef indexDef[] = -+ { -+ PropertyDef( statics.CATALOG , tString ), -+ PropertyDef( statics.IS_CLUSTERED, tBool ), -+ PropertyDef( statics.IS_PRIMARY_KEY_INDEX, tBool ), -+ PropertyDef( statics.IS_UNIQUE, tBool ), -+ PropertyDef( statics.NAME , tString ), -+ PropertyDef( statics.PRIVATE_COLUMN_INDEXES, tStringSequence ) -+ }; -+ statics.refl.index.pProps = createPropertyArrayHelper( -+ indexDef, sizeof(indexDef)/sizeof(PropertyDef), READONLY ); -+ -+ // index props set -+ statics.refl.indexDescriptor.implName = -+ ASCII_STR( "org.openoffice.comp.pq.sdbcx.IndexDescriptor"); -+ statics.refl.indexDescriptor.serviceNames = Sequence< OUString > ( 1 ); -+ statics.refl.indexDescriptor.serviceNames[0] = -+ ASCII_STR( "com.sun.star.sdbcx.IndexDescriptor" ); -+ statics.refl.indexDescriptor.pProps = createPropertyArrayHelper( -+ indexDef, sizeof(indexDef)/sizeof(PropertyDef), 0 ); -+ -+ // indexColumn props set -+ statics.refl.indexColumn.implName = ASCII_STR( "org.openoffice.comp.pq.sdbcx.IndexColumn"); -+ statics.refl.indexColumn.serviceNames = Sequence< OUString > ( 1 ); -+ statics.refl.indexColumn.serviceNames[0] = ASCII_STR("com.sun.star.sdbcx.IndexColumn"); -+ PropertyDef indexColumnDef[] = -+ { -+ PropertyDef( statics.CATALOG_NAME , tString ), -+ PropertyDef( statics.DEFAULT_VALUE, tString ), -+ PropertyDef( statics.DESCRIPTION , tString ), -+ PropertyDef( statics.IS_ASCENDING, tBool ), -+ PropertyDef( statics.IS_AUTO_INCREMENT, tBool ), -+ PropertyDef( statics.IS_CURRENCY, tBool ), -+ PropertyDef( statics.IS_NULLABLE, tInt ), -+ PropertyDef( statics.IS_ROW_VERSISON, tBool ), -+ PropertyDef( statics.NAME , tString ), -+ PropertyDef( statics.PRECISION , tInt ), -+ PropertyDef( statics.SCALE , tInt ), -+ PropertyDef( statics.TYPE , tInt ), -+ PropertyDef( statics.TYPE_NAME , tString ) -+ }; -+ statics.refl.indexColumn.pProps = createPropertyArrayHelper( -+ indexColumnDef, sizeof(indexColumnDef)/sizeof(PropertyDef), READONLY ); -+ -+ // indexColumn props set -+ statics.refl.indexColumnDescriptor.implName = -+ ASCII_STR( "org.openoffice.comp.pq.sdbcx.IndexColumnDescriptor"); -+ statics.refl.indexColumnDescriptor.serviceNames = Sequence< OUString > ( 1 ); -+ statics.refl.indexColumnDescriptor.serviceNames[0] = -+ ASCII_STR("com.sun.star.sdbcx.IndexColumnDescriptor"); -+ PropertyDef indexColumnDescDef[] = -+ { -+ PropertyDef( statics.IS_ASCENDING, tBool ), -+ PropertyDef( statics.NAME , tString ) -+ }; -+ statics.refl.indexColumnDescriptor.pProps = createPropertyArrayHelper( -+ indexColumnDescDef, sizeof(indexColumnDescDef)/sizeof(PropertyDef), 0 ); -+ -+ // resultset -+ statics.refl.resultSet.implName = ASCII_STR( "org.openoffice.comp.pq.ResultSet"); -+ statics.refl.resultSet.serviceNames = Sequence< OUString > ( 1 ); -+ statics.refl.resultSet.serviceNames[0] = ASCII_STR( "com.sun.star.sdbc.ResultSet" ); -+ statics.refl.resultSet.types = UpdateableResultSet::getStaticTypes( false /* updateable */ ); -+ PropertyDef resultSet[] = -+ { -+ PropertyDef( statics.CURSOR_NAME , tString ), -+ PropertyDef( statics.ESCAPE_PROCESSING , tBool ), -+ PropertyDef( statics.FETCH_DIRECTION , tInt ), -+ PropertyDef( statics.FETCH_SIZE , tInt ), -+ PropertyDef( statics.IS_BOOKMARKABLE , tBool ), -+ PropertyDef( statics.RESULT_SET_CONCURRENCY , tInt ), -+ PropertyDef( statics.RESULT_SET_TYPE , tInt ) -+ }; -+ statics.refl.resultSet.pProps = createPropertyArrayHelper( -+ resultSet, sizeof(resultSet)/sizeof(PropertyDef), 0 ); -+ -+ // updateableResultset -+ statics.refl.updateableResultSet.implName = ASCII_STR( "org.openoffice.comp.pq.UpdateableResultSet"); -+ statics.refl.updateableResultSet.serviceNames = Sequence< OUString > ( 1 ); -+ statics.refl.updateableResultSet.serviceNames[0] = ASCII_STR( "com.sun.star.sdbc.ResultSet" ); -+ statics.refl.updateableResultSet.types = UpdateableResultSet::getStaticTypes( true /* updateable */ ); -+ statics.refl.updateableResultSet.pProps = createPropertyArrayHelper( -+ resultSet, sizeof(resultSet)/sizeof(PropertyDef), 0 ); -+ -+ // databasemetadata -+ statics.tablesRowNames = Sequence< OUString > ( 5 ); -+ statics.tablesRowNames[TABLE_INDEX_CATALOG] = ASCII_STR( "TABLE_CAT" ); -+ statics.tablesRowNames[TABLE_INDEX_SCHEMA] = ASCII_STR( "TABLE_SCHEM" ); -+ statics.tablesRowNames[TABLE_INDEX_NAME] = ASCII_STR( "TABLE_NAME" ); -+ statics.tablesRowNames[TABLE_INDEX_TYPE] = ASCII_STR( "TABLE_TYPE" ); -+ statics.tablesRowNames[TABLE_INDEX_REMARKS] = ASCII_STR( "REMARKS" ); -+ -+ statics.primaryKeyNames = Sequence< OUString > ( 6 ); -+ statics.primaryKeyNames[0] = ASCII_STR( "TABLE_CAT" ); -+ statics.primaryKeyNames[1] = ASCII_STR( "TABLE_SCHEM" ); -+ statics.primaryKeyNames[2] = ASCII_STR( "TABLE_NAME" ); -+ statics.primaryKeyNames[3] = ASCII_STR( "COLUMN_NAME" ); -+ statics.primaryKeyNames[4] = ASCII_STR( "KEY_SEQ" ); -+ statics.primaryKeyNames[5] = ASCII_STR( "PK_NAME" ); -+ -+ statics.SELECT = ASCII_STR( "SELECT" ); -+ statics.UPDATE = ASCII_STR( "UPDATE" ); -+ statics.INSERT = ASCII_STR( "INSERT" ); -+ statics.DELETE = ASCII_STR( "DELETE" ); -+ statics.RULE = ASCII_STR( "RULE" ); -+ statics.REFERENCES = ASCII_STR( "REFERENCES" ); -+ statics.TRIGGER = ASCII_STR( "TRIGGER" ); -+ statics.EXECUTE = ASCII_STR( "EXECUTE" ); -+ statics.USAGE = ASCII_STR( "USAGE" ); -+ statics.CREATE = ASCII_STR( "CREATE" ); -+ statics.TEMPORARY = ASCII_STR( "TEMPORARY" ); -+ statics.INDEX = ASCII_STR( "Index" ); -+ statics.INDEX_COLUMN = ASCII_STR( "IndexColumn" ); -+ -+ statics.schemaNames = Sequence< OUString > ( 1 ); -+ statics.schemaNames[0] = ASCII_STR( "TABLE_SCHEM" ); -+ -+ statics.tableTypeData = Sequence< Sequence< Any > >( 2 ); -+ -+ statics.tableTypeData[0] = Sequence< Any > ( 1 ); -+ statics.tableTypeData[0][0] <<= statics.TABLE; -+ -+// statics.tableTypeData[2] = Sequence< Any > ( 1 ); -+// statics.tableTypeData[2][0] <<= statics.VIEW; -+ -+ statics.tableTypeData[1] = Sequence< Any > ( 1 ); -+ statics.tableTypeData[1][0] <<= statics.SYSTEM_TABLE; -+ -+ statics.tableTypeNames = Sequence< OUString > ( 1 ); -+ statics.tableTypeNames[0] = ASCII_STR( "TABLE_TYPE" ); -+ -+ static const char *tablePrivilegesNames[] = -+ { -+ "TABLE_CAT", "TABLE_SCHEM", "TABLE_NAME", "GRANTOR", "GRANTEE", "PRIVILEGE", -+ "IS_GRANTABLE" , 0 -+ }; -+ statics.tablePrivilegesNames = -+ createStringSequence( tablePrivilegesNames ); -+ -+ static const char * columnNames[] = -+ { -+ "TABLE_CAT", "TABLE_SCHEM", "TABLE_NAME", "COLUMN_NAME", -+ "DATA_TYPE", "TYPE_NAME", "COLUMN_SIZE", "BUFFER_LENGTH", -+ "DECIMAL_DIGITS", "NUM_PREC_RADIX", "NULLABLE", "REMARKS", -+ "COLUMN_DEF", "SQL_DATA_TYPE", "SQL_DATETIME_SUB", "CHAR_OCTET_LENGTH", -+ "ORDINAL_POSITION", "IS_NULLABLE", 0 -+ }; -+ statics.columnRowNames = -+ createStringSequence( columnNames ); -+ -+ static const char * typeinfoColumnNames[] = -+ { -+ "TYPE_NAME", "DATA_TYPE", "PRECISION", "LITERAL_PREFIX", -+ "LITERAL_SUFFIX", "CREATE_PARAMS", "NULLABLE", "CASE_SENSITIVE", -+ "SEARCHABLE", "UNSIGNED_ATTRIBUTE", "FIXED_PREC_SCALE", -+ "AUTO_INCREMENT", "LOCAL_TYPE_NAME", "MINIMUM_SCALE", -+ "MAXIMUM_SCALE", "SQL_DATA_TYPE", "SQL_DATETIME_SUB", -+ "NUM_PREC_RADIX", 0 -+ }; -+ statics.typeinfoColumnNames = createStringSequence( typeinfoColumnNames ); -+ -+ static const char * indexinfoColumnNames[] = -+ { -+ "TABLE_CAT", "TABLE_SCHEM", "TABLE_NAME", -+ "NON_UNIQUE", "INDEX_QUALIFIER", "INDEX_NAME", -+ "TYPE", "ORDINAL_POSITION", "COLUMN_NAME", -+ "ASC_OR_DESC", "CARDINALITY", "PAGES", "FILTER_CONDITION",0 -+ }; -+ statics.indexinfoColumnNames = createStringSequence( indexinfoColumnNames ); -+ -+ static const char * importedKeysColumnNames[] = -+ { -+ "PKTABLE_CAT" , -+ "PKTABLE_SCHEM", -+ "PKTABLE_NAME" , -+ "PKCOLUMN_NAME", -+ "FKTABLE_CAT" , -+ "FKTABLE_SCHEM", -+ "FKTABLE_NAME" , -+ "FKCOLUMN_NAME", -+ "KEY_SEQ" , -+ "UPDATE_RULE", -+ "DELETE_RULE", -+ "FK_NAME" , -+ "PK_NAME" , -+ "DEFERRABILITY" , -+ 0 -+ }; -+ statics.importedKeysColumnNames = -+ createStringSequence( importedKeysColumnNames ); -+ -+ static const char * resultSetArrayColumnNames[] = { "INDEX" , "VALUE", 0 }; -+ statics.resultSetArrayColumnNames = -+ createStringSequence( resultSetArrayColumnNames ); -+ -+ BaseTypeDef baseTypeDefs[] = -+ { -+ { "bool" , com::sun::star::sdbc::DataType::BIT }, -+ { "bytea", com::sun::star::sdbc::DataType::VARBINARY }, -+ { "char" , com::sun::star::sdbc::DataType::CHAR }, -+ -+ { "int8" , com::sun::star::sdbc::DataType::BIGINT }, -+ { "serial8" , com::sun::star::sdbc::DataType::BIGINT }, -+ -+ -+ { "int2" , com::sun::star::sdbc::DataType::SMALLINT }, -+ -+ { "int4" , com::sun::star::sdbc::DataType::INTEGER }, -+// { "regproc" , com::sun::star::sdbc::DataType::INTEGER }, -+// { "oid" , com::sun::star::sdbc::DataType::INTEGER }, -+// { "xid" , com::sun::star::sdbc::DataType::INTEGER }, -+// { "cid" , com::sun::star::sdbc::DataType::INTEGER }, -+// { "serial", com::sun::star::sdbc::DataType::INTEGER }, -+// { "serial4", com::sun::star::sdbc::DataType::INTEGER }, -+ -+ { "text", com::sun::star::sdbc::DataType::VARCHAR }, -+ { "bpchar", com::sun::star::sdbc::DataType::CHAR }, -+ { "varchar", com::sun::star::sdbc::DataType::VARCHAR }, -+ -+ { "float4", com::sun::star::sdbc::DataType::REAL }, -+ { "float8", com::sun::star::sdbc::DataType::DOUBLE }, -+ -+ { "numeric", com::sun::star::sdbc::DataType::NUMERIC }, -+ { "decimal", com::sun::star::sdbc::DataType::DECIMAL }, -+ -+ { "date", com::sun::star::sdbc::DataType::DATE }, // switch to date later -+ { "time", com::sun::star::sdbc::DataType::TIME }, // switch to time later -+ { "timestamp", com::sun::star::sdbc::DataType::TIMESTAMP }, // switch to time later -+ -+// { "_bool" , com::sun::star::sdbc::DataType::ARRAY }, -+// { "_bytea", com::sun::star::sdbc::DataType::ARRAY }, -+// { "_char" , com::sun::star::sdbc::DataType::ARRAY }, -+ -+// { "_int8" , com::sun::star::sdbc::DataType::ARRAY }, -+// { "_serial8" , com::sun::star::sdbc::DataType::ARRAY }, -+ -+ -+// { "_int2" , com::sun::star::sdbc::DataType::ARRAY }, -+ -+// { "_int4" , com::sun::star::sdbc::DataType::ARRAY }, -+// { "_regproc" , com::sun::star::sdbc::DataType::ARRAY }, -+// { "_oid" , com::sun::star::sdbc::DataType::ARRAY }, -+// { "_xid" , com::sun::star::sdbc::DataType::ARRAY }, -+// { "_cid" , com::sun::star::sdbc::DataType::ARRAY }, -+ -+// { "_text", com::sun::star::sdbc::DataType::ARRAY }, -+// { "_bpchar", com::sun::star::sdbc::DataType::ARRAY }, -+// { "_varchar", com::sun::star::sdbc::DataType::ARRAY }, -+ -+// { "_float4", com::sun::star::sdbc::DataType::ARRAY }, -+// { "_float8", com::sun::star::sdbc::DataType::ARRAY }, -+ -+// { "_numeric", com::sun::star::sdbc::DataType::ARRAY }, -+// { "_decimal", com::sun::star::sdbc::DataType::ARRAY }, -+ -+// { "_date", com::sun::star::sdbc::DataType::ARRAY }, // switch to date later -+// { "_time", com::sun::star::sdbc::DataType::ARRAY }, // switch to time later -+ -+ { 0, 0 } -+ }; -+ int i; -+ for( i = 0 ; baseTypeDefs[i].typeName ; i ++ ) -+ { -+ statics.baseTypeMap[ -+ OUString::createFromAscii( baseTypeDefs[i].typeName) ] = -+ baseTypeDefs[i].value; -+ } -+ -+ DefColumnMetaData defTypeInfoMetaData[] = -+ { -+ { "TYPE_NAME", "TYPEINFO", "pg_catalog", "", com::sun::star::sdbc::DataType::VARCHAR, 0,50,0,0,0,0 }, // 0 -+ { "DATA_TYPE", "TYPEINFO", "pg_catalog", "", com::sun::star::sdbc::DataType::INTEGER, 0,50,0,0,0,0 }, // 1 -+ { "PRECISION", "TYPEINFO", "pg_catalog", "", com::sun::star::sdbc::DataType::INTEGER, 0,50,0,0,0,0 }, // 2 -+ { "foo1", "TYPEINFO", "pg_catalog", "", com::sun::star::sdbc::DataType::INTEGER, 0,50,0,0,0,0 }, // 3 -+ { "foo2", "TYPEINFO", "pg_catalog", "", com::sun::star::sdbc::DataType::INTEGER, 0,50,0,0,0,0 }, // 4 -+ { "CREATE_PARAMS", "TYPEINFO", "pg_catalog", "", com::sun::star::sdbc::DataType::VARCHAR, 0,50,0,0,0,0 }, // 5 -+ { "NULLABLE", "TYPEINFO", "pg_catalog", "", com::sun::star::sdbc::DataType::INTEGER, 0,50,0,0,0,0 }, // 6 -+ { "CASE_SENSITIVE", "TYPEINFO", "pg_catalog", "", com::sun::star::sdbc::DataType::BIT, 0,50,0,0,0,0 }, // 7 -+ { "SEARCHABLE", "TYPEINFO", "pg_catalog", "", com::sun::star::sdbc::DataType::SMALLINT, 0,50,0,0,0,0 }, // 8 -+ { "UNSIGNED_ATTRIBUTE", "TYPEINFO", "pg_catalog", "", com::sun::star::sdbc::DataType::BIT, 0,50,0,0,0,0 }, // 9 -+ { "FIXED_PREC_SCALE", "TYPEINFO", "pg_catalog", "", com::sun::star::sdbc::DataType::BIT, 0,50,0,0,0,0 }, // 10 -+ { "AUTO_INCREMENT", "TYPEINFO", "pg_catalog", "", com::sun::star::sdbc::DataType::BIT, 0,50,0,0,0,0 }, // 11 -+ { "foo3", "TYPEINFO", "pg_catalog", "", com::sun::star::sdbc::DataType::INTEGER, 0,50,0,0,0,0 }, // 12 -+ { "MINIMUM_SCALE", "TYPEINFO", "pg_catalog", "", com::sun::star::sdbc::DataType::INTEGER, 0,50,0,0,0,0 }, // 13 -+ { "MAXIMUM_SCALE", "TYPEINFO", "pg_catalog", "", com::sun::star::sdbc::DataType::INTEGER, 0,50,0,0,0,0 }, // 14 -+ { "foo4", "TYPEINFO", "pg_catalog", "", com::sun::star::sdbc::DataType::INTEGER, 0,50,0,0,0,0 }, // 15 -+ { "foo5", "TYPEINFO", "pg_catalog", "", com::sun::star::sdbc::DataType::INTEGER, 0,50,0,0,0,0 }, // 16 -+ { "NUM_PREC_RADIX", "TYPEINFO", "pg_catalog", "", com::sun::star::sdbc::DataType::INTEGER, 0,50,0,0,0,0 }, // 17 -+ {0,0,0,0,0,0,0,0,0,0,0} -+ }; -+ -+ for( i = 0 ; defTypeInfoMetaData[i].columnName ; i++ ) -+ { -+ statics.typeInfoMetaData.push_back( -+ ColumnMetaData( -+ rtl::OUString::createFromAscii( defTypeInfoMetaData[i].columnName ), -+ rtl::OUString::createFromAscii( defTypeInfoMetaData[i].tableName ), -+ rtl::OUString::createFromAscii( defTypeInfoMetaData[i].schemaTableName ), -+ rtl::OUString::createFromAscii( defTypeInfoMetaData[i].typeName ), -+ defTypeInfoMetaData[i].type, -+ defTypeInfoMetaData[i].precision, -+ defTypeInfoMetaData[i].scale, -+ defTypeInfoMetaData[i].isCurrency, -+ defTypeInfoMetaData[i].isNullable, -+ defTypeInfoMetaData[i].isAutoIncrement, -+ defTypeInfoMetaData[i].isReadOnly, -+ defTypeInfoMetaData[i].isSigned ) ); -+ } -+ -+ p = &statics; -+ } -+ } -+ return *p; -+} -+ -+ -+ -+} -diff --git connectivity/source/drivers/postgresql/pq_statics.hxx connectivity/source/drivers/postgresql/pq_statics.hxx -new file mode 100644 -index 0000000..5b06a82 ---- /dev/null -+++ connectivity/source/drivers/postgresql/pq_statics.hxx -@@ -0,0 +1,296 @@ -+/************************************************************************* -+ * -+ * $RCSfile: pq_statics.hxx,v $ -+ * -+ * $Revision: 1.1.2.4 $ -+ * -+ * last change: $Author: jbu $ $Date: 2006/01/22 15:14:36 $ -+ * -+ * The Contents of this file are made available subject to the terms of -+ * either of the following licenses -+ * -+ * - GNU Lesser General Public License Version 2.1 -+ * - Sun Industry Standards Source License Version 1.1 -+ * -+ * Sun Microsystems Inc., October, 2000 -+ * -+ * GNU Lesser General Public License Version 2.1 -+ * ============================================= -+ * Copyright 2000 by Sun Microsystems, Inc. -+ * 901 San Antonio Road, Palo Alto, CA 94303, USA -+ * -+ * This library is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License version 2.1, as published by the Free Software Foundation. -+ * -+ * This library is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public -+ * License along with this library; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, -+ * MA 02111-1307 USA -+ * -+ * -+ * Sun Industry Standards Source License Version 1.1 -+ * ================================================= -+ * The contents of this file are subject to the Sun Industry Standards -+ * Source License Version 1.1 (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.openoffice.org/license.html. -+ * -+ * Software provided under this License is provided on an "AS IS" basis, -+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, -+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, -+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. -+ * See the License for the specific provisions governing your rights and -+ * obligations concerning the Software. -+ * -+ * The Initial Developer of the Original Code is: Joerg Budischewski -+ * -+ * Copyright: 2000 by Sun Microsystems, Inc. -+ * -+ * All Rights Reserved. -+ * -+ * Contributor(s): Joerg Budischewski -+ * -+ * -+ ************************************************************************/ -+#ifndef _PQ_STATICS_HXX_ -+#define _PQ_STATICS_HXX_ -+ -+#include -+#include -+ -+#include -+ -+#include -+#include -+#include -+ -+#include -+ -+#include "pq_allocator.hxx" -+ -+namespace pq_sdbc_driver -+{ -+ -+struct ColumnMetaData -+{ -+ ColumnMetaData( -+ const rtl::OUString &_columnName, -+ const rtl::OUString &_tableName, -+ const rtl::OUString &_schemaTableName, -+ const rtl::OUString &_typeName, -+ sal_Int32 _type, -+ sal_Int32 _precision, -+ sal_Int32 _scale, -+ sal_Bool _isCurrency, -+ sal_Bool _isNullable, -+ sal_Bool _isAutoIncrement, -+ sal_Bool _isReadOnly, -+ sal_Bool _isSigned ) : -+ columnName( _columnName ), -+ tableName( _tableName ), -+ schemaTableName( _schemaTableName ), -+ typeName( _typeName ), -+ type( _type ), -+ precision( _precision ), -+ scale( _scale ), -+ isCurrency( _isCurrency ), -+ isNullable( _isNullable ), -+ isAutoIncrement( _isAutoIncrement ), -+ isReadOnly( _isReadOnly ), -+ isSigned( _isSigned ) -+ {} -+ -+ rtl::OUString columnName; -+ rtl::OUString tableName; -+ rtl::OUString schemaTableName; -+ rtl::OUString typeName; -+ sal_Int32 type; -+ sal_Int32 precision; -+ sal_Int32 scale; -+ sal_Bool isCurrency; -+ sal_Bool isNullable; -+ sal_Bool isAutoIncrement; -+ sal_Bool isReadOnly; -+ sal_Bool isSigned; -+}; -+ -+typedef std::vector< ColumnMetaData, Allocator< ColumnMetaData > > ColumnMetaDataVector; -+ -+struct TypeDetails -+{ -+ sal_Int32 dataType; -+ sal_Int32 minScale; -+ sal_Int32 maxScale; // in case nothing is given in getTypeInfo -+ sal_Bool isAutoIncrement; -+ sal_Bool isSearchable; -+}; -+ -+typedef ::std::hash_map -+< -+ rtl::OUString, -+ sal_Int32, -+ rtl::OUStringHash, -+ ::std::equal_to< rtl::OUString >, -+ Allocator< ::std::pair< const ::rtl::OUString , sal_Int32 > > -+> BaseTypeMap; -+ -+ -+ -+struct ImplementationStatics -+{ -+ ImplementationStatics() : -+ implementationId( 16 ) -+ { -+ rtl_createUuid( (sal_uInt8*)implementationId.getArray(), 0 , sal_False ); -+ } -+ -+ rtl::OUString implName; -+ com::sun::star::uno::Sequence< ::rtl::OUString > serviceNames; -+ com::sun::star::uno::Sequence< sal_Int8 > implementationId; -+ cppu::IPropertyArrayHelper *pProps; -+ com::sun::star::uno::Sequence< com::sun::star::uno::Type > types; -+}; -+ -+struct ReflectionImplementations -+{ -+ struct ImplementationStatics table; -+ struct ImplementationStatics tableDescriptor; -+ struct ImplementationStatics column; -+ struct ImplementationStatics columnDescriptor; -+ struct ImplementationStatics key; -+ struct ImplementationStatics keyDescriptor; -+ struct ImplementationStatics keycolumn; -+ struct ImplementationStatics keycolumnDescriptor; -+ struct ImplementationStatics user; -+ struct ImplementationStatics userDescriptor; -+ struct ImplementationStatics view; -+ struct ImplementationStatics viewDescriptor; -+ struct ImplementationStatics index; -+ struct ImplementationStatics indexDescriptor; -+ struct ImplementationStatics indexColumn; -+ struct ImplementationStatics indexColumnDescriptor; -+ -+ struct ImplementationStatics updateableResultSet; -+ struct ImplementationStatics resultSet; -+}; -+ -+static const sal_Int32 TABLE_INDEX_CATALOG = 0; -+static const sal_Int32 TABLE_INDEX_SCHEMA = 1; -+static const sal_Int32 TABLE_INDEX_NAME = 2; -+static const sal_Int32 TABLE_INDEX_TYPE = 3; -+static const sal_Int32 TABLE_INDEX_REMARKS = 4; -+ -+struct Statics -+{ -+ ::rtl::OUString SYSTEM_TABLE; -+ ::rtl::OUString TABLE; -+ ::rtl::OUString VIEW; -+ ::rtl::OUString UNKNOWN; -+ ::rtl::OUString YES; -+ ::rtl::OUString NO; -+ ::rtl::OUString NO_NULLS; -+ ::rtl::OUString NULABLE; -+ ::rtl::OUString NULLABLE_UNKNOWN; -+ ::rtl::OUString SELECT; -+ ::rtl::OUString UPDATE; -+ ::rtl::OUString INSERT; -+ ::rtl::OUString DELETE; -+ ::rtl::OUString RULE; -+ ::rtl::OUString REFERENCES; -+ ::rtl::OUString TRIGGER; -+ ::rtl::OUString EXECUTE; -+ ::rtl::OUString USAGE; -+ ::rtl::OUString CREATE; -+ ::rtl::OUString TEMPORARY; -+ ::rtl::OUString INDEX; -+ ::rtl::OUString INDEX_COLUMN; -+ -+ ::rtl::OUString NAME; -+ ::rtl::OUString SCHEMA_NAME; -+ ::rtl::OUString CATALOG_NAME; -+ ::rtl::OUString DESCRIPTION; -+ ::rtl::OUString TYPE; -+ ::rtl::OUString TYPE_NAME; -+ ::rtl::OUString PRIVILEGES; -+ -+ ::rtl::OUString DEFAULT_VALUE; -+ ::rtl::OUString IS_AUTO_INCREMENT; -+ ::rtl::OUString IS_CURRENCY; -+ ::rtl::OUString IS_NULLABLE; -+ ::rtl::OUString IS_ROW_VERSISON; -+ ::rtl::OUString PRECISION; -+ ::rtl::OUString SCALE; -+ -+ ::rtl::OUString cPERCENT; -+ -+ ::rtl::OUString BEGIN; -+ ::rtl::OUString ROLLBACK; -+ ::rtl::OUString COMMIT; -+ -+ ::rtl::OUString KEY; -+ ::rtl::OUString REFERENCED_TABLE; -+ ::rtl::OUString UPDATE_RULE; -+ ::rtl::OUString DELETE_RULE; -+ ::rtl::OUString PRIVATE_COLUMNS; -+ ::rtl::OUString PRIVATE_FOREIGN_COLUMNS; -+ -+ ::rtl::OUString KEY_COLUMN; -+ ::rtl::OUString RELATED_COLUMN; -+ -+ ::rtl::OUString PASSWORD; -+ ::rtl::OUString USER; -+ -+ ::rtl::OUString CURSOR_NAME; -+ ::rtl::OUString ESCAPE_PROCESSING; -+ ::rtl::OUString FETCH_DIRECTION; -+ ::rtl::OUString FETCH_SIZE; -+ ::rtl::OUString IS_BOOKMARKABLE; -+ ::rtl::OUString RESULT_SET_CONCURRENCY; -+ ::rtl::OUString RESULT_SET_TYPE; -+ -+ ::rtl::OUString COMMAND; -+ ::rtl::OUString CHECK_OPTION; -+ -+ ::rtl::OUString TRUE; -+ ::rtl::OUString FALSE; -+ -+ ::rtl::OUString IS_PRIMARY_KEY_INDEX; -+ ::rtl::OUString IS_CLUSTERED; -+ ::rtl::OUString IS_UNIQUE; -+ ::rtl::OUString PRIVATE_COLUMN_INDEXES; -+ ::rtl::OUString HELP_TEXT; -+ -+ ::rtl::OUString CATALOG; -+ ::rtl::OUString IS_ASCENDING; -+ ReflectionImplementations refl; -+ -+ com::sun::star::uno::Sequence< ::rtl::OUString > tablesRowNames; -+ com::sun::star::uno::Sequence< ::rtl::OUString > columnRowNames; -+ com::sun::star::uno::Sequence< ::rtl::OUString > primaryKeyNames; -+ com::sun::star::uno::Sequence< ::rtl::OUString > tablePrivilegesNames; -+ com::sun::star::uno::Sequence< ::rtl::OUString > schemaNames; -+ com::sun::star::uno::Sequence< ::rtl::OUString > tableTypeNames; -+ com::sun::star::uno::Sequence< ::rtl::OUString > typeinfoColumnNames; -+ com::sun::star::uno::Sequence< ::rtl::OUString > indexinfoColumnNames; -+ com::sun::star::uno::Sequence< ::rtl::OUString > importedKeysColumnNames; -+ com::sun::star::uno::Sequence< ::rtl::OUString > resultSetArrayColumnNames; -+ com::sun::star::uno::Sequence< com::sun::star::uno::Sequence< com::sun::star::uno::Any > > tableTypeData; -+ -+ ColumnMetaDataVector typeInfoMetaData; -+ BaseTypeMap baseTypeMap; -+ Statics(){} -+private: -+ Statics( const Statics & ); -+ Statics & operator = ( const Statics & ); -+}; -+ -+Statics & getStatics(); -+ -+} -+#endif -diff --git connectivity/source/drivers/postgresql/pq_tools.cxx connectivity/source/drivers/postgresql/pq_tools.cxx -new file mode 100644 -index 0000000..c6b16e0 ---- /dev/null -+++ connectivity/source/drivers/postgresql/pq_tools.cxx -@@ -0,0 +1,1232 @@ -+#include -+#include -+ -+#include -+#include -+ -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include "pq_xcontainer.hxx" -+#include "pq_tools.hxx" -+#include "pq_statics.hxx" -+ -+#include -+ -+using rtl::OUString; -+using rtl::OUStringBuffer; -+ -+using com::sun::star::beans::XPropertySet; -+ -+using com::sun::star::lang::XComponent; -+ -+using com::sun::star::sdbc::SQLException; -+using com::sun::star::sdbc::XStatement; -+using com::sun::star::sdbc::XConnection; -+using com::sun::star::sdbc::XPreparedStatement; -+using com::sun::star::sdbc::XParameters; -+using com::sun::star::sdbc::XResultSet; -+using com::sun::star::sdbc::XRow; -+ -+using com::sun::star::sdbcx::XColumnsSupplier; -+ -+using com::sun::star::uno::UNO_QUERY; -+using com::sun::star::uno::Reference; -+using com::sun::star::uno::Sequence; -+using com::sun::star::uno::XInterface; -+using com::sun::star::uno::Any; -+using com::sun::star::uno::makeAny; -+ -+using com::sun::star::container::XEnumeration; -+using com::sun::star::container::XEnumerationAccess; -+ -+namespace pq_sdbc_driver -+{ -+#define ASCII_STR(x) rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( x ) ) -+ -+rtl::OUString date2String( const com::sun::star::util::Date & x ) -+{ -+ char buffer[64]; -+ sprintf( buffer, "%d-%02d-%02d", x.Year, x.Month, x.Day ); -+ return OUString::createFromAscii( buffer ); -+} -+ -+com::sun::star::util::Date string2Date( const rtl::OUString &date ) -+{ -+ // Format: Year-Month-Day -+ com::sun::star::util::Date ret; -+ -+ ret.Year = (sal_Int32) rtl_ustr_toInt32( date.pData->buffer, 10 ); -+ -+ int index = date.indexOf( '-' ); -+ if( index >= 0 ) -+ { -+ ret.Month = (sal_Int32)rtl_ustr_toInt32( &(date.pData->buffer[ index+1]), 10 ); -+ int start = index; -+ index = date.indexOf( '-', start+1 ); -+ if( index >= 0 ) -+ { -+ ret.Day = (sal_Int32)rtl_ustr_toInt32( &date.pData->buffer[index+1], 10 ); -+ } -+ } -+ return ret; -+} -+ -+rtl::OUString time2String( const com::sun::star::util::Time & x ) -+{ -+ char buffer[64]; -+ sprintf( buffer, "%02d:%02d:%02d.%02d", x.Hours, x.Minutes, x.Seconds, x.HundredthSeconds ); -+ return OUString::createFromAscii( buffer ); -+ -+} -+ -+ -+com::sun::star::util::Time string2Time( const rtl::OUString & time ) -+{ -+ com::sun::star::util::Time ret; -+ -+ sal_Unicode temp[4]; -+ -+ temp[0] = time[0]; -+ temp[1] = time[1]; -+ temp[2] = 0; -+ ret.Hours = (sal_Int32)rtl_ustr_toInt32( temp , 10 ); -+ -+ temp[0] = time[3]; -+ temp[1] = time[4]; -+ ret.Minutes = (sal_Int32)rtl_ustr_toInt32( temp , 10 ); -+ -+ temp[0] = time[6]; -+ temp[1] = time[7]; -+ ret.Seconds = (sal_Int32)rtl_ustr_toInt32( temp , 10 ); -+ -+ if( time.getLength() >9 ) -+ { -+ ret.HundredthSeconds = (sal_Int32)rtl_ustr_toInt32( &time[9] , 10 ); -+ } -+ return ret; -+ -+} -+ -+ -+ -+rtl::OUString dateTime2String( const com::sun::star::util::DateTime & x ) -+{ -+ char buffer[128]; -+ sprintf( buffer, "%d-%02d-%02d %02d:%02d:%02d.%02d", -+ x.Year, x.Month, x.Day, -+ x.Hours, x.Minutes, x.Seconds, x.HundredthSeconds ); -+ return OUString::createFromAscii( buffer ); -+ -+} -+ -+com::sun::star::util::DateTime string2DateTime( const rtl::OUString & dateTime ) -+{ -+ int space = dateTime.indexOf( ' ' ); -+ com::sun::star::util::DateTime ret; -+ -+ if( space >= 0 ) -+ { -+ com::sun::star::util::Date date ( string2Date( OUString( dateTime.getStr(), space ) ) ); -+ com::sun::star::util::Time time( string2Time( OUString( dateTime.getStr() + space +1 ) ) ); -+ ret.Day = date.Day; -+ ret.Month = date.Month; -+ ret.Year = date.Year; -+ -+ ret.Hours = time.Hours; -+ ret.Minutes = time.Minutes; -+ ret.Seconds = time.Seconds; -+ ret.HundredthSeconds = time.HundredthSeconds; -+ } -+ return ret; -+} -+ -+rtl::OUString concatQualified( const rtl::OUString & a, const rtl::OUString &b) -+{ -+ rtl::OUStringBuffer buf( a.getLength() + 2 + b.getLength() ); -+ buf.append( a ); -+ buf.appendAscii( RTL_CONSTASCII_STRINGPARAM( "." ) ); -+ buf.append( b ); -+ return buf.makeStringAndClear(); -+} -+ -+void bufferEscapeConstant( rtl::OUStringBuffer & buf, const rtl::OUString & value, sal_Int32 encoding ) -+{ -+ rtl::OString y = rtl::OUStringToOString( value, encoding ); -+ rtl::OStringBuffer strbuf( y.getLength() * 2 + 2 ); -+ int len = PQescapeString( ((char*)strbuf.getStr()), y.getStr() , y.getLength() ); -+ strbuf.setLength( len ); -+ buf.append( rtl::OStringToOUString( strbuf.makeStringAndClear(), RTL_TEXTENCODING_ASCII_US ) ); -+} -+ -+void bufferQuoteConstant( rtl::OUStringBuffer & buf, const rtl::OUString & value, sal_Int32 encoding ) -+{ -+ buf.appendAscii( RTL_CONSTASCII_STRINGPARAM( " '" ) ); -+ bufferEscapeConstant( buf, value, encoding ); -+ buf.appendAscii( RTL_CONSTASCII_STRINGPARAM( "' " ) ); -+} -+ -+void bufferQuoteQualifiedIdentifier( -+ rtl::OUStringBuffer & buf, const rtl::OUString &schema, const rtl::OUString &name) -+{ -+ buf.appendAscii( RTL_CONSTASCII_STRINGPARAM(" \"" ) ); -+ buf.append(schema); -+ buf.appendAscii( RTL_CONSTASCII_STRINGPARAM("\".\"" ) ); -+ buf.append( name ); -+ buf.appendAscii( RTL_CONSTASCII_STRINGPARAM( "\" " ) ); -+} -+ -+void bufferQuoteQualifiedIdentifier( -+ rtl::OUStringBuffer & buf, -+ const rtl::OUString &schema, -+ const rtl::OUString &name, -+ const rtl::OUString &col) -+{ -+ buf.appendAscii( RTL_CONSTASCII_STRINGPARAM(" \"" ) ); -+ buf.append(schema); -+ buf.appendAscii( RTL_CONSTASCII_STRINGPARAM("\".\"" ) ); -+ buf.append( name ); -+ buf.appendAscii( RTL_CONSTASCII_STRINGPARAM("\".\"" ) ); -+ buf.append( col ); -+ buf.appendAscii( RTL_CONSTASCII_STRINGPARAM( "\" " ) ); -+} -+ -+ -+void bufferQuoteIdentifier( rtl::OUStringBuffer & buf, const rtl::OUString &toQuote ) -+{ -+ buf.appendAscii( RTL_CONSTASCII_STRINGPARAM( " \"") ); -+ buf.append( toQuote ); -+ buf.appendAscii( RTL_CONSTASCII_STRINGPARAM( "\" " ) ); -+} -+ -+ -+ -+rtl::OUString extractStringProperty( -+ const Reference< XPropertySet > & descriptor, const rtl::OUString &name ) -+{ -+ rtl::OUString value; -+ descriptor->getPropertyValue( name ) >>= value; -+ return value; -+} -+ -+sal_Bool extractBoolProperty( -+ const Reference< XPropertySet > & descriptor, const rtl::OUString &name ) -+{ -+ sal_Bool value = sal_False; -+ descriptor->getPropertyValue( name ) >>= value; -+ return value; -+} -+ -+sal_Int32 extractIntProperty( -+ const Reference< XPropertySet > & descriptor, const rtl::OUString &name ) -+{ -+ sal_Int32 ret = 0; -+ descriptor->getPropertyValue( name ) >>= ret; -+ return ret; -+} -+ -+void disposeObject( const com::sun::star::uno::Reference< com::sun::star::uno::XInterface > & r ) -+{ -+ Reference< XComponent > comp( r, UNO_QUERY ); -+ if( comp.is() ) -+ comp->dispose(); -+} -+ -+void disposeNoThrow( const com::sun::star::uno::Reference< com::sun::star::uno::XInterface > & r ) -+{ -+ try -+ { -+ disposeObject( r ); -+ } -+ catch( SQLException & e ) -+ { -+ // ignore this -+ } -+ -+} -+ -+void rollbackNoThrow( const com::sun::star::uno::Reference< com::sun::star::sdbc::XConnection > & r ) -+{ -+ try -+ { -+ Reference< XStatement > stmt = r->createStatement(); -+ stmt->executeUpdate( getStatics().ROLLBACK ); -+ -+ } -+ catch( SQLException & ) -+ { -+ // ignore this -+ } -+} -+ -+Reference< XConnection > extractConnectionFromStatement( const Reference< XInterface > & stmt ) -+{ -+ Reference< XConnection > ret; -+ -+ Reference< com::sun::star::sdbc::XStatement > owner( stmt, UNO_QUERY ); -+ if( owner.is() ) -+ ret = owner->getConnection(); -+ else -+ { -+ Reference< com::sun::star::sdbc::XPreparedStatement > myowner( stmt, UNO_QUERY ); -+ if( myowner.is() ) -+ ret = myowner->getConnection(); -+ if( ! ret.is() ) -+ throw SQLException( -+ ASCII_STR( "PQSDBC: Couldn't retrieve connection from statement" ), -+ Reference< XInterface > () , rtl::OUString(), 0 , com::sun::star::uno::Any() ); -+ } -+ -+ return ret; -+ -+} -+ -+DisposeGuard::DisposeGuard( const Reference< XInterface > & r ) -+ : d( r ) -+{} -+ -+DisposeGuard::~DisposeGuard() -+{ -+ disposeNoThrow( d ); -+} -+ -+TransactionGuard::TransactionGuard( const Reference< XStatement > &stmt ) -+ : m_stmt( stmt ), -+ m_commited( sal_False ) -+{ -+ m_stmt->executeUpdate( getStatics().BEGIN ); -+} -+ -+void TransactionGuard::commit() -+{ -+ m_stmt->executeUpdate( getStatics().COMMIT ); -+ m_commited = sal_True; -+} -+ -+void TransactionGuard::executeUpdate( const rtl::OUString & sql ) -+{ -+ m_stmt->executeUpdate( sql ); -+} -+ -+TransactionGuard::~TransactionGuard() -+{ -+ try -+ { -+ if( ! m_commited ) -+ m_stmt->executeUpdate( getStatics().ROLLBACK ); -+ } -+ catch( com::sun::star::uno::Exception & e ) -+ { -+ // ignore, we are within a dtor -+ } -+ -+ disposeNoThrow( m_stmt ); -+} -+ -+ -+bool isWhitespace( sal_Unicode c ) -+{ -+ return ' ' == c || 9 == c || 10 == c || 13 == c; -+} -+ -+::rtl::OUString extractTableFromInsert( const rtl::OUString & sql ) -+{ -+ rtl::OUString ret; -+ int i = 0; -+ for( ; i < sql.getLength() && isWhitespace(sql[i]) ; i++ ); -+ -+ if( 0 == rtl_ustr_ascii_shortenedCompareIgnoreAsciiCase_WithLength( -+ &sql[i], sql.getLength() - i, "insert" , 6 ) ) -+ { -+ i += 6; -+ for( ; i < sql.getLength() && isWhitespace(sql[i]) ; i++ ); -+ if( 0 == rtl_ustr_ascii_shortenedCompareIgnoreAsciiCase_WithLength( -+ &sql[i], sql.getLength() - i, "into" , 4 ) ) -+ { -+ i +=4; -+ for( ; i < sql.getLength() && isWhitespace(sql[i]) ; i++ ); -+ int start = i; -+ bool quote = (sql[i] == '"'); -+ for( i++ ; i < sql.getLength() ; i ++ ) -+ { -+ if( quote && sql[i] == '"' ) -+ { -+ for( i++ ; i < sql.getLength() && isWhitespace(sql[i]) ; i++ ); -+ if( '.' == sql[i] ) -+ { -+ for( i++ ; i < sql.getLength() && isWhitespace(sql[i]) ; i++ ); -+ if( '"' == sql[i] ) -+ { -+ // the second part of the table name does not use quotes -+ // parse on -+ quote = 0; -+ } -+ } -+ else -+ { -+ // end quoted name, ok -+ break; -+ } -+ } -+ else -+ { -+ if( isWhitespace( sql[i] ) ) -+ { -+ // found the end of an unquoted name -+ break; -+ } -+ } -+ } -+ ret = rtl::OUString( &sql[start], i - start ).trim(); -+// printf( "pq_statement: parsed table name %s from insert\n" , -+// OUStringToOString( ret, RTL_TEXTENCODING_ASCII_US).getStr() ); -+ } -+ } -+ return ret; -+} -+ -+ -+static bool isOperator( char c ) -+{ -+ bool ret; -+ switch(c) -+ { -+ case '+': -+ case '-': -+ case '*': -+ case '/': -+ case '<': -+ case '>': -+ case '=': -+ case '~': -+ case '!': -+ case '@': -+ case '#': -+ case '%': -+ case '^': -+ case '&': -+ case '|': -+ case '`': -+ case '?': -+ case '$': -+ ret = true; -+ default: -+ ret = false; -+ } -+ return ret; -+} -+ -+void splitSQL( const rtl::OString & sql, OStringVector &vec ) -+{ -+ int length = sql.getLength(); -+ -+ int i = 0; -+ bool singleQuote = false; -+ bool doubleQuote = false; -+ int start = 0; -+ for( ; i < length ; i ++ ) -+ { -+ char c = sql[i]; -+ if( doubleQuote ) -+ { -+ if( '"' == c ) -+ { -+ vec.push_back( rtl::OString( &sql[start], i-start+1 ) ); -+ start = i + 1; -+ doubleQuote = false; -+ } -+ } -+ else if( singleQuote ) -+ { -+ if( '\'' == c && '\'' == sql[i+1] ) -+ { -+ // two subsequent single quotes within a quoted string -+ // mean a single quote within the string -+ i ++; -+ } -+ else if( '\'' == c ) -+ { -+ vec.push_back( rtl::OString( &sql[start], i - start +1 ) ); -+ start = i + 1; // leave single quotes ! -+ singleQuote = false; -+ } -+ } -+ else -+ { -+ if( '"' == c ) -+ { -+ vec.push_back( rtl::OString( &sql[start], i - start ) ); -+ doubleQuote = true; -+ start = i; -+ } -+ else if( '\'' == c ) -+ { -+ vec.push_back( rtl::OString( &sql[start], i - start ) ); -+ singleQuote = true; -+ start = i; -+ } -+ } -+ } -+ if( start < i ) -+ vec.push_back( rtl::OString( &sql[start] , i - start ) ); -+ -+// for( i = 0 ; i < vec.size() ; i ++ ) -+// printf( "%s!" , vec[i].getStr() ); -+// printf( "\n" ); -+ -+} -+ -+void tokenizeSQL( const rtl::OString & sql, OStringVector &vec ) -+{ -+ int length = sql.getLength(); -+ -+ int i = 0; -+ bool singleQuote = false; -+ bool doubleQuote = false; -+ int start = 0; -+ for( ; i < length ; i ++ ) -+ { -+ char c = sql[i]; -+ if( doubleQuote ) -+ { -+ if( '"' == c ) -+ { -+ vec.push_back( rtl::OString( &sql[start], i-start ) ); -+ start = i + 1; -+ doubleQuote = false; -+ } -+ } -+ else if( singleQuote ) -+ { -+ if( '\'' == c ) -+ { -+ vec.push_back( rtl::OString( &sql[start], i - start +1 ) ); -+ start = i + 1; // leave single quotes ! -+ singleQuote = false; -+ } -+ } -+ else -+ { -+ if( '"' == c ) -+ { -+ doubleQuote = true; -+ start = i +1; // skip double quotes ! -+ } -+ else if( '\'' == c ) -+ { -+ singleQuote = true; -+ start = i; // leave single quotes -+ } -+ else if( isWhitespace( c ) ) -+ { -+ if( i == start ) -+ start ++; // skip additional whitespace -+ else -+ { -+ vec.push_back( rtl::OString( &sql[start], i - start ) ); -+ start = i +1; -+ } -+ } -+ else if( ',' == c || isOperator( c ) || '(' == c || ')' == c ) -+ { -+ if( i - start ) -+ vec.push_back( rtl::OString( &sql[start], i - start ) ); -+ vec.push_back( rtl::OString( &sql[i], 1 ) ); -+ start = i + 1; -+ } -+ else if( '.' == c ) -+ { -+ if( ( i > start && sql[start] >= '0' && sql[start] <= '9' ) || -+ ( i == start && i > 1 && isWhitespace( sql[i-1] ) ) ) -+ { -+ // ignore, is a literal -+ } -+ else -+ { -+ if( i - start ) -+ vec.push_back( rtl::OString( &sql[start], i - start ) ); -+ vec.push_back( rtl::OString( RTL_CONSTASCII_STRINGPARAM( "." ) ) ); -+ start = i + 1; -+ } -+ } -+ } -+ } -+ if( start < i ) -+ vec.push_back( rtl::OString( &sql[start] , i - start ) ); -+ -+// for( i = 0 ; i < vec.size() ; i ++ ) -+// printf( "%s!" , vec[i].getStr() ); -+// printf( "\n" ); -+} -+ -+ -+void splitConcatenatedIdentifier( const rtl::OUString & source, rtl::OUString *first, rtl::OUString *second) -+{ -+ OStringVector vec; -+ tokenizeSQL( rtl::OUStringToOString( source, RTL_TEXTENCODING_UTF8 ), vec ); -+ if( vec.size() == 3 ) -+ { -+ *first = rtl::OStringToOUString( vec[0] , RTL_TEXTENCODING_UTF8 ); -+ *second = rtl::OStringToOUString( vec[2], RTL_TEXTENCODING_UTF8 ); -+ } -+} -+ -+typedef std::vector< sal_Int32 , Allocator< sal_Int32 > > IntVector; -+ -+ -+rtl::OUString array2String( const com::sun::star::uno::Sequence< Any > &seq ) -+{ -+ OUStringBuffer buf(128); -+ int len = seq.getLength(); -+ buf.appendAscii( RTL_CONSTASCII_STRINGPARAM( "{" ) ); -+ for( int i = 0 ; i < len ; i ++ ) -+ { -+ OUString element; -+ seq[i] >>= element; -+ -+ if( i > 0 ) -+ buf.appendAscii( RTL_CONSTASCII_STRINGPARAM(",") ); -+ int strLength = element.getLength(); -+ buf.appendAscii( RTL_CONSTASCII_STRINGPARAM( "\"") ); -+ for( int j = 0 ; j < strLength ; j ++ ) -+ { -+ sal_Unicode c = element[j]; -+ if( c == '\\' || c == '"' || c == '{' || c == '}' ) -+ { -+ buf.appendAscii( RTL_CONSTASCII_STRINGPARAM( "\\" ) ); -+ } -+ buf.append( c ); -+ } -+ buf.appendAscii( RTL_CONSTASCII_STRINGPARAM( "\"" ) ); -+ } -+ buf.appendAscii( RTL_CONSTASCII_STRINGPARAM( "}" ) ); -+ return buf.makeStringAndClear(); -+} -+ -+typedef -+std::vector -+< -+ com::sun::star::uno::Any, -+ Allocator< com::sun::star::uno::Any > -+> AnyVector; -+ -+com::sun::star::uno::Sequence< Any > parseArray( const rtl::OUString & str ) throw( SQLException ) -+{ -+ com::sun::star::uno::Sequence< Any > ret; -+ -+ int len = str.getLength(); -+ bool doubleQuote = false; -+ int brackets = 0; -+ int i = 0; -+ -+ OUStringBuffer current; -+ AnyVector elements; -+ bool doubleQuotedValue = false; -+ while( i < len ) -+ { -+ sal_Unicode c = str[i]; -+ sal_Unicode cnext = str[i+1]; -+ if( doubleQuote ) -+ { -+ if( '\\' == c ) -+ { -+ i ++; -+ current.append( cnext ); -+ } -+ else if( '"' == c ) -+ { -+ doubleQuote = false; -+ doubleQuotedValue = true; // signal, that there was an empty element -+ } -+ else -+ { -+ current.append( c ); -+ } -+ } -+ else if ( '{' == c ) -+ { -+ brackets ++; -+ } -+ else if( '}' == c ) -+ { -+ brackets --; -+ if( brackets < 0 ) -+ { -+ -+ OUStringBuffer buf; -+ buf.appendAscii( "error during array parsing, didn't expect a } at position " ); -+ buf.append( (sal_Int32) i ); -+ buf.appendAscii( " ('" ); -+ buf.append( str ); -+ buf.appendAscii( "')" ); -+ throw SQLException( -+ buf.makeStringAndClear(), -+ Reference< XInterface > (), rtl::OUString(), 1, Any() ); -+ } -+ if( brackets == 0 ) -+ { -+ if( current.getLength() > 0 || doubleQuotedValue ) -+ elements.push_back( makeAny( current.makeStringAndClear() ) ); -+ } -+ else -+ { -+ current.append( c ); -+ } -+ } -+ else if( '"' == c ) -+ { -+// if( current.getLength() != 0 ) -+// { -+// OUStringBuffer buf; -+// buf.appendAscii( "error during array parsing, didn't expect a \" at position " ); -+// buf.append( i ); -+// buf.append( " ('" ); -+// buf.append( str ); -+// buf.append( "')" ); -+// throw SDBCException( -+// buf.makeStringAndClear(), -+// Reference< XInterface > (), 1, Any() ); -+// } -+// else -+// { -+ doubleQuote = true; -+// } -+ } -+ else if( ',' == c && brackets == 1) -+ { -+ doubleQuotedValue = false; -+ elements.push_back( makeAny( current.makeStringAndClear() ) ); -+ } -+ else if( isWhitespace( c ) ) -+ { -+ // ignore whitespace without quotes -+ } -+ else -+ { -+ current.append( c ); -+ } -+ i++; -+ } -+ ret = Sequence< Any > ( &elements[0] , elements.size() ); -+ return ret; -+} -+ -+com::sun::star::uno::Sequence< sal_Int32 > parseIntArray( const ::rtl::OUString & str ) -+{ -+ sal_Int32 start = 0; -+ IntVector vec; -+// printf( ">%s<\n" , OUStringToOString( str, RTL_TEXTENCODING_UTF8 ).getStr() ); -+ for( sal_Int32 i = str.indexOf( ' ' ) ; i != -1 ; i = str.indexOf( ' ', start) ) -+ { -+ vec.push_back( (sal_Int32)rtl_ustr_toInt32( &str.pData->buffer[start], 10 ) ); -+// printf( "found %d\n" , rtl_ustr_toInt32( &str.pData->buffer[start], 10 )); -+ start = i + 1; -+ } -+ vec.push_back( (sal_Int32)rtl_ustr_toInt32( &str.pData->buffer[start], 10 ) ); -+// printf( "found %d\n" , rtl_ustr_toInt32( &str.pData->buffer[start], 10 )); -+ return Sequence< sal_Int32 > ( &vec[0], vec.size() ); -+} -+ -+void fillAttnum2attnameMap( -+ Int2StringMap &map, -+ const Reference< com::sun::star::sdbc::XConnection > &conn, -+ const rtl::OUString &schema, -+ const rtl::OUString &table ) -+{ -+ Reference< XPreparedStatement > prep = conn->prepareStatement( -+ ASCII_STR( "SELECT attname,attnum " -+ "FROM pg_attribute " -+ "INNER JOIN pg_class ON attrelid = pg_class.oid " -+ "INNER JOIN pg_namespace ON pg_class.relnamespace = pg_namespace.oid " -+ "WHERE relname=? AND nspname=?" ) ); -+ -+ Reference< XParameters > paras( prep, UNO_QUERY ); -+ paras->setString( 1 , table ); -+ paras->setString( 2 , schema ); -+ Reference< XResultSet > rs = prep->executeQuery(); -+ -+ Reference< XRow > xRow( rs , UNO_QUERY ); -+ while( rs->next() ) -+ { -+ map[ xRow->getInt(2) ] = xRow->getString(1); -+ } -+} -+ -+::rtl::OString extractSingleTableFromSelect( const OStringVector &vec ) -+{ -+ rtl::OString ret; -+ int token = 0; -+ -+ if( 0 == rtl_str_shortenedCompareIgnoreAsciiCase_WithLength( -+ vec[0].pData->buffer, vec[0].pData->length, "select" , 6 , 6 ) ) -+ { -+ for( token = 1; token < vec.size() ; token ++ ) -+ { -+ if( 0 == rtl_str_shortenedCompareIgnoreAsciiCase_WithLength( -+ vec[token].getStr(), vec[token].getLength(), "from" , 4 , 4 ) ) -+ { -+ // found from -+ break; -+ } -+ } -+ token ++; -+ -+ if( token < vec.size() && 0 == rtl_str_shortenedCompareIgnoreAsciiCase_WithLength( -+ vec[token].pData->buffer, vec[token].pData->length, "only " , 4 , 4 ) ) -+ { -+ token ++; -+ } -+ -+ if( token < vec.size() && rtl_str_compare_WithLength( -+ vec[token].getStr(), vec[token].getLength(), -+ RTL_CONSTASCII_STRINGPARAM("(") ) ) -+ { -+ // it is a table or a function name -+ rtl::OStringBuffer buf(128); -+ if( '"' == vec[token][0] ) -+ buf.append( &(vec[token][1]) , vec[token].getLength() -2 ); -+ else -+ buf.append( vec[token] ); -+ token ++; -+ -+ if( token < vec.size() ) -+ { -+ if( rtl_str_compare_WithLength( -+ vec[token].getStr(), vec[token].getLength(), -+ RTL_CONSTASCII_STRINGPARAM( "." ) ) == 0 ) -+ { -+ buf.append( vec[token] ); -+ token ++; -+ if( token < vec.size() ) -+ { -+ if( '"' == vec[token][0] ) -+ buf.append( &(vec[token][1]) , vec[token].getLength() -2 ); -+ else -+ buf.append( vec[token] ); -+ token ++; -+ } -+ } -+ } -+ -+ ret = buf.makeStringAndClear(); -+ // now got my table candidate -+ -+ if( token < vec.size() && rtl_str_compare_WithLength( -+ vec[token].getStr(), vec[token].getLength(), -+ RTL_CONSTASCII_STRINGPARAM( "(" ) ) == 0 ) -+ { -+ // whoops, it is a function -+ ret = rtl::OString(); -+ } -+ else -+ { -+ if( token < vec.size() ) -+ { -+ if( 0 == rtl_str_shortenedCompareIgnoreAsciiCase_WithLength( -+ vec[token].pData->buffer, vec[token].pData->length, "as" , 2, 2 ) ) -+ { -+ token += 2; // skip alias -+ } -+ } -+ -+ if( token < vec.size() ) -+ { -+ if( rtl_str_compare_WithLength( -+ vec[token].getStr(), vec[token].getLength(), -+ RTL_CONSTASCII_STRINGPARAM( "," ) ) == 0 ) -+ { -+ // whoops, multiple tables are used -+ ret = rtl::OString(); -+ } -+ else -+ { -+ static const char * forbiddenKeywords[] = -+ { "join", "natural", "outer", "inner", "left", "right", "full" , 0 }; -+ for( int i = 0 ; forbiddenKeywords[i] ; i ++ ) -+ { -+ if( 0 == rtl_str_shortenedCompareIgnoreAsciiCase_WithLength( -+ vec[token].pData->buffer, vec[token].pData->length, -+ forbiddenKeywords[i], strlen(forbiddenKeywords[i]), -+ strlen(forbiddenKeywords[i]) ) ) -+ { -+ // whoops, it is a join -+ ret = rtl::OString(); -+ } -+ } -+ } -+ } -+ } -+ } -+ } -+ return ret; -+ -+} -+ -+com::sun::star::uno::Sequence< sal_Int32 > string2intarray( const ::rtl::OUString & str ) -+{ -+ com::sun::star::uno::Sequence< sal_Int32 > ret; -+ if( str.getLength() > 1 && '{' == str[0] ) -+ { -+ std::vector< sal_Int32, Allocator< sal_Int32 > > vec; -+ sal_Int32 start = 0; -+ do -+ { -+ start ++; -+ vec.push_back( (sal_Int32)rtl_ustr_toInt32( &str[start], 10 ) ); -+ start = str.indexOf( ',' , start ); -+ } while( start != -1 ); -+ ret = com::sun::star::uno::Sequence< sal_Int32 > ( &vec[0] , vec.size() ); -+ } -+ return ret; -+} -+ -+ -+Sequence< rtl::OUString > convertMappedIntArray2StringArray( -+ const Int2StringMap &map, const Sequence< sal_Int32 > &intArray ) -+{ -+ Sequence< ::rtl::OUString > ret( intArray.getLength() ); -+ for( int i = 0; i < intArray.getLength() ; i ++ ) -+ { -+ Int2StringMap::const_iterator ii = map.find( intArray[i] ); -+ if( ii != map.end() ) -+ ret[i] = ii->second; -+ } -+ return ret; -+} -+ -+ -+::rtl::OUString sqltype2string( const Reference< XPropertySet > & desc ) -+{ -+ OUStringBuffer typeName; -+ typeName.append( extractStringProperty( desc, getStatics().TYPE_NAME ) ); -+ sal_Int32 precision = extractIntProperty( desc, getStatics().PRECISION ); -+ -+ if( precision ) -+ { -+ switch( extractIntProperty( desc, getStatics().TYPE ) ) -+ { -+ case com::sun::star::sdbc::DataType::VARBINARY: -+ case com::sun::star::sdbc::DataType::VARCHAR: -+ case com::sun::star::sdbc::DataType::CHAR: -+ { -+ typeName.appendAscii( RTL_CONSTASCII_STRINGPARAM( "(" ) ); -+ typeName.append( precision ); -+ typeName.appendAscii( RTL_CONSTASCII_STRINGPARAM( ")" ) ); -+ break; -+ } -+ case com::sun::star::sdbc::DataType::DECIMAL: -+ case com::sun::star::sdbc::DataType::NUMERIC: -+ { -+ typeName.appendAscii( RTL_CONSTASCII_STRINGPARAM( "(" ) ); -+ typeName.append( precision ); -+ typeName.appendAscii( RTL_CONSTASCII_STRINGPARAM( "," ) ); -+ typeName.append( extractIntProperty( desc, getStatics().SCALE ) ); -+ typeName.appendAscii( RTL_CONSTASCII_STRINGPARAM( ")" ) ); -+ break; -+ } -+ default: -+ ((void)0); -+ } -+ } -+ return typeName.makeStringAndClear(); -+} -+ -+ -+ -+ -+static void keyType2String( OUStringBuffer & buf, sal_Int32 keyType ) -+{ -+ if( com::sun::star::sdbc::KeyRule::CASCADE == keyType ) -+ { -+ buf.appendAscii( RTL_CONSTASCII_STRINGPARAM( "CASCADE " ) ); -+ } -+ else if( com::sun::star::sdbc::KeyRule::RESTRICT == keyType ) -+ { -+ buf.appendAscii( RTL_CONSTASCII_STRINGPARAM( "RESTRICT " ) ); -+ } -+ else if( com::sun::star::sdbc::KeyRule::SET_DEFAULT == keyType ) -+ { -+ buf.appendAscii( RTL_CONSTASCII_STRINGPARAM( "SET DEFAULT " ) ); -+ } -+ else if( com::sun::star::sdbc::KeyRule::SET_NULL == keyType ) -+ { -+ buf.appendAscii( RTL_CONSTASCII_STRINGPARAM( "SET NULL " ) ); -+ } -+ else //if( com::sun::star::sdbc::KeyRule::NO_ACTION == keyType ) -+ { -+ buf.appendAscii( RTL_CONSTASCII_STRINGPARAM( "NO ACTION " ) ); -+ } -+} -+ -+void bufferKey2TableConstraint( -+ OUStringBuffer &buf, const Reference< XPropertySet > &key ) -+{ -+ Statics &st = getStatics(); -+ sal_Int32 type = extractIntProperty( key, st.TYPE ); -+ OUString referencedTable = extractStringProperty( key, st.REFERENCED_TABLE ); -+ sal_Int32 updateRule = extractIntProperty( key, st.UPDATE_RULE ); -+ sal_Int32 deleteRule = extractIntProperty( key, st.DELETE_RULE ); -+ bool foreign = false; -+ if( type == com::sun::star::sdbcx::KeyType::UNIQUE ) -+ { -+ buf.appendAscii( RTL_CONSTASCII_STRINGPARAM( "UNIQUE( " ) ); -+ } -+ else if( type == com::sun::star::sdbcx::KeyType::PRIMARY ) -+ { -+ buf.appendAscii( RTL_CONSTASCII_STRINGPARAM( "PRIMARY KEY( " ) ); -+ } -+ else if( type == com::sun::star::sdbcx::KeyType::FOREIGN ) -+ { -+ foreign = true; -+ buf.appendAscii( RTL_CONSTASCII_STRINGPARAM( "FOREIGN KEY( " ) ); -+ } -+ -+ Reference< XColumnsSupplier > columns( key, UNO_QUERY ); -+ if( columns.is() ) -+ { -+ Reference< XEnumerationAccess > colEnumAccess( columns->getColumns(), UNO_QUERY ); -+ if( colEnumAccess.is() ) -+ { -+ Reference< XEnumeration > colEnum = colEnumAccess->createEnumeration(); -+ bool first = true; -+ while(colEnum.is() && colEnum->hasMoreElements() ) -+ { -+ if( first ) -+ { -+ first = false; -+ } -+ else -+ { -+ buf.appendAscii( RTL_CONSTASCII_STRINGPARAM( ", " ) ); -+ } -+ Reference< XPropertySet > keyColumn( colEnum->nextElement(), UNO_QUERY ); -+ bufferQuoteIdentifier(buf, extractStringProperty( keyColumn, st.NAME ) ); -+ } -+ } -+ } -+ buf.appendAscii( RTL_CONSTASCII_STRINGPARAM( ") " )); -+ -+ if( foreign ) -+ { -+ buf.appendAscii( RTL_CONSTASCII_STRINGPARAM( "REFERENCES " ) ); -+ OUString schema; -+ OUString tableName; -+ splitConcatenatedIdentifier( referencedTable, &schema, &tableName ); -+ bufferQuoteQualifiedIdentifier(buf , schema, tableName); -+ if(columns.is() ) -+ { -+ Reference< XEnumerationAccess > colEnumAccess( columns->getColumns(), UNO_QUERY); -+ if( colEnumAccess.is() ) -+ { -+ buf.appendAscii( RTL_CONSTASCII_STRINGPARAM( " (" ) ); -+ Reference< XEnumeration > colEnum(colEnumAccess->createEnumeration()); -+ bool first = true; -+ while(colEnum.is() && colEnum->hasMoreElements() ) -+ { -+ if( first ) -+ { -+ first = false; -+ } -+ else -+ { -+ buf.appendAscii( RTL_CONSTASCII_STRINGPARAM( ", " ) ); -+ } -+ Reference< XPropertySet > keyColumn( colEnum->nextElement(), UNO_QUERY ); -+ bufferQuoteIdentifier( -+ buf, extractStringProperty( keyColumn, st.RELATED_COLUMN ) ); -+ } -+ buf.appendAscii( RTL_CONSTASCII_STRINGPARAM( ") " ) ); -+ } -+ } -+ -+ buf.appendAscii( RTL_CONSTASCII_STRINGPARAM( "ON DELETE " ) ); -+ keyType2String( buf, deleteRule ); -+ buf.appendAscii( RTL_CONSTASCII_STRINGPARAM( " ON UPDATE " ) ); -+ keyType2String( buf, updateRule ); -+ } -+ -+} -+ -+static bool equalsIgnoreCase( const rtl::OString & str, const char *str2, int length2 ) -+{ -+ return 0 == rtl_str_compareIgnoreAsciiCase_WithLength( -+ str.pData->buffer, str.pData->length, str2, length2 ); -+} -+ -+void extractNameValuePairsFromInsert( String2StringMap & map, const rtl::OString & lastQuery ) -+{ -+ OStringVector vec; -+ tokenizeSQL( lastQuery, vec ); -+ -+ int nSize = vec.size(); -+// printf( "1 %d\n", nSize ); -+ if( nSize > 6 && -+ equalsIgnoreCase( vec[0] , RTL_CONSTASCII_STRINGPARAM( "insert" ) ) && -+ equalsIgnoreCase( vec[1] , RTL_CONSTASCII_STRINGPARAM( "into" ) ) ) -+ { -+ int n = 2; -+ -+// printf( "1a\n" ); -+ // extract table name -+ rtl::OString tableName; -+ if( equalsIgnoreCase( vec[n+1], RTL_CONSTASCII_STRINGPARAM( "." ) ) ) -+ { -+ tableName = vec[n]; -+ tableName += vec[n+1]; -+ tableName += vec[n+2]; -+ n +=2; -+ } -+ else -+ { -+ tableName = vec[n]; -+ } -+ -+ OStringVector names; -+ n ++; -+ if( equalsIgnoreCase( vec[n], RTL_CONSTASCII_STRINGPARAM( "(" ) ) ) -+ { -+// printf( "2\n" ); -+ // extract names -+ n++; -+ while( nSize > n && ! equalsIgnoreCase(vec[n] , RTL_CONSTASCII_STRINGPARAM( ")" ) ) ) -+ { -+ names.push_back( vec[n] ); -+ if( nSize > n+1 && equalsIgnoreCase( vec[n+1] , RTL_CONSTASCII_STRINGPARAM( "," ) ) ) -+ { -+ n ++; -+ } -+ n++; -+ } -+ n++; -+ -+ // now read the values -+ if( nSize > n +1 && equalsIgnoreCase( vec[n], RTL_CONSTASCII_STRINGPARAM("VALUES") ) && -+ equalsIgnoreCase(vec[n+1], RTL_CONSTASCII_STRINGPARAM( "(" ) ) ) -+ { -+ n +=2; -+// printf( "3\n" ); -+ for ( int i = 0 ; i < names.size() && nSize > n ; i ++ ) -+ { -+ map[names[i]] = vec[n]; -+ if( nSize > n+1 && equalsIgnoreCase( vec[n+1] , RTL_CONSTASCII_STRINGPARAM(",") ) ) -+ { -+ n ++; -+ } -+ n++; -+ } -+ } -+ } -+ } -+} -+ -+rtl::OUString querySingleValue( -+ const com::sun::star::uno::Reference< com::sun::star::sdbc::XConnection > &connection, -+ const rtl::OUString &query ) -+{ -+ OUString ret; -+ Reference< XStatement > stmt = connection->createStatement(); -+ DisposeGuard guard( stmt ); -+ Reference< XResultSet > rs = stmt->executeQuery( query ); -+ Reference< XRow > xRow( rs, UNO_QUERY ); -+ if( rs->next() ) -+ ret = xRow->getString( 1 ); -+ return ret; -+} -+ -+ -+// copied from connectivity/source/dbtools, can't use the function directly -+bool implSetObject( const Reference< XParameters >& _rxParameters, -+ const sal_Int32 _nColumnIndex, const Any& _rValue) -+{ -+ sal_Bool bSuccessfullyReRouted = sal_True; -+ switch (_rValue.getValueTypeClass()) -+ { -+ case typelib_TypeClass_HYPER: -+ { -+ sal_Int64 nValue = 0; -+ _rxParameters->setLong( _nColumnIndex, nValue ); -+ } -+ break; -+ -+ case typelib_TypeClass_VOID: -+ _rxParameters->setNull(_nColumnIndex,com::sun::star::sdbc::DataType::VARCHAR); -+ break; -+ -+ case typelib_TypeClass_STRING: -+ _rxParameters->setString(_nColumnIndex, *(rtl::OUString*)_rValue.getValue()); -+ break; -+ -+ case typelib_TypeClass_BOOLEAN: -+ _rxParameters->setBoolean(_nColumnIndex, *(sal_Bool *)_rValue.getValue()); -+ break; -+ -+ case typelib_TypeClass_BYTE: -+ _rxParameters->setByte(_nColumnIndex, *(sal_Int8 *)_rValue.getValue()); -+ break; -+ -+ case typelib_TypeClass_UNSIGNED_SHORT: -+ case typelib_TypeClass_SHORT: -+ _rxParameters->setShort(_nColumnIndex, *(sal_Int16*)_rValue.getValue()); -+ break; -+ -+ case typelib_TypeClass_CHAR: -+ _rxParameters->setString(_nColumnIndex, ::rtl::OUString((sal_Unicode *)_rValue.getValue(),1)); -+ break; -+ -+ case typelib_TypeClass_UNSIGNED_LONG: -+ case typelib_TypeClass_LONG: -+ _rxParameters->setInt(_nColumnIndex, *(sal_Int32*)_rValue.getValue()); -+ break; -+ -+ case typelib_TypeClass_FLOAT: -+ _rxParameters->setFloat(_nColumnIndex, *(float*)_rValue.getValue()); -+ break; -+ -+ case typelib_TypeClass_DOUBLE: -+ _rxParameters->setDouble(_nColumnIndex, *(double*)_rValue.getValue()); -+ break; -+ -+ case typelib_TypeClass_SEQUENCE: -+ if (_rValue.getValueType() == ::getCppuType((const Sequence< sal_Int8 > *)0)) -+ { -+ _rxParameters->setBytes(_nColumnIndex, *(Sequence*)_rValue.getValue()); -+ } -+ else -+ bSuccessfullyReRouted = sal_False; -+ break; -+ case typelib_TypeClass_STRUCT: -+ if (_rValue.getValueType() == ::getCppuType((const com::sun::star::util::DateTime*)0)) -+ _rxParameters->setTimestamp(_nColumnIndex, *(com::sun::star::util::DateTime*)_rValue.getValue()); -+ else if (_rValue.getValueType() == ::getCppuType((const com::sun::star::util::Date*)0)) -+ _rxParameters->setDate(_nColumnIndex, *(com::sun::star::util::Date*)_rValue.getValue()); -+ else if (_rValue.getValueType() == ::getCppuType((const com::sun::star::util::Time*)0)) -+ _rxParameters->setTime(_nColumnIndex, *(com::sun::star::util::Time*)_rValue.getValue()); -+ else -+ bSuccessfullyReRouted = sal_False; -+ break; -+ -+ case typelib_TypeClass_INTERFACE: -+ { -+ Reference< com::sun::star::io::XInputStream > xStream; -+ if (_rValue >>= xStream) -+ { -+ _rValue >>= xStream; -+ _rxParameters->setBinaryStream(_nColumnIndex, xStream, xStream->available()); -+ break; -+ } -+ } -+ // run through -+ default: -+ bSuccessfullyReRouted = sal_False; -+ -+ } -+ -+ return bSuccessfullyReRouted; -+} -+ -+ -+} -diff --git connectivity/source/drivers/postgresql/pq_tools.hxx connectivity/source/drivers/postgresql/pq_tools.hxx -new file mode 100644 -index 0000000..4ea1002 ---- /dev/null -+++ connectivity/source/drivers/postgresql/pq_tools.hxx -@@ -0,0 +1,201 @@ -+/************************************************************************* -+ * -+ * $RCSfile: pq_tools.hxx,v $ -+ * -+ * $Revision: 1.1.2.7 $ -+ * -+ * last change: $Author: jbu $ $Date: 2008/07/07 21:37:11 $ -+ * -+ * The Contents of this file are made available subject to the terms of -+ * either of the following licenses -+ * -+ * - GNU Lesser General Public License Version 2.1 -+ * - Sun Industry Standards Source License Version 1.1 -+ * -+ * Sun Microsystems Inc., October, 2000 -+ * -+ * GNU Lesser General Public License Version 2.1 -+ * ============================================= -+ * Copyright 2000 by Sun Microsystems, Inc. -+ * 901 San Antonio Road, Palo Alto, CA 94303, USA -+ * -+ * This library is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License version 2.1, as published by the Free Software Foundation. -+ * -+ * This library is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public -+ * License along with this library; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, -+ * MA 02111-1307 USA -+ * -+ * -+ * Sun Industry Standards Source License Version 1.1 -+ * ================================================= -+ * The contents of this file are subject to the Sun Industry Standards -+ * Source License Version 1.1 (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.openoffice.org/license.html. -+ * -+ * Software provided under this License is provided on an "AS IS" basis, -+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, -+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, -+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. -+ * See the License for the specific provisions governing your rights and -+ * obligations concerning the Software. -+ * -+ * The Initial Developer of the Original Code is: Joerg Budischewski -+ * -+ * Copyright: 2000 by Sun Microsystems, Inc. -+ * -+ * All Rights Reserved. -+ * -+ * Contributor(s): Joerg Budischewski -+ * -+ * -+ ************************************************************************/ -+ -+#ifndef _PQ_TOOLS_ -+#define _PQ_TOOLS_ -+ -+#include -+#include -+#include -+#include -+#include -+ -+#include -+#include -+ -+#include -+namespace pq_sdbc_driver -+{ -+bool isWhitespace( sal_Unicode c ); -+ -+rtl::OUString date2String( const com::sun::star::util::Date & date ); -+com::sun::star::util::Date string2Date( const rtl::OUString & str ); -+ -+rtl::OUString time2String( const com::sun::star::util::Time & time ); -+com::sun::star::util::Time string2Time( const rtl::OUString & str ); -+ -+rtl::OUString dateTime2String( const com::sun::star::util::DateTime & dateTime ); -+com::sun::star::util::DateTime string2DateTime( const rtl::OUString & dateTime ); -+ -+rtl::OUString concatQualified( const rtl::OUString & a, const rtl::OUString &b); -+ -+void bufferQuoteConstant( rtl::OUStringBuffer & buf, const rtl::OUString & str, sal_Int32 encoding ); -+ -+void bufferEscapeConstant( rtl::OUStringBuffer & buf, const rtl::OUString & str, sal_Int32 encoding ); -+ -+::rtl::OUString sqltype2string( -+ const com::sun::star::uno::Reference< com::sun::star::beans::XPropertySet > & column ); -+ -+ -+void bufferQuoteQualifiedIdentifier( -+ rtl::OUStringBuffer & buf, const rtl::OUString &schema, const rtl::OUString &name); -+ -+void bufferQuoteQualifiedIdentifier( -+ rtl::OUStringBuffer & buf, -+ const rtl::OUString &schema, -+ const rtl::OUString &name, -+ const rtl::OUString &col); -+ -+void bufferQuoteIdentifier( rtl::OUStringBuffer & buf, const rtl::OUString &toQuote ); -+void bufferKey2TableConstraint( -+ rtl::OUStringBuffer &buf, -+ const com::sun::star::uno::Reference< com::sun::star::beans::XPropertySet > &key ); -+ -+rtl::OUString extractStringProperty( -+ const com::sun::star::uno::Reference< com::sun::star::beans::XPropertySet > & descriptor, -+ const rtl::OUString &name ); -+ -+sal_Int32 extractIntProperty( -+ const com::sun::star::uno::Reference< com::sun::star::beans::XPropertySet > & descriptor, -+ const rtl::OUString &name ); -+ -+sal_Bool extractBoolProperty( -+ const com::sun::star::uno::Reference< com::sun::star::beans::XPropertySet > & descriptor, -+ const rtl::OUString &name ); -+ -+void disposeNoThrow( const com::sun::star::uno::Reference< com::sun::star::uno::XInterface > & r ); -+void disposeObject( const com::sun::star::uno::Reference< com::sun::star::uno::XInterface > & r ); -+ -+void rollbackNoThrow( const com::sun::star::uno::Reference< com::sun::star::sdbc::XConnection > & r ); -+ -+::rtl::OUString extractTableFromInsert( const rtl::OUString & sql ); -+::rtl::OString extractSingleTableFromSelect( const OStringVector &vec ); -+ -+void tokenizeSQL( const rtl::OString & sql, OStringVector &vec ); -+void splitSQL( const rtl::OString & sql, OStringVector &vec ); -+com::sun::star::uno::Sequence< sal_Int32 > parseIntArray( const ::rtl::OUString & str ); -+com::sun::star::uno::Sequence< com::sun::star::uno::Any > parseArray( const ::rtl::OUString & str ) -+ throw( com::sun::star::sdbc::SQLException ); -+ -+rtl::OUString array2String( const com::sun::star::uno::Sequence< com::sun::star::uno::Any > &seq ); -+ -+com::sun::star::uno::Reference< com::sun::star::sdbc::XConnection > extractConnectionFromStatement( -+ const com::sun::star::uno::Reference< com::sun::star::uno::XInterface > & stmt ); -+ -+void splitConcatenatedIdentifier( const rtl::OUString & source, rtl::OUString *first, rtl::OUString *second); -+ -+ -+void fillAttnum2attnameMap( -+ Int2StringMap &map, -+ const com::sun::star::uno::Reference< com::sun::star::sdbc::XConnection > &conn, -+ const rtl::OUString &schema, -+ const rtl::OUString &table ); -+ -+com::sun::star::uno::Sequence< sal_Int32 > string2intarray( const ::rtl::OUString & str ); -+ -+com::sun::star::uno::Sequence< rtl::OUString > convertMappedIntArray2StringArray( -+ const Int2StringMap &map, const com::sun::star::uno::Sequence< sal_Int32> &source ); -+ -+typedef std::hash_map -+< -+ ::rtl::OString, -+ ::rtl::OString, -+ ::rtl::OStringHash, -+ ::std::equal_to< rtl::OString >, -+ Allocator< ::std::pair< rtl::OString, ::rtl::OString > > -+> String2StringMap; -+ -+rtl::OUString querySingleValue( -+ const com::sun::star::uno::Reference< com::sun::star::sdbc::XConnection > &connection, -+ const rtl::OUString &query ); -+ -+void extractNameValuePairsFromInsert( String2StringMap & map, const rtl::OString & lastQuery ); -+sal_Int32 typeNameToDataType( const rtl::OUString &typeName, const rtl::OUString &typtype ); -+ -+// copied from connectivity/source/dbtools, can't use the function directly -+bool implSetObject( const com::sun::star::uno::Reference< com::sun::star::sdbc::XParameters >& _rxParameters, -+ const sal_Int32 _nColumnIndex, const com::sun::star::uno::Any& _rValue); -+ -+class DisposeGuard -+{ -+ com::sun::star::uno::Reference< com::sun::star::uno::XInterface > d; -+public: -+ DisposeGuard(const com::sun::star::uno::Reference< com::sun::star::uno::XInterface > & r ); -+ ~DisposeGuard(); -+ -+}; -+ -+class TransactionGuard -+{ -+ com::sun::star::uno::Reference< com::sun::star::sdbc::XStatement > m_stmt; -+ sal_Bool m_commited; -+public: -+ /// takes over ownership of given statemet -+ TransactionGuard( const com::sun::star::uno::Reference< com::sun::star::sdbc::XStatement > &stmt ); -+ ~TransactionGuard( ); -+ -+ void commit(); -+ void executeUpdate( const rtl::OUString & sql ); -+}; -+ -+} -+ -+#endif -diff --git connectivity/source/drivers/postgresql/pq_updateableresultset.cxx connectivity/source/drivers/postgresql/pq_updateableresultset.cxx -new file mode 100644 -index 0000000..7efa005 ---- /dev/null -+++ connectivity/source/drivers/postgresql/pq_updateableresultset.cxx -@@ -0,0 +1,569 @@ -+#include -+#include -+ -+#include -+#include -+ -+#include -+// #include -+ -+#include "pq_updateableresultset.hxx" -+#include "pq_resultsetmetadata.hxx" -+#include "pq_tools.hxx" -+#include "pq_statics.hxx" -+ -+using osl::MutexGuard; -+ -+using rtl::OUString; -+using rtl::OUStringBuffer; -+using rtl::OStringBuffer; -+using rtl::OString; -+ -+using com::sun::star::uno::Reference; -+using com::sun::star::uno::makeAny; -+using com::sun::star::uno::Sequence; -+using com::sun::star::uno::UNO_QUERY; -+using com::sun::star::uno::Any; -+using com::sun::star::uno::Type; -+using com::sun::star::uno::RuntimeException; -+ -+using com::sun::star::sdbc::XGeneratedResultSet; -+using com::sun::star::sdbc::XResultSetMetaDataSupplier; -+using com::sun::star::sdbc::SQLException; -+using com::sun::star::sdbc::XResultSet; -+using com::sun::star::sdbc::XCloseable; -+using com::sun::star::sdbc::XColumnLocate; -+using com::sun::star::sdbc::XResultSetUpdate; -+using com::sun::star::sdbc::XRowUpdate; -+using com::sun::star::sdbc::XRow; -+using com::sun::star::sdbc::XStatement; -+ -+using com::sun::star::beans::XFastPropertySet; -+using com::sun::star::beans::XPropertySet; -+using com::sun::star::beans::XMultiPropertySet; -+ -+#define ASCII_STR(x) OUString( RTL_CONSTASCII_USTRINGPARAM( x ) ) -+ -+namespace pq_sdbc_driver -+{ -+ -+ -+com::sun::star::uno::Reference< com::sun::star::sdbc::XCloseable > UpdateableResultSet::createFromPGResultSet( -+ const ::rtl::Reference< RefCountedMutex > & mutex, -+ const com::sun::star::uno::Reference< com::sun::star::uno::XInterface > &owner, -+ ConnectionSettings **ppSettings, -+ PGresult *result, -+ const rtl::OUString &schema, -+ const rtl::OUString &table, -+ const com::sun::star::uno::Sequence< ::rtl::OUString > &primaryKey ) -+{ -+ ConnectionSettings *pSettings = *ppSettings; -+ sal_Int32 columnCount = PQnfields( result ); -+ sal_Int32 rowCount = PQntuples( result ); -+ Sequence< OUString > columnNames( columnCount ); -+ for( int i = 0 ; i < columnCount ; i ++ ) -+ { -+ char * name = PQfname( result, i ); -+ columnNames[i] = rtl::OUString( name, strlen(name), pSettings->encoding ); -+ } -+ Sequence< Sequence< Any > > data( rowCount ); -+ -+ // copy all the data into unicode strings (also binaries, as we yet -+ // don't know, what a binary is and what not!) -+ for( int row = 0 ; row < rowCount ; row ++ ) -+ { -+ Sequence< Any > aRow( columnCount ); -+ for( int col = 0 ; col < columnCount ; col ++ ) -+ { -+ if( ! PQgetisnull( result, row, col ) ) -+ { -+ char * val = PQgetvalue( result, row, col ); -+ -+ aRow[col] = makeAny( -+ rtl::OUString( val, strlen( val ) , (*ppSettings)->encoding ) ); -+ } -+ } -+ data[row] = aRow; -+ } -+ -+ UpdateableResultSet *pRS = new UpdateableResultSet( -+ mutex, owner, columnNames, data, ppSettings, schema, table , primaryKey ); -+ -+ Reference ret = pRS; // give it an refcount -+ -+ pRS->m_meta = new ResultSetMetaData( mutex, pRS,0, ppSettings, result, schema, table ); -+ -+ PQclear( result ); // we don't need it anymore -+ -+ return ret; -+} -+ -+static void bufferQuoteAnyConstant( rtl::OUStringBuffer & buf, const Any &val ) -+{ -+ if( val.hasValue() ) -+ { -+ OUString str; -+ val >>= str; -+ buf.appendAscii( RTL_CONSTASCII_STRINGPARAM( "'" ) ); -+ buf.append( str ); -+ buf.appendAscii( RTL_CONSTASCII_STRINGPARAM( "'" ) ); -+ } -+ else -+ buf.appendAscii( RTL_CONSTASCII_STRINGPARAM( "NULL" ) ); -+} -+ -+ -+com::sun::star::uno::Any UpdateableResultSet::queryInterface( -+ const com::sun::star::uno::Type & reqType ) -+ throw (com::sun::star::uno::RuntimeException) -+{ -+ Any ret = SequenceResultSet::queryInterface( reqType ); -+ if( ! ret.hasValue() ) -+ ret = ::cppu::queryInterface( -+ reqType, -+ static_cast< XResultSetUpdate * > ( this ), -+ static_cast< XRowUpdate * > ( this ) ); -+ return ret; -+} -+ -+ -+com::sun::star::uno::Sequence< com::sun::star::uno::Type > UpdateableResultSet::getTypes() -+ throw( com::sun::star::uno::RuntimeException ) -+{ -+ static cppu::OTypeCollection *pCollection; -+ if( ! pCollection ) -+ { -+ MutexGuard guard( osl::Mutex::getGlobalMutex() ); -+ if( !pCollection ) -+ { -+ static cppu::OTypeCollection collection( -+ getCppuType( (Reference< XResultSetUpdate> *) 0 ), -+ getCppuType( (Reference< XRowUpdate> *) 0 ), -+ SequenceResultSet::getTypes()); -+ pCollection = &collection; -+ } -+ } -+ return pCollection->getTypes(); -+ -+} -+ -+com::sun::star::uno::Sequence< sal_Int8> UpdateableResultSet::getImplementationId() -+ throw( com::sun::star::uno::RuntimeException ) -+{ -+ static cppu::OImplementationId *pId; -+ if( ! pId ) -+ { -+ MutexGuard guard( osl::Mutex::getGlobalMutex() ); -+ if( ! pId ) -+ { -+ static cppu::OImplementationId id(sal_False); -+ pId = &id; -+ } -+ } -+ return pId->getImplementationId(); -+} -+ -+OUString UpdateableResultSet::buildWhereClause() -+{ -+ OUString ret; -+ if( m_primaryKey.getLength() ) -+ { -+ OUStringBuffer buf( 128 ); -+ buf.appendAscii( RTL_CONSTASCII_STRINGPARAM( " WHERE " ) ); -+ for( int i = 0 ; i < m_primaryKey.getLength() ; i ++ ) -+ { -+ if( i > 0 ) -+ buf.appendAscii( RTL_CONSTASCII_STRINGPARAM( " AND " ) ); -+ sal_Int32 index = findColumn( m_primaryKey[i] ); -+ bufferQuoteIdentifier( buf, m_primaryKey[i] ); -+ buf.appendAscii( RTL_CONSTASCII_STRINGPARAM( " = " ) ); -+ bufferQuoteConstant( buf, getString( index ), (*m_ppSettings)->encoding ); -+ } -+ ret = buf.makeStringAndClear(); -+ } -+ return ret; -+} -+ -+ -+void UpdateableResultSet::insertRow( ) throw (SQLException, RuntimeException) -+{ -+ MutexGuard guard( m_refMutex->mutex ); -+ if( isLog( *m_ppSettings, LogLevel::INFO ) ) -+ { -+ log( *m_ppSettings, LogLevel::INFO,"UpdateableResultSet::insertRow got called" ); -+ } -+ if( ! m_insertRow ) -+ throw SQLException( -+ ASCII_STR("pq_resultset.insertRow: moveToInsertRow has not been called !" ), -+ *this, OUString(), 1, Any() ); -+ -+ OUStringBuffer buf( 128 ); -+ buf.appendAscii( RTL_CONSTASCII_STRINGPARAM( "INSERT INTO " ) ); -+ bufferQuoteQualifiedIdentifier( buf, m_schema, m_table ); -+ buf.appendAscii( RTL_CONSTASCII_STRINGPARAM( " ( " ) ); -+ -+ int i; -+ int columns = 0; -+ for( i = 0 ; i < m_updateableField.size() ; i++ ) -+ { -+ if( m_updateableField[i].isTouched ) -+ { -+ if( columns > 0 ) -+ buf.appendAscii( RTL_CONSTASCII_STRINGPARAM( ", " ) ); -+ columns ++; -+ bufferQuoteIdentifier( buf, m_columnNames[i]); -+ } -+ } -+ buf.appendAscii( RTL_CONSTASCII_STRINGPARAM( " ) VALUES ( " ) ); -+ -+ columns = 0; -+ for( i = 0 ; i < m_updateableField.size() ; i ++ ) -+ { -+ if( m_updateableField[i].isTouched ) -+ { -+ if( columns > 0 ) -+ buf.appendAscii( RTL_CONSTASCII_STRINGPARAM( " , " ) ); -+ columns ++; -+ bufferQuoteAnyConstant( buf, m_updateableField[i].value ); -+ -+// OUString val; -+// m_updateableField[i].value >>= val; -+// buf.append( val ); -+// rtl::OStringToOUString(val, (*m_ppSettings)->encoding ) ); -+ } -+ } -+ -+ buf.appendAscii( RTL_CONSTASCII_STRINGPARAM( " )" ) ); -+ -+ Reference< XStatement > stmt = -+ extractConnectionFromStatement(m_owner)->createStatement(); -+ DisposeGuard dispGuard( stmt ); -+ stmt->executeUpdate( buf.makeStringAndClear() ); -+ -+ // reflect the changes ! -+ m_rowCount ++; -+ m_data.realloc( m_rowCount ); -+ m_data[m_rowCount-1] = Sequence< Any > ( m_fieldCount ); -+ Reference< XGeneratedResultSet > result( stmt, UNO_QUERY ); -+ if( result.is() ) -+ { -+ Reference< XResultSet > rs = result->getGeneratedValues(); -+ if( rs.is() && rs->next() ) -+ { -+ Reference< XColumnLocate > columnLocate( rs, UNO_QUERY ); -+ Reference< XRow> xRow ( rs, UNO_QUERY ); -+ for( i = 0 ; i < m_fieldCount ; i++ ) -+ { -+ int field = columnLocate->findColumn( m_columnNames[i] ); -+ if( field >= 1 ) -+ { -+ m_data[m_rowCount-1][i] <<= xRow->getString( field ); -+// printf( "adding %s %s\n" , -+// OUStringToOString( m_columnNames[i], RTL_TEXTENCODING_ASCII_US).getStr(), -+// OUStringToOString( xRow->getString( field ), RTL_TEXTENCODING_ASCII_US).getStr() ); -+ -+ } -+ } -+ } -+ else -+ { -+ // do the best we can ( DEFAULT and AUTO increment values fail ! ) -+ for( int i = 0 ; i < m_fieldCount ; i ++ ) -+ { -+ if( m_updateableField[i].isTouched ) -+ m_data[m_rowCount-1][i] = m_updateableField[i].value; -+ } -+ } -+ } -+ -+ // cleanup -+ m_updateableField = UpdateableFieldVector(); -+} -+ -+void UpdateableResultSet::updateRow( ) throw (SQLException, RuntimeException) -+{ -+ MutexGuard guard( m_refMutex->mutex ); -+ if( isLog( *m_ppSettings, LogLevel::INFO ) ) -+ { -+ log( *m_ppSettings, LogLevel::INFO,"UpdateableResultSet::updateRow got called" ); -+ } -+ if( m_insertRow ) -+ throw SQLException( -+ ASCII_STR("pq_resultset.updateRow: moveToCurrentRow has not been called !" ), -+ *this, OUString(), 1, Any() ); -+ -+ OUStringBuffer buf( 128 ); -+ buf.appendAscii( RTL_CONSTASCII_STRINGPARAM( "UPDATE " ) ); -+ bufferQuoteQualifiedIdentifier( buf, m_schema, m_table ); -+ buf.appendAscii( RTL_CONSTASCII_STRINGPARAM( "SET " ) ); -+ -+ int columns = 0,i; -+ for( i = 0; i < m_updateableField.size() ; i ++ ) -+ { -+ if( m_updateableField[i].isTouched ) -+ { -+ if( columns > 0 ) -+ buf.appendAscii( RTL_CONSTASCII_STRINGPARAM( ", " ) ); -+ columns ++; -+ -+ buf.append( m_columnNames[i] ); -+ buf.appendAscii( RTL_CONSTASCII_STRINGPARAM(" = " ) ); -+ bufferQuoteAnyConstant( buf, m_updateableField[i].value ); -+// OUString val; -+// m_updateableField[i].value >>= val; -+// bufferQuoteConstant( buf, val ): -+// buf.append( val ); -+ } -+ } -+ buf.append( buildWhereClause() ); -+ -+ Reference< XStatement > stmt = extractConnectionFromStatement(m_owner)->createStatement(); -+ DisposeGuard dispGuard( stmt ); -+ stmt->executeUpdate( buf.makeStringAndClear() ); -+ -+ // reflect the changes ! -+ for( i = 0 ; i < m_fieldCount ; i ++ ) -+ { -+ if( m_updateableField[i].isTouched ) -+ m_data[m_row][i] = m_updateableField[i].value; -+ } -+ m_updateableField = UpdateableFieldVector(); -+} -+ -+void UpdateableResultSet::deleteRow( ) throw (SQLException, RuntimeException) -+{ -+ if( isLog( *m_ppSettings, LogLevel::INFO ) ) -+ { -+ log( *m_ppSettings, LogLevel::INFO,"UpdateableResultSet::deleteRow got called" ); -+ } -+ if( m_insertRow ) -+ throw SQLException( -+ ASCII_STR("pq_resultset.deleteRow: deleteRow cannot be called when on insert row !" ), -+ *this, OUString(), 1, Any() ); -+ -+ if( m_row < 0 || m_row >= m_rowCount ) -+ { -+ OUStringBuffer buf( 128 ); -+ buf.appendAscii( "deleteRow cannot be called on invalid row (" ); -+ buf.append( m_row ); -+ buf.appendAscii( ")" ); -+ throw SQLException( buf.makeStringAndClear() , *this, OUString(), 0, Any() ); -+ } -+ -+ Reference< XStatement > stmt = extractConnectionFromStatement(m_owner)->createStatement(); -+ DisposeGuard dispGuard( stmt ); -+ OUStringBuffer buf( 128 ); -+ buf.appendAscii( "DELETE FROM " ); -+ bufferQuoteQualifiedIdentifier( buf, m_schema, m_table ); -+ buf.appendAscii( " " ); -+ buf.append( buildWhereClause() ); -+ -+ stmt->executeUpdate( buf.makeStringAndClear() ); -+ -+ // reflect the changes ! -+ for( int i = m_row + 1; i < m_row ; i ++ ) -+ { -+ m_data[i-1] = m_data[i]; -+ } -+ m_rowCount --; -+ m_data.realloc( m_rowCount ); -+ } -+ -+void UpdateableResultSet::cancelRowUpdates( ) throw (SQLException, RuntimeException) -+{ -+ MutexGuard guard( m_refMutex->mutex ); -+ m_updateableField = UpdateableFieldVector(); -+} -+ -+void UpdateableResultSet::moveToInsertRow( ) throw (SQLException, RuntimeException) -+{ -+ m_insertRow = true; -+} -+ -+void UpdateableResultSet::moveToCurrentRow( ) throw (SQLException, RuntimeException) -+{ -+ m_insertRow = false; -+} -+ -+void UpdateableResultSet::checkUpdate( sal_Int32 columnIndex) -+{ -+ checkColumnIndex( columnIndex ); -+ if( m_updateableField.empty() ) -+ m_updateableField = UpdateableFieldVector( m_fieldCount ); -+ m_updateableField[columnIndex-1].isTouched = true; -+} -+ -+void UpdateableResultSet::updateNull( sal_Int32 columnIndex ) throw (SQLException, RuntimeException) -+{ -+ MutexGuard guard( m_refMutex->mutex ); -+ checkClosed(); -+ checkUpdate( columnIndex ); -+ m_updateableField[columnIndex-1].value = Any(); -+} -+ -+void UpdateableResultSet::updateBoolean( sal_Int32 columnIndex, sal_Bool x ) throw (SQLException, RuntimeException) -+{ -+ MutexGuard guard( m_refMutex->mutex ); -+ checkClosed(); -+ checkUpdate( columnIndex ); -+ -+ Statics &st = getStatics(); -+ if( x ) -+ m_updateableField[columnIndex-1].value <<= ( x ? st.TRUE : st.FALSE ); -+ -+} -+ -+void UpdateableResultSet::updateByte( sal_Int32 columnIndex, sal_Int8 x ) throw (SQLException, RuntimeException) -+{ -+ updateInt(columnIndex,x); -+} -+ -+void UpdateableResultSet::updateShort( sal_Int32 columnIndex, sal_Int16 x ) throw (SQLException, RuntimeException) -+{ -+ updateInt( columnIndex, x ); -+} -+ -+void UpdateableResultSet::updateInt( sal_Int32 columnIndex, sal_Int32 x ) throw (SQLException, RuntimeException) -+{ -+ updateLong( columnIndex, x ); -+// MutexGuard guard( m_refMutex->mutex ); -+// checkClosed(); -+// checkUpdate( columnIndex ); -+ -+// m_updateableField[columnIndex-1].value <<= OUString::valueOf( x ); -+ -+} -+ -+void UpdateableResultSet::updateLong( sal_Int32 columnIndex, sal_Int64 x ) throw (SQLException, RuntimeException) -+{ -+ MutexGuard guard( m_refMutex->mutex ); -+ checkClosed(); -+ checkUpdate( columnIndex ); -+ -+// OStringBuffer buf( 20 ); -+// buf.append( "'" ); -+// buf.append( (sal_Int64) x ); -+// buf.append( "'" ); -+ m_updateableField[columnIndex-1].value <<= OUString::valueOf( x ); -+} -+ -+void UpdateableResultSet::updateFloat( sal_Int32 columnIndex, float x ) throw (SQLException, RuntimeException) -+{ -+ -+ MutexGuard guard( m_refMutex->mutex ); -+ checkClosed(); -+ checkUpdate( columnIndex ); -+ -+ m_updateableField[columnIndex-1].value <<= OUString::valueOf( x ); -+} -+ -+void UpdateableResultSet::updateDouble( sal_Int32 columnIndex, double x ) throw (SQLException, RuntimeException) -+{ -+ MutexGuard guard( m_refMutex->mutex ); -+ checkClosed(); -+ checkUpdate( columnIndex ); -+ -+ m_updateableField[columnIndex-1].value <<= OUString::valueOf( x ); -+} -+ -+void UpdateableResultSet::updateString( sal_Int32 columnIndex, const ::rtl::OUString& x ) throw (SQLException, RuntimeException) -+{ -+ MutexGuard guard( m_refMutex->mutex ); -+ checkClosed(); -+ checkUpdate( columnIndex ); -+ -+ m_updateableField[columnIndex-1].value <<= x; -+} -+ -+void UpdateableResultSet::updateBytes( sal_Int32 columnIndex, const ::com::sun::star::uno::Sequence< sal_Int8 >& x ) throw (SQLException, RuntimeException) -+{ -+ MutexGuard guard( m_refMutex->mutex ); -+ checkClosed(); -+ checkUpdate( columnIndex ); -+ -+ size_t len; -+ unsigned char * escapedString = -+ PQescapeBytea( (unsigned char *)x.getConstArray(), x.getLength(), &len); -+ if( ! escapedString ) -+ { -+ throw SQLException( -+ ASCII_STR("pq_preparedstatement.setBytes: Error during converting bytesequence to an SQL conform string" ), -+ *this, OUString(), 1, Any() ); -+ } -+// buf.append( (const sal_Char *)escapedString, len -1 ); -+ -+ m_updateableField[columnIndex-1].value <<= -+ OUString( (sal_Char*) escapedString, len, RTL_TEXTENCODING_ASCII_US ); -+ free( escapedString ); -+} -+ -+void UpdateableResultSet::updateDate( sal_Int32 columnIndex, const ::com::sun::star::util::Date& x ) throw (SQLException, RuntimeException) -+{ -+ updateString( columnIndex, date2String( x ) ); -+} -+ -+void UpdateableResultSet::updateTime( sal_Int32 columnIndex, const ::com::sun::star::util::Time& x ) throw (SQLException, RuntimeException) -+{ -+ updateString( columnIndex, time2String( x ) ); -+} -+ -+void UpdateableResultSet::updateTimestamp( sal_Int32 columnIndex, const ::com::sun::star::util::DateTime& x ) throw (SQLException, RuntimeException) -+{ -+ updateString( columnIndex, dateTime2String( x ) ); -+} -+ -+void UpdateableResultSet::updateBinaryStream( sal_Int32 columnIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw (SQLException, RuntimeException) -+{ -+} -+ -+void UpdateableResultSet::updateCharacterStream( sal_Int32 columnIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw (SQLException, RuntimeException) -+{ -+} -+ -+void UpdateableResultSet::updateObject( sal_Int32 columnIndex, const ::com::sun::star::uno::Any& x ) throw (SQLException, RuntimeException) -+{ -+} -+ -+void UpdateableResultSet::updateNumericObject( sal_Int32 columnIndex, const ::com::sun::star::uno::Any& x, sal_Int32 scale ) throw (SQLException, RuntimeException) -+{ -+} -+ -+ -+::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData > UpdateableResultSet::getMetaData( ) -+ throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) -+{ -+ return m_meta; -+} -+ -+Sequence< Type > UpdateableResultSet::getStaticTypes( bool updateable ) -+ throw( com::sun::star::uno::RuntimeException ) -+{ -+ if( updateable ) -+ { -+ cppu::OTypeCollection collection( -+ getCppuType( (Reference< XResultSetUpdate> *) 0 ), -+ getCppuType( (Reference< XRowUpdate> *) 0 ), -+// getCppuType( (Reference< com::sun::star::sdbcx::XRowLocate > *) 0 ), -+ getStaticTypes( false /* updateable */ ) ); -+ return collection.getTypes(); -+ } -+ else -+ { -+ cppu::OTypeCollection collection( -+ getCppuType( (Reference< XResultSet> *) 0 ), -+ getCppuType( (Reference< XResultSetMetaDataSupplier> *) 0 ), -+ getCppuType( (Reference< XRow> *) 0 ), -+ getCppuType( (Reference< XColumnLocate> *) 0 ), -+ getCppuType( (Reference< XCloseable> *) 0 ), -+ getCppuType( (Reference< XPropertySet >*) 0 ), -+ getCppuType( (Reference< XFastPropertySet > *) 0 ), -+ getCppuType( (Reference< XMultiPropertySet > *) 0 ), -+ getCppuType( (const Reference< com::sun::star::lang::XComponent > *)0 ), // OComponentHelper -+ getCppuType( (const Reference< com::sun::star::lang::XTypeProvider > *)0 ), -+ getCppuType( (const Reference< com::sun::star::uno::XAggregation > *)0 ), -+ getCppuType( (const Reference< com::sun::star::uno::XWeak > *)0 ) ); -+ return collection.getTypes(); -+ } -+} -+ -+} -diff --git connectivity/source/drivers/postgresql/pq_updateableresultset.hxx connectivity/source/drivers/postgresql/pq_updateableresultset.hxx -new file mode 100644 -index 0000000..0154bb7 ---- /dev/null -+++ connectivity/source/drivers/postgresql/pq_updateableresultset.hxx -@@ -0,0 +1,118 @@ -+#include "pq_sequenceresultset.hxx" -+#include "pq_resultsetmetadata.hxx" -+ -+#include -+#include -+ -+namespace pq_sdbc_driver -+{ -+ -+struct UpdateableField -+{ -+ UpdateableField( ) -+ : isTouched(false) -+ {} -+ com::sun::star::uno::Any value; -+ bool isTouched; -+}; -+ -+typedef ::std::vector< UpdateableField , Allocator< UpdateableField > > UpdateableFieldVector; -+ -+class UpdateableResultSet : -+ public SequenceResultSet, -+ public com::sun::star::sdbc::XResultSetUpdate, -+ public com::sun::star::sdbc::XRowUpdate -+{ -+ ConnectionSettings **m_ppSettings; -+ rtl::OUString m_schema; -+ rtl::OUString m_table; -+ com::sun::star::uno::Sequence< rtl::OUString > m_primaryKey; -+ UpdateableFieldVector m_updateableField; -+ com::sun::star::uno::Reference< com::sun::star::sdbc::XResultSetMetaData > m_meta; -+ bool m_insertRow; -+ -+protected: -+ UpdateableResultSet( -+ const ::rtl::Reference< RefCountedMutex > & mutex, -+ const com::sun::star::uno::Reference< com::sun::star::uno::XInterface > &owner, -+ const com::sun::star::uno::Sequence< rtl::OUString > &colNames, -+ const com::sun::star::uno::Sequence< com::sun::star::uno::Sequence< com::sun::star::uno::Any > > &data, -+ ConnectionSettings **ppSettings, -+ const rtl::OUString &schema, -+ const rtl::OUString &table, -+ const com::sun::star::uno::Sequence< ::rtl::OUString > &primaryKey) -+ : SequenceResultSet( mutex, owner, colNames, data, (*ppSettings)->tc ), -+ m_insertRow( false ), -+ m_primaryKey( primaryKey ), -+ m_table( table ), -+ m_schema( schema ), -+ m_ppSettings( ppSettings ) -+ { -+ } -+ -+ rtl::OUString buildWhereClause(); -+ void checkUpdate( sal_Int32 column ); -+ -+public: -+ static com::sun::star::uno::Reference< com::sun::star::sdbc::XCloseable > createFromPGResultSet( -+ const ::rtl::Reference< RefCountedMutex > & mutex, -+ const com::sun::star::uno::Reference< com::sun::star::uno::XInterface > &owner, -+ ConnectionSettings **ppSettings, -+ PGresult *result, -+ const rtl::OUString &schema, -+ const rtl::OUString &table, -+ const com::sun::star::uno::Sequence< ::rtl::OUString > &primaryKey ); -+ -+public: // XInterface -+ virtual void SAL_CALL acquire() throw() { SequenceResultSet::acquire(); } -+ virtual void SAL_CALL release() throw() { SequenceResultSet::release(); } -+ virtual com::sun::star::uno::Any SAL_CALL queryInterface( -+ const com::sun::star::uno::Type & reqType ) -+ throw (com::sun::star::uno::RuntimeException); -+ -+public: // XTypeProvider -+ virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL getTypes() -+ throw( com::sun::star::uno::RuntimeException ); -+ virtual com::sun::star::uno::Sequence< sal_Int8> SAL_CALL getImplementationId() -+ throw( com::sun::star::uno::RuntimeException ); -+ -+public: // XResultSetUpdate -+ virtual void SAL_CALL insertRow( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual void SAL_CALL updateRow( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual void SAL_CALL deleteRow( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual void SAL_CALL cancelRowUpdates( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual void SAL_CALL moveToInsertRow( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual void SAL_CALL moveToCurrentRow( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ -+public: // XRowUpdate -+ virtual void SAL_CALL updateNull( sal_Int32 columnIndex ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual void SAL_CALL updateBoolean( sal_Int32 columnIndex, sal_Bool x ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual void SAL_CALL updateByte( sal_Int32 columnIndex, sal_Int8 x ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual void SAL_CALL updateShort( sal_Int32 columnIndex, sal_Int16 x ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual void SAL_CALL updateInt( sal_Int32 columnIndex, sal_Int32 x ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual void SAL_CALL updateLong( sal_Int32 columnIndex, sal_Int64 x ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual void SAL_CALL updateFloat( sal_Int32 columnIndex, float x ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual void SAL_CALL updateDouble( sal_Int32 columnIndex, double x ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual void SAL_CALL updateString( sal_Int32 columnIndex, const ::rtl::OUString& x ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual void SAL_CALL updateBytes( sal_Int32 columnIndex, const ::com::sun::star::uno::Sequence< sal_Int8 >& x ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual void SAL_CALL updateDate( sal_Int32 columnIndex, const ::com::sun::star::util::Date& x ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual void SAL_CALL updateTime( sal_Int32 columnIndex, const ::com::sun::star::util::Time& x ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual void SAL_CALL updateTimestamp( sal_Int32 columnIndex, const ::com::sun::star::util::DateTime& x ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual void SAL_CALL updateBinaryStream( sal_Int32 columnIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual void SAL_CALL updateCharacterStream( sal_Int32 columnIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual void SAL_CALL updateObject( sal_Int32 columnIndex, const ::com::sun::star::uno::Any& x ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual void SAL_CALL updateNumericObject( sal_Int32 columnIndex, const ::com::sun::star::uno::Any& x, sal_Int32 scale ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ -+public: // XResultSetMetaDataSupplier -+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData > SAL_CALL getMetaData( ) -+ throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ -+ -+ static com::sun::star::uno::Sequence< com::sun::star::uno::Type > getStaticTypes( bool updateable ) -+ throw( com::sun::star::uno::RuntimeException ); -+ -+}; -+ -+ -+ -+} -diff --git connectivity/source/drivers/postgresql/pq_xbase.cxx connectivity/source/drivers/postgresql/pq_xbase.cxx -new file mode 100644 -index 0000000..f1fbf46 ---- /dev/null -+++ connectivity/source/drivers/postgresql/pq_xbase.cxx -@@ -0,0 +1,279 @@ -+/************************************************************************* -+ * -+ * $RCSfile: pq_xbase.cxx,v $ -+ * -+ * $Revision: 1.1.2.2 $ -+ * -+ * last change: $Author: jbu $ $Date: 2004/06/10 15:26:59 $ -+ * -+ * The Contents of this file are made available subject to the terms of -+ * either of the following licenses -+ * -+ * - GNU Lesser General Public License Version 2.1 -+ * - Sun Industry Standards Source License Version 1.1 -+ * -+ * Sun Microsystems Inc., October, 2000 -+ * -+ * GNU Lesser General Public License Version 2.1 -+ * ============================================= -+ * Copyright 2000 by Sun Microsystems, Inc. -+ * 901 San Antonio Road, Palo Alto, CA 94303, USA -+ * -+ * This library is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License version 2.1, as published by the Free Software Foundation. -+ * -+ * This library is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public -+ * License along with this library; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, -+ * MA 02111-1307 USA -+ * -+ * -+ * Sun Industry Standards Source License Version 1.1 -+ * ================================================= -+ * The contents of this file are subject to the Sun Industry Standards -+ * Source License Version 1.1 (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.openoffice.org/license.html. -+ * -+ * Software provided under this License is provided on an "AS IS" basis, -+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, -+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, -+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. -+ * See the License for the specific provisions governing your rights and -+ * obligations concerning the Software. -+ * -+ * The Initial Developer of the Original Code is: Joerg Budischewski -+ * -+ * Copyright: 2000 by Sun Microsystems, Inc. -+ * -+ * All Rights Reserved. -+ * -+ * Contributor(s): Joerg Budischewski -+ * -+ * -+ ************************************************************************/ -+ -+#include -+#include -+ -+#include "pq_tools.hxx" -+#include "pq_xbase.hxx" -+ -+using osl::MutexGuard; -+ -+using com::sun::star::uno::Any; -+using com::sun::star::uno::Sequence; -+using com::sun::star::uno::Reference; -+using com::sun::star::uno::RuntimeException; -+ -+using com::sun::star::beans::Property; -+using com::sun::star::beans::XPropertySetInfo; -+using com::sun::star::beans::XMultiPropertySet; -+using com::sun::star::beans::XFastPropertySet; -+using com::sun::star::beans::XPropertySet; -+ -+namespace pq_sdbc_driver -+{ -+ -+ReflectionBase::ReflectionBase( -+ const ::rtl::OUString &implName, -+ const ::com::sun::star::uno::Sequence< rtl::OUString > &supportedServices, -+ const ::rtl::Reference< RefCountedMutex > refMutex, -+ const ::com::sun::star::uno::Reference< com::sun::star::sdbc::XConnection > &conn, -+ ConnectionSettings *pSettings, -+ cppu::IPropertyArrayHelper & props /* must survive this object !*/ ) -+ : OComponentHelper( refMutex->mutex ), -+ OPropertySetHelper( OComponentHelper::rBHelper ), -+ m_implName( implName ), -+ m_supportedServices( supportedServices ), -+ m_refMutex( refMutex ), -+ m_conn( conn ), -+ m_pSettings( pSettings ), -+ m_propsDesc( props ), -+ m_values( props.getProperties().getLength() ) -+{} -+ -+cppu::IPropertyArrayHelper & ReflectionBase::getInfoHelper() -+{ -+ return m_propsDesc; -+} -+ -+sal_Bool ReflectionBase::convertFastPropertyValue( -+ ::com::sun::star::uno::Any & rConvertedValue, -+ ::com::sun::star::uno::Any & rOldValue, -+ sal_Int32 nHandle, -+ const ::com::sun::star::uno::Any& rValue ) -+ throw (::com::sun::star::lang::IllegalArgumentException) -+{ -+ -+ rOldValue = m_values[nHandle]; -+ rConvertedValue = rValue; // TODO !!! implement correct conversion ! -+ m_values[nHandle] = rValue; -+ return sal_True; -+} -+ -+void ReflectionBase::setPropertyValue_NoBroadcast_public( -+ const rtl::OUString & name, const com::sun::star::uno::Any & value ) -+{ -+ sal_Int32 nHandle = m_propsDesc.getHandleByName( name ); -+ if( -1 == nHandle ) -+ { -+ rtl::OUStringBuffer buf(128); -+ buf.appendAscii( "Unkown property '" ); -+ buf.append( name ); -+ buf.appendAscii( "' in " ); -+ buf.append( m_implName ); -+ throw com::sun::star::uno::RuntimeException( buf.makeStringAndClear() , *this ); -+ } -+ setFastPropertyValue_NoBroadcast( nHandle , value ); -+} -+ -+void ReflectionBase::setFastPropertyValue_NoBroadcast( -+ sal_Int32 nHandle, -+ const ::com::sun::star::uno::Any& rValue ) -+ throw (::com::sun::star::uno::Exception) -+{ -+// rtl::OUString s; -+// rValue >>= s; -+// printf( "setting value (handle %d):%s\n" , -+// nHandle, rtl::OUStringToOString(s, RTL_TEXTENCODING_ASCII_US).getStr() ); -+ m_values[nHandle] = rValue; -+} -+ -+void ReflectionBase::getFastPropertyValue( -+ ::com::sun::star::uno::Any& rValue, -+ sal_Int32 nHandle ) const -+{ -+ rValue = m_values[nHandle]; -+// rtl::OUString s; -+// rValue >>= s; -+// printf( "getting value (handle %d):%s\n" , -+// nHandle, rtl::OUStringToOString(s, RTL_TEXTENCODING_ASCII_US).getStr() ); -+ -+} -+ -+Reference < ::com::sun::star::beans::XPropertySetInfo > ReflectionBase::getPropertySetInfo() -+ throw(com::sun::star::uno::RuntimeException) -+{ -+ return OPropertySetHelper::createPropertySetInfo( m_propsDesc ); -+} -+ -+rtl::OUString ReflectionBase::getImplementationName() -+ throw(::com::sun::star::uno::RuntimeException) -+{ -+ return m_implName; -+} -+ -+sal_Bool ReflectionBase::supportsService(const rtl::OUString& ServiceName) -+ throw(::com::sun::star::uno::RuntimeException) -+{ -+ for( int i = 0 ; i < m_supportedServices.getLength() ; i ++ ) -+ if( m_supportedServices[i] == ServiceName ) -+ return sal_True; -+ return sal_False; -+} -+ -+Sequence< rtl::OUString > ReflectionBase::getSupportedServiceNames(void) -+ throw(::com::sun::star::uno::RuntimeException) -+{ -+ return m_supportedServices; -+} -+ -+ -+Sequence< com::sun::star::uno::Type > ReflectionBase::getTypes() -+ throw( com::sun::star::uno::RuntimeException ) -+{ -+ osl::MutexGuard guard( m_refMutex->mutex ); -+ static cppu::OTypeCollection collection( -+ getCppuType( (Reference< XPropertySet >*) 0 ), -+ getCppuType( (Reference< XFastPropertySet > *) 0 ), -+ getCppuType( (Reference< XMultiPropertySet > *) 0 ), -+ getCppuType( (Reference< com::sun::star::lang::XServiceInfo > *) 0 ), -+ getCppuType( (Reference< com::sun::star::sdbcx::XDataDescriptorFactory > *) 0 ), -+ getCppuType( (Reference< com::sun::star::container::XNamed > *) 0 ), -+ OComponentHelper::getTypes()); -+ return collection.getTypes(); -+} -+ -+ -+com::sun::star::uno::Any ReflectionBase::queryInterface( -+ const com::sun::star::uno::Type & reqType ) -+ throw (com::sun::star::uno::RuntimeException) -+{ -+ Any ret; -+ ret = OComponentHelper::queryInterface( reqType ); -+ if( ! ret.hasValue() ) -+ ret = ::cppu::queryInterface( -+ reqType, -+ static_cast< com::sun::star::beans::XPropertySet * > ( this ), -+ static_cast< com::sun::star::beans::XMultiPropertySet * > ( this ), -+ static_cast< com::sun::star::lang::XServiceInfo * > ( this ), -+ static_cast< com::sun::star::beans::XFastPropertySet * > ( this ) , -+ static_cast< com::sun::star::sdbcx::XDataDescriptorFactory * > ( this ), -+ static_cast< com::sun::star::container::XNamed * > ( this ) ); -+ return ret; -+ -+} -+ -+Sequence< sal_Int8> ReflectionBase::getImplementationId() throw( RuntimeException ) -+{ -+ static cppu::OImplementationId *pId; -+ if( ! pId ) -+ { -+ MutexGuard guard( osl::Mutex::getGlobalMutex() ); -+ if( ! pId ) -+ { -+ static cppu::OImplementationId id(sal_False); -+ pId = &id; -+ } -+ } -+ return pId->getImplementationId(); -+} -+ -+void ReflectionBase::copyValuesFrom( const Reference< XPropertySet > & set ) -+{ -+ Reference< XPropertySetInfo > info = set->getPropertySetInfo(); -+ if( info.is () ) -+ { -+ Reference< XPropertySetInfo > myPropInfo = getPropertySetInfo(); -+ -+ Sequence< Property > props = info->getProperties(); -+ for( int i = 0 ; i < props.getLength() ; i ++ ) -+ { -+ if( myPropInfo->hasPropertyByName( props[i].Name ) ) -+ setPropertyValue_NoBroadcast_public( -+ props[i].Name, set->getPropertyValue( props[i].Name ) ); -+ } -+ } -+} -+ -+::rtl::OUString ReflectionBase::getName( ) throw (::com::sun::star::uno::RuntimeException) -+{ -+ Statics & st = getStatics(); -+ if( getInfoHelper().hasPropertyByName( st.SCHEMA_NAME ) ) -+ return concatQualified( -+ extractStringProperty( this, getStatics().SCHEMA_NAME ), -+ extractStringProperty( this, getStatics().NAME ) ); -+ else -+ return extractStringProperty( this, getStatics().NAME ); -+} -+ -+ -+void ReflectionBase::setName( const ::rtl::OUString& aName ) -+ throw (::com::sun::star::uno::RuntimeException) -+{ -+ throw RuntimeException( -+ rtl::OUString( -+ RTL_CONSTASCII_USTRINGPARAM( "pq_sdbc::ReflectionBase::setName not implemented" ) ), -+ *this ); -+ //setPropertyValue( getStatics().NAME , makeAny( aName ) ); -+} -+ -+ -+} -diff --git connectivity/source/drivers/postgresql/pq_xbase.hxx connectivity/source/drivers/postgresql/pq_xbase.hxx -new file mode 100644 -index 0000000..f05c352 ---- /dev/null -+++ connectivity/source/drivers/postgresql/pq_xbase.hxx -@@ -0,0 +1,161 @@ -+/************************************************************************* -+ * -+ * $RCSfile: pq_xbase.hxx,v $ -+ * -+ * $Revision: 1.1.2.2 $ -+ * -+ * last change: $Author: jbu $ $Date: 2004/06/10 15:26:59 $ -+ * -+ * The Contents of this file are made available subject to the terms of -+ * either of the following licenses -+ * -+ * - GNU Lesser General Public License Version 2.1 -+ * - Sun Industry Standards Source License Version 1.1 -+ * -+ * Sun Microsystems Inc., October, 2000 -+ * -+ * GNU Lesser General Public License Version 2.1 -+ * ============================================= -+ * Copyright 2000 by Sun Microsystems, Inc. -+ * 901 San Antonio Road, Palo Alto, CA 94303, USA -+ * -+ * This library is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License version 2.1, as published by the Free Software Foundation. -+ * -+ * This library is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public -+ * License along with this library; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, -+ * MA 02111-1307 USA -+ * -+ * -+ * Sun Industry Standards Source License Version 1.1 -+ * ================================================= -+ * The contents of this file are subject to the Sun Industry Standards -+ * Source License Version 1.1 (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.openoffice.org/license.html. -+ * -+ * Software provided under this License is provided on an "AS IS" basis, -+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, -+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, -+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. -+ * See the License for the specific provisions governing your rights and -+ * obligations concerning the Software. -+ * -+ * The Initial Developer of the Original Code is: Joerg Budischewski -+ * -+ * Copyright: 2000 by Sun Microsystems, Inc. -+ * -+ * All Rights Reserved. -+ * -+ * Contributor(s): Joerg Budischewski -+ * -+ * -+ ************************************************************************/ -+ -+#ifndef _PQ_REFL_BASE_HXX_ -+#define _PQ_REFL_BASE_HXX_ -+#include -+#include -+ -+#include -+#include -+ -+#include "pq_xcontainer.hxx" -+ -+namespace pq_sdbc_driver -+{ -+ -+class ReflectionBase : -+ public cppu::OComponentHelper, -+ public cppu::OPropertySetHelper, -+ public com::sun::star::lang::XServiceInfo, -+ public com::sun::star::sdbcx::XDataDescriptorFactory, -+ public com::sun::star::container::XNamed -+{ -+protected: -+ const rtl::OUString m_implName; -+ const ::com::sun::star::uno::Sequence< rtl::OUString > m_supportedServices; -+ ::rtl::Reference< RefCountedMutex > m_refMutex; -+ ::com::sun::star::uno::Reference< com::sun::star::sdbc::XConnection > m_conn; -+ ConnectionSettings *m_pSettings; -+ cppu::IPropertyArrayHelper & m_propsDesc; -+ com::sun::star::uno::Sequence< com::sun::star::uno::Any > m_values; -+public: -+ ReflectionBase( -+ const ::rtl::OUString &implName, -+ const ::com::sun::star::uno::Sequence< rtl::OUString > &supportedServices, -+ const ::rtl::Reference< RefCountedMutex > refMutex, -+ const ::com::sun::star::uno::Reference< com::sun::star::sdbc::XConnection > &conn, -+ ConnectionSettings *pSettings, -+ cppu::IPropertyArrayHelper & props /* must survive this object !*/ ); -+ -+public: -+ void copyValuesFrom( const com::sun::star::uno::Reference< com::sun::star::beans::XPropertySet > &set ); -+ -+public: // for initialization purposes only, not exported via an interface ! -+ void setPropertyValue_NoBroadcast_public( -+ const rtl::OUString & name, const com::sun::star::uno::Any & value ); -+ -+public: //XInterface -+ virtual void SAL_CALL acquire() throw() { OComponentHelper::acquire(); } -+ virtual void SAL_CALL release() throw() { OComponentHelper::release(); } -+ virtual com::sun::star::uno::Any SAL_CALL queryInterface( -+ const com::sun::star::uno::Type & reqType ) -+ throw (com::sun::star::uno::RuntimeException); -+ -+public: // OPropertySetHelper -+ virtual cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper(); -+ -+ virtual sal_Bool SAL_CALL convertFastPropertyValue( -+ ::com::sun::star::uno::Any & rConvertedValue, -+ ::com::sun::star::uno::Any & rOldValue, -+ sal_Int32 nHandle, -+ const ::com::sun::star::uno::Any& rValue ) -+ throw (::com::sun::star::lang::IllegalArgumentException); -+ -+ virtual void SAL_CALL setFastPropertyValue_NoBroadcast( -+ sal_Int32 nHandle, -+ const ::com::sun::star::uno::Any& rValue ) -+ throw (::com::sun::star::uno::Exception); -+ -+ virtual void SAL_CALL getFastPropertyValue( -+ ::com::sun::star::uno::Any& rValue, -+ sal_Int32 nHandle ) const; -+ -+ // XPropertySet -+ ::com::sun::star::uno::Reference < ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() -+ throw(com::sun::star::uno::RuntimeException); -+ -+public: // XServiceInfo -+ virtual rtl::OUString SAL_CALL getImplementationName() -+ throw(::com::sun::star::uno::RuntimeException); -+ virtual sal_Bool SAL_CALL supportsService(const rtl::OUString& ServiceName) -+ throw(::com::sun::star::uno::RuntimeException); -+ virtual com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames(void) -+ throw(::com::sun::star::uno::RuntimeException); -+ -+public: // XTypeProvider, first implemented by OPropertySetHelper -+ virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL getTypes() -+ throw( com::sun::star::uno::RuntimeException ); -+ virtual com::sun::star::uno::Sequence< sal_Int8> SAL_CALL getImplementationId() -+ throw( com::sun::star::uno::RuntimeException ); -+ -+public: // XDataDescriptorFactory -+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL -+ createDataDescriptor( ) throw (::com::sun::star::uno::RuntimeException) = 0; -+ -+public: // XNamed -+ virtual ::rtl::OUString SAL_CALL getName( ) throw (::com::sun::star::uno::RuntimeException); -+ virtual void SAL_CALL setName( const ::rtl::OUString& aName ) throw (::com::sun::star::uno::RuntimeException); -+ -+}; -+ -+} -+#endif -diff --git connectivity/source/drivers/postgresql/pq_xcolumn.cxx connectivity/source/drivers/postgresql/pq_xcolumn.cxx -new file mode 100644 -index 0000000..7fb6c62 ---- /dev/null -+++ connectivity/source/drivers/postgresql/pq_xcolumn.cxx -@@ -0,0 +1,124 @@ -+/************************************************************************* -+ * -+ * $RCSfile: pq_xcolumn.cxx,v $ -+ * -+ * $Revision: 1.1.2.2 $ -+ * -+ * last change: $Author: jbu $ $Date: 2004/06/10 15:26:59 $ -+ * -+ * The Contents of this file are made available subject to the terms of -+ * either of the following licenses -+ * -+ * - GNU Lesser General Public License Version 2.1 -+ * - Sun Industry Standards Source License Version 1.1 -+ * -+ * Sun Microsystems Inc., October, 2000 -+ * -+ * GNU Lesser General Public License Version 2.1 -+ * ============================================= -+ * Copyright 2000 by Sun Microsystems, Inc. -+ * 901 San Antonio Road, Palo Alto, CA 94303, USA -+ * -+ * This library is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License version 2.1, as published by the Free Software Foundation. -+ * -+ * This library is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public -+ * License along with this library; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, -+ * MA 02111-1307 USA -+ * -+ * -+ * Sun Industry Standards Source License Version 1.1 -+ * ================================================= -+ * The contents of this file are subject to the Sun Industry Standards -+ * Source License Version 1.1 (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.openoffice.org/license.html. -+ * -+ * Software provided under this License is provided on an "AS IS" basis, -+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, -+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, -+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. -+ * See the License for the specific provisions governing your rights and -+ * obligations concerning the Software. -+ * -+ * The Initial Developer of the Original Code is: Joerg Budischewski -+ * -+ * Copyright: 2000 by Sun Microsystems, Inc. -+ * -+ * All Rights Reserved. -+ * -+ * Contributor(s): Joerg Budischewski -+ * -+ * -+ ************************************************************************/ -+ -+#include -+ -+#include "pq_xcolumn.hxx" -+ -+using com::sun::star::uno::Any; -+using com::sun::star::uno::Reference; -+using com::sun::star::uno::RuntimeException; -+using com::sun::star::uno::Type; -+using com::sun::star::uno::Sequence; -+ -+using com::sun::star::beans::XPropertySet; -+ -+namespace pq_sdbc_driver -+{ -+#define ASCII_STR(x) OUString( RTL_CONSTASCII_USTRINGPARAM( x ) ) -+ -+Column::Column( const ::rtl::Reference< RefCountedMutex > & refMutex, -+ const Reference< com::sun::star::sdbc::XConnection > & connection, -+ ConnectionSettings *pSettings) -+ : ReflectionBase( -+ getStatics().refl.column.implName, -+ getStatics().refl.column.serviceNames, -+ refMutex, -+ connection, -+ pSettings, -+ * getStatics().refl.column.pProps ) -+{} -+ -+Reference< XPropertySet > Column::createDataDescriptor( ) throw (RuntimeException) -+{ -+ ColumnDescriptor * pColumn = new ColumnDescriptor( -+ m_refMutex, m_conn, m_pSettings ); -+ pColumn->copyValuesFrom( this ); -+ return Reference< XPropertySet > ( pColumn ); -+} -+ -+ColumnDescriptor::ColumnDescriptor( -+ const ::rtl::Reference< RefCountedMutex > & refMutex, -+ const Reference< com::sun::star::sdbc::XConnection > & connection, -+ ConnectionSettings *pSettings) -+ : ReflectionBase( -+ getStatics().refl.columnDescriptor.implName, -+ getStatics().refl.columnDescriptor.serviceNames, -+ refMutex, -+ connection, -+ pSettings, -+ *getStatics().refl.columnDescriptor.pProps ) -+{} -+ -+Reference< XPropertySet > ColumnDescriptor::createDataDescriptor( ) throw (RuntimeException) -+{ -+ ColumnDescriptor * pColumn = new ColumnDescriptor( -+ m_refMutex, m_conn, m_pSettings ); -+ pColumn->copyValuesFrom( this ); -+ -+ return Reference< XPropertySet > ( pColumn ); -+} -+ -+ -+ -+ -+ -+} -diff --git connectivity/source/drivers/postgresql/pq_xcolumn.hxx connectivity/source/drivers/postgresql/pq_xcolumn.hxx -new file mode 100644 -index 0000000..00b3b7b ---- /dev/null -+++ connectivity/source/drivers/postgresql/pq_xcolumn.hxx -@@ -0,0 +1,108 @@ -+/************************************************************************* -+ * -+ * $RCSfile: pq_xcolumn.hxx,v $ -+ * -+ * $Revision: 1.1.2.2 $ -+ * -+ * last change: $Author: jbu $ $Date: 2004/06/10 15:26:59 $ -+ * -+ * The Contents of this file are made available subject to the terms of -+ * either of the following licenses -+ * -+ * - GNU Lesser General Public License Version 2.1 -+ * - Sun Industry Standards Source License Version 1.1 -+ * -+ * Sun Microsystems Inc., October, 2000 -+ * -+ * GNU Lesser General Public License Version 2.1 -+ * ============================================= -+ * Copyright 2000 by Sun Microsystems, Inc. -+ * 901 San Antonio Road, Palo Alto, CA 94303, USA -+ * -+ * This library is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License version 2.1, as published by the Free Software Foundation. -+ * -+ * This library is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public -+ * License along with this library; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, -+ * MA 02111-1307 USA -+ * -+ * -+ * Sun Industry Standards Source License Version 1.1 -+ * ================================================= -+ * The contents of this file are subject to the Sun Industry Standards -+ * Source License Version 1.1 (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.openoffice.org/license.html. -+ * -+ * Software provided under this License is provided on an "AS IS" basis, -+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, -+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, -+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. -+ * See the License for the specific provisions governing your rights and -+ * obligations concerning the Software. -+ * -+ * The Initial Developer of the Original Code is: Joerg Budischewski -+ * -+ * Copyright: 2000 by Sun Microsystems, Inc. -+ * -+ * All Rights Reserved. -+ * -+ * Contributor(s): Joerg Budischewski -+ * -+ * -+ ************************************************************************/ -+ -+#ifndef _PQ_COLUMN_HXX_ -+#define _PQ_COLUMN_HXX_ -+ -+#include -+#include -+ -+#include -+#include -+ -+#include "pq_connection.hxx" -+#include "pq_xbase.hxx" -+ -+namespace pq_sdbc_driver -+{ -+ -+class Column : public ReflectionBase -+{ -+public: -+ Column( const ::rtl::Reference< RefCountedMutex > & refMutex, -+ const ::com::sun::star::uno::Reference< com::sun::star::sdbc::XConnection > & connection, -+ ConnectionSettings *pSettings); -+ -+public: // XDataDescriptorFactory -+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL -+ createDataDescriptor( ) throw (::com::sun::star::uno::RuntimeException); -+ -+}; -+ -+class ColumnDescriptor : public ReflectionBase -+{ -+public: -+ ColumnDescriptor( -+ const ::rtl::Reference< RefCountedMutex > & refMutex, -+ const ::com::sun::star::uno::Reference< com::sun::star::sdbc::XConnection > & connection, -+ ConnectionSettings *pSettings ); -+ -+public: // XDataDescriptorFactory -+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL -+ createDataDescriptor( ) throw (::com::sun::star::uno::RuntimeException); -+ -+}; -+ -+ -+} -+ -+ -+#endif -diff --git connectivity/source/drivers/postgresql/pq_xcolumns.cxx connectivity/source/drivers/postgresql/pq_xcolumns.cxx -new file mode 100644 -index 0000000..a424e3e ---- /dev/null -+++ connectivity/source/drivers/postgresql/pq_xcolumns.cxx -@@ -0,0 +1,616 @@ -+/************************************************************************* -+ * -+ * $RCSfile: pq_xcolumns.cxx,v $ -+ * -+ * $Revision: 1.1.2.3 $ -+ * -+ * last change: $Author: jbu $ $Date: 2004/08/29 08:33:30 $ -+ * -+ * The Contents of this file are made available subject to the terms of -+ * either of the following licenses -+ * -+ * - GNU Lesser General Public License Version 2.1 -+ * - Sun Industry Standards Source License Version 1.1 -+ * -+ * Sun Microsystems Inc., October, 2000 -+ * -+ * GNU Lesser General Public License Version 2.1 -+ * ============================================= -+ * Copyright 2000 by Sun Microsystems, Inc. -+ * 901 San Antonio Road, Palo Alto, CA 94303, USA -+ * -+ * This library is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License version 2.1, as published by the Free Software Foundation. -+ * -+ * This library is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public -+ * License along with this library; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, -+ * MA 02111-1307 USA -+ * -+ * -+ * Sun Industry Standards Source License Version 1.1 -+ * ================================================= -+ * The contents of this file are subject to the Sun Industry Standards -+ * Source License Version 1.1 (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.openoffice.org/license.html. -+ * -+ * Software provided under this License is provided on an "AS IS" basis, -+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, -+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, -+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. -+ * See the License for the specific provisions governing your rights and -+ * obligations concerning the Software. -+ * -+ * The Initial Developer of the Original Code is: Joerg Budischewski -+ * -+ * Copyright: 2000 by Sun Microsystems, Inc. -+ * -+ * All Rights Reserved. -+ * -+ * Contributor(s): Joerg Budischewski -+ * -+ * -+ ************************************************************************/ -+ -+#include -+ -+#include -+#include -+ -+#include -+#include -+#include -+#include -+ -+#include -+ -+#include "pq_xcolumns.hxx" -+#include "pq_xcolumn.hxx" -+#include "pq_statics.hxx" -+#include "pq_tools.hxx" -+ -+using osl::MutexGuard; -+ -+using rtl::OUString; -+using rtl::OUStringBuffer; -+using rtl::OUStringToOString; -+ -+using com::sun::star::beans::XPropertySet; -+using com::sun::star::beans::XPropertyChangeListener; -+using com::sun::star::beans::PropertyChangeEvent; -+ -+using com::sun::star::uno::Any; -+using com::sun::star::uno::makeAny; -+using com::sun::star::uno::UNO_QUERY; -+using com::sun::star::uno::Type; -+using com::sun::star::uno::XInterface; -+using com::sun::star::uno::Reference; -+using com::sun::star::uno::Sequence; -+using com::sun::star::uno::RuntimeException; -+ -+using com::sun::star::container::NoSuchElementException; -+using com::sun::star::lang::WrappedTargetException; -+ -+using com::sun::star::sdbc::XRow; -+using com::sun::star::sdbc::XCloseable; -+using com::sun::star::sdbc::XStatement; -+using com::sun::star::sdbc::XResultSet; -+using com::sun::star::sdbc::XParameters; -+using com::sun::star::sdbc::XPreparedStatement; -+using com::sun::star::sdbc::XDatabaseMetaData; -+using com::sun::star::sdbc::SQLException; -+ -+namespace pq_sdbc_driver -+{ -+#define ASCII_STR(x) OUString( RTL_CONSTASCII_USTRINGPARAM( x ) ) -+ -+static Any isCurrency( const rtl::OUString & typeName ) -+{ -+ sal_Bool b = typeName.equalsIgnoreAsciiCaseAscii( "money" ); -+ return Any( &b, getBooleanCppuType() ); -+} -+ -+// static sal_Bool isAutoIncrement8( const rtl::OUString & typeName ) -+// { -+// return typeName.equalsIgnoreAsciiCaseAscii( "serial8" ) || -+// typeName.equalsIgnoreAsciiCaseAscii( "bigserial" ); -+// } -+ -+static Any isAutoIncrement( const rtl::OUString & defaultValue ) -+{ -+ sal_Bool ret = sal_False; -+ -+ ret = defaultValue.matchAsciiL( RTL_CONSTASCII_STRINGPARAM( "nextval(" ) ); -+// printf( "%s %d\n", -+// OUStringToOString(defaultValue, RTL_TEXTENCODING_ASCII_US).getStr(), -+// ret ); -+// { -+// static const char * const serials[] = -+// { -+// "serial", "serial4", "serial8", "bigserial", 0 -+// }; -+// s sal_Bool b = sal_False; -+// for( int i = 0; !b && serials[i] ; i ++ ) -+// { -+// b = b || typeName.equalsIgnoreAsciiCaseAscii( serials[i] ); -+// } -+ return Any ( &ret, getBooleanCppuType() ); -+} -+ -+Columns::Columns( -+ const ::rtl::Reference< RefCountedMutex > & refMutex, -+ const ::com::sun::star::uno::Reference< com::sun::star::sdbc::XConnection > & origin, -+ ConnectionSettings *pSettings, -+ const rtl::OUString &schemaName, -+ const rtl::OUString &tableName) -+ : Container( refMutex, origin, pSettings, ASCII_STR( "COLUMN" ) ), -+ m_schemaName( schemaName ), -+ m_tableName( tableName ) -+{} -+ -+Columns::~Columns() -+{} -+ -+rtl::OUString columnMetaData2SDBCX( -+ ReflectionBase *pBase, const com::sun::star::uno::Reference< com::sun::star::sdbc::XRow > &xRow ) -+{ -+ Statics & st = getStatics(); -+ -+ // 1. TABLE_CAT string => table catalog (may be NULL) -+ // => not supported -+ // 2. TABLE_SCHEM string => table schema (may be NULL) -+ // => pg_namespace.nspname -+ // 3. TABLE_NAME string => table name -+ // => pg_class.relname -+ // 4. COLUMN_NAME string => column name -+ // => pg_attribure.attname -+ // 5. DATA_TYPE short => SQL type from java.sql.Types -+ // => pg_type.typname => sdbc.DataType -+ // 6. TYPE_NAME string => Data source dependent type name, for a UDT the -+ // type name is fully qualified -+ // => pg_type.typname -+ // 7. COLUMN_SIZE long => column size. For char or date types this is -+ // the maximum number of characters, for numeric -+ // or decimal types this is precision. -+ // => pg_type.typlen ( TODO: What is about variable size ? ) -+ // 8. BUFFER_LENGTH is not used. -+ // => not used -+ // 9. DECIMAL_DIGITS long => the number of fractional digits -+ // => don't know ! TODO ! -+ // 10. NUM_PREC_RADIX long => Radix (typically either 10 or 2) -+ // => TODO ?? -+ // 11. NULLABLE long => is NULL allowed? -+ // NO_NULLS - might not allow NULL values -+ // NULABLE - definitely allows NULL values -+ // NULLABLE_UNKNOWN - nullability unknown -+ // => pg_attribute.attnotnull -+ // 12. REMARKS string => comment describing column (may be NULL ) -+ // => Don't know, there does not seem to exist something like -+ // that in postgres -+ // 13. COLUMN_DEF string => default value (may be NULL) -+ // => pg_type.typdefault -+ // 14. SQL_DATA_TYPE long => unused -+ // => empty -+ // 15. SQL_DATETIME_SUB long => unused -+ // => empty -+ // 16. CHAR_OCTET_LENGTH long => for char types the maximum number of -+ // bytes in the column -+ // => pg_type.typlen -+ // 17. ORDINAL_POSITION int => index of column in table (starting at 1) -+ // pg_attribute.attnum -+ // 18. IS_NULLABLE string => "NO" means column definitely does not allow -+ // NULL values; "YES" means the column might -+ // allow NULL values. An empty string means -+ // nobody knows. -+ // => pg_attribute.attnotnull -+ -+ static const int COLUMN_NAME = 4; -+ static const int DATA_TYPE = 5; -+ static const int TYPE_NAME = 6; -+ static const int COLUMN_SIZE = 7; -+ static const int DECIMAL_DIGITS = 9; -+ static const int IS_NULLABLE = 11; -+ static const int DESCRIPTION = 12; -+ static const int DEFAULT_VALUE = 13; -+ -+ OUString name = xRow->getString( COLUMN_NAME ); -+ OUString typeName = xRow->getString( TYPE_NAME ); -+ -+ pBase->setPropertyValue_NoBroadcast_public( -+ st.NAME, makeAny( name ) ); -+ -+ pBase->setPropertyValue_NoBroadcast_public( -+ st.TYPE, makeAny( xRow->getInt( DATA_TYPE ) ) ); -+ -+ pBase->setPropertyValue_NoBroadcast_public( -+ st.TYPE_NAME, makeAny( typeName ) ); -+ -+ pBase->setPropertyValue_NoBroadcast_public( -+ st.PRECISION, makeAny( xRow->getInt( COLUMN_SIZE ) ) ); -+ -+ pBase->setPropertyValue_NoBroadcast_public( -+ st.SCALE, makeAny( xRow->getInt( DECIMAL_DIGITS ) ) ); -+ -+ pBase->setPropertyValue_NoBroadcast_public( -+ st.IS_NULLABLE, makeAny( xRow->getInt( IS_NULLABLE ) ) ); -+ -+ pBase->setPropertyValue_NoBroadcast_public( -+ st.DEFAULT_VALUE, makeAny( xRow->getString( DEFAULT_VALUE ) ) ); -+ -+// pBase->setPropertyValue_NoBroadcast_public( -+// st.DESCRIPTION, makeAny( xRow->getString( DESCRIPTION ) ) ); -+ -+// if( pBase->getPropertySetInfo()->hasPropertyByName( st.HELP_TEXT ) ) -+// pBase->setPropertyValue_NoBroadcast_public( -+// st.HELP_TEXT, makeAny( xRow->getString( DESCRIPTION ) ) ); -+// else // for key columns, etc. ... -+ pBase->setPropertyValue_NoBroadcast_public( -+ st.DESCRIPTION, makeAny( xRow->getString( DESCRIPTION ) ) ); -+ -+ -+ // maybe a better criterium than the type name can be found in future -+ pBase->setPropertyValue_NoBroadcast_public( -+ st.IS_AUTO_INCREMENT, isAutoIncrement(xRow->getString( DEFAULT_VALUE )) ); -+ -+ pBase->setPropertyValue_NoBroadcast_public( -+ st.IS_CURRENCY, isCurrency( typeName)); -+ return name; -+} -+ -+ -+// class CommentChanger : public cppu::WeakImplHelper1< XPropertyChangeListener > -+// { -+// ::rtl::Reference< RefCountedMutex > m_refMutex; -+// ::com::sun::star::uno::Reference< com::sun::star::sdbc::XConnection > m_connection; -+// ConnectionSettings *m_pSettings; -+// rtl::OUString m_schema; -+// rtl::OUString m_table; -+// rtl::OUString m_column; -+ -+// public: -+// CommentChanger( -+// const ::rtl::Reference< RefCountedMutex > & refMutex, -+// const ::com::sun::star::uno::Reference< com::sun::star::sdbc::XConnection > & connection, -+// ConnectionSettings *pSettings, -+// const rtl::OUString & schema, -+// const rtl::OUString & table, -+// const rtl::OUString & column ) : -+// m_refMutex( refMutex ), -+// m_connection( connection ), -+// m_pSettings( pSettings ), -+// m_schema ( schema ), -+// m_table ( table ), -+// m_column ( column ) -+// {} -+ -+ -+// // Methods -+// virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException) -+// { -+// osl::MutexGuard guard( m_refMutex->mutex ); -+// m_connection.clear(); -+// } -+// // Methods -+// virtual void SAL_CALL propertyChange( const ::com::sun::star::beans::PropertyChangeEvent& evt ) throw (::com::sun::star::uno::RuntimeException) -+// { -+// osl::MutexGuard guard( m_refMutex->mutex ); -+// OUStringBuffer buf( 128 ); -+// OUString comment; -+// evt.NewValue >>= comment; -+// buf.appendAscii( RTL_CONSTASCII_STRINGPARAM( "COMMENT ON COLUMN" ) ); -+// bufferQuoteQualifiedIdentifier( buf, m_schema, m_table , m_column ); -+// buf.appendAscii( RTL_CONSTASCII_STRINGPARAM( "IS " ) ); -+// bufferQuoteConstant( buf, comment,m_pSettings->encoding); -+ -+// printf( "changing comment of column %s to %s\n", -+// OUStringToOString( m_column, RTL_TEXTENCODING_ASCII_US ).getStr(), -+// OUStringToOString( comment, RTL_TEXTENCODING_ASCII_US ).getStr() ); -+ -+// m_connection->createStatement()->executeUpdate( buf.makeStringAndClear() ); -+// } -+// }; -+ -+void Columns::refresh() -+ throw (::com::sun::star::uno::RuntimeException) -+{ -+ try -+ { -+ if( isLog( m_pSettings, LogLevel::INFO ) ) -+ { -+ rtl::OStringBuffer buf; -+ buf.append( "sdbcx.Columns get refreshed for table " ); -+ buf.append( OUStringToOString( m_schemaName, m_pSettings->encoding ) ); -+ buf.append( "." ); -+ buf.append( OUStringToOString( m_tableName, m_pSettings->encoding ) ); -+ log( m_pSettings, LogLevel::INFO, buf.makeStringAndClear().getStr() ); -+ } -+ osl::MutexGuard guard( m_refMutex->mutex ); -+ -+ Statics &st = getStatics(); -+ Reference< XDatabaseMetaData > meta = m_origin->getMetaData(); -+ -+ Reference< XResultSet > rs = -+ meta->getColumns( Any(), m_schemaName, m_tableName, st.cPERCENT ); -+ -+ DisposeGuard disposeIt( rs ); -+ Reference< XRow > xRow( rs , UNO_QUERY ); -+ -+ String2IntMap map; -+ -+ std::vector< Any, Allocator< Any> > vec; -+ sal_Int32 columnIndex = 0; -+ while( rs->next() ) -+ { -+ Column * pColumn = -+ new Column( m_refMutex, m_origin, m_pSettings ); -+ Reference< com::sun::star::beans::XPropertySet > prop = pColumn; -+ -+ OUString name = columnMetaData2SDBCX( pColumn, xRow ); -+// pColumn->addPropertyChangeListener( -+// st.HELP_TEXT, -+// new CommentChanger( -+// m_refMutex, -+// m_origin, -+// m_pSettings, -+// m_schemaName, -+// m_tableName, -+// name ) ); -+ -+ vec.push_back( makeAny( prop ) ); -+ map[ name ] = columnIndex; -+ columnIndex ++; -+ } -+ m_values = Sequence< com::sun::star::uno::Any > ( & vec[0] , vec.size() ); -+ m_name2index.swap( map ); -+ } -+ catch ( com::sun::star::sdbc::SQLException & e ) -+ { -+ throw RuntimeException( e.Message , e.Context ); -+ } -+ fire( RefreshedBroadcaster( *this ) ); -+} -+ -+ -+void alterColumnByDescriptor( -+ const OUString & schemaName, -+ const OUString & tableName, -+ rtl_TextEncoding encoding, -+ const Reference< XStatement > &stmt, -+ const com::sun::star::uno::Reference< com::sun::star::beans::XPropertySet > & past, -+ const com::sun::star::uno::Reference< com::sun::star::beans::XPropertySet > & future) -+{ -+ Statics & st = getStatics(); -+ -+// if( past->getPropertyValue( st.TABLE_NAME ) != future->getPropertyValue( st.TABLE_NAME ) || -+// past->getPropertyValue( st.SCHEMA_NAME ) != future->getPropertyValue( st.SCHEMA_NAME )) -+// { -+// OUStringBuffer buf(128); -+// buf.appendAscii( RTL_CONSTASCII_STRINGPARAM( "Can't move column " ) ); -+// buf.append( extractStringProperty( past, st.COLUMN_NAME ) ); -+// buf.appendAscii( RTL_CONSTASCII_STRINGPARAM( " from table " ) ); -+// buf.append( extractStringProperty( past, st.TABLE_NAME ) ); -+// buf.appendAscii( RTL_CONSTASCII_STRINGPARAM( " to table " ) ); -+// buf.append( extractStringProperty( past, st.TABLE_NAME ) ); -+// throw SQLException( buf.makeStringAndClear(), Reference< XInterface > () ); -+// } -+ -+// OUString tableName = extractStringProperty( past, st.TABLE_NAME ); -+// OUString schemaName = extractStringProperty( past, st.SCHEMA_NAME ); -+ OUString pastColumnName = extractStringProperty( past, st.NAME ); -+ OUString futureColumnName = extractStringProperty( future, st.NAME ); -+ OUString pastTypeName = sqltype2string( past ); -+ OUString futureTypeName = sqltype2string( future ); -+ -+ TransactionGuard transaction( stmt ); -+ -+ OUStringBuffer buf( 128 ); -+ if( ! pastColumnName.getLength()) -+ { -+ // create a new column -+ buf.appendAscii( RTL_CONSTASCII_STRINGPARAM( "ALTER TABLE" ) ); -+ bufferQuoteQualifiedIdentifier( buf, schemaName, tableName ); -+ buf.appendAscii( RTL_CONSTASCII_STRINGPARAM( "ADD COLUMN" ) ); -+ bufferQuoteIdentifier( buf, futureColumnName ); -+ buf.append( futureTypeName ); -+ transaction.executeUpdate( buf.makeStringAndClear() ); -+ } -+ else -+ { -+ if( pastTypeName != futureTypeName ) -+ { -+ throw RuntimeException( -+ ASCII_STR( "Can't modify column types, drop the column and create a new one" ), -+ Reference< XInterface > () ); -+ } -+ -+ if( pastColumnName != futureColumnName ) -+ { -+ buf.appendAscii( RTL_CONSTASCII_STRINGPARAM( "ALTER TABLE" ) ); -+ bufferQuoteQualifiedIdentifier( buf, schemaName, tableName ); -+ buf.appendAscii( RTL_CONSTASCII_STRINGPARAM( "RENAME COLUMN" ) ); -+ bufferQuoteIdentifier( buf, pastColumnName ); -+ buf.appendAscii( RTL_CONSTASCII_STRINGPARAM( "TO" ) ); -+ bufferQuoteIdentifier( buf, futureColumnName ); -+ transaction.executeUpdate( buf.makeStringAndClear() ); -+ } -+ } -+ -+ OUString futureDefaultValue = extractStringProperty( future, st.DEFAULT_VALUE ); -+ OUString pastDefaultValue = extractStringProperty( past, st.DEFAULT_VALUE ); -+ if( futureDefaultValue != pastDefaultValue ) -+ { -+ buf = OUStringBuffer( 128 ); -+ buf.appendAscii( RTL_CONSTASCII_STRINGPARAM( "ALTER TABLE" ) ); -+ bufferQuoteQualifiedIdentifier( buf, schemaName, tableName ); -+ buf.appendAscii( RTL_CONSTASCII_STRINGPARAM( "ALTER COLUMN" ) ); -+ bufferQuoteIdentifier( buf, futureColumnName ); -+ buf.appendAscii( RTL_CONSTASCII_STRINGPARAM( "SET DEFAULT " ) ); -+ // default value is not quoted, caller needs to quote himself (otherwise -+ // how to pass e.g. nextval('something' ) ???? -+ buf.append( futureDefaultValue ); -+// bufferQuoteConstant( buf, defaultValue, encoding ); -+ transaction.executeUpdate( buf.makeStringAndClear() ); -+ } -+ -+ sal_Int32 futureNullable = extractIntProperty( future, st.IS_NULLABLE ); -+ sal_Int32 pastNullable = extractIntProperty( past, st.IS_NULLABLE ); -+ if( futureNullable != pastNullable ) -+ { -+ buf = OUStringBuffer( 128 ); -+ buf.appendAscii( RTL_CONSTASCII_STRINGPARAM( "ALTER TABLE" ) ); -+ bufferQuoteQualifiedIdentifier( buf, schemaName, tableName ); -+ buf.appendAscii( RTL_CONSTASCII_STRINGPARAM( "ALTER COLUMN" ) ); -+ bufferQuoteIdentifier( buf, futureColumnName ); -+ if( futureNullable == com::sun::star::sdbc::ColumnValue::NO_NULLS ) -+ { -+ buf.appendAscii( RTL_CONSTASCII_STRINGPARAM( "SET" ) ); -+ } -+ else -+ { -+ buf.appendAscii( RTL_CONSTASCII_STRINGPARAM( "DROP" ) ); -+ } -+ buf.appendAscii( RTL_CONSTASCII_STRINGPARAM( " NOT NULL" ) ); -+ transaction.executeUpdate( buf.makeStringAndClear() ); -+ } -+ -+// OUString futureComment = extractStringProperty( future, st.HELP_TEXT ); -+// OUString pastComment = extractStringProperty( past, st.HELP_TEXT ); -+// printf( "past Comment %s, futureComment %s\n", -+// OUStringToOString( pastComment, RTL_TEXTENCODING_ASCII_US ).getStr(), -+// OUStringToOString( futureComment, RTL_TEXTENCODING_ASCII_US ).getStr() ); -+ OUString futureComment = extractStringProperty( future, st.DESCRIPTION ); -+ OUString pastComment = extractStringProperty( past, st.DESCRIPTION ); -+ -+ if( futureComment != pastComment ) -+ { -+ buf = OUStringBuffer( 128 ); -+ buf.appendAscii( RTL_CONSTASCII_STRINGPARAM( "COMMENT ON COLUMN" ) ); -+ bufferQuoteQualifiedIdentifier( buf, schemaName, tableName , futureColumnName ); -+ buf.appendAscii( RTL_CONSTASCII_STRINGPARAM( "IS " ) ); -+ bufferQuoteConstant( buf, futureComment,encoding); -+ transaction.executeUpdate( buf.makeStringAndClear() ); -+ } -+ transaction.commit(); -+} -+ -+void Columns::appendByDescriptor( -+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& future ) -+ throw (::com::sun::star::sdbc::SQLException, -+ ::com::sun::star::container::ElementExistException, -+ ::com::sun::star::uno::RuntimeException) -+{ -+ osl::MutexGuard guard( m_refMutex->mutex ); -+ Statics & st = getStatics(); -+ Reference< XPropertySet > past = createDataDescriptor(); -+ past->setPropertyValue( st.IS_NULLABLE, makeAny( com::sun::star::sdbc::ColumnValue::NULLABLE ) ); -+ alterColumnByDescriptor( -+ m_schemaName, m_tableName, m_pSettings->encoding, m_origin->createStatement() , past, future ); -+ -+ refresh(); -+} -+ -+// void Columns::dropByName( const ::rtl::OUString& elementName ) -+// throw (::com::sun::star::sdbc::SQLException, -+// ::com::sun::star::container::NoSuchElementException, -+// ::com::sun::star::uno::RuntimeException) -+// { -+// String2IntMap::const_iterator ii = m_name2index.find( elementName ); -+// if( ii == m_name2index.end() ) -+// { -+// OUStringBuffer buf( 128 ); -+// buf.appendAscii( "Column " ); -+// buf.append( elementName ); -+// buf.appendAscii( " is unknown in table " ); -+// buf.append( m_schemaName ); -+// buf.appendAscii( "." ); -+// buf.append( m_tableName ); -+// buf.appendAscii( ", so it can't be dropped" ); -+// throw com::sun::star::container::NoSuchElementException( -+// buf.makeStringAndClear(), *this ); -+// } -+// dropByIndex( ii->second ); -+// } -+ -+void Columns::dropByIndex( sal_Int32 index ) -+ throw (::com::sun::star::sdbc::SQLException, -+ ::com::sun::star::lang::IndexOutOfBoundsException, -+ ::com::sun::star::uno::RuntimeException) -+{ -+ osl::MutexGuard guard( m_refMutex->mutex ); -+ if( index < 0 || index >= m_values.getLength() ) -+ { -+ OUStringBuffer buf( 128 ); -+ buf.appendAscii( "COLUMNS: Index out of range (allowed 0 to " ); -+ buf.append((sal_Int32)(m_values.getLength() -1) ); -+ buf.appendAscii( ", got " ); -+ buf.append( index ); -+ buf.appendAscii( ")" ); -+ throw com::sun::star::lang::IndexOutOfBoundsException( -+ buf.makeStringAndClear(), *this ); -+ } -+ -+ Reference< XPropertySet > set; -+ m_values[index] >>= set; -+ Statics &st = getStatics(); -+ OUString name; -+ set->getPropertyValue( st.NAME ) >>= name; -+ -+ OUStringBuffer update( 128 ); -+ update.appendAscii( "ALTER TABLE ONLY"); -+ bufferQuoteQualifiedIdentifier( update, m_schemaName, m_tableName ); -+ update.appendAscii( "DROP COLUMN" ); -+ bufferQuoteIdentifier( update, name ); -+ Reference< XStatement > stmt = m_origin->createStatement( ); -+ DisposeGuard disposeIt( stmt ); -+ stmt->executeUpdate( update.makeStringAndClear() ); -+ -+ Container::dropByIndex( index ); -+} -+ -+ -+::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > Columns::createDataDescriptor() -+ throw (::com::sun::star::uno::RuntimeException) -+{ -+ return new ColumnDescriptor( m_refMutex, m_origin, m_pSettings ); -+} -+ -+Reference< com::sun::star::container::XNameAccess > Columns::create( -+ const ::rtl::Reference< RefCountedMutex > & refMutex, -+ const ::com::sun::star::uno::Reference< com::sun::star::sdbc::XConnection > & origin, -+ ConnectionSettings *pSettings, -+ const rtl::OUString &schemaName, -+ const rtl::OUString &tableName, -+ Columns **ppColumns) -+{ -+ *ppColumns = new Columns( -+ refMutex, origin, pSettings, schemaName, tableName ); -+ Reference< com::sun::star::container::XNameAccess > ret = *ppColumns; -+ (*ppColumns)->refresh(); -+ -+ return ret; -+} -+ -+ -+//_____________________________________________________________________________________ -+ColumnDescriptors::ColumnDescriptors( -+ const ::rtl::Reference< RefCountedMutex > & refMutex, -+ const ::com::sun::star::uno::Reference< com::sun::star::sdbc::XConnection > & origin, -+ ConnectionSettings *pSettings ) -+ : Container( refMutex, origin, pSettings, ASCII_STR( "COLUMN-DESCRIPTOR" ) ) -+{} -+ -+ -+Reference< ::com::sun::star::beans::XPropertySet > ColumnDescriptors::createDataDescriptor() -+ throw (::com::sun::star::uno::RuntimeException) -+{ -+ return new ColumnDescriptor( m_refMutex, m_origin, m_pSettings ); -+} -+ -+} -diff --git connectivity/source/drivers/postgresql/pq_xcolumns.hxx connectivity/source/drivers/postgresql/pq_xcolumns.hxx -new file mode 100644 -index 0000000..3f5301a ---- /dev/null -+++ connectivity/source/drivers/postgresql/pq_xcolumns.hxx -@@ -0,0 +1,147 @@ -+/************************************************************************* -+ * -+ * $RCSfile: pq_xcolumns.hxx,v $ -+ * -+ * $Revision: 1.1.2.2 $ -+ * -+ * last change: $Author: jbu $ $Date: 2004/06/10 15:27:00 $ -+ * -+ * The Contents of this file are made available subject to the terms of -+ * either of the following licenses -+ * -+ * - GNU Lesser General Public License Version 2.1 -+ * - Sun Industry Standards Source License Version 1.1 -+ * -+ * Sun Microsystems Inc., October, 2000 -+ * -+ * GNU Lesser General Public License Version 2.1 -+ * ============================================= -+ * Copyright 2000 by Sun Microsystems, Inc. -+ * 901 San Antonio Road, Palo Alto, CA 94303, USA -+ * -+ * This library is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License version 2.1, as published by the Free Software Foundation. -+ * -+ * This library is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public -+ * License along with this library; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, -+ * MA 02111-1307 USA -+ * -+ * -+ * Sun Industry Standards Source License Version 1.1 -+ * ================================================= -+ * The contents of this file are subject to the Sun Industry Standards -+ * Source License Version 1.1 (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.openoffice.org/license.html. -+ * -+ * Software provided under this License is provided on an "AS IS" basis, -+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, -+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, -+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. -+ * See the License for the specific provisions governing your rights and -+ * obligations concerning the Software. -+ * -+ * The Initial Developer of the Original Code is: Joerg Budischewski -+ * -+ * Copyright: 2000 by Sun Microsystems, Inc. -+ * -+ * All Rights Reserved. -+ * -+ * Contributor(s): Joerg Budischewski -+ * -+ * -+ ************************************************************************/ -+ -+#ifndef _PQ_COLUMNS_HXX_ -+#define _PQ_COLUMNS_HXX_ -+ -+#include "pq_xcontainer.hxx" -+#include "pq_xbase.hxx" -+ -+namespace pq_sdbc_driver -+{ -+ -+void alterColumnByDescriptor( -+ const rtl::OUString & schemaName, -+ const rtl::OUString & tableName, -+ rtl_TextEncoding encoding, -+ const com::sun::star::uno::Reference< com::sun::star::sdbc::XStatement > &stmt, -+ const com::sun::star::uno::Reference< com::sun::star::beans::XPropertySet > & past, -+ const com::sun::star::uno::Reference< com::sun::star::beans::XPropertySet > & future); -+ -+rtl::OUString columnMetaData2SDBCX( -+ ReflectionBase *pBase, const com::sun::star::uno::Reference< com::sun::star::sdbc::XRow > &xRow ); -+ -+class Columns : public Container -+{ -+ rtl::OUString m_schemaName; -+ rtl::OUString m_tableName; -+ -+public: // instances Columns 'exception safe' -+ static com::sun::star::uno::Reference< com::sun::star::container::XNameAccess > create( -+ const ::rtl::Reference< RefCountedMutex > & refMutex, -+ const ::com::sun::star::uno::Reference< com::sun::star::sdbc::XConnection > & origin, -+ ConnectionSettings *pSettings, -+ const rtl::OUString &schemaName, -+ const rtl::OUString &tableName, -+ Columns **pColumns); -+ -+protected: -+ Columns( -+ const ::rtl::Reference< RefCountedMutex > & refMutex, -+ const ::com::sun::star::uno::Reference< com::sun::star::sdbc::XConnection > & origin, -+ ConnectionSettings *pSettings, -+ const rtl::OUString &schemaName, -+ const rtl::OUString &tableName); -+ -+ -+ virtual ~Columns(); -+ -+public: // XAppend -+ virtual void SAL_CALL appendByDescriptor( -+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ) -+ throw (::com::sun::star::sdbc::SQLException, -+ ::com::sun::star::container::ElementExistException, -+ ::com::sun::star::uno::RuntimeException); -+ -+// public: // XDrop -+// virtual void SAL_CALL dropByName( const ::rtl::OUString& elementName ) -+// throw (::com::sun::star::sdbc::SQLException, -+// ::com::sun::star::container::NoSuchElementException, -+// ::com::sun::star::uno::RuntimeException); -+ virtual void SAL_CALL dropByIndex( sal_Int32 index ) -+ throw (::com::sun::star::sdbc::SQLException, -+ ::com::sun::star::lang::IndexOutOfBoundsException, -+ ::com::sun::star::uno::RuntimeException); -+ -+public: // XRefreshable -+ virtual void SAL_CALL refresh( ) throw (::com::sun::star::uno::RuntimeException); -+ -+public: // XDataDescriptorFactory -+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL createDataDescriptor( ) -+ throw (::com::sun::star::uno::RuntimeException); -+}; -+ -+ -+class ColumnDescriptors : public Container -+{ -+public: -+ ColumnDescriptors( -+ const ::rtl::Reference< RefCountedMutex > & refMutex, -+ const ::com::sun::star::uno::Reference< com::sun::star::sdbc::XConnection > & origin, -+ ConnectionSettings *pSettings ); -+ -+public: // XDataDescriptorFactory -+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL createDataDescriptor( ) -+ throw (::com::sun::star::uno::RuntimeException); -+}; -+ -+} -+#endif -diff --git connectivity/source/drivers/postgresql/pq_xcontainer.cxx connectivity/source/drivers/postgresql/pq_xcontainer.cxx -new file mode 100644 -index 0000000..6e0126a ---- /dev/null -+++ connectivity/source/drivers/postgresql/pq_xcontainer.cxx -@@ -0,0 +1,514 @@ -+/************************************************************************* -+ * -+ * $RCSfile: pq_xcontainer.cxx,v $ -+ * -+ * $Revision: 1.1.2.5 $ -+ * -+ * last change: $Author: jbu $ $Date: 2007/01/07 13:50:38 $ -+ * -+ * The Contents of this file are made available subject to the terms of -+ * either of the following licenses -+ * -+ * - GNU Lesser General Public License Version 2.1 -+ * - Sun Industry Standards Source License Version 1.1 -+ * -+ * Sun Microsystems Inc., October, 2000 -+ * -+ * GNU Lesser General Public License Version 2.1 -+ * ============================================= -+ * Copyright 2000 by Sun Microsystems, Inc. -+ * 901 San Antonio Road, Palo Alto, CA 94303, USA -+ * -+ * This library is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License version 2.1, as published by the Free Software Foundation. -+ * -+ * This library is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public -+ * License along with this library; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, -+ * MA 02111-1307 USA -+ * -+ * -+ * Sun Industry Standards Source License Version 1.1 -+ * ================================================= -+ * The contents of this file are subject to the Sun Industry Standards -+ * Source License Version 1.1 (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.openoffice.org/license.html. -+ * -+ * Software provided under this License is provided on an "AS IS" basis, -+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, -+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, -+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. -+ * See the License for the specific provisions governing your rights and -+ * obligations concerning the Software. -+ * -+ * The Initial Developer of the Original Code is: Joerg Budischewski -+ * -+ * Copyright: 2000 by Sun Microsystems, Inc. -+ * -+ * All Rights Reserved. -+ * -+ * Contributor(s): Joerg Budischewski -+ * -+ * -+ ************************************************************************/ -+ -+#include -+ -+#include -+#include -+ -+ -+#include -+ -+#include "pq_xcontainer.hxx" -+#include "pq_statics.hxx" -+#include "pq_tools.hxx" -+ -+using osl::MutexGuard; -+ -+using rtl::OUString; -+using rtl::OUStringBuffer; -+using rtl::OUStringToOString; -+ -+using com::sun::star::beans::XPropertySet; -+ -+using com::sun::star::uno::Any; -+using com::sun::star::uno::makeAny; -+using com::sun::star::uno::UNO_QUERY; -+using com::sun::star::uno::Type; -+using com::sun::star::uno::XInterface; -+using com::sun::star::uno::Reference; -+using com::sun::star::uno::Sequence; -+using com::sun::star::uno::RuntimeException; -+ -+using com::sun::star::container::NoSuchElementException; -+using com::sun::star::container::XEnumeration; -+using com::sun::star::container::XContainerListener; -+using com::sun::star::container::ContainerEvent; -+using com::sun::star::lang::IndexOutOfBoundsException; -+using com::sun::star::lang::XEventListener; -+ -+using com::sun::star::lang::WrappedTargetException; -+ -+using com::sun::star::sdbc::XRow; -+using com::sun::star::sdbc::XCloseable; -+using com::sun::star::sdbc::XStatement; -+using com::sun::star::sdbc::XResultSet; -+using com::sun::star::sdbc::XParameters; -+using com::sun::star::sdbc::XPreparedStatement; -+using com::sun::star::sdbcx::XDataDescriptorFactory; -+ -+namespace pq_sdbc_driver -+{ -+#define ASCII_STR(x) OUString( RTL_CONSTASCII_USTRINGPARAM( x ) ) -+ -+ -+class ReplacedBroadcaster : public EventBroadcastHelper -+{ -+ ContainerEvent m_event; -+public: -+ ReplacedBroadcaster( -+ const Reference< XInterface > & source, -+ const rtl::OUString & name, -+ const Any & newElement, -+ const rtl::OUString & oldElement ) : -+ m_event( source, makeAny( name ), newElement, makeAny(oldElement) ) -+ {} -+ -+ virtual void fire( XEventListener * listener ) const -+ { -+ ((XContainerListener*)listener)->elementReplaced( m_event ); -+ } -+ virtual Type getType() const -+ { -+ return getCppuType( (Reference< XContainerListener > *)0 ); -+ } -+}; -+ -+class InsertedBroadcaster : public EventBroadcastHelper -+{ -+public: -+ ContainerEvent m_event; -+ InsertedBroadcaster( -+ const Reference< XInterface > & source, -+ const rtl::OUString & name, -+ const Any & newElement ) : -+ m_event( source, makeAny( name ), newElement, Any() ) -+ {} -+ -+ virtual void fire( XEventListener * listener ) const -+ { -+ ((XContainerListener*)listener)->elementInserted( m_event ); -+ } -+ -+ virtual Type getType() const -+ { -+ return getCppuType( (Reference< XContainerListener > *)0 ); -+ } -+}; -+ -+class RemovedBroadcaster : public EventBroadcastHelper -+{ -+public: -+ ContainerEvent m_event; -+ RemovedBroadcaster( -+ const Reference< XInterface > & source, -+ const rtl::OUString & name) : -+ m_event( source, makeAny( name ), Any(), Any() ) -+ {} -+ -+ virtual void fire( XEventListener * listener ) const -+ { -+ ((XContainerListener*)listener)->elementRemoved( m_event ); -+ } -+ -+ virtual Type getType() const -+ { -+ return getCppuType( (Reference< XContainerListener > *)0 ); -+ } -+}; -+ -+Container::Container( -+ const ::rtl::Reference< RefCountedMutex > & refMutex, -+ const ::com::sun::star::uno::Reference< com::sun::star::sdbc::XConnection > & origin, -+ ConnectionSettings *pSettings, -+ const ::rtl::OUString &type) -+ : ContainerBase( refMutex->mutex ), -+ m_refMutex( refMutex ), -+ m_pSettings( pSettings ), -+ m_origin( origin ), -+ m_type( type ) -+{ -+} -+ -+Any Container::getByName( const ::rtl::OUString& aName ) -+ throw (NoSuchElementException,WrappedTargetException,RuntimeException) -+{ -+ String2IntMap::const_iterator ii = m_name2index.find( aName ); -+ if( ii == m_name2index.end() ) -+ { -+ OUStringBuffer buf(128); -+ buf.appendAscii( "Element " ); -+ buf.append( aName ); -+ buf.appendAscii( " unknown in " ); -+ buf.append( m_type ); -+ buf.appendAscii( "-Container" ); -+ throw NoSuchElementException( buf.makeStringAndClear() , *this ); -+ } -+ OSL_ASSERT( ii->second >= 0 && ii->second < m_values.getLength() ); -+ return m_values[ ii->second ]; -+} -+ -+Sequence< OUString > Container::getElementNames( ) -+ throw (::com::sun::star::uno::RuntimeException) -+{ -+ Sequence< OUString > ret( m_values.getLength() ); -+ for( String2IntMap::const_iterator ii = m_name2index.begin(); -+ ii != m_name2index.end() ; -+ ++ ii ) -+ { -+ // give element names in index order ! -+ ret[ii->second] = ii->first; -+// ret[i] = ii->first; -+ } -+ return ret; -+} -+ -+sal_Bool Container::hasByName( const ::rtl::OUString& aName ) -+ throw (::com::sun::star::uno::RuntimeException) -+{ -+ return m_name2index.find( aName ) != m_name2index.end(); -+} -+ // Methods -+Type Container::getElementType( ) -+ throw (::com::sun::star::uno::RuntimeException) -+{ -+ return Type(); -+} -+ -+sal_Bool Container::hasElements( ) -+ throw (::com::sun::star::uno::RuntimeException) -+{ -+ return ! m_name2index.empty(); -+} -+ -+Any Container::getByIndex( sal_Int32 Index ) -+ throw (::com::sun::star::lang::IndexOutOfBoundsException, -+ ::com::sun::star::lang::WrappedTargetException, -+ ::com::sun::star::uno::RuntimeException) -+{ -+ if( Index < 0 || Index >= m_values.getLength() ) -+ { -+ OUStringBuffer buf(128); -+ buf.appendAscii( "Index " ); -+ buf.append( Index ); -+ buf.appendAscii(" out of range for " ); -+ buf.append( m_type ); -+ buf.appendAscii("-Container, expected 0 <= x <= " ); -+ buf.append( (sal_Int32 ) (m_values.getLength() -1)); -+ throw IndexOutOfBoundsException( buf.makeStringAndClear(), *this ); -+ } -+ return m_values[Index]; -+} -+ -+sal_Int32 Container::getCount() -+ throw (::com::sun::star::uno::RuntimeException) -+{ -+ return m_values.getLength(); -+} -+ -+ -+class ContainerEnumeration : public ::cppu::WeakImplHelper1< XEnumeration > -+{ -+ com::sun::star::uno::Sequence< com::sun::star::uno::Any > m_vec; -+ sal_Int32 m_index; -+public: -+ ContainerEnumeration( const com::sun::star::uno::Sequence< com::sun::star::uno::Any > &vec ) -+ : m_vec( vec ), -+ m_index( -1 ) -+ {} -+ -+public: -+ // XEnumeration -+ virtual sal_Bool SAL_CALL hasMoreElements( ) -+ throw (::com::sun::star::uno::RuntimeException); -+ virtual ::com::sun::star::uno::Any SAL_CALL nextElement( ) -+ throw (::com::sun::star::container::NoSuchElementException, -+ ::com::sun::star::lang::WrappedTargetException, -+ ::com::sun::star::uno::RuntimeException); -+ -+}; -+ -+sal_Bool ContainerEnumeration::hasMoreElements() -+ throw (::com::sun::star::uno::RuntimeException) -+{ -+ return m_vec.getLength() > m_index +1; -+} -+ -+com::sun::star::uno::Any ContainerEnumeration::nextElement() -+ throw (::com::sun::star::container::NoSuchElementException, -+ ::com::sun::star::lang::WrappedTargetException, -+ ::com::sun::star::uno::RuntimeException) -+{ -+ if( ! hasMoreElements() ) -+ { -+ throw NoSuchElementException( -+ ASCII_STR( "NoSuchElementException during enumeration" ), *this ); -+ } -+ m_index ++; -+ return m_vec[m_index]; -+} -+ -+Reference< XEnumeration > Container::createEnumeration( ) -+ throw (::com::sun::star::uno::RuntimeException) -+{ -+ return new ContainerEnumeration( m_values ); -+} -+ -+void Container::addRefreshListener( -+ const ::com::sun::star::uno::Reference< ::com::sun::star::util::XRefreshListener >& l ) -+ throw (::com::sun::star::uno::RuntimeException) -+{ -+ rBHelper.addListener( getCppuType(&l) , l ); -+} -+ -+void Container::removeRefreshListener( -+ const ::com::sun::star::uno::Reference< ::com::sun::star::util::XRefreshListener >& l ) -+ throw (::com::sun::star::uno::RuntimeException) -+{ -+ rBHelper.removeListener( getCppuType(&l) , l ); -+} -+ -+void Container::disposing() -+{ -+ m_origin.clear(); -+} -+ -+void Container::rename( const rtl::OUString &oldName, const rtl::OUString &newName ) -+{ -+ Any newValue; -+ { -+ osl::MutexGuard guard ( m_refMutex->mutex ); -+ String2IntMap::iterator ii = m_name2index.find( oldName ); -+ if( ii != m_name2index.end() ) -+ { -+ sal_Int32 nIndex = ii->second; -+ newValue = m_values[nIndex]; -+ m_name2index.erase( ii ); -+ m_name2index[ newName ] = nIndex; -+ newValue = m_values[nIndex]; -+ } -+ } -+ fire( ReplacedBroadcaster( *this, newName, newValue, oldName ) ); -+ fire( RefreshedBroadcaster( *this ) ); -+} -+ -+void Container::dropByName( const ::rtl::OUString& elementName ) -+ throw (::com::sun::star::sdbc::SQLException, -+ ::com::sun::star::container::NoSuchElementException, -+ ::com::sun::star::uno::RuntimeException) -+{ -+ osl::MutexGuard guard( m_refMutex->mutex ); -+ String2IntMap::const_iterator ii = m_name2index.find( elementName ); -+ if( ii == m_name2index.end() ) -+ { -+ OUStringBuffer buf( 128 ); -+ buf.appendAscii( "Column " ); -+ buf.append( elementName ); -+ buf.appendAscii( " is unknown in " ); -+ buf.append( m_type ); -+// buf.appendAscii( " " ); -+// buf.append( m_schemaName ); -+// buf.appendAscii( "." ); -+// buf.append( m_tableName ); -+ buf.appendAscii( " container, so it can't be dropped" ); -+ throw com::sun::star::container::NoSuchElementException( -+ buf.makeStringAndClear(), *this ); -+ } -+ dropByIndex( ii->second ); -+} -+ -+void Container::dropByIndex( sal_Int32 index ) -+ throw (::com::sun::star::sdbc::SQLException, -+ ::com::sun::star::lang::IndexOutOfBoundsException, -+ ::com::sun::star::uno::RuntimeException) -+{ -+ osl::MutexGuard guard( m_refMutex->mutex ); -+ if( index < 0 || index >= m_values.getLength() ) -+ { -+ OUStringBuffer buf( 128 ); -+ buf.appendAscii( "Index out of range (allowed 0 to " ); -+ buf.append((sal_Int32)(m_values.getLength() -1) ); -+ buf.appendAscii( ", got " ); -+ buf.append( index ); -+ buf.appendAscii( ") in " ); -+ buf.append( m_type ); -+ throw com::sun::star::lang::IndexOutOfBoundsException( -+ buf.makeStringAndClear(), *this ); -+ } -+ -+ OUString name; -+ for( String2IntMap::iterator ii = m_name2index.begin() ; -+ ii != m_name2index.end() ; -+ ++ ii ) -+ { -+ if( ii->second == index ) -+ { -+ name = ii->first; -+ m_name2index.erase( ii ); -+ break; -+ } -+ } -+ -+ Any oldElement = m_values[index]; -+ for( int i = index +1 ; i < m_values.getLength() ; i ++ ) -+ { -+ m_values[i-1] = m_values[i]; -+ -+ // I know, this is expensive, but don't want to maintain another map ... -+ for( String2IntMap::iterator ii = m_name2index.begin() ; -+ ii != m_name2index.end() ; -+ ++ ii ) -+ { -+ if( ii->second == i ) -+ { -+ ii->second = i-1; -+ break; -+ } -+ } -+ } -+ m_values.realloc( m_values.getLength() - 1 ); -+ -+ fire( RemovedBroadcaster( *this, name ) ); -+} -+ -+void Container::append( -+ const rtl::OUString & name, -+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ) -+ throw ( ::com::sun::star::container::ElementExistException ) -+ -+{ -+ osl::MutexGuard guard( m_refMutex->mutex ); -+ -+ if( hasByName( name ) ) -+ { -+ OUStringBuffer buf( 128 ); -+ buf.appendAscii( "a "); -+ buf.append( m_type ); -+ buf.appendAscii( " with name " ); -+ buf.append( name ); -+ buf.appendAscii( " already exists in this container" ); -+ throw com::sun::star::container::ElementExistException( -+ buf.makeStringAndClear() , *this ); -+ } -+ -+ int index = m_values.getLength(); -+ m_values.realloc( m_values.getLength() + 1 ); -+ m_values[index] = makeAny( descriptor ); -+ m_name2index[name] = index; -+ -+ fire( InsertedBroadcaster( *this, name, makeAny( descriptor ) ) ); -+} -+ -+void Container::appendByDescriptor( -+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor) -+ throw (::com::sun::star::sdbc::SQLException, -+ ::com::sun::star::container::ElementExistException, -+ ::com::sun::star::uno::RuntimeException) -+{ -+ append( extractStringProperty( descriptor, getStatics().NAME ), descriptor ); -+} -+ -+ -+void Container::addContainerListener( -+ const ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerListener >& l ) -+ throw (::com::sun::star::uno::RuntimeException) -+{ -+ rBHelper.addListener( getCppuType(&l) , l ); -+} -+ -+void Container::removeContainerListener( -+ const ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerListener >& l ) -+ throw (::com::sun::star::uno::RuntimeException) -+{ -+ rBHelper.removeListener( getCppuType(&l) , l ); -+} -+ -+ -+void Container::fire( const EventBroadcastHelper &helper ) -+{ -+ Reference< ::com::sun::star::util::XRefreshListener > l; -+ cppu::OInterfaceContainerHelper *container = rBHelper.getContainer( helper.getType() ); -+ if( container ) -+ { -+ cppu::OInterfaceIteratorHelper iterator( * container ); -+ while( iterator.hasMoreElements() ) -+ { -+ try -+ { -+ helper.fire( (XEventListener * ) iterator.next() ); -+ } -+ catch ( com::sun::star::uno::RuntimeException & e ) -+ { -+ OSL_ENSURE( 0, "exception catched" ); -+ // loose coupling, a runtime exception shall not break anything -+ // TODO: log away as warning ! -+ } -+ catch( com::sun::star::uno::Exception & e ) -+ { -+ OSL_ENSURE( 0, "exception from listener flying through" ); -+ throw; -+ } -+ } -+ } -+ -+} -+ -+} -diff --git connectivity/source/drivers/postgresql/pq_xcontainer.hxx connectivity/source/drivers/postgresql/pq_xcontainer.hxx -new file mode 100644 -index 0000000..8aaffde ---- /dev/null -+++ connectivity/source/drivers/postgresql/pq_xcontainer.hxx -@@ -0,0 +1,240 @@ -+/************************************************************************* -+ * -+ * $RCSfile: pq_xcontainer.hxx,v $ -+ * -+ * $Revision: 1.1.2.4 $ -+ * -+ * last change: $Author: jbu $ $Date: 2007/01/07 13:50:38 $ -+ * -+ * The Contents of this file are made available subject to the terms of -+ * either of the following licenses -+ * -+ * - GNU Lesser General Public License Version 2.1 -+ * - Sun Industry Standards Source License Version 1.1 -+ * -+ * Sun Microsystems Inc., October, 2000 -+ * -+ * GNU Lesser General Public License Version 2.1 -+ * ============================================= -+ * Copyright 2000 by Sun Microsystems, Inc. -+ * 901 San Antonio Road, Palo Alto, CA 94303, USA -+ * -+ * This library is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License version 2.1, as published by the Free Software Foundation. -+ * -+ * This library is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public -+ * License along with this library; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, -+ * MA 02111-1307 USA -+ * -+ * -+ * Sun Industry Standards Source License Version 1.1 -+ * ================================================= -+ * The contents of this file are subject to the Sun Industry Standards -+ * Source License Version 1.1 (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.openoffice.org/license.html. -+ * -+ * Software provided under this License is provided on an "AS IS" basis, -+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, -+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, -+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. -+ * See the License for the specific provisions governing your rights and -+ * obligations concerning the Software. -+ * -+ * The Initial Developer of the Original Code is: Joerg Budischewski -+ * -+ * Copyright: 2000 by Sun Microsystems, Inc. -+ * -+ * All Rights Reserved. -+ * -+ * Contributor(s): Joerg Budischewski -+ * -+ * -+ ************************************************************************/ -+ -+#ifndef _PQ_CONTAINER_HXX_ -+#define _PQ_CONTAINER_HXX_ -+#include -+#include -+ -+#include -+#include -+#include -+#include -+ -+#include -+#include -+#include -+ -+#include -+ -+#include -+ -+#include "pq_connection.hxx" -+#include "pq_statics.hxx" -+ -+namespace pq_sdbc_driver -+{ -+ -+class EventBroadcastHelper -+{ -+public: -+ virtual void fire(com::sun::star::lang::XEventListener * listener) const = 0; -+ virtual com::sun::star::uno::Type getType() const = 0; -+ virtual ~EventBroadcastHelper(){}; -+}; -+ -+class RefreshedBroadcaster : public EventBroadcastHelper -+{ -+ com::sun::star::lang::EventObject m_event; -+public: -+ RefreshedBroadcaster(const com::sun::star::uno::Reference< com::sun::star::uno::XInterface > & source ) : -+ m_event( source ) -+ {} -+ -+ virtual void fire( com::sun::star::lang::XEventListener * listener ) const -+ { -+ ((com::sun::star::util::XRefreshListener*)listener)->refreshed( m_event ); -+ } -+ -+ virtual com::sun::star::uno::Type getType() const -+ { -+ return getCppuType( -+ (com::sun::star::uno::Reference< com::sun::star::util::XRefreshListener > *)0 ); -+ } -+}; -+ -+typedef ::std::hash_map -+< -+ rtl::OUString, -+ sal_Int32, -+ rtl::OUStringHash, -+ ::std::equal_to< rtl::OUString >, -+ Allocator< ::std::pair< const ::rtl::OUString , sal_Int32 > > -+> String2IntMap; -+ -+typedef ::cppu::WeakComponentImplHelper8 -+< -+ com::sun::star::container::XNameAccess, -+ com::sun::star::container::XIndexAccess, -+ com::sun::star::container::XEnumerationAccess, -+ com::sun::star::sdbcx::XAppend, -+ com::sun::star::sdbcx::XDrop, -+ com::sun::star::util::XRefreshable, -+ com::sun::star::sdbcx::XDataDescriptorFactory, -+ com::sun::star::container::XContainer -+> ContainerBase; -+ -+class /* abstract */ Container : public ContainerBase -+{ -+protected: -+ ::rtl::Reference< RefCountedMutex > m_refMutex; -+ ConnectionSettings *m_pSettings; -+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > m_origin; -+ String2IntMap m_name2index; // maps the element name to an index -+ ::com::sun::star::uno::Sequence< com::sun::star::uno::Any > m_values; // contains the real values -+ ::rtl::OUString m_type; -+ -+public: -+ Container( -+ const ::rtl::Reference< RefCountedMutex > & refMutex, -+ const ::com::sun::star::uno::Reference< com::sun::star::sdbc::XConnection > & origin, -+ ConnectionSettings *pSettings, -+ const ::rtl::OUString & type // for exception messages -+ ); -+ -+public: // XIndexAccess -+ virtual sal_Int32 SAL_CALL getCount( ) -+ throw (::com::sun::star::uno::RuntimeException); -+ virtual ::com::sun::star::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) -+ throw (::com::sun::star::lang::IndexOutOfBoundsException, -+ ::com::sun::star::lang::WrappedTargetException, -+ ::com::sun::star::uno::RuntimeException); -+ -+public: // XEnumerationAccess -+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration > -+ SAL_CALL createEnumeration( ) throw (::com::sun::star::uno::RuntimeException); -+ -+public: // XNameAccess -+ virtual ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) -+ throw (::com::sun::star::container::NoSuchElementException, -+ ::com::sun::star::lang::WrappedTargetException, -+ ::com::sun::star::uno::RuntimeException); -+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames( ) -+ throw (::com::sun::star::uno::RuntimeException); -+ virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) -+ throw (::com::sun::star::uno::RuntimeException); -+ // Methods -+ virtual ::com::sun::star::uno::Type SAL_CALL getElementType( ) -+ throw (::com::sun::star::uno::RuntimeException); -+ virtual sal_Bool SAL_CALL hasElements( ) -+ throw (::com::sun::star::uno::RuntimeException); -+ -+ -+public: // XAppend -+ // Must be overriden in Non-Descriptors. May be overriden in descriptors, when -+ // PropertySet.NAME != container name -+ virtual void SAL_CALL appendByDescriptor( -+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ) -+ throw (::com::sun::star::sdbc::SQLException, -+ ::com::sun::star::container::ElementExistException, -+ ::com::sun::star::uno::RuntimeException); -+ -+ // helper method ! -+ void append( -+ const rtl::OUString & str, -+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ) -+ throw ( ::com::sun::star::container::ElementExistException ); -+ -+ -+public: // XDrop -+ virtual void SAL_CALL dropByName( const ::rtl::OUString& elementName ) -+ throw (::com::sun::star::sdbc::SQLException, -+ ::com::sun::star::container::NoSuchElementException, -+ ::com::sun::star::uno::RuntimeException); -+ virtual void SAL_CALL dropByIndex( sal_Int32 index ) -+ throw (::com::sun::star::sdbc::SQLException, -+ ::com::sun::star::lang::IndexOutOfBoundsException, -+ ::com::sun::star::uno::RuntimeException); -+ -+public: // XDataDescriptorFactory -+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL createDataDescriptor( ) -+ throw (::com::sun::star::uno::RuntimeException) = 0; -+ -+public: // XRefreshable -+ virtual void SAL_CALL refresh( ) throw (::com::sun::star::uno::RuntimeException) {} -+ virtual void SAL_CALL addRefreshListener( -+ const ::com::sun::star::uno::Reference< ::com::sun::star::util::XRefreshListener >& l ) -+ throw (::com::sun::star::uno::RuntimeException); -+ virtual void SAL_CALL removeRefreshListener( -+ const ::com::sun::star::uno::Reference< ::com::sun::star::util::XRefreshListener >& l ) -+ throw (::com::sun::star::uno::RuntimeException); -+ -+public: -+ // Methods -+ virtual void SAL_CALL addContainerListener( -+ const ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerListener >& xListener ) -+ throw (::com::sun::star::uno::RuntimeException); -+ virtual void SAL_CALL removeContainerListener( -+ const ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerListener >& xListener ) -+ throw (::com::sun::star::uno::RuntimeException); -+ -+public: -+ virtual void SAL_CALL disposing(); -+ -+public: -+ void rename( const rtl::OUString & oldName, const rtl::OUString &newName ); -+ -+protected: -+ void fire( const EventBroadcastHelper & helper ); -+}; -+ -+} -+#endif -diff --git connectivity/source/drivers/postgresql/pq_xindex.cxx connectivity/source/drivers/postgresql/pq_xindex.cxx -new file mode 100644 -index 0000000..6edcb7e ---- /dev/null -+++ connectivity/source/drivers/postgresql/pq_xindex.cxx -@@ -0,0 +1,267 @@ -+/************************************************************************* -+ * -+ * $RCSfile: pq_xindex.cxx,v $ -+ * -+ * $Revision: 1.1.2.1 $ -+ * -+ * last change: $Author: jbu $ $Date: 2004/06/10 15:27:01 $ -+ * -+ * The Contents of this file are made available subject to the terms of -+ * either of the following licenses -+ * -+ * - GNU Lesser General Public License Version 2.1 -+ * - Sun Industry Standards Source License Version 1.1 -+ * -+ * Sun Microsystems Inc., October, 2000 -+ * -+ * GNU Lesser General Public License Version 2.1 -+ * ============================================= -+ * Copyright 2000 by Sun Microsystems, Inc. -+ * 901 San Antonio Road, Palo Alto, CA 94303, USA -+ * -+ * This library is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License version 2.1, as published by the Free Software Foundation. -+ * -+ * This library is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public -+ * License along with this library; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, -+ * MA 02111-1307 USA -+ * -+ * -+ * Sun Industry Standards Source License Version 1.1 -+ * ================================================= -+ * The contents of this file are subject to the Sun Industry Standards -+ * Source License Version 1.1 (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.openoffice.org/license.html. -+ * -+ * Software provided under this License is provided on an "AS IS" basis, -+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, -+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, -+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. -+ * See the License for the specific provisions governing your rights and -+ * obligations concerning the Software. -+ * -+ * The Initial Developer of the Original Code is: Joerg Budischewski -+ * -+ * Copyright: 2000 by Sun Microsystems, Inc. -+ * -+ * All Rights Reserved. -+ * -+ * Contributor(s): Joerg Budischewski -+ * -+ * -+ ************************************************************************/ -+ -+#include -+ -+#include -+#include -+ -+#include -+ -+#include -+#include -+ -+#include "pq_xindex.hxx" -+#include "pq_xindexcolumns.hxx" -+#include "pq_tools.hxx" -+#include "pq_statics.hxx" -+ -+using osl::MutexGuard; -+using osl::Mutex; -+ -+using rtl::OUString; -+using rtl::OUStringBuffer; -+ -+using com::sun::star::container::XNameAccess; -+using com::sun::star::container::XIndexAccess; -+using com::sun::star::container::ElementExistException; -+using com::sun::star::container::NoSuchElementException; -+ -+using com::sun::star::uno::Reference; -+using com::sun::star::uno::Exception; -+using com::sun::star::uno::UNO_QUERY; -+using com::sun::star::uno::XInterface; -+using com::sun::star::uno::Sequence; -+using com::sun::star::uno::Any; -+using com::sun::star::uno::makeAny; -+using com::sun::star::uno::Type; -+using com::sun::star::uno::RuntimeException; -+ -+using com::sun::star::lang::IllegalArgumentException; -+using com::sun::star::lang::IndexOutOfBoundsException; -+ -+using com::sun::star::beans::XPropertySetInfo; -+using com::sun::star::beans::XFastPropertySet; -+using com::sun::star::beans::XMultiPropertySet; -+using com::sun::star::beans::XPropertySet; -+using com::sun::star::beans::Property; -+ -+using com::sun::star::sdbc::XResultSet; -+using com::sun::star::sdbc::XPreparedStatement; -+using com::sun::star::sdbc::XStatement; -+using com::sun::star::sdbc::XParameters; -+using com::sun::star::sdbc::XRow; -+using com::sun::star::sdbc::SQLException; -+ -+namespace pq_sdbc_driver -+{ -+#define ASCII_STR(x) OUString( RTL_CONSTASCII_USTRINGPARAM( x ) ) -+ -+Index::Index( const ::rtl::Reference< RefCountedMutex > & refMutex, -+ const Reference< com::sun::star::sdbc::XConnection > & connection, -+ ConnectionSettings *pSettings, -+ const rtl::OUString & schemaName, -+ const rtl::OUString & tableName ) -+ : ReflectionBase( -+ getStatics().refl.index.implName, -+ getStatics().refl.index.serviceNames, -+ refMutex, -+ connection, -+ pSettings, -+ * getStatics().refl.index.pProps ), -+ m_schemaName( schemaName ), -+ m_tableName( tableName ) -+{} -+ -+Reference< XPropertySet > Index::createDataDescriptor( ) throw (RuntimeException) -+{ -+ IndexDescriptor * pIndex = new IndexDescriptor( -+ m_refMutex, m_conn, m_pSettings ); -+ pIndex->copyValuesFrom( this ); -+ -+ return Reference< XPropertySet > ( pIndex ); -+} -+ -+Reference< XNameAccess > Index::getColumns( ) throw (::com::sun::star::uno::RuntimeException) -+{ -+ if( ! m_indexColumns.is() ) -+ { -+ Sequence< OUString > columnNames; -+ getPropertyValue( getStatics().PRIVATE_COLUMN_INDEXES ) >>= columnNames; -+ OUString indexName = extractStringProperty( this, getStatics().NAME ); -+ m_indexColumns = IndexColumns::create( -+ m_refMutex, m_conn, m_pSettings, m_schemaName, -+ m_tableName, indexName, columnNames ); -+ } -+ return m_indexColumns; -+} -+ -+Sequence Index::getTypes() throw( RuntimeException ) -+{ -+ static cppu::OTypeCollection *pCollection; -+ if( ! pCollection ) -+ { -+ MutexGuard guard( osl::Mutex::getGlobalMutex() ); -+ if( !pCollection ) -+ { -+ static cppu::OTypeCollection collection( -+ getCppuType( (Reference< com::sun::star::sdbcx::XColumnsSupplier> *) 0 ), -+ ReflectionBase::getTypes()); -+ pCollection = &collection; -+ } -+ } -+ return pCollection->getTypes(); -+} -+ -+Sequence< sal_Int8> Index::getImplementationId() throw( RuntimeException ) -+{ -+ return getStatics().refl.index.implementationId; -+} -+ -+Any Index::queryInterface( const Type & reqType ) throw (RuntimeException) -+{ -+ Any ret; -+ -+ ret = ReflectionBase::queryInterface( reqType ); -+ if( ! ret.hasValue() ) -+ ret = ::cppu::queryInterface( -+ reqType, -+ static_cast< com::sun::star::sdbcx::XColumnsSupplier * > ( this ) ); -+ return ret; -+} -+ -+ -+//___________________________________________________________________________________ -+IndexDescriptor::IndexDescriptor( -+ const ::rtl::Reference< RefCountedMutex > & refMutex, -+ const Reference< com::sun::star::sdbc::XConnection > & connection, -+ ConnectionSettings *pSettings ) -+ : ReflectionBase( -+ getStatics().refl.indexDescriptor.implName, -+ getStatics().refl.indexDescriptor.serviceNames, -+ refMutex, -+ connection, -+ pSettings, -+ * getStatics().refl.indexDescriptor.pProps ) -+{} -+ -+Reference< XPropertySet > IndexDescriptor::createDataDescriptor( ) throw (RuntimeException) -+{ -+ IndexDescriptor * pIndex = new IndexDescriptor( -+ m_refMutex, m_conn, m_pSettings ); -+ pIndex->copyValuesFrom( this ); -+ return Reference< XPropertySet > ( pIndex ); -+} -+ -+Reference< XNameAccess > IndexDescriptor::getColumns( ) throw (::com::sun::star::uno::RuntimeException) -+{ -+ if( ! m_indexColumns.is() ) -+ { -+ m_indexColumns = IndexColumnDescriptors::create( -+ m_refMutex, m_conn, m_pSettings ); -+// Sequence< OUString > columnNames; -+// getPropertyValue( getStatics().PRIVATE_COLUMN_INDEXES ) >>= columnNames; -+// OUString indexName = extractStringProperty( this, getStatics().NAME ); -+// m_indexColumns = IndexColumns::create( -+// m_refMutex, m_conn, m_pSettings, m_schemaName, -+// m_tableName, indexName, columnNames ); -+ } -+ return m_indexColumns; -+} -+ -+Sequence IndexDescriptor::getTypes() throw( RuntimeException ) -+{ -+ static cppu::OTypeCollection *pCollection; -+ if( ! pCollection ) -+ { -+ MutexGuard guard( osl::Mutex::getGlobalMutex() ); -+ if( !pCollection ) -+ { -+ static cppu::OTypeCollection collection( -+ getCppuType( (Reference< com::sun::star::sdbcx::XColumnsSupplier> *) 0 ), -+ ReflectionBase::getTypes()); -+ pCollection = &collection; -+ } -+ } -+ return pCollection->getTypes(); -+} -+ -+Sequence< sal_Int8> IndexDescriptor::getImplementationId() throw( RuntimeException ) -+{ -+ return getStatics().refl.indexDescriptor.implementationId; -+} -+ -+Any IndexDescriptor::queryInterface( const Type & reqType ) throw (RuntimeException) -+{ -+ Any ret; -+ -+ ret = ReflectionBase::queryInterface( reqType ); -+ if( ! ret.hasValue() ) -+ ret = ::cppu::queryInterface( -+ reqType, -+ static_cast< com::sun::star::sdbcx::XColumnsSupplier * > ( this ) ); -+ return ret; -+} -+ -+ -+ -+ -+} -diff --git connectivity/source/drivers/postgresql/pq_xindex.hxx connectivity/source/drivers/postgresql/pq_xindex.hxx -new file mode 100644 -index 0000000..43451f4 ---- /dev/null -+++ connectivity/source/drivers/postgresql/pq_xindex.hxx -@@ -0,0 +1,156 @@ -+/************************************************************************* -+ * -+ * $RCSfile: pq_xindex.hxx,v $ -+ * -+ * $Revision: 1.1.2.1 $ -+ * -+ * last change: $Author: jbu $ $Date: 2004/06/10 15:27:02 $ -+ * -+ * The Contents of this file are made available subject to the terms of -+ * either of the following licenses -+ * -+ * - GNU Lesser General Public License Version 2.1 -+ * - Sun Industry Standards Source License Version 1.1 -+ * -+ * Sun Microsystems Inc., October, 2000 -+ * -+ * GNU Lesser General Public License Version 2.1 -+ * ============================================= -+ * Copyright 2000 by Sun Microsystems, Inc. -+ * 901 San Antonio Road, Palo Alto, CA 94303, USA -+ * -+ * This library is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License version 2.1, as published by the Free Software Foundation. -+ * -+ * This library is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public -+ * License along with this library; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, -+ * MA 02111-1307 USA -+ * -+ * -+ * Sun Industry Standards Source License Version 1.1 -+ * ================================================= -+ * The contents of this file are subject to the Sun Industry Standards -+ * Source License Version 1.1 (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.openoffice.org/license.html. -+ * -+ * Software provided under this License is provided on an "AS IS" basis, -+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, -+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, -+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. -+ * See the License for the specific provisions governing your rights and -+ * obligations concerning the Software. -+ * -+ * The Initial Developer of the Original Code is: Joerg Budischewski -+ * -+ * Copyright: 2000 by Sun Microsystems, Inc. -+ * -+ * All Rights Reserved. -+ * -+ * Contributor(s): Joerg Budischewski -+ * -+ * -+ ************************************************************************/ -+ -+#ifndef HEADER_PQ_XINDEX_HXX -+#define HEADER_PQ_XINDEX_HXX -+ -+#include -+#include -+ -+#include -+#include -+#include -+ -+#include "pq_connection.hxx" -+#include "pq_xbase.hxx" -+ -+namespace pq_sdbc_driver -+{ -+ -+class Index : public ReflectionBase, -+ public com::sun::star::sdbcx::XColumnsSupplier -+{ -+ ::com::sun::star::uno::Reference< com::sun::star::sdbc::XDatabaseMetaData > m_meta; -+ ::com::sun::star::uno::Reference< com::sun::star::container::XNameAccess > m_indexColumns; -+ -+ rtl::OUString m_schemaName; -+ rtl::OUString m_tableName; -+ -+public: -+ Index( const ::rtl::Reference< RefCountedMutex > & refMutex, -+ const ::com::sun::star::uno::Reference< com::sun::star::sdbc::XConnection > & connection, -+ ConnectionSettings *pSettings, -+ const rtl::OUString &schemaName, -+ const rtl::OUString &tableName); -+ -+public: // XInterface -+ virtual void SAL_CALL acquire() throw() { OComponentHelper::acquire(); } -+ virtual void SAL_CALL release() throw() { OComponentHelper::release(); } -+ virtual com::sun::star::uno::Any SAL_CALL queryInterface( -+ const com::sun::star::uno::Type & reqType ) -+ throw (com::sun::star::uno::RuntimeException); -+ -+public: // XColumnsSupplier -+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL -+ getColumns( ) throw (::com::sun::star::uno::RuntimeException); -+ -+public: // XTypeProvider, first implemented by OPropertySetHelper -+ virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL getTypes() -+ throw( com::sun::star::uno::RuntimeException ); -+ virtual com::sun::star::uno::Sequence< sal_Int8> SAL_CALL getImplementationId() -+ throw( com::sun::star::uno::RuntimeException ); -+ -+public: // XDataDescriptorFactory -+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL -+ createDataDescriptor( ) throw (::com::sun::star::uno::RuntimeException); -+ -+}; -+ -+ -+class IndexDescriptor : public ReflectionBase, -+ public com::sun::star::sdbcx::XColumnsSupplier -+{ -+ ::com::sun::star::uno::Reference< com::sun::star::container::XNameAccess > m_indexColumns; -+ -+public: -+ IndexDescriptor( -+ const ::rtl::Reference< RefCountedMutex > & refMutex, -+ const ::com::sun::star::uno::Reference< com::sun::star::sdbc::XConnection > & connection, -+ ConnectionSettings *pSettings); -+ -+public: // XInterface -+ virtual void SAL_CALL acquire() throw() { OComponentHelper::acquire(); } -+ virtual void SAL_CALL release() throw() { OComponentHelper::release(); } -+ virtual com::sun::star::uno::Any SAL_CALL queryInterface( -+ const com::sun::star::uno::Type & reqType ) -+ throw (com::sun::star::uno::RuntimeException); -+ -+public: // XColumnsSupplier -+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL -+ getColumns( ) throw (::com::sun::star::uno::RuntimeException); -+ -+public: // XTypeProvider, first implemented by OPropertySetHelper -+ virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL getTypes() -+ throw( com::sun::star::uno::RuntimeException ); -+ virtual com::sun::star::uno::Sequence< sal_Int8> SAL_CALL getImplementationId() -+ throw( com::sun::star::uno::RuntimeException ); -+ -+public: // XDataDescriptorFactory -+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL -+ createDataDescriptor( ) throw (::com::sun::star::uno::RuntimeException); -+ -+}; -+ -+ -+} -+ -+ -+#endif -diff --git connectivity/source/drivers/postgresql/pq_xindexcolumn.cxx connectivity/source/drivers/postgresql/pq_xindexcolumn.cxx -new file mode 100644 -index 0000000..4e974af ---- /dev/null -+++ connectivity/source/drivers/postgresql/pq_xindexcolumn.cxx -@@ -0,0 +1,122 @@ -+/************************************************************************* -+ * -+ * $RCSfile: pq_xindexcolumn.cxx,v $ -+ * -+ * $Revision: 1.1.2.1 $ -+ * -+ * last change: $Author: jbu $ $Date: 2004/06/10 15:27:03 $ -+ * -+ * The Contents of this file are made available subject to the terms of -+ * either of the following licenses -+ * -+ * - GNU Lesser General Public License Version 2.1 -+ * - Sun Industry Standards Source License Version 1.1 -+ * -+ * Sun Microsystems Inc., October, 2000 -+ * -+ * GNU Lesser General Public License Version 2.1 -+ * ============================================= -+ * Copyright 2000 by Sun Microsystems, Inc. -+ * 901 San Antonio Road, Palo Alto, CA 94303, USA -+ * -+ * This library is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License version 2.1, as published by the Free Software Foundation. -+ * -+ * This library is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public -+ * License along with this library; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, -+ * MA 02111-1307 USA -+ * -+ * -+ * Sun Industry Standards Source License Version 1.1 -+ * ================================================= -+ * The contents of this file are subject to the Sun Industry Standards -+ * Source License Version 1.1 (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.openoffice.org/license.html. -+ * -+ * Software provided under this License is provided on an "AS IS" basis, -+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, -+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, -+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. -+ * See the License for the specific provisions governing your rights and -+ * obligations concerning the Software. -+ * -+ * The Initial Developer of the Original Code is: Joerg Budischewski -+ * -+ * Copyright: 2000 by Sun Microsystems, Inc. -+ * -+ * All Rights Reserved. -+ * -+ * Contributor(s): Joerg Budischewski -+ * -+ * -+ ************************************************************************/ -+ -+#include -+ -+#include "pq_xindexcolumn.hxx" -+ -+using com::sun::star::uno::Any; -+using com::sun::star::uno::Reference; -+using com::sun::star::uno::RuntimeException; -+using com::sun::star::uno::Type; -+using com::sun::star::uno::Sequence; -+ -+using com::sun::star::beans::XPropertySet; -+ -+namespace pq_sdbc_driver -+{ -+#define ASCII_STR(x) OUString( RTL_CONSTASCII_USTRINGPARAM( x ) ) -+ -+IndexColumn::IndexColumn( const ::rtl::Reference< RefCountedMutex > & refMutex, -+ const Reference< com::sun::star::sdbc::XConnection > & connection, -+ ConnectionSettings *pSettings ) -+ : ReflectionBase( -+ getStatics().refl.indexColumn.implName, -+ getStatics().refl.indexColumn.serviceNames, -+ refMutex, -+ connection, -+ pSettings, -+ * getStatics().refl.indexColumn.pProps ) -+{} -+ -+Reference< XPropertySet > IndexColumn::createDataDescriptor( ) throw (RuntimeException) -+{ -+ IndexColumnDescriptor * pIndexColumn = new IndexColumnDescriptor( -+ m_refMutex, m_conn, m_pSettings ); -+ pIndexColumn->copyValuesFrom( this ); -+ -+ return Reference< XPropertySet > ( pIndexColumn ); -+} -+ -+ -+IndexColumnDescriptor::IndexColumnDescriptor( -+ const ::rtl::Reference< RefCountedMutex > & refMutex, -+ const Reference< com::sun::star::sdbc::XConnection > & connection, -+ ConnectionSettings *pSettings ) -+ : ReflectionBase( -+ getStatics().refl.indexColumnDescriptor.implName, -+ getStatics().refl.indexColumnDescriptor.serviceNames, -+ refMutex, -+ connection, -+ pSettings, -+ * getStatics().refl.indexColumnDescriptor.pProps ) -+{} -+ -+Reference< XPropertySet > IndexColumnDescriptor::createDataDescriptor( ) throw (RuntimeException) -+{ -+ IndexColumnDescriptor * pIndexColumn = new IndexColumnDescriptor( -+ m_refMutex, m_conn, m_pSettings ); -+ pIndexColumn->copyValuesFrom( this ); -+ -+ return Reference< XPropertySet > ( pIndexColumn ); -+} -+ -+} -diff --git connectivity/source/drivers/postgresql/pq_xindexcolumn.hxx connectivity/source/drivers/postgresql/pq_xindexcolumn.hxx -new file mode 100644 -index 0000000..ff6dd52 ---- /dev/null -+++ connectivity/source/drivers/postgresql/pq_xindexcolumn.hxx -@@ -0,0 +1,109 @@ -+/************************************************************************* -+ * -+ * $RCSfile: pq_xindexcolumn.hxx,v $ -+ * -+ * $Revision: 1.1.2.1 $ -+ * -+ * last change: $Author: jbu $ $Date: 2004/06/10 15:27:04 $ -+ * -+ * The Contents of this file are made available subject to the terms of -+ * either of the following licenses -+ * -+ * - GNU Lesser General Public License Version 2.1 -+ * - Sun Industry Standards Source License Version 1.1 -+ * -+ * Sun Microsystems Inc., October, 2000 -+ * -+ * GNU Lesser General Public License Version 2.1 -+ * ============================================= -+ * Copyright 2000 by Sun Microsystems, Inc. -+ * 901 San Antonio Road, Palo Alto, CA 94303, USA -+ * -+ * This library is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License version 2.1, as published by the Free Software Foundation. -+ * -+ * This library is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public -+ * License along with this library; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, -+ * MA 02111-1307 USA -+ * -+ * -+ * Sun Industry Standards Source License Version 1.1 -+ * ================================================= -+ * The contents of this file are subject to the Sun Industry Standards -+ * Source License Version 1.1 (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.openoffice.org/license.html. -+ * -+ * Software provided under this License is provided on an "AS IS" basis, -+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, -+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, -+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. -+ * See the License for the specific provisions governing your rights and -+ * obligations concerning the Software. -+ * -+ * The Initial Developer of the Original Code is: Joerg Budischewski -+ * -+ * Copyright: 2000 by Sun Microsystems, Inc. -+ * -+ * All Rights Reserved. -+ * -+ * Contributor(s): Joerg Budischewski -+ * -+ * -+ ************************************************************************/ -+ -+#ifndef HEADER_PQ_INDEXCOLUMN_HXX -+#define HEADER_PQ_INDEXCOLUMN_HXX -+ -+#include -+#include -+ -+#include -+#include -+ -+#include "pq_connection.hxx" -+#include "pq_xbase.hxx" -+ -+namespace pq_sdbc_driver -+{ -+ -+class IndexColumn : public ReflectionBase -+{ -+public: -+ IndexColumn( -+ const ::rtl::Reference< RefCountedMutex > & refMutex, -+ const ::com::sun::star::uno::Reference< com::sun::star::sdbc::XConnection > & connection, -+ ConnectionSettings *pSettings); -+ -+public: // XDataDescriptorFactory -+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL -+ createDataDescriptor( ) throw (::com::sun::star::uno::RuntimeException); -+ -+}; -+ -+class IndexColumnDescriptor : public ReflectionBase -+{ -+public: -+ IndexColumnDescriptor( -+ const ::rtl::Reference< RefCountedMutex > & refMutex, -+ const ::com::sun::star::uno::Reference< com::sun::star::sdbc::XConnection > & connection, -+ ConnectionSettings *pSettings); -+ -+public: // XDataDescriptorFactory -+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL -+ createDataDescriptor( ) throw (::com::sun::star::uno::RuntimeException); -+ -+}; -+ -+ -+} -+ -+ -+#endif -diff --git connectivity/source/drivers/postgresql/pq_xindexcolumns.cxx connectivity/source/drivers/postgresql/pq_xindexcolumns.cxx -new file mode 100644 -index 0000000..4218cf5 ---- /dev/null -+++ connectivity/source/drivers/postgresql/pq_xindexcolumns.cxx -@@ -0,0 +1,322 @@ -+/************************************************************************* -+ * -+ * $RCSfile: pq_xindexcolumns.cxx,v $ -+ * -+ * $Revision: 1.1.2.2 $ -+ * -+ * last change: $Author: jbu $ $Date: 2004/08/29 08:33:31 $ -+ * -+ * The Contents of this file are made available subject to the terms of -+ * either of the following licenses -+ * -+ * - GNU Lesser General Public License Version 2.1 -+ * - Sun Industry Standards Source License Version 1.1 -+ * -+ * Sun Microsystems Inc., October, 2000 -+ * -+ * GNU Lesser General Public License Version 2.1 -+ * ============================================= -+ * Copyright 2000 by Sun Microsystems, Inc. -+ * 901 San Antonio Road, Palo Alto, CA 94303, USA -+ * -+ * This library is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License version 2.1, as published by the Free Software Foundation. -+ * -+ * This library is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public -+ * License along with this library; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, -+ * MA 02111-1307 USA -+ * -+ * -+ * Sun Industry Standards Source License Version 1.1 -+ * ================================================= -+ * The contents of this file are subject to the Sun Industry Standards -+ * Source License Version 1.1 (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.openoffice.org/license.html. -+ * -+ * Software provided under this License is provided on an "AS IS" basis, -+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, -+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, -+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. -+ * See the License for the specific provisions governing your rights and -+ * obligations concerning the Software. -+ * -+ * The Initial Developer of the Original Code is: Joerg Budischewski -+ * -+ * Copyright: 2000 by Sun Microsystems, Inc. -+ * -+ * All Rights Reserved. -+ * -+ * Contributor(s): Joerg Budischewski -+ * -+ * -+ ************************************************************************/ -+ -+#include -+ -+#include -+#include -+ -+#include -+#include -+#include -+#include -+ -+#include "pq_xcolumns.hxx" -+#include "pq_xindexcolumns.hxx" -+#include "pq_xindexcolumn.hxx" -+#include "pq_statics.hxx" -+#include "pq_tools.hxx" -+ -+using osl::MutexGuard; -+ -+using rtl::OUString; -+using rtl::OUStringBuffer; -+using rtl::OUStringToOString; -+ -+using com::sun::star::beans::XPropertySet; -+ -+using com::sun::star::uno::Any; -+using com::sun::star::uno::makeAny; -+using com::sun::star::uno::UNO_QUERY; -+using com::sun::star::uno::Type; -+using com::sun::star::uno::XInterface; -+using com::sun::star::uno::Reference; -+using com::sun::star::uno::Sequence; -+using com::sun::star::uno::RuntimeException; -+ -+using com::sun::star::container::NoSuchElementException; -+using com::sun::star::lang::WrappedTargetException; -+ -+using com::sun::star::sdbc::XRow; -+using com::sun::star::sdbc::XCloseable; -+using com::sun::star::sdbc::XStatement; -+using com::sun::star::sdbc::XResultSet; -+using com::sun::star::sdbc::XParameters; -+using com::sun::star::sdbc::XPreparedStatement; -+using com::sun::star::sdbc::XDatabaseMetaData; -+using com::sun::star::sdbc::SQLException; -+ -+namespace pq_sdbc_driver -+{ -+#define ASCII_STR(x) OUString( RTL_CONSTASCII_USTRINGPARAM( x ) ) -+ -+IndexColumns::IndexColumns( -+ const ::rtl::Reference< RefCountedMutex > & refMutex, -+ const ::com::sun::star::uno::Reference< com::sun::star::sdbc::XConnection > & origin, -+ ConnectionSettings *pSettings, -+ const rtl::OUString &schemaName, -+ const rtl::OUString &tableName, -+ const rtl::OUString &indexName, -+ const com::sun::star::uno::Sequence< rtl::OUString > &columns ) -+ : Container( refMutex, origin, pSettings, ASCII_STR( "INDEX_COLUMN" ) ), -+ m_schemaName( schemaName ), -+ m_tableName( tableName ), -+ m_columns( columns ), -+ m_indexName( indexName ) -+{} -+ -+IndexColumns::~IndexColumns() -+{} -+ -+static sal_Int32 findInSequence( const Sequence< rtl::OUString > & seq , const rtl::OUString &str) -+{ -+ int index; -+ for( index = 0 ; index < seq.getLength() ; index ++ ) -+ { -+ if( str == seq[index] ) -+ break; -+ } -+ return index; -+} -+ -+void IndexColumns::refresh() -+ throw (::com::sun::star::uno::RuntimeException) -+{ -+ try -+ { -+ if( isLog( m_pSettings, LogLevel::INFO ) ) -+ { -+ rtl::OStringBuffer buf; -+ buf.append( "sdbcx.IndexColumns get refreshed for index " ); -+ buf.append( OUStringToOString( m_indexName, m_pSettings->encoding ) ); -+ log( m_pSettings, LogLevel::INFO, buf.makeStringAndClear().getStr() ); -+ } -+ -+ osl::MutexGuard guard( m_refMutex->mutex ); -+ -+ Statics &st = getStatics(); -+ Reference< XDatabaseMetaData > meta = m_origin->getMetaData(); -+ -+ Reference< XResultSet > rs = -+ meta->getColumns( Any(), m_schemaName, m_tableName, st.cPERCENT ); -+ -+ DisposeGuard disposeIt( rs ); -+ Reference< XRow > xRow( rs , UNO_QUERY ); -+ m_values = Sequence< Any >( m_columns.getLength() ); -+ -+ while( rs->next() ) -+ { -+ OUString columnName = xRow->getString( 4 ); -+ -+ sal_Int32 index = findInSequence( m_columns, columnName ); -+ if( index >= m_columns.getLength() ) -+ continue; -+ -+ IndexColumn * pIndexColumn = -+ new IndexColumn( m_refMutex, m_origin, m_pSettings ); -+ Reference< com::sun::star::beans::XPropertySet > prop = pIndexColumn; -+ -+ columnMetaData2SDBCX( pIndexColumn, xRow ); -+ pIndexColumn->setPropertyValue_NoBroadcast_public( -+ st.IS_ASCENDING , makeAny( (sal_Bool ) sal_False ) ); -+ -+ m_values[ index ] = makeAny( prop ); -+ m_name2index[ columnName ] = index; -+ } -+ } -+ catch ( com::sun::star::sdbc::SQLException & e ) -+ { -+ throw RuntimeException( e.Message , e.Context ); -+ } -+ -+ fire( RefreshedBroadcaster( *this ) ); -+} -+ -+ -+void IndexColumns::appendByDescriptor( -+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& future ) -+ throw (::com::sun::star::sdbc::SQLException, -+ ::com::sun::star::container::ElementExistException, -+ ::com::sun::star::uno::RuntimeException) -+{ -+ OUString name = extractStringProperty( future, getStatics().NAME ); -+ throw com::sun::star::sdbc::SQLException( -+ ASCII_STR( "SDBC-POSTGRESQL: IndexesColumns.appendByDescriptor not yet implemented" ), -+ *this, OUString(), 1, Any() ); -+// osl::MutexGuard guard( m_refMutex->mutex ); -+// Statics & st = getStatics(); -+// Reference< XPropertySet > past = createDataDescriptor(); -+// past->setPropertyValue( st.IS_NULLABLE, makeAny( com::sun::star::sdbc::ColumnValue::NULLABLE ) ); -+// alterColumnByDescriptor( -+// m_schemaName, m_tableName, m_pSettings->encoding, m_origin->createStatement() , past, future ); -+ -+} -+ -+void IndexColumns::dropByName( const ::rtl::OUString& elementName ) -+ throw (::com::sun::star::sdbc::SQLException, -+ ::com::sun::star::container::NoSuchElementException, -+ ::com::sun::star::uno::RuntimeException) -+{ -+ throw com::sun::star::sdbc::SQLException( -+ ASCII_STR( "SDBC-POSTGRESQL: IndexesColumns.dropByName not yet implemented" ), -+ *this, OUString(), 1, Any() ); -+// String2IntMap::const_iterator ii = m_name2index.find( elementName ); -+// if( ii == m_name2index.end() ) -+// { -+// OUStringBuffer buf( 128 ); -+// buf.appendAscii( "Column " ); -+// buf.append( elementName ); -+// buf.appendAscii( " is unknown in table " ); -+// buf.append( m_schemaName ); -+// buf.appendAscii( "." ); -+// buf.append( m_tableName ); -+// buf.appendAscii( ", so it can't be dropped" ); -+// throw com::sun::star::container::NoSuchElementException( -+// buf.makeStringAndClear(), *this ); -+// } -+// dropByIndex( ii->second ); -+} -+ -+void IndexColumns::dropByIndex( sal_Int32 index ) -+ throw (::com::sun::star::sdbc::SQLException, -+ ::com::sun::star::lang::IndexOutOfBoundsException, -+ ::com::sun::star::uno::RuntimeException) -+{ -+ throw com::sun::star::sdbc::SQLException( -+ ASCII_STR( "SDBC-POSTGRESQL: IndexesColumns.dropByIndex not yet implemented" ), -+ *this, OUString(), 1, Any() ); -+// osl::MutexGuard guard( m_refMutex->mutex ); -+// if( index < 0 || index >= m_values.getLength() ) -+// { -+// OUStringBuffer buf( 128 ); -+// buf.appendAscii( "COLUMNS: Index out of range (allowed 0 to " ); -+// buf.append((sal_Int32)(m_values.getLength() -1) ); -+// buf.appendAscii( ", got " ); -+// buf.append( index ); -+// buf.appendAscii( ")" ); -+// throw com::sun::star::lang::IndexOutOfBoundsException( -+// buf.makeStringAndClear(), *this ); -+// } -+ -+// Reference< XPropertySet > set; -+// m_values[index] >>= set; -+// Statics &st = getStatics(); -+// OUString name; -+// set->getPropertyValue( st.NAME ) >>= name; -+ -+// OUStringBuffer update( 128 ); -+// update.appendAscii( "ALTER TABLE ONLY"); -+// bufferQuoteQualifiedIdentifier( update, m_schemaName, m_tableName ); -+// update.appendAscii( "DROP COLUMN" ); -+// bufferQuoteIdentifier( update, name ); -+// Reference< XStatement > stmt = m_origin->createStatement( ); -+// DisposeGuard disposeIt( stmt ); -+// stmt->executeUpdate( update.makeStringAndClear() ); -+ -+} -+ -+ -+Reference< ::com::sun::star::beans::XPropertySet > IndexColumns::createDataDescriptor() -+ throw (::com::sun::star::uno::RuntimeException) -+{ -+ return new IndexColumnDescriptor( m_refMutex, m_origin, m_pSettings ); -+} -+ -+Reference< com::sun::star::container::XNameAccess > IndexColumns::create( -+ const ::rtl::Reference< RefCountedMutex > & refMutex, -+ const ::com::sun::star::uno::Reference< com::sun::star::sdbc::XConnection > & origin, -+ ConnectionSettings *pSettings, -+ const rtl::OUString &schemaName, -+ const rtl::OUString &tableName, -+ const rtl::OUString &indexName, -+ const Sequence< rtl::OUString > &columns ) -+{ -+ IndexColumns *pIndexColumns = new IndexColumns( -+ refMutex, origin, pSettings, schemaName, tableName, indexName, columns ); -+ Reference< com::sun::star::container::XNameAccess > ret = pIndexColumns; -+ pIndexColumns->refresh(); -+ -+ return ret; -+} -+ -+//_________________________________________________________________________________________ -+IndexColumnDescriptors::IndexColumnDescriptors( -+ const ::rtl::Reference< RefCountedMutex > & refMutex, -+ const ::com::sun::star::uno::Reference< com::sun::star::sdbc::XConnection > & origin, -+ ConnectionSettings *pSettings) -+ : Container( refMutex, origin, pSettings, getStatics().INDEX_COLUMN ) -+{} -+ -+Reference< com::sun::star::container::XNameAccess > IndexColumnDescriptors::create( -+ const ::rtl::Reference< RefCountedMutex > & refMutex, -+ const ::com::sun::star::uno::Reference< com::sun::star::sdbc::XConnection > & origin, -+ ConnectionSettings *pSettings) -+{ -+ return new IndexColumnDescriptors( refMutex, origin, pSettings ); -+} -+ -+::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > IndexColumnDescriptors::createDataDescriptor() -+ throw (::com::sun::star::uno::RuntimeException) -+{ -+ return new IndexColumnDescriptor( m_refMutex, m_origin, m_pSettings ); -+} -+ -+}; -diff --git connectivity/source/drivers/postgresql/pq_xindexcolumns.hxx connectivity/source/drivers/postgresql/pq_xindexcolumns.hxx -new file mode 100644 -index 0000000..b4bec81 ---- /dev/null -+++ connectivity/source/drivers/postgresql/pq_xindexcolumns.hxx -@@ -0,0 +1,146 @@ -+/************************************************************************* -+ * -+ * $RCSfile: pq_xindexcolumns.hxx,v $ -+ * -+ * $Revision: 1.1.2.1 $ -+ * -+ * last change: $Author: jbu $ $Date: 2004/06/10 15:27:05 $ -+ * -+ * The Contents of this file are made available subject to the terms of -+ * either of the following licenses -+ * -+ * - GNU Lesser General Public License Version 2.1 -+ * - Sun Industry Standards Source License Version 1.1 -+ * -+ * Sun Microsystems Inc., October, 2000 -+ * -+ * GNU Lesser General Public License Version 2.1 -+ * ============================================= -+ * Copyright 2000 by Sun Microsystems, Inc. -+ * 901 San Antonio Road, Palo Alto, CA 94303, USA -+ * -+ * This library is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License version 2.1, as published by the Free Software Foundation. -+ * -+ * This library is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public -+ * License along with this library; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, -+ * MA 02111-1307 USA -+ * -+ * -+ * Sun Industry Standards Source License Version 1.1 -+ * ================================================= -+ * The contents of this file are subject to the Sun Industry Standards -+ * Source License Version 1.1 (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.openoffice.org/license.html. -+ * -+ * Software provided under this License is provided on an "AS IS" basis, -+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, -+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, -+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. -+ * See the License for the specific provisions governing your rights and -+ * obligations concerning the Software. -+ * -+ * The Initial Developer of the Original Code is: Joerg Budischewski -+ * -+ * Copyright: 2000 by Sun Microsystems, Inc. -+ * -+ * All Rights Reserved. -+ * -+ * Contributor(s): Joerg Budischewski -+ * -+ * -+ ************************************************************************/ -+ -+#ifndef HEADER_PQ_INDEXCOLUMNS_HXX -+#define HEADER_PQ_INDEXCOLUMNS_HXX -+ -+#include "pq_xcontainer.hxx" -+ -+namespace pq_sdbc_driver -+{ -+ -+class IndexColumns : public Container -+{ -+ rtl::OUString m_schemaName; -+ rtl::OUString m_tableName; -+ rtl::OUString m_indexName; -+ com::sun::star::uno::Sequence< rtl::OUString > m_columns; -+ -+public: // instances IndexColumns 'exception safe' -+ static com::sun::star::uno::Reference< com::sun::star::container::XNameAccess > create( -+ const ::rtl::Reference< RefCountedMutex > & refMutex, -+ const ::com::sun::star::uno::Reference< com::sun::star::sdbc::XConnection > & origin, -+ ConnectionSettings *pSettings, -+ const rtl::OUString &schemaName, -+ const rtl::OUString &tableName, -+ const rtl::OUString &indexName, -+ const com::sun::star::uno::Sequence< ::rtl::OUString > &columns ); -+ -+protected: -+ IndexColumns( -+ const ::rtl::Reference< RefCountedMutex > & refMutex, -+ const ::com::sun::star::uno::Reference< com::sun::star::sdbc::XConnection > & origin, -+ ConnectionSettings *pSettings, -+ const rtl::OUString &schemaName, -+ const rtl::OUString &tableName, -+ const rtl::OUString &indexName, -+ const com::sun::star::uno::Sequence< ::rtl::OUString > &columns ); -+ -+ virtual ~IndexColumns(); -+ -+public: // XAppend -+ virtual void SAL_CALL appendByDescriptor( -+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ) -+ throw (::com::sun::star::sdbc::SQLException, -+ ::com::sun::star::container::ElementExistException, -+ ::com::sun::star::uno::RuntimeException); -+ -+public: // XDrop -+ virtual void SAL_CALL dropByName( const ::rtl::OUString& elementName ) -+ throw (::com::sun::star::sdbc::SQLException, -+ ::com::sun::star::container::NoSuchElementException, -+ ::com::sun::star::uno::RuntimeException); -+ virtual void SAL_CALL dropByIndex( sal_Int32 index ) -+ throw (::com::sun::star::sdbc::SQLException, -+ ::com::sun::star::lang::IndexOutOfBoundsException, -+ ::com::sun::star::uno::RuntimeException); -+ -+public: // XRefreshable -+ virtual void SAL_CALL refresh( ) throw (::com::sun::star::uno::RuntimeException); -+ -+public: // XDataDescriptorFactory -+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL createDataDescriptor( ) -+ throw (::com::sun::star::uno::RuntimeException); -+}; -+ -+ -+class IndexColumnDescriptors : public Container -+{ -+ -+public: // instances IndexColumns 'exception safe' -+ static com::sun::star::uno::Reference< com::sun::star::container::XNameAccess > create( -+ const ::rtl::Reference< RefCountedMutex > & refMutex, -+ const ::com::sun::star::uno::Reference< com::sun::star::sdbc::XConnection > & origin, -+ ConnectionSettings *pSettings ); -+ -+protected: -+ IndexColumnDescriptors( -+ const ::rtl::Reference< RefCountedMutex > & refMutex, -+ const ::com::sun::star::uno::Reference< com::sun::star::sdbc::XConnection > & origin, -+ ConnectionSettings *pSettings); -+ -+public: // XDataDescriptorFactory -+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL createDataDescriptor( ) -+ throw (::com::sun::star::uno::RuntimeException); -+}; -+ -+} -+#endif -diff --git connectivity/source/drivers/postgresql/pq_xindexes.cxx connectivity/source/drivers/postgresql/pq_xindexes.cxx -new file mode 100644 -index 0000000..d54d304 ---- /dev/null -+++ connectivity/source/drivers/postgresql/pq_xindexes.cxx -@@ -0,0 +1,355 @@ -+/************************************************************************* -+ * -+ * $RCSfile: pq_xindexes.cxx,v $ -+ * -+ * $Revision: 1.1.2.2 $ -+ * -+ * last change: $Author: jbu $ $Date: 2004/08/29 08:33:31 $ -+ * -+ * The Contents of this file are made available subject to the terms of -+ * either of the following licenses -+ * -+ * - GNU Lesser General Public License Version 2.1 -+ * - Sun Industry Standards Source License Version 1.1 -+ * -+ * Sun Microsystems Inc., October, 2000 -+ * -+ * GNU Lesser General Public License Version 2.1 -+ * ============================================= -+ * Copyright 2000 by Sun Microsystems, Inc. -+ * 901 San Antonio Road, Palo Alto, CA 94303, USA -+ * -+ * This library is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License version 2.1, as published by the Free Software Foundation. -+ * -+ * This library is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public -+ * License along with this library; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, -+ * MA 02111-1307 USA -+ * -+ * -+ * Sun Industry Standards Source License Version 1.1 -+ * ================================================= -+ * The contents of this file are subject to the Sun Industry Standards -+ * Source License Version 1.1 (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.openoffice.org/license.html. -+ * -+ * Software provided under this License is provided on an "AS IS" basis, -+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, -+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, -+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. -+ * See the License for the specific provisions governing your rights and -+ * obligations concerning the Software. -+ * -+ * The Initial Developer of the Original Code is: Joerg Budischewski -+ * -+ * Copyright: 2000 by Sun Microsystems, Inc. -+ * -+ * All Rights Reserved. -+ * -+ * Contributor(s): Joerg Budischewski -+ * -+ * -+ ************************************************************************/ -+ -+#include -+#include -+ -+#include -+#include -+ -+#include -+#include -+#include -+#include -+ -+#include "pq_xindexes.hxx" -+#include "pq_xindex.hxx" -+#include "pq_statics.hxx" -+#include "pq_tools.hxx" -+ -+using osl::MutexGuard; -+ -+using rtl::OUString; -+using rtl::OUStringBuffer; -+using rtl::OUStringToOString; -+ -+using com::sun::star::beans::XPropertySet; -+ -+using com::sun::star::uno::Any; -+using com::sun::star::uno::makeAny; -+using com::sun::star::uno::UNO_QUERY; -+using com::sun::star::uno::Type; -+using com::sun::star::uno::XInterface; -+using com::sun::star::uno::Reference; -+using com::sun::star::uno::Sequence; -+using com::sun::star::uno::RuntimeException; -+ -+using com::sun::star::container::NoSuchElementException; -+using com::sun::star::container::XEnumerationAccess; -+using com::sun::star::container::XEnumeration; -+ -+using com::sun::star::lang::WrappedTargetException; -+ -+using com::sun::star::sdbcx::XColumnsSupplier; -+ -+using com::sun::star::sdbc::XRow; -+using com::sun::star::sdbc::XCloseable; -+using com::sun::star::sdbc::XStatement; -+using com::sun::star::sdbc::XResultSet; -+using com::sun::star::sdbc::XParameters; -+using com::sun::star::sdbc::XPreparedStatement; -+using com::sun::star::sdbc::XDatabaseMetaData; -+ -+namespace pq_sdbc_driver -+{ -+#define ASCII_STR(x) OUString( RTL_CONSTASCII_USTRINGPARAM( x ) ) -+ -+Indexes::Indexes( -+ const ::rtl::Reference< RefCountedMutex > & refMutex, -+ const ::com::sun::star::uno::Reference< com::sun::star::sdbc::XConnection > & origin, -+ ConnectionSettings *pSettings, -+ const rtl::OUString &schemaName, -+ const rtl::OUString &tableName) -+ : Container( refMutex, origin, pSettings, getStatics().KEY ), -+ m_schemaName( schemaName ), -+ m_tableName( tableName ) -+{ -+} -+ -+Indexes::~Indexes() -+{} -+ -+void Indexes::refresh() -+ throw (::com::sun::star::uno::RuntimeException) -+{ -+ try -+ { -+ if( isLog( m_pSettings, LogLevel::INFO ) ) -+ { -+ rtl::OStringBuffer buf; -+ buf.append( "sdbcx.Indexes get refreshed for table " ); -+ buf.append( OUStringToOString( m_schemaName, m_pSettings->encoding ) ); -+ buf.append( "." ); -+ buf.append( OUStringToOString( m_tableName,m_pSettings->encoding ) ); -+ log( m_pSettings, LogLevel::INFO, buf.makeStringAndClear().getStr() ); -+ } -+ -+ osl::MutexGuard guard( m_refMutex->mutex ); -+ Statics & st = getStatics(); -+ -+ Int2StringMap column2NameMap; -+ fillAttnum2attnameMap( column2NameMap, m_origin, m_schemaName, m_tableName ); -+ -+ // see XDatabaseMetaData::getIndexInfo() -+ Reference< XPreparedStatement > stmt = m_origin->prepareStatement( -+ ASCII_STR( -+ "SELECT nspname, " // 1 -+ "pg_class.relname, " // 2 -+ "class2.relname, " // 3 -+ "indisclustered, " // 4 -+ "indisunique, " // 5 -+ "indisprimary, " // 6 -+ "indkey " // 7 -+ "FROM pg_index INNER JOIN pg_class ON indrelid = pg_class.oid " -+ "INNER JOIN pg_namespace ON pg_class.relnamespace = pg_namespace.oid " -+ "INNER JOIN pg_class as class2 ON pg_index.indexrelid = class2.oid " -+ "WHERE nspname = ? AND pg_class.relname = ?" ) ); -+ -+ Reference< XParameters > params( stmt, UNO_QUERY); -+ params->setString( 1, m_schemaName ); -+ params->setString( 2, m_tableName ); -+ Reference< XResultSet > rs = stmt->executeQuery(); -+ -+ Reference< XRow > row( rs, UNO_QUERY ); -+ String2IntMap map; -+ std::vector< Any, Allocator< Any> > vec; -+ sal_Int32 index = 0; -+ while( rs->next() ) -+ { -+ static const sal_Int32 C_SCHEMA = 1; -+ static const sal_Int32 C_TABLENAME = 2; -+ static const sal_Int32 C_INDEXNAME = 3; -+ static const sal_Int32 C_IS_CLUSTERED = 4; -+ static const sal_Int32 C_IS_UNIQUE = 5; -+ static const sal_Int32 C_IS_PRIMARY = 6; -+ static const sal_Int32 C_COLUMNS = 7; -+ OUString currentIndexName = row->getString( C_INDEXNAME ); -+ Index *pIndex = -+ new Index( m_refMutex, m_origin, m_pSettings, -+ m_schemaName, m_tableName ); -+ -+ sal_Bool isUnique = row->getBoolean( C_IS_UNIQUE ); -+ sal_Bool isPrimary = row->getBoolean( C_IS_PRIMARY ); -+ sal_Bool isClusterd = row->getBoolean( C_IS_CLUSTERED ); -+ Reference< com::sun::star::beans::XPropertySet > prop = pIndex; -+ pIndex->setPropertyValue_NoBroadcast_public( -+ st.IS_UNIQUE, Any( &isUnique, getBooleanCppuType() ) ); -+ pIndex->setPropertyValue_NoBroadcast_public( -+ st.IS_PRIMARY_KEY_INDEX, Any( &isPrimary, getBooleanCppuType() ) ); -+ pIndex->setPropertyValue_NoBroadcast_public( -+ st.IS_CLUSTERED, Any( &isClusterd, getBooleanCppuType() ) ); -+ pIndex->setPropertyValue_NoBroadcast_public( -+ st.NAME, makeAny( currentIndexName ) ); -+ -+ Sequence< sal_Int32 > seq = parseIntArray( row->getString( C_COLUMNS ) ); -+ Sequence< OUString > columnNames(seq.getLength()); -+ for( int columns = 0 ; columns < seq.getLength() ; columns ++ ) -+ { -+ columnNames[columns] = column2NameMap[ seq[columns] ]; -+ } -+ -+ pIndex->setPropertyValue_NoBroadcast_public( -+ st.PRIVATE_COLUMN_INDEXES, makeAny( columnNames )); -+ -+ vec.push_back( makeAny( prop ) ); -+ map[ currentIndexName ] = index; -+ index ++; -+ } -+ m_values = Sequence< com::sun::star::uno::Any > ( & vec[0] , vec.size() ); -+ m_name2index.swap( map ); -+ } -+ catch ( com::sun::star::sdbc::SQLException & e ) -+ { -+ throw RuntimeException( e.Message , e.Context ); -+ } -+ -+ fire( RefreshedBroadcaster( *this ) ); -+} -+ -+ -+void Indexes::appendByDescriptor( -+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ) -+ throw (::com::sun::star::sdbc::SQLException, -+ ::com::sun::star::container::ElementExistException, -+ ::com::sun::star::uno::RuntimeException) -+{ -+ Statics & st = getStatics(); -+ OUString name = extractStringProperty( descriptor, st.NAME ); -+ -+ sal_Bool isUnique = extractBoolProperty( descriptor, st.IS_UNIQUE ); -+ -+ OUStringBuffer buf( 128 ); -+ -+ buf.appendAscii( RTL_CONSTASCII_STRINGPARAM( "CREATE " ) ); -+ if( isUnique ) -+ buf.appendAscii( RTL_CONSTASCII_STRINGPARAM( "UNIQUE " ) ); -+ buf.appendAscii( RTL_CONSTASCII_STRINGPARAM( "INDEX " ) ); -+ bufferQuoteIdentifier( buf, name ); -+ buf.appendAscii( RTL_CONSTASCII_STRINGPARAM( " ON " ) ); -+ bufferQuoteQualifiedIdentifier( buf, m_schemaName, m_tableName ); -+ -+ buf.appendAscii( RTL_CONSTASCII_STRINGPARAM( " ( " ) ); -+ -+ Reference< XColumnsSupplier > columns( descriptor, UNO_QUERY ); -+ if( columns.is() ) -+ { -+ Reference< XEnumerationAccess > access( columns->getColumns(), UNO_QUERY ); -+ if( access.is() ) -+ { -+ Reference< XEnumeration > xEnum( access->createEnumeration() ); -+ bool first = true; -+ while( xEnum.is() && xEnum->hasMoreElements() ) -+ { -+ Reference< XPropertySet > column( xEnum->nextElement(), UNO_QUERY ); -+ if( first ) -+ { -+ first = false; -+ } -+ else -+ { -+ buf.appendAscii( RTL_CONSTASCII_STRINGPARAM( ", " ) ); -+ } -+ buf.append( extractStringProperty( column, st.NAME ) ); -+ } -+ } -+ } -+ buf.appendAscii( RTL_CONSTASCII_STRINGPARAM( " ) " ) ); -+ -+ m_origin->createStatement()->executeUpdate( buf.makeStringAndClear() ); -+ refresh(); -+} -+ -+void Indexes::dropByIndex( sal_Int32 index ) -+ throw (::com::sun::star::sdbc::SQLException, -+ ::com::sun::star::lang::IndexOutOfBoundsException, -+ ::com::sun::star::uno::RuntimeException) -+{ -+ -+ -+ osl::MutexGuard guard( m_refMutex->mutex ); -+ if( index < 0 || index >= m_values.getLength() ) -+ { -+ OUStringBuffer buf( 128 ); -+ buf.appendAscii( "Indexes: Index out of range (allowed 0 to " ); -+ buf.append( (sal_Int32) (m_values.getLength() -1) ); -+ buf.appendAscii( ", got " ); -+ buf.append( index ); -+ buf.appendAscii( ")" ); -+ throw com::sun::star::lang::IndexOutOfBoundsException( -+ buf.makeStringAndClear(), *this ); -+ } -+ -+ Reference< XPropertySet > set; -+ m_values[index] >>= set; -+ Statics &st = getStatics(); -+ -+ OUStringBuffer buf( 128 ); -+ buf.appendAscii( RTL_CONSTASCII_STRINGPARAM( "DROP INDEX " ) ); -+ bufferQuoteIdentifier( buf, extractStringProperty( set, st.NAME ) ); -+ m_origin->createStatement()->executeUpdate( buf.makeStringAndClear() ); -+ -+ Container::dropByIndex( index ); -+} -+ -+ -+::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > Indexes::createDataDescriptor() -+ throw (::com::sun::star::uno::RuntimeException) -+{ -+ return new IndexDescriptor( m_refMutex, m_origin, m_pSettings ); -+} -+ -+Reference< com::sun::star::container::XNameAccess > Indexes::create( -+ const ::rtl::Reference< RefCountedMutex > & refMutex, -+ const ::com::sun::star::uno::Reference< com::sun::star::sdbc::XConnection > & origin, -+ ConnectionSettings *pSettings, -+ const rtl::OUString & schemaName, -+ const rtl::OUString & tableName) -+{ -+ Indexes *pIndexes = new Indexes( refMutex, origin, pSettings, schemaName, tableName ); -+ Reference< com::sun::star::container::XNameAccess > ret = pIndexes; -+ pIndexes->refresh(); -+ return ret; -+} -+ -+ -+//_________________________________________________________________________________________ -+IndexDescriptors::IndexDescriptors( -+ const ::rtl::Reference< RefCountedMutex > & refMutex, -+ const ::com::sun::star::uno::Reference< com::sun::star::sdbc::XConnection > & origin, -+ ConnectionSettings *pSettings) -+ : Container( refMutex, origin, pSettings, getStatics().INDEX ) -+{} -+ -+Reference< com::sun::star::container::XNameAccess > IndexDescriptors::create( -+ const ::rtl::Reference< RefCountedMutex > & refMutex, -+ const ::com::sun::star::uno::Reference< com::sun::star::sdbc::XConnection > & origin, -+ ConnectionSettings *pSettings) -+{ -+ return new IndexDescriptors( refMutex, origin, pSettings ); -+} -+ -+::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > IndexDescriptors::createDataDescriptor() -+ throw (::com::sun::star::uno::RuntimeException) -+{ -+ return new IndexDescriptor( m_refMutex, m_origin, m_pSettings ); -+} -+ -+}; -diff --git connectivity/source/drivers/postgresql/pq_xindexes.hxx connectivity/source/drivers/postgresql/pq_xindexes.hxx -new file mode 100644 -index 0000000..bdb32a0 ---- /dev/null -+++ connectivity/source/drivers/postgresql/pq_xindexes.hxx -@@ -0,0 +1,135 @@ -+/************************************************************************* -+ * -+ * $RCSfile: pq_xindexes.hxx,v $ -+ * -+ * $Revision: 1.1.2.1 $ -+ * -+ * last change: $Author: jbu $ $Date: 2004/06/10 15:27:07 $ -+ * -+ * The Contents of this file are made available subject to the terms of -+ * either of the following licenses -+ * -+ * - GNU Lesser General Public License Version 2.1 -+ * - Sun Industry Standards Source License Version 1.1 -+ * -+ * Sun Microsystems Inc., October, 2000 -+ * -+ * GNU Lesser General Public License Version 2.1 -+ * ============================================= -+ * Copyright 2000 by Sun Microsystems, Inc. -+ * 901 San Antonio Road, Palo Alto, CA 94303, USA -+ * -+ * This library is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License version 2.1, as published by the Free Software Foundation. -+ * -+ * This library is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public -+ * License along with this library; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, -+ * MA 02111-1307 USA -+ * -+ * -+ * Sun Industry Standards Source License Version 1.1 -+ * ================================================= -+ * The contents of this file are subject to the Sun Industry Standards -+ * Source License Version 1.1 (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.openoffice.org/license.html. -+ * -+ * Software provided under this License is provided on an "AS IS" basis, -+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, -+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, -+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. -+ * See the License for the specific provisions governing your rights and -+ * obligations concerning the Software. -+ * -+ * The Initial Developer of the Original Code is: Joerg Budischewski -+ * -+ * Copyright: 2000 by Sun Microsystems, Inc. -+ * -+ * All Rights Reserved. -+ * -+ * Contributor(s): Joerg Budischewski -+ * -+ * -+ ************************************************************************/ -+ -+#ifndef HEADER_PQ_INDEXES_HXX_ -+#define HEADER_PQ_INDEXES_HXX_ -+ -+#include "pq_xcontainer.hxx" -+ -+namespace pq_sdbc_driver -+{ -+class Indexes : public Container -+{ -+ rtl::OUString m_schemaName; -+ rtl::OUString m_tableName; -+ -+public: // instances Columns 'exception safe' -+ static com::sun::star::uno::Reference< com::sun::star::container::XNameAccess > create( -+ const ::rtl::Reference< RefCountedMutex > & refMutex, -+ const ::com::sun::star::uno::Reference< com::sun::star::sdbc::XConnection > & origin, -+ ConnectionSettings *pSettings, -+ const rtl::OUString &schemaName, -+ const rtl::OUString &tableName); -+ -+protected: -+ Indexes( -+ const ::rtl::Reference< RefCountedMutex > & refMutex, -+ const ::com::sun::star::uno::Reference< com::sun::star::sdbc::XConnection > & origin, -+ ConnectionSettings *pSettings, -+ const rtl::OUString &schemaName, -+ const rtl::OUString &tableName); -+ -+ virtual ~Indexes(); -+ -+public: // XAppend -+ virtual void SAL_CALL appendByDescriptor( -+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ) -+ throw (::com::sun::star::sdbc::SQLException, -+ ::com::sun::star::container::ElementExistException, -+ ::com::sun::star::uno::RuntimeException); -+ -+public: // XDrop -+ virtual void SAL_CALL dropByIndex( sal_Int32 index ) -+ throw (::com::sun::star::sdbc::SQLException, -+ ::com::sun::star::lang::IndexOutOfBoundsException, -+ ::com::sun::star::uno::RuntimeException); -+ -+public: // XRefreshable -+ virtual void SAL_CALL refresh( ) throw (::com::sun::star::uno::RuntimeException); -+ -+public: // XDataDescriptorFactory -+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL createDataDescriptor( ) -+ throw (::com::sun::star::uno::RuntimeException); -+}; -+ -+ -+class IndexDescriptors : public Container -+{ -+public: // instances IndexDescriptors 'exception safe' -+ static com::sun::star::uno::Reference< com::sun::star::container::XNameAccess > create( -+ const ::rtl::Reference< RefCountedMutex > & refMutex, -+ const ::com::sun::star::uno::Reference< com::sun::star::sdbc::XConnection > & origin, -+ ConnectionSettings *pSettings ); -+ -+protected: -+ IndexDescriptors( -+ const ::rtl::Reference< RefCountedMutex > & refMutex, -+ const ::com::sun::star::uno::Reference< com::sun::star::sdbc::XConnection > & origin, -+ ConnectionSettings *pSettings ); -+ -+public: // XDataDescriptorFactory -+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL createDataDescriptor( ) -+ throw (::com::sun::star::uno::RuntimeException); -+ -+}; -+ -+} -+#endif -diff --git connectivity/source/drivers/postgresql/pq_xkey.cxx connectivity/source/drivers/postgresql/pq_xkey.cxx -new file mode 100644 -index 0000000..87f5394 ---- /dev/null -+++ connectivity/source/drivers/postgresql/pq_xkey.cxx -@@ -0,0 +1,262 @@ -+/************************************************************************* -+ * -+ * $RCSfile: pq_xkey.cxx,v $ -+ * -+ * $Revision: 1.1.2.2 $ -+ * -+ * last change: $Author: jbu $ $Date: 2004/06/10 15:27:07 $ -+ * -+ * The Contents of this file are made available subject to the terms of -+ * either of the following licenses -+ * -+ * - GNU Lesser General Public License Version 2.1 -+ * - Sun Industry Standards Source License Version 1.1 -+ * -+ * Sun Microsystems Inc., October, 2000 -+ * -+ * GNU Lesser General Public License Version 2.1 -+ * ============================================= -+ * Copyright 2000 by Sun Microsystems, Inc. -+ * 901 San Antonio Road, Palo Alto, CA 94303, USA -+ * -+ * This library is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License version 2.1, as published by the Free Software Foundation. -+ * -+ * This library is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public -+ * License along with this library; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, -+ * MA 02111-1307 USA -+ * -+ * -+ * Sun Industry Standards Source License Version 1.1 -+ * ================================================= -+ * The contents of this file are subject to the Sun Industry Standards -+ * Source License Version 1.1 (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.openoffice.org/license.html. -+ * -+ * Software provided under this License is provided on an "AS IS" basis, -+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, -+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, -+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. -+ * See the License for the specific provisions governing your rights and -+ * obligations concerning the Software. -+ * -+ * The Initial Developer of the Original Code is: Joerg Budischewski -+ * -+ * Copyright: 2000 by Sun Microsystems, Inc. -+ * -+ * All Rights Reserved. -+ * -+ * Contributor(s): Joerg Budischewski -+ * -+ * -+ ************************************************************************/ -+ -+#include -+ -+#include -+#include -+ -+#include -+ -+#include -+#include -+ -+#include "pq_xkey.hxx" -+#include "pq_xkeycolumns.hxx" -+#include "pq_tools.hxx" -+#include "pq_statics.hxx" -+ -+using osl::MutexGuard; -+using osl::Mutex; -+ -+using rtl::OUString; -+using rtl::OUStringBuffer; -+ -+using com::sun::star::container::XNameAccess; -+using com::sun::star::container::XIndexAccess; -+using com::sun::star::container::ElementExistException; -+using com::sun::star::container::NoSuchElementException; -+ -+using com::sun::star::uno::Reference; -+using com::sun::star::uno::Exception; -+using com::sun::star::uno::UNO_QUERY; -+using com::sun::star::uno::XInterface; -+using com::sun::star::uno::Sequence; -+using com::sun::star::uno::Any; -+using com::sun::star::uno::makeAny; -+using com::sun::star::uno::Type; -+using com::sun::star::uno::RuntimeException; -+ -+using com::sun::star::lang::IllegalArgumentException; -+using com::sun::star::lang::IndexOutOfBoundsException; -+ -+using com::sun::star::beans::XPropertySetInfo; -+using com::sun::star::beans::XFastPropertySet; -+using com::sun::star::beans::XMultiPropertySet; -+using com::sun::star::beans::XPropertySet; -+using com::sun::star::beans::Property; -+ -+using com::sun::star::sdbc::XResultSet; -+using com::sun::star::sdbc::XPreparedStatement; -+using com::sun::star::sdbc::XStatement; -+using com::sun::star::sdbc::XParameters; -+using com::sun::star::sdbc::XRow; -+using com::sun::star::sdbc::SQLException; -+ -+namespace pq_sdbc_driver -+{ -+#define ASCII_STR(x) OUString( RTL_CONSTASCII_USTRINGPARAM( x ) ) -+ -+Key::Key( const ::rtl::Reference< RefCountedMutex > & refMutex, -+ const Reference< com::sun::star::sdbc::XConnection > & connection, -+ ConnectionSettings *pSettings, -+ const rtl::OUString & schemaName, -+ const rtl::OUString & tableName ) -+ : ReflectionBase( -+ getStatics().refl.key.implName, -+ getStatics().refl.key.serviceNames, -+ refMutex, -+ connection, -+ pSettings, -+ * getStatics().refl.key.pProps ), -+ m_schemaName( schemaName ), -+ m_tableName( tableName ) -+{} -+ -+Reference< XPropertySet > Key::createDataDescriptor( ) throw (RuntimeException) -+{ -+ KeyDescriptor * pKeyDescriptor = new KeyDescriptor( -+ m_refMutex, m_conn, m_pSettings ); -+ pKeyDescriptor->copyValuesFrom( this ); -+ -+ return Reference< XPropertySet > ( pKeyDescriptor ); -+} -+ -+Reference< XNameAccess > Key::getColumns( ) throw (::com::sun::star::uno::RuntimeException) -+{ -+ // TODO: cash columns object ! -+ if( !m_keyColumns.is() ) -+ { -+ Sequence< OUString > columnNames, foreignColumnNames; -+ getPropertyValue( getStatics().PRIVATE_COLUMNS ) >>= columnNames; -+ getPropertyValue( getStatics().PRIVATE_FOREIGN_COLUMNS ) >>= foreignColumnNames; -+ -+ m_keyColumns = KeyColumns::create( -+ m_refMutex, m_conn, m_pSettings, m_schemaName, -+ m_tableName, columnNames, foreignColumnNames ); -+ } -+ return m_keyColumns; -+} -+ -+Sequence Key::getTypes() throw( RuntimeException ) -+{ -+ static cppu::OTypeCollection *pCollection; -+ if( ! pCollection ) -+ { -+ MutexGuard guard( osl::Mutex::getGlobalMutex() ); -+ if( !pCollection ) -+ { -+ static cppu::OTypeCollection collection( -+ getCppuType( (Reference< com::sun::star::sdbcx::XColumnsSupplier> *) 0 ), -+ ReflectionBase::getTypes()); -+ pCollection = &collection; -+ } -+ } -+ return pCollection->getTypes(); -+} -+ -+Sequence< sal_Int8> Key::getImplementationId() throw( RuntimeException ) -+{ -+ return getStatics().refl.key.implementationId; -+} -+ -+Any Key::queryInterface( const Type & reqType ) throw (RuntimeException) -+{ -+ Any ret; -+ -+ ret = ReflectionBase::queryInterface( reqType ); -+ if( ! ret.hasValue() ) -+ ret = ::cppu::queryInterface( -+ reqType, -+ static_cast< com::sun::star::sdbcx::XColumnsSupplier * > ( this ) ); -+ return ret; -+} -+ -+ -+//_____________________________________________________________________________ -+KeyDescriptor::KeyDescriptor( const ::rtl::Reference< RefCountedMutex > & refMutex, -+ const Reference< com::sun::star::sdbc::XConnection > & connection, -+ ConnectionSettings *pSettings ) -+ : ReflectionBase( -+ getStatics().refl.keyDescriptor.implName, -+ getStatics().refl.keyDescriptor.serviceNames, -+ refMutex, -+ connection, -+ pSettings, -+ * getStatics().refl.keyDescriptor.pProps ) -+{ -+} -+ -+Reference< XPropertySet > KeyDescriptor::createDataDescriptor( ) throw (RuntimeException) -+{ -+ KeyDescriptor * pKeyDescriptor = new KeyDescriptor( -+ m_refMutex, m_conn, m_pSettings ); -+ pKeyDescriptor->copyValuesFrom( this ); -+ -+ return Reference< XPropertySet > ( pKeyDescriptor ); -+} -+ -+Reference< XNameAccess > KeyDescriptor::getColumns( ) throw (::com::sun::star::uno::RuntimeException) -+{ -+ // TODO: cash columns object ! -+ if( !m_keyColumns.is() ) -+ { -+ m_keyColumns = new KeyColumnDescriptors( m_refMutex, m_conn, m_pSettings ); -+ } -+ return m_keyColumns; -+} -+ -+Sequence KeyDescriptor::getTypes() throw( RuntimeException ) -+{ -+ static cppu::OTypeCollection *pCollection; -+ if( ! pCollection ) -+ { -+ MutexGuard guard( osl::Mutex::getGlobalMutex() ); -+ if( !pCollection ) -+ { -+ static cppu::OTypeCollection collection( -+ getCppuType( (Reference< com::sun::star::sdbcx::XColumnsSupplier> *) 0 ), -+ ReflectionBase::getTypes()); -+ pCollection = &collection; -+ } -+ } -+ return pCollection->getTypes(); -+} -+ -+Sequence< sal_Int8> KeyDescriptor::getImplementationId() throw( RuntimeException ) -+{ -+ return getStatics().refl.keyDescriptor.implementationId; -+} -+ -+Any KeyDescriptor::queryInterface( const Type & reqType ) throw (RuntimeException) -+{ -+ Any ret; -+ -+ ret = ReflectionBase::queryInterface( reqType ); -+ if( ! ret.hasValue() ) -+ ret = ::cppu::queryInterface( -+ reqType, -+ static_cast< com::sun::star::sdbcx::XColumnsSupplier * > ( this ) ); -+ return ret; -+} -+ -+ -+} -diff --git connectivity/source/drivers/postgresql/pq_xkey.hxx connectivity/source/drivers/postgresql/pq_xkey.hxx -new file mode 100644 -index 0000000..4e3409b ---- /dev/null -+++ connectivity/source/drivers/postgresql/pq_xkey.hxx -@@ -0,0 +1,152 @@ -+/************************************************************************* -+ * -+ * $RCSfile: pq_xkey.hxx,v $ -+ * -+ * $Revision: 1.1.2.2 $ -+ * -+ * last change: $Author: jbu $ $Date: 2004/06/10 15:27:08 $ -+ * -+ * The Contents of this file are made available subject to the terms of -+ * either of the following licenses -+ * -+ * - GNU Lesser General Public License Version 2.1 -+ * - Sun Industry Standards Source License Version 1.1 -+ * -+ * Sun Microsystems Inc., October, 2000 -+ * -+ * GNU Lesser General Public License Version 2.1 -+ * ============================================= -+ * Copyright 2000 by Sun Microsystems, Inc. -+ * 901 San Antonio Road, Palo Alto, CA 94303, USA -+ * -+ * This library is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License version 2.1, as published by the Free Software Foundation. -+ * -+ * This library is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public -+ * License along with this library; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, -+ * MA 02111-1307 USA -+ * -+ * -+ * Sun Industry Standards Source License Version 1.1 -+ * ================================================= -+ * The contents of this file are subject to the Sun Industry Standards -+ * Source License Version 1.1 (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.openoffice.org/license.html. -+ * -+ * Software provided under this License is provided on an "AS IS" basis, -+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, -+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, -+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. -+ * See the License for the specific provisions governing your rights and -+ * obligations concerning the Software. -+ * -+ * The Initial Developer of the Original Code is: Joerg Budischewski -+ * -+ * Copyright: 2000 by Sun Microsystems, Inc. -+ * -+ * All Rights Reserved. -+ * -+ * Contributor(s): Joerg Budischewski -+ * -+ * -+ ************************************************************************/ -+ -+#ifndef HEADER_PQ_KEY_HXX_ -+#define HEADER_PQ_KEY_HXX_ -+ -+#include -+#include -+ -+#include -+#include -+#include -+ -+#include "pq_connection.hxx" -+#include "pq_xbase.hxx" -+ -+namespace pq_sdbc_driver -+{ -+ -+class Key : public ReflectionBase, -+ public com::sun::star::sdbcx::XColumnsSupplier -+{ -+ ::com::sun::star::uno::Reference< com::sun::star::sdbc::XDatabaseMetaData > m_meta; -+ ::com::sun::star::uno::Reference< com::sun::star::container::XNameAccess > m_keyColumns; -+ -+ rtl::OUString m_schemaName; -+ rtl::OUString m_tableName; -+ -+public: -+ Key( const ::rtl::Reference< RefCountedMutex > & refMutex, -+ const ::com::sun::star::uno::Reference< com::sun::star::sdbc::XConnection > & connection, -+ ConnectionSettings *pSettings, -+ const rtl::OUString &schemaName, -+ const rtl::OUString &tableName); -+ -+public: // XInterface -+ virtual void SAL_CALL acquire() throw() { OComponentHelper::acquire(); } -+ virtual void SAL_CALL release() throw() { OComponentHelper::release(); } -+ virtual com::sun::star::uno::Any SAL_CALL queryInterface( -+ const com::sun::star::uno::Type & reqType ) -+ throw (com::sun::star::uno::RuntimeException); -+ -+public: // XColumnsSupplier -+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL -+ getColumns( ) throw (::com::sun::star::uno::RuntimeException); -+ -+public: // XTypeProvider, first implemented by OPropertySetHelper -+ virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL getTypes() -+ throw( com::sun::star::uno::RuntimeException ); -+ virtual com::sun::star::uno::Sequence< sal_Int8> SAL_CALL getImplementationId() -+ throw( com::sun::star::uno::RuntimeException ); -+ -+public: // XDataDescriptorFactory -+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL -+ createDataDescriptor( ) throw (::com::sun::star::uno::RuntimeException); -+ -+}; -+ -+ -+class KeyDescriptor : public ReflectionBase, public com::sun::star::sdbcx::XColumnsSupplier -+{ -+ ::com::sun::star::uno::Reference< com::sun::star::container::XNameAccess > m_keyColumns; -+ -+public: -+ KeyDescriptor( const ::rtl::Reference< RefCountedMutex > & refMutex, -+ const ::com::sun::star::uno::Reference< com::sun::star::sdbc::XConnection > & connection, -+ ConnectionSettings *pSettings ); -+ -+public: // XInterface -+ virtual void SAL_CALL acquire() throw() { OComponentHelper::acquire(); } -+ virtual void SAL_CALL release() throw() { OComponentHelper::release(); } -+ virtual com::sun::star::uno::Any SAL_CALL queryInterface( -+ const com::sun::star::uno::Type & reqType ) -+ throw (com::sun::star::uno::RuntimeException); -+ -+public: // XColumnsSupplier -+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL -+ getColumns( ) throw (::com::sun::star::uno::RuntimeException); -+ -+public: // XTypeProvider, first implemented by OPropertySetHelper -+ virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL getTypes() -+ throw( com::sun::star::uno::RuntimeException ); -+ virtual com::sun::star::uno::Sequence< sal_Int8> SAL_CALL getImplementationId() -+ throw( com::sun::star::uno::RuntimeException ); -+ -+public: // XDataDescriptorFactory -+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL -+ createDataDescriptor( ) throw (::com::sun::star::uno::RuntimeException); -+}; -+ -+} -+ -+ -+#endif -diff --git connectivity/source/drivers/postgresql/pq_xkeycolumn.cxx connectivity/source/drivers/postgresql/pq_xkeycolumn.cxx -new file mode 100644 -index 0000000..2d5fe72 ---- /dev/null -+++ connectivity/source/drivers/postgresql/pq_xkeycolumn.cxx -@@ -0,0 +1,121 @@ -+/************************************************************************* -+ * -+ * $RCSfile: pq_xkeycolumn.cxx,v $ -+ * -+ * $Revision: 1.1.2.2 $ -+ * -+ * last change: $Author: jbu $ $Date: 2004/06/10 15:27:08 $ -+ * -+ * The Contents of this file are made available subject to the terms of -+ * either of the following licenses -+ * -+ * - GNU Lesser General Public License Version 2.1 -+ * - Sun Industry Standards Source License Version 1.1 -+ * -+ * Sun Microsystems Inc., October, 2000 -+ * -+ * GNU Lesser General Public License Version 2.1 -+ * ============================================= -+ * Copyright 2000 by Sun Microsystems, Inc. -+ * 901 San Antonio Road, Palo Alto, CA 94303, USA -+ * -+ * This library is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License version 2.1, as published by the Free Software Foundation. -+ * -+ * This library is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public -+ * License along with this library; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, -+ * MA 02111-1307 USA -+ * -+ * -+ * Sun Industry Standards Source License Version 1.1 -+ * ================================================= -+ * The contents of this file are subject to the Sun Industry Standards -+ * Source License Version 1.1 (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.openoffice.org/license.html. -+ * -+ * Software provided under this License is provided on an "AS IS" basis, -+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, -+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, -+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. -+ * See the License for the specific provisions governing your rights and -+ * obligations concerning the Software. -+ * -+ * The Initial Developer of the Original Code is: Joerg Budischewski -+ * -+ * Copyright: 2000 by Sun Microsystems, Inc. -+ * -+ * All Rights Reserved. -+ * -+ * Contributor(s): Joerg Budischewski -+ * -+ * -+ ************************************************************************/ -+ -+#include -+ -+#include "pq_xkeycolumn.hxx" -+ -+using com::sun::star::uno::Any; -+using com::sun::star::uno::Reference; -+using com::sun::star::uno::RuntimeException; -+using com::sun::star::uno::Type; -+using com::sun::star::uno::Sequence; -+ -+using com::sun::star::beans::XPropertySet; -+ -+namespace pq_sdbc_driver -+{ -+#define ASCII_STR(x) OUString( RTL_CONSTASCII_USTRINGPARAM( x ) ) -+ -+KeyColumn::KeyColumn( const ::rtl::Reference< RefCountedMutex > & refMutex, -+ const Reference< com::sun::star::sdbc::XConnection > & connection, -+ ConnectionSettings *pSettings) -+ : ReflectionBase( -+ getStatics().refl.keycolumn.implName, -+ getStatics().refl.keycolumn.serviceNames, -+ refMutex, -+ connection, -+ pSettings, -+ * getStatics().refl.keycolumn.pProps ) -+{} -+ -+Reference< XPropertySet > KeyColumn::createDataDescriptor( ) throw (RuntimeException) -+{ -+ KeyColumnDescriptor * pKeyColumn = new KeyColumnDescriptor( -+ m_refMutex, m_conn, m_pSettings ); -+ pKeyColumn->copyValuesFrom( this ); -+ -+ return Reference< XPropertySet > ( pKeyColumn ); -+} -+ -+KeyColumnDescriptor::KeyColumnDescriptor( -+ const ::rtl::Reference< RefCountedMutex > & refMutex, -+ const Reference< com::sun::star::sdbc::XConnection > & connection, -+ ConnectionSettings *pSettings) -+ : ReflectionBase( -+ getStatics().refl.keycolumnDescriptor.implName, -+ getStatics().refl.keycolumnDescriptor.serviceNames, -+ refMutex, -+ connection, -+ pSettings, -+ * getStatics().refl.keycolumnDescriptor.pProps ) -+{} -+ -+Reference< XPropertySet > KeyColumnDescriptor::createDataDescriptor( ) throw (RuntimeException) -+{ -+ KeyColumnDescriptor * pKeyColumn = new KeyColumnDescriptor( -+ m_refMutex, m_conn, m_pSettings ); -+ pKeyColumn->copyValuesFrom( this ); -+ -+ return Reference< XPropertySet > ( pKeyColumn ); -+} -+ -+} -diff --git connectivity/source/drivers/postgresql/pq_xkeycolumn.hxx connectivity/source/drivers/postgresql/pq_xkeycolumn.hxx -new file mode 100644 -index 0000000..7aaacff ---- /dev/null -+++ connectivity/source/drivers/postgresql/pq_xkeycolumn.hxx -@@ -0,0 +1,108 @@ -+/************************************************************************* -+ * -+ * $RCSfile: pq_xkeycolumn.hxx,v $ -+ * -+ * $Revision: 1.1.2.2 $ -+ * -+ * last change: $Author: jbu $ $Date: 2004/06/10 15:27:09 $ -+ * -+ * The Contents of this file are made available subject to the terms of -+ * either of the following licenses -+ * -+ * - GNU Lesser General Public License Version 2.1 -+ * - Sun Industry Standards Source License Version 1.1 -+ * -+ * Sun Microsystems Inc., October, 2000 -+ * -+ * GNU Lesser General Public License Version 2.1 -+ * ============================================= -+ * Copyright 2000 by Sun Microsystems, Inc. -+ * 901 San Antonio Road, Palo Alto, CA 94303, USA -+ * -+ * This library is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License version 2.1, as published by the Free Software Foundation. -+ * -+ * This library is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public -+ * License along with this library; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, -+ * MA 02111-1307 USA -+ * -+ * -+ * Sun Industry Standards Source License Version 1.1 -+ * ================================================= -+ * The contents of this file are subject to the Sun Industry Standards -+ * Source License Version 1.1 (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.openoffice.org/license.html. -+ * -+ * Software provided under this License is provided on an "AS IS" basis, -+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, -+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, -+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. -+ * See the License for the specific provisions governing your rights and -+ * obligations concerning the Software. -+ * -+ * The Initial Developer of the Original Code is: Joerg Budischewski -+ * -+ * Copyright: 2000 by Sun Microsystems, Inc. -+ * -+ * All Rights Reserved. -+ * -+ * Contributor(s): Joerg Budischewski -+ * -+ * -+ ************************************************************************/ -+ -+#ifndef HEADER_PQ_KEYCOLUMN_HXX -+#define HEADER_PQ_KEYCOLUMN_HXX -+ -+#include -+#include -+ -+#include -+#include -+ -+#include "pq_connection.hxx" -+#include "pq_xbase.hxx" -+ -+namespace pq_sdbc_driver -+{ -+ -+class KeyColumn : public ReflectionBase -+{ -+public: -+ KeyColumn( const ::rtl::Reference< RefCountedMutex > & refMutex, -+ const ::com::sun::star::uno::Reference< com::sun::star::sdbc::XConnection > & connection, -+ ConnectionSettings *pSettings); -+ -+public: // XDataDescriptorFactory -+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL -+ createDataDescriptor( ) throw (::com::sun::star::uno::RuntimeException); -+ -+}; -+ -+class KeyColumnDescriptor : public ReflectionBase -+{ -+public: -+ KeyColumnDescriptor( -+ const ::rtl::Reference< RefCountedMutex > & refMutex, -+ const ::com::sun::star::uno::Reference< com::sun::star::sdbc::XConnection > & connection, -+ ConnectionSettings *pSettings); -+ -+public: // XDataDescriptorFactory -+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL -+ createDataDescriptor( ) throw (::com::sun::star::uno::RuntimeException); -+ -+}; -+ -+ -+} -+ -+ -+#endif -diff --git connectivity/source/drivers/postgresql/pq_xkeycolumns.cxx connectivity/source/drivers/postgresql/pq_xkeycolumns.cxx -new file mode 100644 -index 0000000..898b81c ---- /dev/null -+++ connectivity/source/drivers/postgresql/pq_xkeycolumns.cxx -@@ -0,0 +1,411 @@ -+/************************************************************************* -+ * -+ * $RCSfile: pq_xkeycolumns.cxx,v $ -+ * -+ * $Revision: 1.1.2.3 $ -+ * -+ * last change: $Author: jbu $ $Date: 2004/08/29 08:33:31 $ -+ * -+ * The Contents of this file are made available subject to the terms of -+ * either of the following licenses -+ * -+ * - GNU Lesser General Public License Version 2.1 -+ * - Sun Industry Standards Source License Version 1.1 -+ * -+ * Sun Microsystems Inc., October, 2000 -+ * -+ * GNU Lesser General Public License Version 2.1 -+ * ============================================= -+ * Copyright 2000 by Sun Microsystems, Inc. -+ * 901 San Antonio Road, Palo Alto, CA 94303, USA -+ * -+ * This library is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License version 2.1, as published by the Free Software Foundation. -+ * -+ * This library is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public -+ * License along with this library; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, -+ * MA 02111-1307 USA -+ * -+ * -+ * Sun Industry Standards Source License Version 1.1 -+ * ================================================= -+ * The contents of this file are subject to the Sun Industry Standards -+ * Source License Version 1.1 (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.openoffice.org/license.html. -+ * -+ * Software provided under this License is provided on an "AS IS" basis, -+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, -+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, -+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. -+ * See the License for the specific provisions governing your rights and -+ * obligations concerning the Software. -+ * -+ * The Initial Developer of the Original Code is: Joerg Budischewski -+ * -+ * Copyright: 2000 by Sun Microsystems, Inc. -+ * -+ * All Rights Reserved. -+ * -+ * Contributor(s): Joerg Budischewski -+ * -+ * -+ ************************************************************************/ -+ -+#include -+ -+#include -+#include -+ -+#include -+#include -+#include -+#include -+ -+#include "pq_xcolumns.hxx" -+#include "pq_xkeycolumns.hxx" -+#include "pq_xkeycolumn.hxx" -+#include "pq_statics.hxx" -+#include "pq_tools.hxx" -+ -+using osl::MutexGuard; -+ -+using rtl::OUString; -+using rtl::OUStringBuffer; -+using rtl::OUStringToOString; -+ -+using com::sun::star::beans::XPropertySet; -+ -+using com::sun::star::uno::Any; -+using com::sun::star::uno::makeAny; -+using com::sun::star::uno::UNO_QUERY; -+using com::sun::star::uno::Type; -+using com::sun::star::uno::XInterface; -+using com::sun::star::uno::Reference; -+using com::sun::star::uno::Sequence; -+using com::sun::star::uno::RuntimeException; -+ -+using com::sun::star::container::NoSuchElementException; -+using com::sun::star::lang::WrappedTargetException; -+ -+using com::sun::star::sdbc::XRow; -+using com::sun::star::sdbc::XCloseable; -+using com::sun::star::sdbc::XStatement; -+using com::sun::star::sdbc::XResultSet; -+using com::sun::star::sdbc::XParameters; -+using com::sun::star::sdbc::XPreparedStatement; -+using com::sun::star::sdbc::XDatabaseMetaData; -+using com::sun::star::sdbc::SQLException; -+ -+namespace pq_sdbc_driver -+{ -+#define ASCII_STR(x) OUString( RTL_CONSTASCII_USTRINGPARAM( x ) ) -+ -+KeyColumns::KeyColumns( -+ const ::rtl::Reference< RefCountedMutex > & refMutex, -+ const ::com::sun::star::uno::Reference< com::sun::star::sdbc::XConnection > & origin, -+ ConnectionSettings *pSettings, -+ const rtl::OUString &schemaName, -+ const rtl::OUString &tableName, -+ const Sequence< rtl::OUString > &columnNames, -+ const Sequence< rtl::OUString > &foreignColumnNames ) -+ : Container( refMutex, origin, pSettings, ASCII_STR( "KEY_COLUMN" ) ), -+ m_schemaName( schemaName ), -+ m_tableName( tableName ), -+ m_columnNames( columnNames ), -+ m_foreignColumnNames( foreignColumnNames ) -+{} -+ -+KeyColumns::~KeyColumns() -+{} -+ -+ -+void KeyColumns::refresh() -+ throw (::com::sun::star::uno::RuntimeException) -+{ -+ try -+ { -+ if( isLog( m_pSettings, LogLevel::INFO ) ) -+ { -+ rtl::OStringBuffer buf; -+ buf.append( "sdbcx.KeyColumns get refreshed for table " ); -+ buf.append( OUStringToOString( m_schemaName, m_pSettings->encoding ) ); -+ buf.append( "." ); -+ buf.append( OUStringToOString( m_tableName, m_pSettings->encoding ) ); -+ log( m_pSettings, LogLevel::INFO, buf.makeStringAndClear().getStr() ); -+ } -+ -+ osl::MutexGuard guard( m_refMutex->mutex ); -+ -+ Statics &st = getStatics(); -+ Reference< XDatabaseMetaData > meta = m_origin->getMetaData(); -+ -+ Reference< XResultSet > rs = -+ meta->getColumns( Any(), m_schemaName, m_tableName, st.cPERCENT ); -+ -+ DisposeGuard disposeIt( rs ); -+ Reference< XRow > xRow( rs , UNO_QUERY ); -+ -+ String2IntMap map; -+ -+ std::vector< Any, Allocator< Any> > vec; -+ sal_Int32 columnIndex = 0; -+ while( rs->next() ) -+ { -+ OUString columnName = xRow->getString( 4 ); -+ -+ int keyindex; -+ for( keyindex = 0 ; keyindex < m_columnNames.getLength() ; keyindex ++ ) -+ { -+ if( columnName == m_columnNames[keyindex] ) -+ break; -+ } -+ if( m_columnNames.getLength() == keyindex ) -+ continue; -+ -+ KeyColumn * pKeyColumn = -+ new KeyColumn( m_refMutex, m_origin, m_pSettings ); -+ Reference< com::sun::star::beans::XPropertySet > prop = pKeyColumn; -+ -+ OUString name = columnMetaData2SDBCX( pKeyColumn, xRow ); -+ if( keyindex < m_foreignColumnNames.getLength() ) -+ { -+ pKeyColumn->setPropertyValue_NoBroadcast_public( -+ st.RELATED_COLUMN, makeAny( m_foreignColumnNames[keyindex]) ); -+ } -+ -+ vec.push_back( makeAny( prop ) ); -+ map[ name ] = columnIndex; -+ columnIndex ++; -+ } -+ m_values = Sequence< com::sun::star::uno::Any > ( & vec[0] , vec.size() ); -+ m_name2index.swap( map ); -+ } -+ catch ( com::sun::star::sdbc::SQLException & e ) -+ { -+ throw RuntimeException( e.Message , e.Context ); -+ } -+ -+ fire( RefreshedBroadcaster( *this ) ); -+} -+ -+ -+// void alterColumnByDescriptor( -+// const OUString & schemaName, -+// const OUString & tableName, -+// rtl_TextEncoding encoding, -+// const Reference< XStatement > &stmt, -+// const com::sun::star::uno::Reference< com::sun::star::beans::XPropertySet > & past, -+// const com::sun::star::uno::Reference< com::sun::star::beans::XPropertySet > & future) -+// { -+// Statics & st = getStatics(); -+ -+// // if( past->getPropertyValue( st.TABLE_NAME ) != future->getPropertyValue( st.TABLE_NAME ) || -+// // past->getPropertyValue( st.SCHEMA_NAME ) != future->getPropertyValue( st.SCHEMA_NAME )) -+// // { -+// // OUStringBuffer buf(128); -+// // buf.appendAscii( RTL_CONSTASCII_STRINGPARAM( "Can't move column " ) ); -+// // buf.append( extractStringProperty( past, st.COLUMN_NAME ) ); -+// // buf.appendAscii( RTL_CONSTASCII_STRINGPARAM( " from table " ) ); -+// // buf.append( extractStringProperty( past, st.TABLE_NAME ) ); -+// // buf.appendAscii( RTL_CONSTASCII_STRINGPARAM( " to table " ) ); -+// // buf.append( extractStringProperty( past, st.TABLE_NAME ) ); -+// // throw SQLException( buf.makeStringAndClear(), Reference< XInterface > () ); -+// // } -+ -+// // OUString tableName = extractStringProperty( past, st.TABLE_NAME ); -+// // OUString schemaName = extractStringProperty( past, st.SCHEMA_NAME ); -+// OUString pastColumnName = extractStringProperty( past, st.NAME ); -+// OUString futureColumnName = extractStringProperty( future, st.NAME ); -+// OUString pastTypeName = sqltype2string( past ); -+// OUString futureTypeName = sqltype2string( future ); -+ -+// TransactionGuard transaction( stmt ); -+ -+// OUStringBuffer buf( 128 ); -+// if( ! pastColumnName.getLength()) -+// { -+// // create a new column -+// buf.appendAscii( RTL_CONSTASCII_STRINGPARAM( "ALTER TABLE" ) ); -+// bufferQuoteQualifiedIdentifier( buf, schemaName, tableName ); -+// buf.appendAscii( RTL_CONSTASCII_STRINGPARAM( "ADD COLUMN" ) ); -+// bufferQuoteIdentifier( buf, futureColumnName ); -+// buf.append( futureTypeName ); -+// transaction.executeUpdate( buf.makeStringAndClear() ); -+// } -+// else -+// { -+// if( pastTypeName != futureTypeName ) -+// { -+// throw RuntimeException( -+// ASCII_STR( "Can't modify column types, drop the column and create a new one" ), -+// Reference< XInterface > () ); -+// } -+ -+// if( pastColumnName != futureColumnName ) -+// { -+// buf.appendAscii( RTL_CONSTASCII_STRINGPARAM( "ALTER TABLE" ) ); -+// bufferQuoteQualifiedIdentifier( buf, schemaName, tableName ); -+// buf.appendAscii( RTL_CONSTASCII_STRINGPARAM( "RENAME COLUMN" ) ); -+// bufferQuoteIdentifier( buf, pastColumnName ); -+// buf.appendAscii( RTL_CONSTASCII_STRINGPARAM( "TO" ) ); -+// bufferQuoteIdentifier( buf, futureColumnName ); -+// transaction.executeUpdate( buf.makeStringAndClear() ); -+// } -+// } -+ -+// OUString futureDefaultValue = extractStringProperty( future, st.DEFAULT_VALUE ); -+// OUString pastDefaultValue = extractStringProperty( past, st.DEFAULT_VALUE ); -+// if( futureDefaultValue != pastDefaultValue ) -+// { -+// buf = OUStringBuffer( 128 ); -+// buf.appendAscii( RTL_CONSTASCII_STRINGPARAM( "ALTER TABLE" ) ); -+// bufferQuoteQualifiedIdentifier( buf, schemaName, tableName ); -+// buf.appendAscii( RTL_CONSTASCII_STRINGPARAM( "ALTER COLUMN" ) ); -+// bufferQuoteIdentifier( buf, futureColumnName ); -+// buf.appendAscii( RTL_CONSTASCII_STRINGPARAM( "SET DEFAULT " ) ); -+// // default value is not quoted, caller needs to quote himself (otherwise -+// // how to pass e.g. nextval('something' ) ???? -+// buf.append( futureDefaultValue ); -+// // bufferQuoteConstant( buf, defaultValue, encoding ); -+// transaction.executeUpdate( buf.makeStringAndClear() ); -+// } -+ -+// sal_Int32 futureNullable = extractIntProperty( future, st.IS_NULLABLE ); -+// sal_Int32 pastNullable = extractIntProperty( past, st.IS_NULLABLE ); -+// if( futureNullable != pastNullable ) -+// { -+// buf = OUStringBuffer( 128 ); -+// buf.appendAscii( RTL_CONSTASCII_STRINGPARAM( "ALTER TABLE" ) ); -+// bufferQuoteQualifiedIdentifier( buf, schemaName, tableName ); -+// buf.appendAscii( RTL_CONSTASCII_STRINGPARAM( "ALTER COLUMN" ) ); -+// bufferQuoteIdentifier( buf, futureColumnName ); -+// if( futureNullable == com::sun::star::sdbc::ColumnValue::NO_NULLS ) -+// { -+// buf.appendAscii( RTL_CONSTASCII_STRINGPARAM( "SET" ) ); -+// } -+// else -+// { -+// buf.appendAscii( RTL_CONSTASCII_STRINGPARAM( "DROP" ) ); -+// } -+// buf.appendAscii( RTL_CONSTASCII_STRINGPARAM( " NOT NULL" ) ); -+// transaction.executeUpdate( buf.makeStringAndClear() ); -+// } -+ -+// OUString futureComment = extractStringProperty( future, st.DESCRIPTION ); -+// OUString pastComment = extractStringProperty( past, st.DESCRIPTION ); -+// if( futureComment != pastComment ) -+// { -+// buf = OUStringBuffer( 128 ); -+// buf.appendAscii( RTL_CONSTASCII_STRINGPARAM( "COMMENT ON COLUMN" ) ); -+// bufferQuoteQualifiedIdentifier( buf, schemaName, tableName , futureColumnName ); -+// buf.appendAscii( RTL_CONSTASCII_STRINGPARAM( "IS " ) ); -+// bufferQuoteConstant( buf, futureComment,encoding); -+// transaction.executeUpdate( buf.makeStringAndClear() ); -+// } -+// transaction.commit(); -+// } -+ -+void KeyColumns::appendByDescriptor( -+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& future ) -+ throw (::com::sun::star::sdbc::SQLException, -+ ::com::sun::star::container::ElementExistException, -+ ::com::sun::star::uno::RuntimeException) -+{ -+ throw com::sun::star::sdbc::SQLException( -+ ASCII_STR( "KeyColumns::appendByDescriptor not implemented yet" ), -+ *this, OUString(), 1, Any() ); -+ -+// osl::MutexGuard guard( m_refMutex->mutex ); -+// Statics & st = getStatics(); -+// Reference< XPropertySet > past = createDataDescriptor(); -+// past->setPropertyValue( st.IS_NULLABLE, makeAny( com::sun::star::sdbc::ColumnValue::NULLABLE ) ); -+// alterColumnByDescriptor( -+// m_schemaName, m_tableName, m_pSettings->encoding, m_origin->createStatement() , past, future ); -+ -+} -+ -+ -+void KeyColumns::dropByIndex( sal_Int32 index ) -+ throw (::com::sun::star::sdbc::SQLException, -+ ::com::sun::star::lang::IndexOutOfBoundsException, -+ ::com::sun::star::uno::RuntimeException) -+{ -+ throw com::sun::star::sdbc::SQLException( -+ ASCII_STR( "KeyColumns::dropByIndex not implemented yet" ), -+ *this, OUString(), 1, Any() ); -+// osl::MutexGuard guard( m_refMutex->mutex ); -+// if( index < 0 || index >= m_values.getLength() ) -+// { -+// OUStringBuffer buf( 128 ); -+// buf.appendAscii( "COLUMNS: Index out of range (allowed 0 to " ); -+// buf.append((sal_Int32)(m_values.getLength() -1) ); -+// buf.appendAscii( ", got " ); -+// buf.append( index ); -+// buf.appendAscii( ")" ); -+// throw com::sun::star::lang::IndexOutOfBoundsException( -+// buf.makeStringAndClear(), *this ); -+// } -+ -+// Reference< XPropertySet > set; -+// m_values[index] >>= set; -+// Statics &st = getStatics(); -+// OUString name; -+// set->getPropertyValue( st.NAME ) >>= name; -+ -+// OUStringBuffer update( 128 ); -+// update.appendAscii( "ALTER TABLE ONLY"); -+// bufferQuoteQualifiedIdentifier( update, m_schemaName, m_tableName ); -+// update.appendAscii( "DROP COLUMN" ); -+// bufferQuoteIdentifier( update, name ); -+// Reference< XStatement > stmt = m_origin->createStatement( ); -+// DisposeGuard disposeIt( stmt ); -+// stmt->executeUpdate( update.makeStringAndClear() ); -+ -+} -+ -+ -+Reference< ::com::sun::star::beans::XPropertySet > KeyColumns::createDataDescriptor() -+ throw (::com::sun::star::uno::RuntimeException) -+{ -+ return new KeyColumnDescriptor( m_refMutex, m_origin, m_pSettings ); -+} -+ -+Reference< com::sun::star::container::XNameAccess > KeyColumns::create( -+ const ::rtl::Reference< RefCountedMutex > & refMutex, -+ const ::com::sun::star::uno::Reference< com::sun::star::sdbc::XConnection > & origin, -+ ConnectionSettings *pSettings, -+ const rtl::OUString &schemaName, -+ const rtl::OUString &tableName, -+ const Sequence< rtl::OUString > &columnNames , -+ const Sequence< rtl::OUString > &foreignColumnNames ) -+{ -+ KeyColumns *pKeyColumns = new KeyColumns( -+ refMutex, origin, pSettings, schemaName, tableName, columnNames, foreignColumnNames ); -+ Reference< com::sun::star::container::XNameAccess > ret = pKeyColumns; -+ pKeyColumns->refresh(); -+ -+ return ret; -+} -+ -+//_______________________________________________________________________________________ -+KeyColumnDescriptors::KeyColumnDescriptors( -+ const ::rtl::Reference< RefCountedMutex > & refMutex, -+ const ::com::sun::star::uno::Reference< com::sun::star::sdbc::XConnection > & origin, -+ ConnectionSettings *pSettings ) -+ : Container( refMutex, origin, pSettings, ASCII_STR( "KEY_COLUMN" ) ) -+{} -+ -+Reference< ::com::sun::star::beans::XPropertySet > KeyColumnDescriptors::createDataDescriptor() -+ throw (::com::sun::star::uno::RuntimeException) -+{ -+ return new KeyColumnDescriptor( m_refMutex, m_origin, m_pSettings ); -+} -+}; -diff --git connectivity/source/drivers/postgresql/pq_xkeycolumns.hxx connectivity/source/drivers/postgresql/pq_xkeycolumns.hxx -new file mode 100644 -index 0000000..ae0f001 ---- /dev/null -+++ connectivity/source/drivers/postgresql/pq_xkeycolumns.hxx -@@ -0,0 +1,134 @@ -+/************************************************************************* -+ * -+ * $RCSfile: pq_xkeycolumns.hxx,v $ -+ * -+ * $Revision: 1.1.2.2 $ -+ * -+ * last change: $Author: jbu $ $Date: 2004/06/10 15:27:09 $ -+ * -+ * The Contents of this file are made available subject to the terms of -+ * either of the following licenses -+ * -+ * - GNU Lesser General Public License Version 2.1 -+ * - Sun Industry Standards Source License Version 1.1 -+ * -+ * Sun Microsystems Inc., October, 2000 -+ * -+ * GNU Lesser General Public License Version 2.1 -+ * ============================================= -+ * Copyright 2000 by Sun Microsystems, Inc. -+ * 901 San Antonio Road, Palo Alto, CA 94303, USA -+ * -+ * This library is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License version 2.1, as published by the Free Software Foundation. -+ * -+ * This library is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public -+ * License along with this library; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, -+ * MA 02111-1307 USA -+ * -+ * -+ * Sun Industry Standards Source License Version 1.1 -+ * ================================================= -+ * The contents of this file are subject to the Sun Industry Standards -+ * Source License Version 1.1 (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.openoffice.org/license.html. -+ * -+ * Software provided under this License is provided on an "AS IS" basis, -+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, -+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, -+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. -+ * See the License for the specific provisions governing your rights and -+ * obligations concerning the Software. -+ * -+ * The Initial Developer of the Original Code is: Joerg Budischewski -+ * -+ * Copyright: 2000 by Sun Microsystems, Inc. -+ * -+ * All Rights Reserved. -+ * -+ * Contributor(s): Joerg Budischewski -+ * -+ * -+ ************************************************************************/ -+ -+#ifndef HEADER_PQ_KEYCOLUMNS_HXX -+#define HEADER_PQ_KEYCOLUMNS_HXX -+ -+#include "pq_xcontainer.hxx" -+ -+namespace pq_sdbc_driver -+{ -+ -+class KeyColumns : public Container -+{ -+ rtl::OUString m_schemaName; -+ rtl::OUString m_tableName; -+ com::sun::star::uno::Sequence< rtl::OUString > m_columnNames; -+ com::sun::star::uno::Sequence< rtl::OUString > m_foreignColumnNames; -+ -+public: // instances KeyColumns 'exception safe' -+ static com::sun::star::uno::Reference< com::sun::star::container::XNameAccess > create( -+ const ::rtl::Reference< RefCountedMutex > & refMutex, -+ const ::com::sun::star::uno::Reference< com::sun::star::sdbc::XConnection > & origin, -+ ConnectionSettings *pSettings, -+ const rtl::OUString &schemaName, -+ const rtl::OUString &tableName, -+ const com::sun::star::uno::Sequence< rtl::OUString > &keyColumns, -+ const com::sun::star::uno::Sequence< rtl::OUString > &foreignColumnNames ); -+ -+protected: -+ KeyColumns( -+ const ::rtl::Reference< RefCountedMutex > & refMutex, -+ const ::com::sun::star::uno::Reference< com::sun::star::sdbc::XConnection > & origin, -+ ConnectionSettings *pSettings, -+ const rtl::OUString &schemaName, -+ const rtl::OUString &tableName, -+ const com::sun::star::uno::Sequence< rtl::OUString > &keyColumns, -+ const com::sun::star::uno::Sequence< rtl::OUString > &foreignColumnNames); -+ -+ virtual ~KeyColumns(); -+ -+public: // XAppend -+ virtual void SAL_CALL appendByDescriptor( -+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ) -+ throw (::com::sun::star::sdbc::SQLException, -+ ::com::sun::star::container::ElementExistException, -+ ::com::sun::star::uno::RuntimeException); -+ -+public: // XDrop -+ virtual void SAL_CALL dropByIndex( sal_Int32 index ) -+ throw (::com::sun::star::sdbc::SQLException, -+ ::com::sun::star::lang::IndexOutOfBoundsException, -+ ::com::sun::star::uno::RuntimeException); -+ -+public: // XRefreshable -+ virtual void SAL_CALL refresh( ) throw (::com::sun::star::uno::RuntimeException); -+ -+public: // XDataDescriptorFactory -+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL createDataDescriptor( ) -+ throw (::com::sun::star::uno::RuntimeException); -+}; -+ -+ -+class KeyColumnDescriptors : public Container -+{ -+public: -+ KeyColumnDescriptors( -+ const ::rtl::Reference< RefCountedMutex > & refMutex, -+ const ::com::sun::star::uno::Reference< com::sun::star::sdbc::XConnection > & origin, -+ ConnectionSettings *pSettings); -+ -+public: // XDataDescriptorFactory -+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL createDataDescriptor( ) -+ throw (::com::sun::star::uno::RuntimeException); -+}; -+} -+#endif -diff --git connectivity/source/drivers/postgresql/pq_xkeys.cxx connectivity/source/drivers/postgresql/pq_xkeys.cxx -new file mode 100644 -index 0000000..2b7b540 ---- /dev/null -+++ connectivity/source/drivers/postgresql/pq_xkeys.cxx -@@ -0,0 +1,387 @@ -+/************************************************************************* -+ * -+ * $RCSfile: pq_xkeys.cxx,v $ -+ * -+ * $Revision: 1.1.2.3 $ -+ * -+ * last change: $Author: jbu $ $Date: 2004/08/29 08:33:32 $ -+ * -+ * The Contents of this file are made available subject to the terms of -+ * either of the following licenses -+ * -+ * - GNU Lesser General Public License Version 2.1 -+ * - Sun Industry Standards Source License Version 1.1 -+ * -+ * Sun Microsystems Inc., October, 2000 -+ * -+ * GNU Lesser General Public License Version 2.1 -+ * ============================================= -+ * Copyright 2000 by Sun Microsystems, Inc. -+ * 901 San Antonio Road, Palo Alto, CA 94303, USA -+ * -+ * This library is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License version 2.1, as published by the Free Software Foundation. -+ * -+ * This library is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public -+ * License along with this library; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, -+ * MA 02111-1307 USA -+ * -+ * -+ * Sun Industry Standards Source License Version 1.1 -+ * ================================================= -+ * The contents of this file are subject to the Sun Industry Standards -+ * Source License Version 1.1 (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.openoffice.org/license.html. -+ * -+ * Software provided under this License is provided on an "AS IS" basis, -+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, -+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, -+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. -+ * See the License for the specific provisions governing your rights and -+ * obligations concerning the Software. -+ * -+ * The Initial Developer of the Original Code is: Joerg Budischewski -+ * -+ * Copyright: 2000 by Sun Microsystems, Inc. -+ * -+ * All Rights Reserved. -+ * -+ * Contributor(s): Joerg Budischewski -+ * -+ * -+ ************************************************************************/ -+ -+#include -+#include -+ -+#include -+#include -+ -+#include -+#include -+#include -+#include -+ -+#include "pq_xkeys.hxx" -+#include "pq_xkey.hxx" -+#include "pq_statics.hxx" -+#include "pq_tools.hxx" -+ -+using osl::MutexGuard; -+ -+using rtl::OUString; -+using rtl::OUStringBuffer; -+using rtl::OUStringToOString; -+ -+using com::sun::star::beans::XPropertySet; -+ -+using com::sun::star::uno::Any; -+using com::sun::star::uno::makeAny; -+using com::sun::star::uno::UNO_QUERY; -+using com::sun::star::uno::Type; -+using com::sun::star::uno::XInterface; -+using com::sun::star::uno::Reference; -+using com::sun::star::uno::Sequence; -+using com::sun::star::uno::RuntimeException; -+ -+using com::sun::star::container::NoSuchElementException; -+using com::sun::star::lang::WrappedTargetException; -+ -+using com::sun::star::sdbc::XRow; -+using com::sun::star::sdbc::XCloseable; -+using com::sun::star::sdbc::XStatement; -+using com::sun::star::sdbc::XResultSet; -+using com::sun::star::sdbc::XParameters; -+using com::sun::star::sdbc::XPreparedStatement; -+using com::sun::star::sdbc::XDatabaseMetaData; -+ -+namespace pq_sdbc_driver -+{ -+#define ASCII_STR(x) OUString( RTL_CONSTASCII_USTRINGPARAM( x ) ) -+ -+Keys::Keys( -+ const ::rtl::Reference< RefCountedMutex > & refMutex, -+ const ::com::sun::star::uno::Reference< com::sun::star::sdbc::XConnection > & origin, -+ ConnectionSettings *pSettings, -+ const rtl::OUString &schemaName, -+ const rtl::OUString &tableName) -+ : Container( refMutex, origin, pSettings, getStatics().KEY ), -+ m_schemaName( schemaName ), -+ m_tableName( tableName ) -+{} -+ -+Keys::~Keys() -+{} -+ -+static sal_Int32 string2keytype( const rtl::OUString &type ) -+{ -+ sal_Int32 ret = com::sun::star::sdbcx::KeyType::UNIQUE; -+ if( type.compareToAscii( RTL_CONSTASCII_STRINGPARAM( "p" ) ) == 0 ) -+ ret = com::sun::star::sdbcx::KeyType::PRIMARY; -+ else if( type.compareToAscii( RTL_CONSTASCII_STRINGPARAM( "f" ) ) == 0 ) -+ ret = com::sun::star::sdbcx::KeyType::FOREIGN; -+ return ret; -+} -+ -+static sal_Int32 string2keyrule( const rtl::OUString & rule ) -+{ -+ sal_Int32 ret = com::sun::star::sdbc::KeyRule::NO_ACTION; -+ if( rule.compareToAscii( RTL_CONSTASCII_STRINGPARAM( "r" ) ) == 0 ) -+ ret = com::sun::star::sdbc::KeyRule::RESTRICT; -+ else if( rule.compareToAscii( RTL_CONSTASCII_STRINGPARAM( "c" ) ) == 0 ) -+ ret = com::sun::star::sdbc::KeyRule::CASCADE; -+ else if( rule.compareToAscii( RTL_CONSTASCII_STRINGPARAM( "n" ) ) == 0 ) -+ ret = com::sun::star::sdbc::KeyRule::SET_NULL; -+ else if( rule.compareToAscii( RTL_CONSTASCII_STRINGPARAM( "d" ) ) == 0 ) -+ ret = com::sun::star::sdbc::KeyRule::SET_DEFAULT; -+ return ret; -+} -+ -+ -+ -+// static void fillAttnum2attnameMap( -+// Int2StringMap &map, -+// const Reference< com::sun::star::sdbc::XConnection > &conn, -+// const rtl::OUString &schema, -+// const rtl::OUString &table ) -+// { -+// Reference< XPreparedStatement > prep = conn->prepareStatement( -+// ASCII_STR( "SELECT attname,attnum " -+// "FROM pg_attribute " -+// "INNER JOIN pg_class ON attrelid = pg_class.oid " -+// "INNER JOIN pg_namespace ON pg_class.relnamespace = pg_namespace.oid " -+// "WHERE relname=? AND nspname=?" ) ); -+ -+// Reference< XParameters > paras( prep, UNO_QUERY ); -+// paras->setString( 1 , table ); -+// paras->setString( 2 , schema ); -+// Reference< XResultSet > rs = prep->executeQuery(); -+ -+// Reference< XRow > xRow( rs , UNO_QUERY ); -+// while( rs->next() ) -+// { -+// map[ xRow->getInt(2) ] = xRow->getString(1); -+// } -+// } -+ -+// static Sequence< rtl::OUString > resolveColumnNames( -+// const Int2StringMap &map, const rtl::OUString &array ) -+// { -+// Sequence< sal_Int32 > intArray = string2intarray( array ); -+// Sequence< ::rtl::OUString > ret( intArray.getLength() ); -+// for( int i = 0; i < intArray.getLength() ; i ++ ) -+// { -+// Int2StringMap::const_iterator ii = map.find( intArray[i] ); -+// if( ii != map.end() ) -+// ret[i] = ii->second; -+// } -+// return ret; -+// } -+ -+void Keys::refresh() -+ throw (::com::sun::star::uno::RuntimeException) -+{ -+ try -+ { -+ if( isLog( m_pSettings, LogLevel::INFO ) ) -+ { -+ rtl::OStringBuffer buf; -+ buf.append( "sdbcx.Keys get refreshed for table " ); -+ buf.append( OUStringToOString( m_schemaName, m_pSettings->encoding ) ); -+ buf.append( "." ); -+ buf.append( OUStringToOString( m_tableName,m_pSettings->encoding ) ); -+ log( m_pSettings, LogLevel::INFO, buf.makeStringAndClear().getStr() ); -+ } -+ -+ osl::MutexGuard guard( m_refMutex->mutex ); -+ Statics & st = getStatics(); -+ -+ Int2StringMap mainMap; -+ fillAttnum2attnameMap( mainMap, m_origin, m_schemaName, m_tableName ); -+ -+ Reference< XPreparedStatement > stmt = m_origin->prepareStatement( -+ ASCII_STR( -+ "SELECT conname, " // 1 -+ "contype, " // 2 -+ "confupdtype, " // 3 -+ "confdeltype, " // 4 -+ "class2.relname, " // 5 -+ "nmsp2.nspname, " // 6 -+ "conkey," // 7 -+ "confkey " // 8 -+ "FROM pg_constraint INNER JOIN pg_class ON conrelid = pg_class.oid " -+ "INNER JOIN pg_namespace ON pg_class.relnamespace = pg_namespace.oid " -+ "LEFT JOIN pg_class AS class2 ON confrelid = class2.oid " -+ "LEFT JOIN pg_namespace AS nmsp2 ON class2.relnamespace=nmsp2.oid " -+ "WHERE pg_class.relname = ? AND pg_namespace.nspname = ?" ) ); -+ -+ Reference< XParameters > paras( stmt, UNO_QUERY ); -+ paras->setString( 1 , m_tableName ); -+ paras->setString( 2 , m_schemaName ); -+ Reference< XResultSet > rs = stmt->executeQuery(); -+ -+ Reference< XRow > xRow( rs , UNO_QUERY ); -+ -+ String2IntMap map; -+ std::vector< Any, Allocator< Any> > vec; -+ sal_Int32 keyIndex = 0; -+ while( rs->next() ) -+ { -+ Key * pKey = -+ new Key( m_refMutex, m_origin, m_pSettings , m_schemaName, m_tableName ); -+ Reference< com::sun::star::beans::XPropertySet > prop = pKey; -+ -+ pKey->setPropertyValue_NoBroadcast_public( -+ st.NAME, makeAny( xRow->getString( 1 ) ) ); -+ sal_Int32 keyType = string2keytype( xRow->getString(2) ); -+ pKey->setPropertyValue_NoBroadcast_public( st.TYPE, makeAny( keyType ) ); -+ pKey->setPropertyValue_NoBroadcast_public( -+ st.UPDATE_RULE, makeAny( string2keyrule( xRow->getString(3) ) ) ); -+ pKey->setPropertyValue_NoBroadcast_public( -+ st.DELETE_RULE, makeAny( string2keyrule( xRow->getString(4) ) ) ); -+ pKey->setPropertyValue_NoBroadcast_public( -+ st.PRIVATE_COLUMNS, -+ makeAny( -+ convertMappedIntArray2StringArray( -+ mainMap, -+ string2intarray( xRow->getString( 7 ) ) ) ) ); -+ -+ if( com::sun::star::sdbcx::KeyType::FOREIGN == keyType ) -+ { -+ OUStringBuffer buf( 128 ); -+ buf.append( xRow->getString( 6 ) ); -+ buf.appendAscii( RTL_CONSTASCII_STRINGPARAM( "." ) ); -+ buf.append( xRow->getString( 5 ) ); -+ pKey->setPropertyValue_NoBroadcast_public( -+ st.REFERENCED_TABLE, makeAny( buf.makeStringAndClear() ) ); -+ -+ Int2StringMap foreignMap; -+ fillAttnum2attnameMap( foreignMap, m_origin, xRow->getString(6), xRow->getString(5)); -+ pKey->setPropertyValue_NoBroadcast_public( -+ st.PRIVATE_FOREIGN_COLUMNS, -+ makeAny( -+ convertMappedIntArray2StringArray( -+ foreignMap, -+ string2intarray( xRow->getString(8) ) ) ) ); -+ } -+ -+ vec.push_back( makeAny( prop ) ); -+ map[ xRow->getString( 1 ) ] = keyIndex; -+ keyIndex ++; -+ } -+ m_values = Sequence< com::sun::star::uno::Any > ( & vec[0] , vec.size() ); -+ m_name2index.swap( map ); -+ } -+ catch ( com::sun::star::sdbc::SQLException & e ) -+ { -+ throw RuntimeException( e.Message , e.Context ); -+ } -+ -+ fire( RefreshedBroadcaster( *this ) ); -+} -+ -+ -+void Keys::appendByDescriptor( -+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ) -+ throw (::com::sun::star::sdbc::SQLException, -+ ::com::sun::star::container::ElementExistException, -+ ::com::sun::star::uno::RuntimeException) -+{ -+ osl::MutexGuard guard( m_refMutex->mutex ); -+ -+ OUStringBuffer buf( 128 ); -+ buf.appendAscii( RTL_CONSTASCII_STRINGPARAM( "ALTER TABLE " ) ); -+ bufferQuoteQualifiedIdentifier( buf, m_schemaName, m_tableName ); -+ buf.appendAscii( RTL_CONSTASCII_STRINGPARAM( " ADD " ) ); -+ bufferKey2TableConstraint( buf, descriptor ); -+ -+ Reference< XStatement > stmt = -+ m_origin->createStatement(); -+ stmt->executeUpdate( buf.makeStringAndClear() ); -+} -+ -+ -+void Keys::dropByIndex( sal_Int32 index ) -+ throw (::com::sun::star::sdbc::SQLException, -+ ::com::sun::star::lang::IndexOutOfBoundsException, -+ ::com::sun::star::uno::RuntimeException) -+{ -+ osl::MutexGuard guard( m_refMutex->mutex ); -+ if( index < 0 || index >= m_values.getLength() ) -+ { -+ OUStringBuffer buf( 128 ); -+ buf.appendAscii( "TABLES: Index out of range (allowed 0 to " ); -+ buf.append( (sal_Int32)(m_values.getLength() -1) ); -+ buf.appendAscii( ", got " ); -+ buf.append( index ); -+ buf.appendAscii( ")" ); -+ throw com::sun::star::lang::IndexOutOfBoundsException( -+ buf.makeStringAndClear(), *this ); -+ } -+ -+ -+ Reference< XPropertySet > set; -+ m_values[index] >>= set; -+ -+ OUStringBuffer buf( 128 ); -+ buf.appendAscii( RTL_CONSTASCII_STRINGPARAM( "ALTER TABLE " ) ); -+ bufferQuoteQualifiedIdentifier( buf, m_schemaName, m_tableName ); -+ buf.appendAscii( RTL_CONSTASCII_STRINGPARAM( " DROP CONSTRAINT " ) ); -+ bufferQuoteIdentifier( buf, extractStringProperty( set , getStatics().NAME ) ); -+ m_origin->createStatement()->executeUpdate( buf.makeStringAndClear() ); -+ -+ -+ Container::dropByIndex( index ); -+} -+ -+ -+::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > Keys::createDataDescriptor() -+ throw (::com::sun::star::uno::RuntimeException) -+{ -+ return new KeyDescriptor( m_refMutex, m_origin, m_pSettings ); -+} -+ -+Reference< com::sun::star::container::XIndexAccess > Keys::create( -+ const ::rtl::Reference< RefCountedMutex > & refMutex, -+ const ::com::sun::star::uno::Reference< com::sun::star::sdbc::XConnection > & origin, -+ ConnectionSettings *pSettings, -+ const rtl::OUString & schemaName, -+ const rtl::OUString & tableName) -+{ -+ Keys *pKeys = new Keys( refMutex, origin, pSettings, schemaName, tableName ); -+ Reference< com::sun::star::container::XIndexAccess > ret = pKeys; -+ pKeys->refresh(); -+ -+ return ret; -+} -+//_________________________________________________________________________________________ -+KeyDescriptors::KeyDescriptors( -+ const ::rtl::Reference< RefCountedMutex > & refMutex, -+ const ::com::sun::star::uno::Reference< com::sun::star::sdbc::XConnection > & origin, -+ ConnectionSettings *pSettings) -+ : Container( refMutex, origin, pSettings, getStatics().KEY ) -+{} -+ -+Reference< com::sun::star::container::XIndexAccess > KeyDescriptors::create( -+ const ::rtl::Reference< RefCountedMutex > & refMutex, -+ const ::com::sun::star::uno::Reference< com::sun::star::sdbc::XConnection > & origin, -+ ConnectionSettings *pSettings) -+{ -+ return new KeyDescriptors( refMutex, origin, pSettings ); -+} -+ -+::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > KeyDescriptors::createDataDescriptor() -+ throw (::com::sun::star::uno::RuntimeException) -+{ -+ return new KeyDescriptor( m_refMutex, m_origin, m_pSettings ); -+} -+ -+}; -diff --git connectivity/source/drivers/postgresql/pq_xkeys.hxx connectivity/source/drivers/postgresql/pq_xkeys.hxx -new file mode 100644 -index 0000000..c996222 ---- /dev/null -+++ connectivity/source/drivers/postgresql/pq_xkeys.hxx -@@ -0,0 +1,134 @@ -+/************************************************************************* -+ * -+ * $RCSfile: pq_xkeys.hxx,v $ -+ * -+ * $Revision: 1.1.2.2 $ -+ * -+ * last change: $Author: jbu $ $Date: 2004/06/10 15:27:10 $ -+ * -+ * The Contents of this file are made available subject to the terms of -+ * either of the following licenses -+ * -+ * - GNU Lesser General Public License Version 2.1 -+ * - Sun Industry Standards Source License Version 1.1 -+ * -+ * Sun Microsystems Inc., October, 2000 -+ * -+ * GNU Lesser General Public License Version 2.1 -+ * ============================================= -+ * Copyright 2000 by Sun Microsystems, Inc. -+ * 901 San Antonio Road, Palo Alto, CA 94303, USA -+ * -+ * This library is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License version 2.1, as published by the Free Software Foundation. -+ * -+ * This library is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public -+ * License along with this library; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, -+ * MA 02111-1307 USA -+ * -+ * -+ * Sun Industry Standards Source License Version 1.1 -+ * ================================================= -+ * The contents of this file are subject to the Sun Industry Standards -+ * Source License Version 1.1 (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.openoffice.org/license.html. -+ * -+ * Software provided under this License is provided on an "AS IS" basis, -+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, -+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, -+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. -+ * See the License for the specific provisions governing your rights and -+ * obligations concerning the Software. -+ * -+ * The Initial Developer of the Original Code is: Joerg Budischewski -+ * -+ * Copyright: 2000 by Sun Microsystems, Inc. -+ * -+ * All Rights Reserved. -+ * -+ * Contributor(s): Joerg Budischewski -+ * -+ * -+ ************************************************************************/ -+ -+#ifndef _PQ_KEYS_HXX_ -+#define _PQ_KEYS_HXX_ -+ -+#include "pq_xcontainer.hxx" -+ -+namespace pq_sdbc_driver -+{ -+class Keys : public Container -+{ -+ rtl::OUString m_schemaName; -+ rtl::OUString m_tableName; -+ -+public: // instances Columns 'exception safe' -+ static com::sun::star::uno::Reference< com::sun::star::container::XIndexAccess > create( -+ const ::rtl::Reference< RefCountedMutex > & refMutex, -+ const ::com::sun::star::uno::Reference< com::sun::star::sdbc::XConnection > & origin, -+ ConnectionSettings *pSettings, -+ const rtl::OUString &schemaName, -+ const rtl::OUString &tableName); -+ -+protected: -+ Keys( -+ const ::rtl::Reference< RefCountedMutex > & refMutex, -+ const ::com::sun::star::uno::Reference< com::sun::star::sdbc::XConnection > & origin, -+ ConnectionSettings *pSettings, -+ const rtl::OUString &schemaName, -+ const rtl::OUString &tableName); -+ -+ virtual ~Keys(); -+ -+public: // XAppend -+ virtual void SAL_CALL appendByDescriptor( -+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ) -+ throw (::com::sun::star::sdbc::SQLException, -+ ::com::sun::star::container::ElementExistException, -+ ::com::sun::star::uno::RuntimeException); -+ -+public: // XDrop -+ virtual void SAL_CALL dropByIndex( sal_Int32 index ) -+ throw (::com::sun::star::sdbc::SQLException, -+ ::com::sun::star::lang::IndexOutOfBoundsException, -+ ::com::sun::star::uno::RuntimeException); -+ -+public: // XRefreshable -+ virtual void SAL_CALL refresh( ) throw (::com::sun::star::uno::RuntimeException); -+ -+public: // XDataDescriptorFactory -+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL createDataDescriptor( ) -+ throw (::com::sun::star::uno::RuntimeException); -+}; -+ -+ -+class KeyDescriptors : public Container -+{ -+public: // instances Columns 'exception safe' -+ static com::sun::star::uno::Reference< com::sun::star::container::XIndexAccess > create( -+ const ::rtl::Reference< RefCountedMutex > & refMutex, -+ const ::com::sun::star::uno::Reference< com::sun::star::sdbc::XConnection > & origin, -+ ConnectionSettings *pSettings ); -+ -+protected: -+ KeyDescriptors( -+ const ::rtl::Reference< RefCountedMutex > & refMutex, -+ const ::com::sun::star::uno::Reference< com::sun::star::sdbc::XConnection > & origin, -+ ConnectionSettings *pSettings ); -+ -+public: // XDataDescriptorFactory -+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL createDataDescriptor( ) -+ throw (::com::sun::star::uno::RuntimeException); -+}; -+ -+} -+#endif -diff --git connectivity/source/drivers/postgresql/pq_xtable.cxx connectivity/source/drivers/postgresql/pq_xtable.cxx -new file mode 100644 -index 0000000..50871a1 ---- /dev/null -+++ connectivity/source/drivers/postgresql/pq_xtable.cxx -@@ -0,0 +1,484 @@ -+/************************************************************************* -+ * -+ * $RCSfile: pq_xtable.cxx,v $ -+ * -+ * $Revision: 1.1.2.6 $ -+ * -+ * last change: $Author: jbu $ $Date: 2007/01/07 13:50:38 $ -+ * -+ * The Contents of this file are made available subject to the terms of -+ * either of the following licenses -+ * -+ * - GNU Lesser General Public License Version 2.1 -+ * - Sun Industry Standards Source License Version 1.1 -+ * -+ * Sun Microsystems Inc., October, 2000 -+ * -+ * GNU Lesser General Public License Version 2.1 -+ * ============================================= -+ * Copyright 2000 by Sun Microsystems, Inc. -+ * 901 San Antonio Road, Palo Alto, CA 94303, USA -+ * -+ * This library is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License version 2.1, as published by the Free Software Foundation. -+ * -+ * This library is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public -+ * License along with this library; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, -+ * MA 02111-1307 USA -+ * -+ * -+ * Sun Industry Standards Source License Version 1.1 -+ * ================================================= -+ * The contents of this file are subject to the Sun Industry Standards -+ * Source License Version 1.1 (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.openoffice.org/license.html. -+ * -+ * Software provided under this License is provided on an "AS IS" basis, -+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, -+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, -+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. -+ * See the License for the specific provisions governing your rights and -+ * obligations concerning the Software. -+ * -+ * The Initial Developer of the Original Code is: Joerg Budischewski -+ * -+ * Copyright: 2000 by Sun Microsystems, Inc. -+ * -+ * All Rights Reserved. -+ * -+ * Contributor(s): Joerg Budischewski -+ * -+ * -+ ************************************************************************/ -+ -+#include -+ -+#include -+#include -+ -+#include -+ -+#include -+#include -+ -+#include "pq_xtable.hxx" -+#include "pq_xtables.hxx" -+#include "pq_xviews.hxx" -+#include "pq_xindexes.hxx" -+#include "pq_xkeys.hxx" -+#include "pq_xcolumns.hxx" -+#include "pq_tools.hxx" -+#include "pq_statics.hxx" -+ -+using osl::MutexGuard; -+using osl::Mutex; -+ -+using rtl::OUString; -+using rtl::OUStringBuffer; -+using rtl::OUStringToOString; -+ -+using com::sun::star::container::XNameAccess; -+using com::sun::star::container::XIndexAccess; -+using com::sun::star::container::ElementExistException; -+using com::sun::star::container::NoSuchElementException; -+ -+using com::sun::star::uno::Reference; -+using com::sun::star::uno::Exception; -+using com::sun::star::uno::UNO_QUERY; -+using com::sun::star::uno::XInterface; -+using com::sun::star::uno::Sequence; -+using com::sun::star::uno::Any; -+using com::sun::star::uno::makeAny; -+using com::sun::star::uno::Type; -+using com::sun::star::uno::RuntimeException; -+ -+using com::sun::star::lang::IllegalArgumentException; -+using com::sun::star::lang::IndexOutOfBoundsException; -+ -+using com::sun::star::beans::XPropertySetInfo; -+using com::sun::star::beans::XFastPropertySet; -+using com::sun::star::beans::XMultiPropertySet; -+using com::sun::star::beans::XPropertySet; -+using com::sun::star::beans::Property; -+ -+using com::sun::star::sdbc::XResultSet; -+using com::sun::star::sdbc::XPreparedStatement; -+using com::sun::star::sdbc::XStatement; -+using com::sun::star::sdbc::XParameters; -+using com::sun::star::sdbc::XRow; -+using com::sun::star::sdbc::SQLException; -+ -+namespace pq_sdbc_driver -+{ -+#define ASCII_STR(x) OUString( RTL_CONSTASCII_USTRINGPARAM( x ) ) -+ -+Table::Table( const ::rtl::Reference< RefCountedMutex > & refMutex, -+ const Reference< com::sun::star::sdbc::XConnection > & connection, -+ ConnectionSettings *pSettings) -+ : ReflectionBase( -+ getStatics().refl.table.implName, -+ getStatics().refl.table.serviceNames, -+ refMutex, -+ connection, -+ pSettings, -+ * getStatics().refl.table.pProps ), -+ m_pColumns( 0 ) -+{} -+ -+Reference< XPropertySet > Table::createDataDescriptor( ) throw (RuntimeException) -+{ -+ TableDescriptor * pTable = new TableDescriptor( -+ m_refMutex, m_conn, m_pSettings ); -+ pTable->copyValuesFrom( this ); -+ -+ return Reference< XPropertySet > ( pTable ); -+} -+ -+Reference< XNameAccess > Table::getColumns( ) throw (::com::sun::star::uno::RuntimeException) -+{ -+ if( ! m_columns.is() ) -+ { -+ m_columns = Columns::create( -+ m_refMutex, -+ m_conn, -+ m_pSettings, -+ extractStringProperty( this, getStatics().SCHEMA_NAME ), -+ extractStringProperty( this, getStatics().NAME ), -+ &m_pColumns); -+ } -+ return m_columns; -+} -+ -+Reference< XNameAccess > Table::getIndexes() throw (::com::sun::star::uno::RuntimeException) -+{ -+ if( ! m_indexes.is() ) -+ { -+ m_indexes = ::pq_sdbc_driver::Indexes::create( -+ m_refMutex, -+ m_conn, -+ m_pSettings, -+ extractStringProperty( this, getStatics().SCHEMA_NAME ), -+ extractStringProperty( this, getStatics().NAME ) ); -+ } -+ return m_indexes; -+} -+ -+Reference< XIndexAccess > Table::getKeys( ) throw (::com::sun::star::uno::RuntimeException) -+{ -+ if( ! m_keys.is() ) -+ { -+ m_keys = ::pq_sdbc_driver::Keys::create( -+ m_refMutex, -+ m_conn, -+ m_pSettings, -+ extractStringProperty( this, getStatics().SCHEMA_NAME ), -+ extractStringProperty( this, getStatics().NAME ) ); -+ } -+ return m_keys; -+} -+ -+void Table::rename( const ::rtl::OUString& newName ) -+ throw (::com::sun::star::sdbc::SQLException, -+ ::com::sun::star::container::ElementExistException, -+ ::com::sun::star::uno::RuntimeException) -+{ -+ MutexGuard guard( m_refMutex->mutex ); -+ Statics & st = getStatics(); -+ -+ ::rtl::OUString oldName = extractStringProperty(this,st.NAME ); -+ ::rtl::OUString schema = extractStringProperty(this,st.SCHEMA_NAME ); -+ ::rtl::OUString fullOldName = concatQualified( schema, oldName ); -+ -+ OUString newTableName; -+ OUString newSchemaName; -+ // OOo2.0 passes schema + dot + new-table-name while -+ // OO1.1.x passes new Name without schema -+ // in case name contains a dot, it is interpreted as schema.tablename -+ if( newName.indexOf( '.' ) >= 0 ) -+ { -+ splitConcatenatedIdentifier( newName, &newSchemaName, &newTableName ); -+ } -+ else -+ { -+ newTableName = newName; -+ newSchemaName = schema; -+ } -+ ::rtl::OUString fullNewName = concatQualified( newSchemaName, newTableName ); -+ -+ if( extractStringProperty( this, st.TYPE ).equals( st.VIEW ) && m_pSettings->views.is() ) -+ { -+ // maintain view list (really strange API !) -+ Any a = m_pSettings->pViewsImpl->getByName( fullOldName ); -+ Reference< com::sun::star::sdbcx::XRename > rename; -+ a >>= rename; -+ if( rename.is() ) -+ { -+ rename->rename( newName ); -+ setPropertyValue_NoBroadcast_public( st.SCHEMA_NAME, makeAny(newSchemaName) ); -+ } -+ } -+ else -+ { -+ if( ! newSchemaName.equals(schema) ) -+ { -+ // try new schema name first -+ try -+ { -+ OUStringBuffer buf(128); -+ buf.appendAscii( RTL_CONSTASCII_STRINGPARAM( "ALTER TABLE" ) ); -+ bufferQuoteQualifiedIdentifier(buf, schema, oldName ); -+ buf.appendAscii( RTL_CONSTASCII_STRINGPARAM("SET SCHEMA" ) ); -+ bufferQuoteIdentifier( buf, newSchemaName ); -+ Reference< XStatement > statement = m_conn->createStatement(); -+ statement->executeUpdate( buf.makeStringAndClear() ); -+ setPropertyValue_NoBroadcast_public( st.SCHEMA_NAME, makeAny(newSchemaName) ); -+ disposeNoThrow( statement ); -+ schema = newSchemaName; -+ } -+ catch( com::sun::star::sdbc::SQLException &e ) -+ { -+ OUStringBuffer buf( e.Message ); -+ buf.appendAscii( RTL_CONSTASCII_STRINGPARAM( "(NOTE: Only postgresql server >= V8.1 support changing a table's schema)" ) ); -+ e.Message = buf.makeStringAndClear(); -+ throw e; -+ } -+ -+ } -+ if( ! newTableName.equals( oldName ) ) // might also be just the change of a schema name -+ { -+ OUStringBuffer buf(128); -+ buf.appendAscii( RTL_CONSTASCII_STRINGPARAM( "ALTER TABLE" ) ); -+ bufferQuoteQualifiedIdentifier(buf, schema, oldName ); -+ buf.appendAscii( RTL_CONSTASCII_STRINGPARAM("RENAME TO" ) ); -+ bufferQuoteIdentifier( buf, newTableName ); -+ Reference< XStatement > statement = m_conn->createStatement(); -+ statement->executeUpdate( buf.makeStringAndClear() ); -+ disposeNoThrow( statement ); -+ } -+ } -+ setPropertyValue_NoBroadcast_public( st.NAME, makeAny(newTableName) ); -+ // inform the container of the name change ! -+ if( m_pSettings->tables.is() ) -+ { -+ m_pSettings->pTablesImpl->rename( fullOldName, fullNewName ); -+ } -+} -+ -+void Table::alterColumnByName( -+ const ::rtl::OUString& colName, -+ const Reference< XPropertySet >& descriptor ) -+ throw (SQLException,NoSuchElementException,RuntimeException) -+{ -+ Reference< com::sun::star::container::XNameAccess > colums = -+ Reference< com::sun::star::container::XNameAccess > ( getColumns(), UNO_QUERY ); -+ -+ OUString newName = extractStringProperty(descriptor, getStatics().NAME ); -+ ::pq_sdbc_driver::alterColumnByDescriptor( -+ extractStringProperty( this, getStatics().SCHEMA_NAME ), -+ extractStringProperty( this, getStatics().NAME ), -+ m_pSettings->encoding, -+ m_conn->createStatement(), -+ Reference< com::sun::star::beans::XPropertySet>( colums->getByName( colName ), UNO_QUERY) , -+ descriptor ); -+ -+ if( colName != newName ) -+ { -+// m_pColumns->rename( colName, newName ); -+ m_pColumns->refresh(); -+ } -+} -+ -+void Table::alterColumnByIndex( -+ sal_Int32 index, -+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ) -+ throw (SQLException,IndexOutOfBoundsException,RuntimeException) -+{ -+ Reference< com::sun::star::container::XIndexAccess > colums = -+ Reference< com::sun::star::container::XIndexAccess>( getColumns(), UNO_QUERY ); -+ Reference< com::sun::star::beans::XPropertySet> column(colums->getByIndex( index ), UNO_QUERY ); -+ OUString oldName = extractStringProperty( column, getStatics().NAME ); -+ OUString newName = extractStringProperty( descriptor, getStatics().NAME ); -+ ::pq_sdbc_driver::alterColumnByDescriptor( -+ extractStringProperty( this, getStatics().SCHEMA_NAME ), -+ extractStringProperty( this, getStatics().NAME ), -+ m_pSettings->encoding, -+ m_conn->createStatement(), -+ column, -+ descriptor ); -+// m_pColumns->rename( oldName, newName ); -+ m_pColumns->refresh(); -+} -+ -+Sequence Table::getTypes() throw( RuntimeException ) -+{ -+ static cppu::OTypeCollection *pCollection; -+ if( ! pCollection ) -+ { -+ MutexGuard guard( osl::Mutex::getGlobalMutex() ); -+ if( !pCollection ) -+ { -+ static cppu::OTypeCollection collection( -+ getCppuType( (Reference< com::sun::star::sdbcx::XIndexesSupplier> *) 0 ), -+ getCppuType( (Reference< com::sun::star::sdbcx::XKeysSupplier> *) 0 ), -+ getCppuType( (Reference< com::sun::star::sdbcx::XColumnsSupplier> *) 0 ), -+ getCppuType( (Reference< com::sun::star::sdbcx::XRename> *) 0 ), -+ getCppuType( (Reference< com::sun::star::sdbcx::XAlterTable> *) 0 ), -+ ReflectionBase::getTypes()); -+ pCollection = &collection; -+ } -+ } -+ return pCollection->getTypes(); -+} -+ -+Sequence< sal_Int8> Table::getImplementationId() throw( RuntimeException ) -+{ -+ return getStatics().refl.table.implementationId; -+} -+ -+Any Table::queryInterface( const Type & reqType ) throw (RuntimeException) -+{ -+ Any ret; -+ -+ ret = ReflectionBase::queryInterface( reqType ); -+ if( ! ret.hasValue() ) -+ ret = ::cppu::queryInterface( -+ reqType, -+ static_cast< com::sun::star::sdbcx::XIndexesSupplier * > ( this ), -+ static_cast< com::sun::star::sdbcx::XKeysSupplier * > ( this ), -+ static_cast< com::sun::star::sdbcx::XColumnsSupplier * > ( this ), -+ static_cast< com::sun::star::sdbcx::XRename * > ( this ), -+ static_cast< com::sun::star::sdbcx::XAlterTable * > ( this ) -+ ); -+ return ret; -+} -+ -+::com::sun::star::uno::Any Table::getPropertyValue(const ::rtl::OUString& aPropertyName) -+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException) -+{ -+ return ReflectionBase::getPropertyValue( aPropertyName ); -+} -+ -+ -+::rtl::OUString Table::getName( ) throw (::com::sun::star::uno::RuntimeException) -+{ -+ Statics & st = getStatics(); -+ return concatQualified( -+ extractStringProperty( this, st.SCHEMA_NAME ), -+ extractStringProperty( this, st.NAME ) ); -+} -+ -+void Table::setName( const ::rtl::OUString& aName ) throw (::com::sun::star::uno::RuntimeException) -+{ -+ rename( aName ); -+} -+ -+ -+ -+//________________________________________________________________________ -+TableDescriptor::TableDescriptor( -+ const ::rtl::Reference< RefCountedMutex > & refMutex, -+ const Reference< com::sun::star::sdbc::XConnection > & connection, -+ ConnectionSettings *pSettings) -+ : ReflectionBase( -+ getStatics().refl.tableDescriptor.implName, -+ getStatics().refl.tableDescriptor.serviceNames, -+ refMutex, -+ connection, -+ pSettings, -+ * getStatics().refl.tableDescriptor.pProps ) -+{ -+} -+ -+Reference< XNameAccess > TableDescriptor::getColumns( ) throw (::com::sun::star::uno::RuntimeException) -+{ -+ if( ! m_columns.is() ) -+ { -+ m_columns = new ColumnDescriptors(m_refMutex, m_conn, m_pSettings ); -+ } -+ return m_columns; -+} -+ -+Reference< XNameAccess > TableDescriptor::getIndexes() throw (::com::sun::star::uno::RuntimeException) -+{ -+ if( ! m_indexes.is() ) -+ { -+ m_indexes = ::pq_sdbc_driver::IndexDescriptors::create( -+ m_refMutex, -+ m_conn, -+ m_pSettings); -+ } -+ return m_indexes; -+} -+ -+Reference< XIndexAccess > TableDescriptor::getKeys( ) throw (::com::sun::star::uno::RuntimeException) -+{ -+ if( ! m_keys.is() ) -+ { -+ m_keys = ::pq_sdbc_driver::KeyDescriptors::create( -+ m_refMutex, -+ m_conn, -+ m_pSettings ); -+ } -+ return m_keys; -+} -+ -+ -+Sequence TableDescriptor::getTypes() throw( RuntimeException ) -+{ -+ static cppu::OTypeCollection *pCollection; -+ if( ! pCollection ) -+ { -+ MutexGuard guard( osl::Mutex::getGlobalMutex() ); -+ if( !pCollection ) -+ { -+ static cppu::OTypeCollection collection( -+ getCppuType( (Reference< com::sun::star::sdbcx::XIndexesSupplier> *) 0 ), -+ getCppuType( (Reference< com::sun::star::sdbcx::XKeysSupplier> *) 0 ), -+ getCppuType( (Reference< com::sun::star::sdbcx::XColumnsSupplier> *) 0 ), -+ ReflectionBase::getTypes()); -+ pCollection = &collection; -+ } -+ } -+ return pCollection->getTypes(); -+} -+ -+Sequence< sal_Int8> TableDescriptor::getImplementationId() throw( RuntimeException ) -+{ -+ return getStatics().refl.tableDescriptor.implementationId; -+} -+ -+Any TableDescriptor::queryInterface( const Type & reqType ) throw (RuntimeException) -+{ -+ Any ret; -+ -+ ret = ReflectionBase::queryInterface( reqType ); -+ if( ! ret.hasValue() ) -+ ret = ::cppu::queryInterface( -+ reqType, -+ static_cast< com::sun::star::sdbcx::XIndexesSupplier * > ( this ), -+ static_cast< com::sun::star::sdbcx::XKeysSupplier * > ( this ), -+ static_cast< com::sun::star::sdbcx::XColumnsSupplier * > ( this )); -+ return ret; -+} -+ -+ -+Reference< XPropertySet > TableDescriptor::createDataDescriptor( ) throw (RuntimeException) -+{ -+ TableDescriptor * pTable = new TableDescriptor( -+ m_refMutex, m_conn, m_pSettings ); -+ -+ // TODO: deep copies -+ pTable->m_values = m_values; -+ -+ return Reference< XPropertySet > ( pTable ); -+} -+ -+} -diff --git connectivity/source/drivers/postgresql/pq_xtable.hxx connectivity/source/drivers/postgresql/pq_xtable.hxx -new file mode 100644 -index 0000000..4a7e25c ---- /dev/null -+++ connectivity/source/drivers/postgresql/pq_xtable.hxx -@@ -0,0 +1,220 @@ -+/************************************************************************* -+ * -+ * $RCSfile: pq_xtable.hxx,v $ -+ * -+ * $Revision: 1.1.2.2 $ -+ * -+ * last change: $Author: jbu $ $Date: 2004/06/10 15:27:10 $ -+ * -+ * The Contents of this file are made available subject to the terms of -+ * either of the following licenses -+ * -+ * - GNU Lesser General Public License Version 2.1 -+ * - Sun Industry Standards Source License Version 1.1 -+ * -+ * Sun Microsystems Inc., October, 2000 -+ * -+ * GNU Lesser General Public License Version 2.1 -+ * ============================================= -+ * Copyright 2000 by Sun Microsystems, Inc. -+ * 901 San Antonio Road, Palo Alto, CA 94303, USA -+ * -+ * This library is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License version 2.1, as published by the Free Software Foundation. -+ * -+ * This library is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public -+ * License along with this library; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, -+ * MA 02111-1307 USA -+ * -+ * -+ * Sun Industry Standards Source License Version 1.1 -+ * ================================================= -+ * The contents of this file are subject to the Sun Industry Standards -+ * Source License Version 1.1 (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.openoffice.org/license.html. -+ * -+ * Software provided under this License is provided on an "AS IS" basis, -+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, -+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, -+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. -+ * See the License for the specific provisions governing your rights and -+ * obligations concerning the Software. -+ * -+ * The Initial Developer of the Original Code is: Joerg Budischewski -+ * -+ * Copyright: 2000 by Sun Microsystems, Inc. -+ * -+ * All Rights Reserved. -+ * -+ * Contributor(s): Joerg Budischewski -+ * -+ * -+ ************************************************************************/ -+ -+#ifndef _PQ_TABLE_HXX_ -+#define _PQ_TABLE_HXX_ -+ -+#include -+#include -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include "pq_xbase.hxx" -+ -+namespace pq_sdbc_driver -+{ -+ -+class Columns; -+ -+class Table : public ReflectionBase, -+ public com::sun::star::sdbcx::XColumnsSupplier, -+ public com::sun::star::sdbcx::XIndexesSupplier, -+ public com::sun::star::sdbcx::XKeysSupplier, -+ public com::sun::star::sdbcx::XRename, -+ public com::sun::star::sdbcx::XAlterTable -+{ -+ ::com::sun::star::uno::Reference< com::sun::star::sdbc::XDatabaseMetaData > m_meta; -+ ::com::sun::star::uno::Reference< com::sun::star::container::XNameAccess > m_columns; -+ ::com::sun::star::uno::Reference< com::sun::star::container::XIndexAccess > m_keys; -+ ::com::sun::star::uno::Reference< com::sun::star::container::XNameAccess > m_indexes; -+ Columns *m_pColumns; -+ -+public: -+ Table( const ::rtl::Reference< RefCountedMutex > & refMutex, -+ const ::com::sun::star::uno::Reference< com::sun::star::sdbc::XConnection > & connection, -+ ConnectionSettings *pSettings); -+public: -+ void refetch(); -+ -+public: // XInterface -+ virtual void SAL_CALL acquire() throw() { OComponentHelper::acquire(); } -+ virtual void SAL_CALL release() throw() { OComponentHelper::release(); } -+ virtual com::sun::star::uno::Any SAL_CALL queryInterface( -+ const com::sun::star::uno::Type & reqType ) -+ throw (com::sun::star::uno::RuntimeException); -+ -+public: // XTypeProvider, first implemented by OPropertySetHelper -+ virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL getTypes() -+ throw( com::sun::star::uno::RuntimeException ); -+ virtual com::sun::star::uno::Sequence< sal_Int8> SAL_CALL getImplementationId() -+ throw( com::sun::star::uno::RuntimeException ); -+ -+public: // XDataDescriptorFactory -+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL -+ createDataDescriptor( ) throw (::com::sun::star::uno::RuntimeException); -+ -+public: // XColumnsSupplier -+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL -+ getColumns( ) throw (::com::sun::star::uno::RuntimeException); -+ -+public: // XIndexesSupplier -+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL -+ getIndexes( ) throw (::com::sun::star::uno::RuntimeException); -+ -+public: // XKeysSupplier -+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > SAL_CALL -+ getKeys( ) throw (::com::sun::star::uno::RuntimeException); -+ -+public: // XRename -+ virtual void SAL_CALL rename( const ::rtl::OUString& newName ) -+ throw (::com::sun::star::sdbc::SQLException, -+ ::com::sun::star::container::ElementExistException, -+ ::com::sun::star::uno::RuntimeException); -+ -+public: // XAlterTable -+ // Methods -+ virtual void SAL_CALL alterColumnByName( -+ const ::rtl::OUString& colName, -+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ) -+ throw (::com::sun::star::sdbc::SQLException, -+ ::com::sun::star::container::NoSuchElementException, -+ ::com::sun::star::uno::RuntimeException); -+ -+ virtual void SAL_CALL alterColumnByIndex( -+ sal_Int32 index, -+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ) -+ throw (::com::sun::star::sdbc::SQLException, -+ ::com::sun::star::lang::IndexOutOfBoundsException, -+ ::com::sun::star::uno::RuntimeException); -+ -+public: // TODO: remove again -+ virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue(const ::rtl::OUString& aPropertyName) -+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); -+ -+public: // XNamed -+ virtual ::rtl::OUString SAL_CALL getName( ) throw (::com::sun::star::uno::RuntimeException); -+ virtual void SAL_CALL setName( const ::rtl::OUString& aName ) throw (::com::sun::star::uno::RuntimeException); -+}; -+ -+ -+ -+class TableDescriptor -+ : public ReflectionBase, -+ public com::sun::star::sdbcx::XColumnsSupplier, -+ public com::sun::star::sdbcx::XIndexesSupplier, -+ public com::sun::star::sdbcx::XKeysSupplier -+{ -+ ::com::sun::star::uno::Reference< com::sun::star::container::XNameAccess > m_columns; -+ ::com::sun::star::uno::Reference< com::sun::star::container::XIndexAccess > m_keys; -+ ::com::sun::star::uno::Reference< com::sun::star::container::XNameAccess > m_indexes; -+ -+public: -+ TableDescriptor( -+ const ::rtl::Reference< RefCountedMutex > & refMutex, -+ const ::com::sun::star::uno::Reference< com::sun::star::sdbc::XConnection > & connection, -+ ConnectionSettings *pSettings); -+ -+public: // XInterface -+ virtual void SAL_CALL acquire() throw() { OComponentHelper::acquire(); } -+ virtual void SAL_CALL release() throw() { OComponentHelper::release(); } -+ virtual com::sun::star::uno::Any SAL_CALL queryInterface( -+ const com::sun::star::uno::Type & reqType ) -+ throw (com::sun::star::uno::RuntimeException); -+ -+public: // XTypeProvider, first implemented by OPropertySetHelper -+ virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL getTypes() -+ throw( com::sun::star::uno::RuntimeException ); -+ virtual com::sun::star::uno::Sequence< sal_Int8> SAL_CALL getImplementationId() -+ throw( com::sun::star::uno::RuntimeException ); -+ -+public: // XColumnsSupplier -+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL -+ getColumns( ) throw (::com::sun::star::uno::RuntimeException); -+ -+public: // XIndexesSupplier -+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL -+ getIndexes( ) throw (::com::sun::star::uno::RuntimeException); -+ -+public: // XKeysSupplier -+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > SAL_CALL -+ getKeys( ) throw (::com::sun::star::uno::RuntimeException); -+ -+public: // XDataDescriptorFactory -+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL -+ createDataDescriptor( ) throw (::com::sun::star::uno::RuntimeException); -+}; -+ -+ -+void copyProperties( -+ ReflectionBase *target, -+ const com::sun::star::uno::Reference< com::sun::star::beans::XPropertySet > & source ); -+ -+} -+ -+ -+#endif -diff --git connectivity/source/drivers/postgresql/pq_xtables.cxx connectivity/source/drivers/postgresql/pq_xtables.cxx -new file mode 100644 -index 0000000..90a5786 ---- /dev/null -+++ connectivity/source/drivers/postgresql/pq_xtables.cxx -@@ -0,0 +1,464 @@ -+/************************************************************************* -+ * -+ * $RCSfile: pq_xtables.cxx,v $ -+ * -+ * $Revision: 1.1.2.4 $ -+ * -+ * last change: $Author: jbu $ $Date: 2006/05/01 19:19:08 $ -+ * -+ * The Contents of this file are made available subject to the terms of -+ * either of the following licenses -+ * -+ * - GNU Lesser General Public License Version 2.1 -+ * - Sun Industry Standards Source License Version 1.1 -+ * -+ * Sun Microsystems Inc., October, 2000 -+ * -+ * GNU Lesser General Public License Version 2.1 -+ * ============================================= -+ * Copyright 2000 by Sun Microsystems, Inc. -+ * 901 San Antonio Road, Palo Alto, CA 94303, USA -+ * -+ * This library is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License version 2.1, as published by the Free Software Foundation. -+ * -+ * This library is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public -+ * License along with this library; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, -+ * MA 02111-1307 USA -+ * -+ * -+ * Sun Industry Standards Source License Version 1.1 -+ * ================================================= -+ * The contents of this file are subject to the Sun Industry Standards -+ * Source License Version 1.1 (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.openoffice.org/license.html. -+ * -+ * Software provided under this License is provided on an "AS IS" basis, -+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, -+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, -+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. -+ * See the License for the specific provisions governing your rights and -+ * obligations concerning the Software. -+ * -+ * The Initial Developer of the Original Code is: Joerg Budischewski -+ * -+ * Copyright: 2000 by Sun Microsystems, Inc. -+ * -+ * All Rights Reserved. -+ * -+ * Contributor(s): Joerg Budischewski -+ * -+ * -+ ************************************************************************/ -+ -+#include -+ -+#include -+ -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include "pq_xtables.hxx" -+#include "pq_xviews.hxx" -+#include "pq_xtable.hxx" -+#include "pq_statics.hxx" -+#include "pq_tools.hxx" -+ -+using osl::MutexGuard; -+ -+using rtl::OUString; -+using rtl::OUStringBuffer; -+using rtl::OUStringToOString; -+ -+using com::sun::star::beans::XPropertySet; -+ -+using com::sun::star::uno::Any; -+using com::sun::star::uno::makeAny; -+using com::sun::star::uno::UNO_QUERY; -+using com::sun::star::uno::Type; -+using com::sun::star::uno::XInterface; -+using com::sun::star::uno::Reference; -+using com::sun::star::uno::Sequence; -+using com::sun::star::uno::RuntimeException; -+ -+using com::sun::star::container::NoSuchElementException; -+using com::sun::star::container::XEnumerationAccess; -+using com::sun::star::container::XEnumeration; -+using com::sun::star::lang::WrappedTargetException; -+ -+using com::sun::star::sdbc::XRow; -+// using com::sun::star::sdbc::DataType; -+using com::sun::star::sdbc::XCloseable; -+using com::sun::star::sdbc::XStatement; -+using com::sun::star::sdbc::XResultSet; -+using com::sun::star::sdbc::XParameters; -+using com::sun::star::sdbc::XPreparedStatement; -+using com::sun::star::sdbc::XDatabaseMetaData; -+using com::sun::star::sdbcx::XColumnsSupplier; -+using com::sun::star::sdbcx::XKeysSupplier; -+using com::sun::star::sdbcx::XViewsSupplier; -+// using com::sun::star::sdbcx::Privilege; -+ -+namespace pq_sdbc_driver -+{ -+#define ASCII_STR(x) OUString( RTL_CONSTASCII_USTRINGPARAM( x ) ) -+Tables::Tables( -+ const ::rtl::Reference< RefCountedMutex > & refMutex, -+ const ::com::sun::star::uno::Reference< com::sun::star::sdbc::XConnection > & origin, -+ ConnectionSettings *pSettings ) -+ : Container( refMutex, origin, pSettings, getStatics().TABLE ) -+{} -+ -+Tables::~Tables() -+{} -+ -+void Tables::refresh() -+ throw (::com::sun::star::uno::RuntimeException) -+{ -+ try -+ { -+ osl::MutexGuard guard( m_refMutex->mutex ); -+ Statics & st = getStatics(); -+ -+ Reference< XDatabaseMetaData > meta = m_origin->getMetaData(); -+ -+ Reference< XResultSet > rs = -+ meta->getTables( Any(), st.cPERCENT,st.cPERCENT, Sequence< OUString > () ); -+ -+ Reference< XRow > xRow( rs , UNO_QUERY ); -+ -+ String2IntMap map; -+ -+ std::vector< Any, Allocator< Any> > vec; -+ sal_Int32 tableIndex = 0; -+ while( rs->next() ) -+ { -+ // if creating all these tables turns out to have too bad performance, we might -+ // instead offer a factory interface -+ Table * pTable = -+ new Table( m_refMutex, m_origin, m_pSettings ); -+ Reference< com::sun::star::beans::XPropertySet > prop = pTable; -+ -+ OUString name = xRow->getString( TABLE_INDEX_NAME+1); -+ OUString schema = xRow->getString( TABLE_INDEX_SCHEMA+1); -+ pTable->setPropertyValue_NoBroadcast_public( -+ st.CATALOG_NAME , makeAny(xRow->getString( TABLE_INDEX_CATALOG+1) ) ); -+ pTable->setPropertyValue_NoBroadcast_public( st.NAME , makeAny( name ) ); -+ pTable->setPropertyValue_NoBroadcast_public( st.SCHEMA_NAME , makeAny( schema )); -+ pTable->setPropertyValue_NoBroadcast_public( -+ st.TYPE , makeAny( xRow->getString( TABLE_INDEX_TYPE+1) ) ); -+ pTable->setPropertyValue_NoBroadcast_public( -+ st.DESCRIPTION , makeAny( xRow->getString( TABLE_INDEX_REMARKS+1) ) ); -+ pTable->setPropertyValue_NoBroadcast_public( -+ st.PRIVILEGES , -+ makeAny( (sal_Int32) -+ ( com::sun::star::sdbcx::Privilege::SELECT | -+ com::sun::star::sdbcx::Privilege::INSERT | -+ com::sun::star::sdbcx::Privilege::UPDATE | -+ com::sun::star::sdbcx::Privilege::DELETE | -+ com::sun::star::sdbcx::Privilege::READ | -+ com::sun::star::sdbcx::Privilege::CREATE | -+ com::sun::star::sdbcx::Privilege::ALTER | -+ com::sun::star::sdbcx::Privilege::REFERENCE | -+ com::sun::star::sdbcx::Privilege::DROP ) ) ); -+ -+ vec.push_back( makeAny( prop ) ); -+ OUStringBuffer buf( name.getLength() + schema.getLength() + 1); -+ buf.append( schema ).appendAscii( "." ).append( name ); -+ map[ buf.makeStringAndClear() ] = tableIndex; -+ tableIndex ++; -+ } -+ m_values = Sequence< com::sun::star::uno::Any > ( & vec[0] , vec.size() ); -+ m_name2index.swap( map ); -+ } -+ catch ( com::sun::star::sdbc::SQLException & e ) -+ { -+ throw RuntimeException( e.Message , e.Context ); -+ } -+ -+ fire( RefreshedBroadcaster( *this ) ); -+} -+ -+ -+static void appendColumnList( -+ OUStringBuffer &buf, const Reference< XColumnsSupplier > & columnSupplier, sal_Int32 encoding ) -+{ -+ if( columnSupplier.is() ) -+ { -+ Reference< XEnumerationAccess > columns( columnSupplier->getColumns(),UNO_QUERY ); -+ if( columns.is() ) -+ { -+ Reference< XEnumeration > xEnum( columns->createEnumeration() ); -+ bool first = true; -+ Statics & st = getStatics(); -+ -+ while( xEnum.is() && xEnum->hasMoreElements() ) -+ { -+ if( first ) -+ { -+ first = false; -+ } -+ else -+ { -+ buf.appendAscii( RTL_CONSTASCII_STRINGPARAM( ", " ) ); -+ } -+ Reference< XPropertySet > column( xEnum->nextElement(), UNO_QUERY ); -+ OUString name = extractStringProperty( column, st.NAME ); -+ OUString defaultValue = extractStringProperty( column, st.DEFAULT_VALUE ); -+ sal_Bool isNullable = extractBoolProperty( column, st.IS_NULLABLE ); -+ sal_Bool isAutoIncrement = extractBoolProperty( column, st.IS_AUTO_INCREMENT ); -+ -+ bufferQuoteIdentifier( buf, name ); -+ -+ OUString type = sqltype2string( column ); -+ if( isAutoIncrement ) -+ { -+ sal_Int32 dataType; -+ column->getPropertyValue( st.TYPE ) >>= dataType; -+ if( com::sun::star::sdbc::DataType::INTEGER == dataType ) -+ { -+ buf.appendAscii( " serial "); -+ isNullable = sal_False; -+ } -+ else if( com::sun::star::sdbc::DataType::BIGINT == dataType ) -+ { -+ buf.appendAscii( " serial8 " ); -+ isNullable = sal_False; -+ } -+ else -+ buf.append( type ); -+ } -+ else -+ { -+ buf.append( type ); -+ } -+ if( defaultValue.getLength() ) -+ { -+ bufferQuoteConstant( buf, defaultValue, encoding ); -+ } -+ -+ if( ! isNullable ) -+// buf.appendAscii( RTL_CONSTASCII_STRINGPARAM( " NULL " ) ); -+// else -+ buf.appendAscii( RTL_CONSTASCII_STRINGPARAM( " NOT NULL " ) ); -+ -+ } -+ } -+ } -+} -+ -+static void appendKeyList( -+ OUStringBuffer & buf, const Reference< XKeysSupplier > &keySupplier ) -+{ -+ if( keySupplier.is() ) -+ { -+ Reference< XEnumerationAccess > keys( keySupplier->getKeys(), UNO_QUERY ); -+ if(keys.is() ) -+ { -+ Statics &st = getStatics(); -+ Reference< XEnumeration > xEnum = keys->createEnumeration(); -+ while( xEnum.is() && xEnum->hasMoreElements() ) -+ { -+ buf.appendAscii( RTL_CONSTASCII_STRINGPARAM( ", " ) ); -+ Reference< XPropertySet > key( xEnum->nextElement(), UNO_QUERY ); -+ bufferKey2TableConstraint( buf, key ); -+ } -+ } -+ } -+} -+ -+void Tables::appendByDescriptor( -+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ) -+ throw (::com::sun::star::sdbc::SQLException, -+ ::com::sun::star::container::ElementExistException, -+ ::com::sun::star::uno::RuntimeException) -+{ -+ osl::MutexGuard guard( m_refMutex->mutex ); -+ Reference< XStatement > stmt = -+ m_origin->createStatement(); -+ -+ Statics &st = getStatics(); -+ OUString name,schema; -+ descriptor->getPropertyValue( st.SCHEMA_NAME ) >>= schema; -+ descriptor->getPropertyValue( st.NAME ) >>= name; -+ -+ TransactionGuard transaction( stmt ); -+ -+ OUStringBuffer buf( 128 ); -+ buf.appendAscii( RTL_CONSTASCII_STRINGPARAM("CREATE TABLE" ) ); -+ bufferQuoteQualifiedIdentifier( buf, schema, name ); -+ buf.appendAscii( RTL_CONSTASCII_STRINGPARAM( "(" ) ); -+ -+ // columns -+ Reference< XColumnsSupplier > supplier( descriptor, UNO_QUERY ); -+ appendColumnList( buf, supplier, m_pSettings->encoding ); -+ -+ appendKeyList( buf, Reference< XKeysSupplier >( descriptor, UNO_QUERY ) ); -+ -+ buf.appendAscii( RTL_CONSTASCII_STRINGPARAM( ") " ) ); -+ // execute the creation ! -+ transaction.executeUpdate( buf.makeStringAndClear() ); -+ -+ // description .... -+ OUString description = extractStringProperty( descriptor, st.DESCRIPTION ); -+ if( description.getLength() ) -+ { -+ buf = OUStringBuffer( 128 ); -+ buf.appendAscii( RTL_CONSTASCII_STRINGPARAM( "COMMENT ON TABLE" ) ); -+ bufferQuoteQualifiedIdentifier( buf, schema, name ); -+ buf.appendAscii( RTL_CONSTASCII_STRINGPARAM( "IS " ) ); -+ bufferQuoteConstant( buf, description, m_pSettings->encoding ); -+ -+ transaction.executeUpdate( buf.makeStringAndClear() ); -+ } -+ -+ // column descriptions -+ if( supplier.is() ) -+ { -+ Reference< XEnumerationAccess > columns( supplier->getColumns(),UNO_QUERY ); -+ if( columns.is() ) -+ { -+ Reference< XEnumeration > xEnum( columns->createEnumeration() ); -+ while( xEnum.is() && xEnum->hasMoreElements() ) -+ { -+ Reference< XPropertySet > column( xEnum->nextElement(), UNO_QUERY ); -+ // help text seems to be used by OOo rather than Description -+// OUString description = extractStringProperty( column, st.HELP_TEXT ); -+ OUString helpText = extractStringProperty( column,st.DESCRIPTION ); -+ if( description.getLength() ) -+ { -+ buf = OUStringBuffer( 128 ); -+ buf.appendAscii( RTL_CONSTASCII_STRINGPARAM( "COMMENT ON COLUMN " ) ); -+ bufferQuoteQualifiedIdentifier( -+ buf, schema, name, extractStringProperty( column, st.NAME ) ); -+ buf.appendAscii( RTL_CONSTASCII_STRINGPARAM( "IS " ) ); -+ bufferQuoteConstant( -+ buf, description,m_pSettings->encoding ); -+ transaction.executeUpdate( buf.makeStringAndClear() ); -+ } -+ } -+ } -+ } -+ -+ transaction.commit(); -+ -+ disposeNoThrow( stmt ); -+ // TODO: cheaper recalculate -+// Container::append( concatQualified( schema, name ), descriptor ); // maintain the lists -+ refresh(); -+ -+ // increase the vector -+// sal_Int32 index = m_values.getLength(); -+// m_values.realloc( index + 1 ); -+ -+// Table * pTable = -+// new Table( m_refMutex, m_origin, m_pSettings, false /*modifiable*/ ); -+// Reference< com::sun::star::beans::XPropertySet > prop = pTable; -+// copyProperties( pTable, descriptor ); -+// m_values[index] = makeAny( prop ); -+// OUStringBuffer buf( name.getLength() + 1 + schema.getLength() ); -+// buf.append( schema ).appendAscii( "." ).append( name ); -+// m_name2index[ buf.makeStringAndClear() ] = index; -+} -+ -+// void Tables::dropByName( const ::rtl::OUString& elementName ) -+// throw (::com::sun::star::sdbc::SQLException, -+// ::com::sun::star::container::NoSuchElementException, -+// ::com::sun::star::uno::RuntimeException) -+// { -+// String2IntMap::const_iterator ii = m_name2index.find( elementName ); -+// if( ii == m_name2index.end() ) -+// { -+// OUStringBuffer buf( 128 ); -+// buf.appendAscii( "Table " ); -+// buf.append( elementName ); -+// buf.appendAscii( " is unknown, so it can't be dropped" ); -+// throw com::sun::star::container::NoSuchElementException( -+// buf.makeStringAndClear(), *this ); -+// } -+// dropByIndex( ii->second ); -+// } -+ -+void Tables::dropByIndex( sal_Int32 index ) -+ throw (::com::sun::star::sdbc::SQLException, -+ ::com::sun::star::lang::IndexOutOfBoundsException, -+ ::com::sun::star::uno::RuntimeException) -+{ -+ osl::MutexGuard guard( m_refMutex->mutex ); -+ if( index < 0 || index >= m_values.getLength() ) -+ { -+ OUStringBuffer buf( 128 ); -+ buf.appendAscii( "TABLES: Index out of range (allowed 0 to " ); -+ buf.append( (sal_Int32) (m_values.getLength() -1) ); -+ buf.appendAscii( ", got " ); -+ buf.append( index ); -+ buf.appendAscii( ")" ); -+ throw com::sun::star::lang::IndexOutOfBoundsException( -+ buf.makeStringAndClear(), *this ); -+ } -+ -+ Reference< XPropertySet > set; -+ m_values[index] >>= set; -+ Statics &st = getStatics(); -+ OUString name,schema; -+ set->getPropertyValue( st.SCHEMA_NAME ) >>= schema; -+ set->getPropertyValue( st.NAME ) >>= name; -+ if( extractStringProperty( set, st.TYPE ).equals( st.VIEW ) && m_pSettings->views.is() ) -+ { -+ m_pSettings->pViewsImpl->dropByName( concatQualified( schema, name ) ); -+ } -+ else -+ { -+ OUStringBuffer update( 128 ); -+ update.appendAscii( RTL_CONSTASCII_STRINGPARAM( "DROP " ) ); -+ if( extractStringProperty( set, st.TYPE ).equals( st.VIEW ) ) -+ update.appendAscii( RTL_CONSTASCII_STRINGPARAM( "VIEW " ) ); -+ else -+ update.appendAscii( RTL_CONSTASCII_STRINGPARAM( "TABLE " ) ); -+ bufferQuoteQualifiedIdentifier( update, schema, name ); -+ Reference< XStatement > stmt = m_origin->createStatement( ); -+ DisposeGuard dispGuard( stmt ); -+ stmt->executeUpdate( update.makeStringAndClear() ); -+ } -+ -+ Container::dropByIndex( index ); -+} -+ -+ -+::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > Tables::createDataDescriptor() -+ throw (::com::sun::star::uno::RuntimeException) -+{ -+ return new TableDescriptor( m_refMutex, m_origin, m_pSettings ); -+} -+ -+Reference< com::sun::star::container::XNameAccess > Tables::create( -+ const ::rtl::Reference< RefCountedMutex > & refMutex, -+ const ::com::sun::star::uno::Reference< com::sun::star::sdbc::XConnection > & origin, -+ ConnectionSettings *pSettings, -+ Tables **ppTables) -+{ -+ *ppTables = new Tables( refMutex, origin, pSettings ); -+ Reference< com::sun::star::container::XNameAccess > ret = *ppTables; -+ (*ppTables)->refresh(); -+ -+ return ret; -+} -+ -+void Tables::disposing() -+{ -+ Container::disposing(); -+} -+ -+}; -diff --git connectivity/source/drivers/postgresql/pq_xtables.hxx connectivity/source/drivers/postgresql/pq_xtables.hxx -new file mode 100644 -index 0000000..c14fe77 ---- /dev/null -+++ connectivity/source/drivers/postgresql/pq_xtables.hxx -@@ -0,0 +1,118 @@ -+/************************************************************************* -+ * -+ * $RCSfile: pq_xtables.hxx,v $ -+ * -+ * $Revision: 1.1.2.2 $ -+ * -+ * last change: $Author: jbu $ $Date: 2004/06/10 15:27:11 $ -+ * -+ * The Contents of this file are made available subject to the terms of -+ * either of the following licenses -+ * -+ * - GNU Lesser General Public License Version 2.1 -+ * - Sun Industry Standards Source License Version 1.1 -+ * -+ * Sun Microsystems Inc., October, 2000 -+ * -+ * GNU Lesser General Public License Version 2.1 -+ * ============================================= -+ * Copyright 2000 by Sun Microsystems, Inc. -+ * 901 San Antonio Road, Palo Alto, CA 94303, USA -+ * -+ * This library is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License version 2.1, as published by the Free Software Foundation. -+ * -+ * This library is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public -+ * License along with this library; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, -+ * MA 02111-1307 USA -+ * -+ * -+ * Sun Industry Standards Source License Version 1.1 -+ * ================================================= -+ * The contents of this file are subject to the Sun Industry Standards -+ * Source License Version 1.1 (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.openoffice.org/license.html. -+ * -+ * Software provided under this License is provided on an "AS IS" basis, -+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, -+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, -+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. -+ * See the License for the specific provisions governing your rights and -+ * obligations concerning the Software. -+ * -+ * The Initial Developer of the Original Code is: Joerg Budischewski -+ * -+ * Copyright: 2000 by Sun Microsystems, Inc. -+ * -+ * All Rights Reserved. -+ * -+ * Contributor(s): Joerg Budischewski -+ * -+ * -+ ************************************************************************/ -+ -+#ifndef _PQ_TABLES_HXX_ -+#define _PQ_TABLES_HXX_ -+ -+#include "pq_xcontainer.hxx" -+ -+namespace pq_sdbc_driver -+{ -+ -+class Tables : public Container -+{ -+ -+public: // instances Tables 'exception safe' -+ static com::sun::star::uno::Reference< com::sun::star::container::XNameAccess > create( -+ const ::rtl::Reference< RefCountedMutex > & refMutex, -+ const ::com::sun::star::uno::Reference< com::sun::star::sdbc::XConnection > & origin, -+ ConnectionSettings *pSettings, -+ Tables ** ppTables); -+ -+protected: -+ Tables( -+ const ::rtl::Reference< RefCountedMutex > & refMutex, -+ const ::com::sun::star::uno::Reference< com::sun::star::sdbc::XConnection > & origin, -+ ConnectionSettings *pSettings ); -+ -+ virtual ~Tables(); -+ -+public: // XAppend -+ virtual void SAL_CALL appendByDescriptor( -+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ) -+ throw (::com::sun::star::sdbc::SQLException, -+ ::com::sun::star::container::ElementExistException, -+ ::com::sun::star::uno::RuntimeException); -+ -+public: // XDrop -+// virtual void SAL_CALL dropByName( const ::rtl::OUString& elementName ) -+// throw (::com::sun::star::sdbc::SQLException, -+// ::com::sun::star::container::NoSuchElementException, -+// ::com::sun::star::uno::RuntimeException); -+ virtual void SAL_CALL dropByIndex( sal_Int32 index ) -+ throw (::com::sun::star::sdbc::SQLException, -+ ::com::sun::star::lang::IndexOutOfBoundsException, -+ ::com::sun::star::uno::RuntimeException); -+ -+public: // XRefreshable -+ virtual void SAL_CALL refresh( ) throw (::com::sun::star::uno::RuntimeException); -+ -+public: // XDataDescriptorFactory -+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL createDataDescriptor( ) -+ throw (::com::sun::star::uno::RuntimeException); -+ -+protected: -+ virtual void SAL_CALL disposing(); -+ -+}; -+ -+} -+#endif -diff --git connectivity/source/drivers/postgresql/pq_xuser.cxx connectivity/source/drivers/postgresql/pq_xuser.cxx -new file mode 100644 -index 0000000..0fe46f6 ---- /dev/null -+++ connectivity/source/drivers/postgresql/pq_xuser.cxx -@@ -0,0 +1,257 @@ -+/************************************************************************* -+ * -+ * $RCSfile: pq_xuser.cxx,v $ -+ * -+ * $Revision: 1.1.2.3 $ -+ * -+ * last change: $Author: jbu $ $Date: 2006/01/22 15:14:40 $ -+ * -+ * The Contents of this file are made available subject to the terms of -+ * either of the following licenses -+ * -+ * - GNU Lesser General Public License Version 2.1 -+ * - Sun Industry Standards Source License Version 1.1 -+ * -+ * Sun Microsystems Inc., October, 2000 -+ * -+ * GNU Lesser General Public License Version 2.1 -+ * ============================================= -+ * Copyright 2000 by Sun Microsystems, Inc. -+ * 901 San Antonio Road, Palo Alto, CA 94303, USA -+ * -+ * This library is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License version 2.1, as published by the Free Software Foundation. -+ * -+ * This library is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public -+ * License along with this library; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, -+ * MA 02111-1307 USA -+ * -+ * -+ * Sun Industry Standards Source License Version 1.1 -+ * ================================================= -+ * The contents of this file are subject to the Sun Industry Standards -+ * Source License Version 1.1 (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.openoffice.org/license.html. -+ * -+ * Software provided under this License is provided on an "AS IS" basis, -+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, -+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, -+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. -+ * See the License for the specific provisions governing your rights and -+ * obligations concerning the Software. -+ * -+ * The Initial Developer of the Original Code is: Joerg Budischewski -+ * -+ * Copyright: 2000 by Sun Microsystems, Inc. -+ * -+ * All Rights Reserved. -+ * -+ * Contributor(s): Joerg Budischewski -+ * -+ * -+ ************************************************************************/ -+ -+#include -+ -+#include -+#include -+ -+#include -+ -+#include -+#include -+ -+#include "pq_xuser.hxx" -+#include "pq_tools.hxx" -+#include "pq_statics.hxx" -+ -+using osl::MutexGuard; -+using osl::Mutex; -+ -+using rtl::OUString; -+using rtl::OUStringBuffer; -+ -+using com::sun::star::container::XNameAccess; -+using com::sun::star::container::XIndexAccess; -+using com::sun::star::container::ElementExistException; -+using com::sun::star::container::NoSuchElementException; -+ -+using com::sun::star::uno::Reference; -+using com::sun::star::uno::Exception; -+using com::sun::star::uno::UNO_QUERY; -+using com::sun::star::uno::XInterface; -+using com::sun::star::uno::Sequence; -+using com::sun::star::uno::Any; -+using com::sun::star::uno::makeAny; -+using com::sun::star::uno::Type; -+using com::sun::star::uno::RuntimeException; -+ -+using com::sun::star::lang::IllegalArgumentException; -+using com::sun::star::lang::IndexOutOfBoundsException; -+ -+using com::sun::star::beans::XPropertySetInfo; -+using com::sun::star::beans::XFastPropertySet; -+using com::sun::star::beans::XMultiPropertySet; -+using com::sun::star::beans::XPropertySet; -+using com::sun::star::beans::Property; -+ -+using com::sun::star::sdbc::XResultSet; -+using com::sun::star::sdbc::XPreparedStatement; -+using com::sun::star::sdbc::XStatement; -+using com::sun::star::sdbc::XParameters; -+using com::sun::star::sdbc::XRow; -+using com::sun::star::sdbc::SQLException; -+ -+namespace pq_sdbc_driver -+{ -+ -+#define ASCII_STR(x) OUString( RTL_CONSTASCII_USTRINGPARAM( x ) ) -+ -+User::User( const ::rtl::Reference< RefCountedMutex > & refMutex, -+ const Reference< com::sun::star::sdbc::XConnection > & connection, -+ ConnectionSettings *pSettings ) -+ : ReflectionBase( -+ getStatics().refl.user.implName, -+ getStatics().refl.user.serviceNames, -+ refMutex, -+ connection, -+ pSettings, -+ * getStatics().refl.user.pProps ) -+{} -+ -+Reference< XPropertySet > User::createDataDescriptor( ) throw (RuntimeException) -+{ -+ UserDescriptor * pUser = new UserDescriptor( m_refMutex, m_conn, m_pSettings ); -+ pUser->copyValuesFrom( this ); -+ -+ return Reference< XPropertySet > ( pUser ); -+} -+ -+ -+Sequence User::getTypes() throw( RuntimeException ) -+{ -+ static cppu::OTypeCollection *pCollection; -+ if( ! pCollection ) -+ { -+ MutexGuard guard( osl::Mutex::getGlobalMutex() ); -+ if( !pCollection ) -+ { -+ static cppu::OTypeCollection collection( -+ getCppuType( (Reference< com::sun::star::sdbcx::XUser> *) 0 ), -+ ReflectionBase::getTypes()); -+ pCollection = &collection; -+ } -+ } -+ return pCollection->getTypes(); -+} -+ -+Sequence< sal_Int8> User::getImplementationId() throw( RuntimeException ) -+{ -+ return getStatics().refl.user.implementationId; -+} -+ -+Any User::queryInterface( const Type & reqType ) throw (RuntimeException) -+{ -+ Any ret; -+ -+ ret = ReflectionBase::queryInterface( reqType ); -+ if( ! ret.hasValue() ) -+ ret = ::cppu::queryInterface( -+ reqType, -+ static_cast< com::sun::star::sdbcx::XUser * > ( this ) ); -+ return ret; -+} -+ -+ -+void User::changePassword( -+ const ::rtl::OUString& oldPassword, const ::rtl::OUString& newPassword ) -+ throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) -+{ -+ rtl::OUStringBuffer buf(128); -+ buf.appendAscii( RTL_CONSTASCII_STRINGPARAM( "ALTER USER " ) ); -+ bufferQuoteIdentifier( buf, extractStringProperty( this, getStatics().NAME ) ); -+ buf.appendAscii( RTL_CONSTASCII_STRINGPARAM( " PASSWORD " ) ); -+ bufferQuoteConstant( buf, newPassword, m_pSettings->encoding ); -+ Reference< XStatement > stmt = m_conn->createStatement(); -+ DisposeGuard guard( stmt ); -+ stmt->executeUpdate( buf.makeStringAndClear() ); -+} -+ -+sal_Int32 User::getPrivileges( const ::rtl::OUString& objName, sal_Int32 objType ) -+ throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) -+{ -+ sal_Int32 ret = 0xffffffff; -+ if( isLog( m_pSettings, LogLevel::INFO ) ) -+ { -+ Statics & st = getStatics(); -+ rtl::OUString user = extractStringProperty( this, st.NAME ); -+ -+ rtl::OUStringBuffer buf( 128 ); -+ buf.appendAscii( RTL_CONSTASCII_STRINGPARAM("User::getPrivileges[") ); -+ buf.append( extractStringProperty( this, st.NAME ) ); -+ buf.appendAscii( RTL_CONSTASCII_STRINGPARAM( "] got called for " ) ); -+ buf.append( objName ); -+ buf.appendAscii( RTL_CONSTASCII_STRINGPARAM( "(type=" ) ); -+ buf.append( objType ); -+ buf.appendAscii( RTL_CONSTASCII_STRINGPARAM( ")" ) ); -+ log( m_pSettings, LogLevel::INFO, buf.makeStringAndClear() ); -+ } -+ // all privileges -+ return ret; -+} -+ -+sal_Int32 User::getGrantablePrivileges( const ::rtl::OUString& objName, sal_Int32 objType ) -+ throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) -+{ -+ // all privileges -+ return 0xffffffff; -+} -+ -+void User::grantPrivileges( const ::rtl::OUString& objName, sal_Int32 objType, sal_Int32 objPrivileges ) -+ throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) -+{ -+ throw com::sun::star::sdbc::SQLException( -+ ASCII_STR( "pq_driver: privilege change not implemented yet" ), -+ *this, OUString(), 1, Any() ); -+} -+ -+void User::revokePrivileges( const ::rtl::OUString& objName, sal_Int32 objType, sal_Int32 objPrivileges ) -+ throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) -+{ -+ throw com::sun::star::sdbc::SQLException( -+ ASCII_STR( "pq_driver: privilege change not implemented yet" ), -+ *this, OUString(), 1, Any() ); -+} -+ -+//______________________________________________________________________________________ -+UserDescriptor::UserDescriptor( -+ const ::rtl::Reference< RefCountedMutex > & refMutex, -+ const Reference< com::sun::star::sdbc::XConnection > & connection, -+ ConnectionSettings *pSettings ) -+ : ReflectionBase( -+ getStatics().refl.userDescriptor.implName, -+ getStatics().refl.userDescriptor.serviceNames, -+ refMutex, -+ connection, -+ pSettings, -+ * getStatics().refl.userDescriptor.pProps ) -+{} -+ -+Reference< XPropertySet > UserDescriptor::createDataDescriptor( ) throw (RuntimeException) -+{ -+ UserDescriptor * pUser = new UserDescriptor( m_refMutex, m_conn, m_pSettings ); -+ pUser->copyValuesFrom( this ); -+ -+ return Reference< XPropertySet > ( pUser ); -+} -+ -+ -+} -diff --git connectivity/source/drivers/postgresql/pq_xuser.hxx connectivity/source/drivers/postgresql/pq_xuser.hxx -new file mode 100644 -index 0000000..fc33174 ---- /dev/null -+++ connectivity/source/drivers/postgresql/pq_xuser.hxx -@@ -0,0 +1,132 @@ -+/************************************************************************* -+ * -+ * $RCSfile: pq_xuser.hxx,v $ -+ * -+ * $Revision: 1.1.2.2 $ -+ * -+ * last change: $Author: jbu $ $Date: 2004/06/10 15:27:12 $ -+ * -+ * The Contents of this file are made available subject to the terms of -+ * either of the following licenses -+ * -+ * - GNU Lesser General Public License Version 2.1 -+ * - Sun Industry Standards Source License Version 1.1 -+ * -+ * Sun Microsystems Inc., October, 2000 -+ * -+ * GNU Lesser General Public License Version 2.1 -+ * ============================================= -+ * Copyright 2000 by Sun Microsystems, Inc. -+ * 901 San Antonio Road, Palo Alto, CA 94303, USA -+ * -+ * This library is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License version 2.1, as published by the Free Software Foundation. -+ * -+ * This library is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public -+ * License along with this library; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, -+ * MA 02111-1307 USA -+ * -+ * -+ * Sun Industry Standards Source License Version 1.1 -+ * ================================================= -+ * The contents of this file are subject to the Sun Industry Standards -+ * Source License Version 1.1 (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.openoffice.org/license.html. -+ * -+ * Software provided under this License is provided on an "AS IS" basis, -+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, -+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, -+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. -+ * See the License for the specific provisions governing your rights and -+ * obligations concerning the Software. -+ * -+ * The Initial Developer of the Original Code is: Joerg Budischewski -+ * -+ * Copyright: 2000 by Sun Microsystems, Inc. -+ * -+ * All Rights Reserved. -+ * -+ * Contributor(s): Joerg Budischewski -+ * -+ * -+ ************************************************************************/ -+ -+#ifndef HEADER_PQ_USER_HXX_ -+#define HEADER_PQ_USER_HXX_ -+ -+#include -+#include -+ -+#include -+#include -+#include -+ -+#include "pq_xbase.hxx" -+ -+namespace pq_sdbc_driver -+{ -+ -+class User : public ReflectionBase, -+ public com::sun::star::sdbcx::XUser -+{ -+ -+public: -+ User( const ::rtl::Reference< RefCountedMutex > & refMutex, -+ const ::com::sun::star::uno::Reference< com::sun::star::sdbc::XConnection > & connection, -+ ConnectionSettings *pSettings); -+public: -+ void refetch(); -+ -+public: // XInterface -+ virtual void SAL_CALL acquire() throw() { OComponentHelper::acquire(); } -+ virtual void SAL_CALL release() throw() { OComponentHelper::release(); } -+ virtual com::sun::star::uno::Any SAL_CALL queryInterface( -+ const com::sun::star::uno::Type & reqType ) -+ throw (com::sun::star::uno::RuntimeException); -+ -+public: // XTypeProvider, first implemented by OPropertySetHelper -+ virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL getTypes() -+ throw( com::sun::star::uno::RuntimeException ); -+ virtual com::sun::star::uno::Sequence< sal_Int8> SAL_CALL getImplementationId() -+ throw( com::sun::star::uno::RuntimeException ); -+ -+public: // XDataDescriptorFactory -+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL -+ createDataDescriptor( ) throw (::com::sun::star::uno::RuntimeException); -+ -+public: // XUser : XAuthorizable -+ // Methods -+ virtual sal_Int32 SAL_CALL getPrivileges( const ::rtl::OUString& objName, sal_Int32 objType ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual sal_Int32 SAL_CALL getGrantablePrivileges( const ::rtl::OUString& objName, sal_Int32 objType ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual void SAL_CALL grantPrivileges( const ::rtl::OUString& objName, sal_Int32 objType, sal_Int32 objPrivileges ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual void SAL_CALL revokePrivileges( const ::rtl::OUString& objName, sal_Int32 objType, sal_Int32 objPrivileges ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ virtual void SAL_CALL changePassword( const ::rtl::OUString& oldPassword, const ::rtl::OUString& newPassword ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); -+ -+ -+}; -+ -+class UserDescriptor : public ReflectionBase -+{ -+public: -+ UserDescriptor( -+ const ::rtl::Reference< RefCountedMutex > & refMutex, -+ const ::com::sun::star::uno::Reference< com::sun::star::sdbc::XConnection > & connection, -+ ConnectionSettings *pSettings); -+ -+public: // XDataDescriptorFactory -+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL -+ createDataDescriptor( ) throw (::com::sun::star::uno::RuntimeException); -+}; -+ -+} -+ -+ -+#endif -diff --git connectivity/source/drivers/postgresql/pq_xusers.cxx connectivity/source/drivers/postgresql/pq_xusers.cxx -new file mode 100644 -index 0000000..85da3e7 ---- /dev/null -+++ connectivity/source/drivers/postgresql/pq_xusers.cxx -@@ -0,0 +1,256 @@ -+/************************************************************************* -+ * -+ * $RCSfile: pq_xusers.cxx,v $ -+ * -+ * $Revision: 1.1.2.4 $ -+ * -+ * last change: $Author: jbu $ $Date: 2006/01/22 15:14:41 $ -+ * -+ * The Contents of this file are made available subject to the terms of -+ * either of the following licenses -+ * -+ * - GNU Lesser General Public License Version 2.1 -+ * - Sun Industry Standards Source License Version 1.1 -+ * -+ * Sun Microsystems Inc., October, 2000 -+ * -+ * GNU Lesser General Public License Version 2.1 -+ * ============================================= -+ * Copyright 2000 by Sun Microsystems, Inc. -+ * 901 San Antonio Road, Palo Alto, CA 94303, USA -+ * -+ * This library is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License version 2.1, as published by the Free Software Foundation. -+ * -+ * This library is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public -+ * License along with this library; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, -+ * MA 02111-1307 USA -+ * -+ * -+ * Sun Industry Standards Source License Version 1.1 -+ * ================================================= -+ * The contents of this file are subject to the Sun Industry Standards -+ * Source License Version 1.1 (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.openoffice.org/license.html. -+ * -+ * Software provided under this License is provided on an "AS IS" basis, -+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, -+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, -+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. -+ * See the License for the specific provisions governing your rights and -+ * obligations concerning the Software. -+ * -+ * The Initial Developer of the Original Code is: Joerg Budischewski -+ * -+ * Copyright: 2000 by Sun Microsystems, Inc. -+ * -+ * All Rights Reserved. -+ * -+ * Contributor(s): Joerg Budischewski -+ * -+ * -+ ************************************************************************/ -+ -+#include -+ -+#include -+ -+#include -+#include -+#include -+ -+#include "pq_xusers.hxx" -+#include "pq_xuser.hxx" -+#include "pq_statics.hxx" -+#include "pq_tools.hxx" -+ -+using osl::MutexGuard; -+ -+using rtl::OUString; -+using rtl::OUStringBuffer; -+using rtl::OUStringToOString; -+ -+using com::sun::star::beans::XPropertySet; -+ -+using com::sun::star::uno::Any; -+using com::sun::star::uno::makeAny; -+using com::sun::star::uno::UNO_QUERY; -+using com::sun::star::uno::Type; -+using com::sun::star::uno::XInterface; -+using com::sun::star::uno::Reference; -+using com::sun::star::uno::Sequence; -+using com::sun::star::uno::RuntimeException; -+ -+using com::sun::star::container::NoSuchElementException; -+using com::sun::star::lang::WrappedTargetException; -+ -+using com::sun::star::sdbc::XRow; -+using com::sun::star::sdbc::XCloseable; -+using com::sun::star::sdbc::XStatement; -+using com::sun::star::sdbc::XResultSet; -+using com::sun::star::sdbc::XParameters; -+using com::sun::star::sdbc::XPreparedStatement; -+using com::sun::star::sdbc::XDatabaseMetaData; -+ -+namespace pq_sdbc_driver -+{ -+#define ASCII_STR(x) OUString( RTL_CONSTASCII_USTRINGPARAM( x ) ) -+Users::Users( -+ const ::rtl::Reference< RefCountedMutex > & refMutex, -+ const ::com::sun::star::uno::Reference< com::sun::star::sdbc::XConnection > & origin, -+ ConnectionSettings *pSettings ) -+ : Container( refMutex, origin, pSettings, getStatics().USER ) -+{} -+ -+Users::~Users() -+{} -+ -+void Users::refresh() -+ throw (::com::sun::star::uno::RuntimeException) -+{ -+ try -+ { -+ osl::MutexGuard guard( m_refMutex->mutex ); -+ Statics & st = getStatics(); -+ -+ Reference< XStatement > stmt = m_origin->createStatement(); -+ -+ Reference< XResultSet > rs = -+ stmt->executeQuery( ASCII_STR( "SELECT usename FROM pg_shadow" ) ); -+ -+ Reference< XRow > xRow( rs , UNO_QUERY ); -+ -+ String2IntMap map; -+ -+ std::vector< Any, Allocator< Any> > vec; -+ sal_Int32 tableIndex = 0; -+ while( rs->next() ) -+ { -+ User * pUser = -+ new User( m_refMutex, m_origin, m_pSettings ); -+ Reference< com::sun::star::beans::XPropertySet > prop = pUser; -+ -+ OUString name = xRow->getString( 1); -+ pUser->setPropertyValue_NoBroadcast_public( -+ st.NAME , makeAny(xRow->getString( TABLE_INDEX_CATALOG+1) ) ); -+ -+ vec.push_back( makeAny(prop ) ); -+ map[ name ] = tableIndex; -+ tableIndex ++; -+ } -+ m_values = Sequence< com::sun::star::uno::Any > ( & vec[0] , vec.size() ); -+ m_name2index.swap( map ); -+ } -+ catch ( com::sun::star::sdbc::SQLException & e ) -+ { -+ throw RuntimeException( e.Message , e.Context ); -+ } -+ -+ fire( RefreshedBroadcaster( *this ) ); -+} -+ -+ -+void Users::appendByDescriptor( -+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ) -+ throw (::com::sun::star::sdbc::SQLException, -+ ::com::sun::star::container::ElementExistException, -+ ::com::sun::star::uno::RuntimeException) -+{ -+ osl::MutexGuard guard( m_refMutex->mutex ); -+ Statics &st = getStatics(); -+ -+ OUStringBuffer update( 128 ); -+ update.appendAscii( RTL_CONSTASCII_STRINGPARAM( "CREATE USER " ) ); -+ bufferQuoteIdentifier( update, extractStringProperty( descriptor, getStatics().NAME ) ); -+ update.appendAscii( RTL_CONSTASCII_STRINGPARAM( " PASSWORD " ) ); -+ bufferQuoteConstant( update, extractStringProperty( descriptor, getStatics().PASSWORD ), m_pSettings->encoding ); -+ -+ Reference< XStatement > stmt = m_origin->createStatement( ); -+ DisposeGuard disposeGuard( stmt ); -+ stmt->executeUpdate( update.makeStringAndClear() ); -+} -+ -+void Users::dropByName( const ::rtl::OUString& elementName ) -+ throw (::com::sun::star::sdbc::SQLException, -+ ::com::sun::star::container::NoSuchElementException, -+ ::com::sun::star::uno::RuntimeException) -+{ -+ String2IntMap::const_iterator ii = m_name2index.find( elementName ); -+ if( ii == m_name2index.end() ) -+ { -+ OUStringBuffer buf( 128 ); -+ buf.appendAscii( "User " ); -+ buf.append( elementName ); -+ buf.appendAscii( " is unknown, so it can't be dropped" ); -+ throw com::sun::star::container::NoSuchElementException( -+ buf.makeStringAndClear(), *this ); -+ } -+ dropByIndex( ii->second ); -+} -+ -+void Users::dropByIndex( sal_Int32 index ) -+ throw (::com::sun::star::sdbc::SQLException, -+ ::com::sun::star::lang::IndexOutOfBoundsException, -+ ::com::sun::star::uno::RuntimeException) -+{ -+ -+ osl::MutexGuard guard( m_refMutex->mutex ); -+ if( index < 0 || index >= m_values.getLength() ) -+ { -+ OUStringBuffer buf( 128 ); -+ buf.appendAscii( "USERS: Index out of range (allowed 0 to " ); -+ buf.append( (sal_Int32) (m_values.getLength() -1) ); -+ buf.appendAscii( ", got " ); -+ buf.append( index ); -+ buf.appendAscii( ")" ); -+ throw com::sun::star::lang::IndexOutOfBoundsException( -+ buf.makeStringAndClear(), *this ); -+ } -+ -+ Reference< XPropertySet > set; -+ m_values[index] >>= set; -+ Statics &st = getStatics(); -+ OUString name; -+ set->getPropertyValue( getStatics().NAME ) >>= name; -+ -+ OUStringBuffer update( 128 ); -+ update.appendAscii( "DROP USER " ); -+ bufferQuoteIdentifier( update, name ); -+ -+ Reference< XStatement > stmt = m_origin->createStatement( ); -+ DisposeGuard disposeGuard( stmt ); -+ stmt->executeUpdate( update.makeStringAndClear() ); -+} -+ -+ -+::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > Users::createDataDescriptor() -+ throw (::com::sun::star::uno::RuntimeException) -+{ -+ return new UserDescriptor( m_refMutex, m_origin, m_pSettings ); -+} -+ -+Reference< com::sun::star::container::XNameAccess > Users::create( -+ const ::rtl::Reference< RefCountedMutex > & refMutex, -+ const ::com::sun::star::uno::Reference< com::sun::star::sdbc::XConnection > & origin, -+ ConnectionSettings *pSettings ) -+{ -+ Users *pUsers = new Users( refMutex, origin, pSettings ); -+ Reference< com::sun::star::container::XNameAccess > ret = pUsers; -+ pUsers->refresh(); -+ -+ return ret; -+} -+ -+void Users::disposing() -+{ -+} -+ -+}; -diff --git connectivity/source/drivers/postgresql/pq_xusers.hxx connectivity/source/drivers/postgresql/pq_xusers.hxx -new file mode 100644 -index 0000000..a70672d ---- /dev/null -+++ connectivity/source/drivers/postgresql/pq_xusers.hxx -@@ -0,0 +1,116 @@ -+/************************************************************************* -+ * -+ * $RCSfile: pq_xusers.hxx,v $ -+ * -+ * $Revision: 1.1.2.1 $ -+ * -+ * last change: $Author: jbu $ $Date: 2004/05/09 19:47:25 $ -+ * -+ * The Contents of this file are made available subject to the terms of -+ * either of the following licenses -+ * -+ * - GNU Lesser General Public License Version 2.1 -+ * - Sun Industry Standards Source License Version 1.1 -+ * -+ * Sun Microsystems Inc., October, 2000 -+ * -+ * GNU Lesser General Public License Version 2.1 -+ * ============================================= -+ * Copyright 2000 by Sun Microsystems, Inc. -+ * 901 San Antonio Road, Palo Alto, CA 94303, USA -+ * -+ * This library is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License version 2.1, as published by the Free Software Foundation. -+ * -+ * This library is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public -+ * License along with this library; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, -+ * MA 02111-1307 USA -+ * -+ * -+ * Sun Industry Standards Source License Version 1.1 -+ * ================================================= -+ * The contents of this file are subject to the Sun Industry Standards -+ * Source License Version 1.1 (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.openoffice.org/license.html. -+ * -+ * Software provided under this License is provided on an "AS IS" basis, -+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, -+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, -+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. -+ * See the License for the specific provisions governing your rights and -+ * obligations concerning the Software. -+ * -+ * The Initial Developer of the Original Code is: Joerg Budischewski -+ * -+ * Copyright: 2000 by Sun Microsystems, Inc. -+ * -+ * All Rights Reserved. -+ * -+ * Contributor(s): Joerg Budischewski -+ * -+ * -+ ************************************************************************/ -+ -+#ifndef HEADER_PQ_USERS_HXX_ -+#define HEADER_PQ_USERS_HXX_ -+ -+#include "pq_xcontainer.hxx" -+ -+namespace pq_sdbc_driver -+{ -+ -+class Users : public Container -+{ -+ -+public: // instances Tables 'exception safe' -+ static com::sun::star::uno::Reference< com::sun::star::container::XNameAccess > create( -+ const ::rtl::Reference< RefCountedMutex > & refMutex, -+ const ::com::sun::star::uno::Reference< com::sun::star::sdbc::XConnection > & origin, -+ ConnectionSettings *pSettings ); -+ -+protected: -+ Users( -+ const ::rtl::Reference< RefCountedMutex > & refMutex, -+ const ::com::sun::star::uno::Reference< com::sun::star::sdbc::XConnection > & origin, -+ ConnectionSettings *pSettings ); -+ -+ virtual ~Users(); -+ -+public: // XAppend -+ virtual void SAL_CALL appendByDescriptor( -+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ) -+ throw (::com::sun::star::sdbc::SQLException, -+ ::com::sun::star::container::ElementExistException, -+ ::com::sun::star::uno::RuntimeException); -+ -+public: // XDrop -+ virtual void SAL_CALL dropByName( const ::rtl::OUString& elementName ) -+ throw (::com::sun::star::sdbc::SQLException, -+ ::com::sun::star::container::NoSuchElementException, -+ ::com::sun::star::uno::RuntimeException); -+ virtual void SAL_CALL dropByIndex( sal_Int32 index ) -+ throw (::com::sun::star::sdbc::SQLException, -+ ::com::sun::star::lang::IndexOutOfBoundsException, -+ ::com::sun::star::uno::RuntimeException); -+ -+public: // XRefreshable -+ virtual void SAL_CALL refresh( ) throw (::com::sun::star::uno::RuntimeException); -+ -+public: // XDataDescriptorFactory -+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL createDataDescriptor( ) -+ throw (::com::sun::star::uno::RuntimeException); -+ -+protected: -+ virtual void SAL_CALL disposing(); -+}; -+ -+} -+#endif -diff --git connectivity/source/drivers/postgresql/pq_xview.cxx connectivity/source/drivers/postgresql/pq_xview.cxx -new file mode 100644 -index 0000000..3377d97 ---- /dev/null -+++ connectivity/source/drivers/postgresql/pq_xview.cxx -@@ -0,0 +1,285 @@ -+/************************************************************************* -+ * -+ * $RCSfile: pq_xview.cxx,v $ -+ * -+ * $Revision: 1.1.2.5 $ -+ * -+ * last change: $Author: jbu $ $Date: 2007/01/07 13:50:38 $ -+ * -+ * The Contents of this file are made available subject to the terms of -+ * either of the following licenses -+ * -+ * - GNU Lesser General Public License Version 2.1 -+ * - Sun Industry Standards Source License Version 1.1 -+ * -+ * Sun Microsystems Inc., October, 2000 -+ * -+ * GNU Lesser General Public License Version 2.1 -+ * ============================================= -+ * Copyright 2000 by Sun Microsystems, Inc. -+ * 901 San Antonio Road, Palo Alto, CA 94303, USA -+ * -+ * This library is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License version 2.1, as published by the Free Software Foundation. -+ * -+ * This library is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public -+ * License along with this library; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, -+ * MA 02111-1307 USA -+ * -+ * -+ * Sun Industry Standards Source License Version 1.1 -+ * ================================================= -+ * The contents of this file are subject to the Sun Industry Standards -+ * Source License Version 1.1 (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.openoffice.org/license.html. -+ * -+ * Software provided under this License is provided on an "AS IS" basis, -+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, -+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, -+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. -+ * See the License for the specific provisions governing your rights and -+ * obligations concerning the Software. -+ * -+ * The Initial Developer of the Original Code is: Joerg Budischewski -+ * -+ * Copyright: 2000 by Sun Microsystems, Inc. -+ * -+ * All Rights Reserved. -+ * -+ * Contributor(s): Joerg Budischewski -+ * -+ * -+ ************************************************************************/ -+ -+#include -+ -+#include -+#include -+ -+#include -+ -+#include -+#include -+ -+#include "pq_xview.hxx" -+#include "pq_xviews.hxx" -+#include "pq_statics.hxx" -+#include "pq_tools.hxx" -+ -+using osl::MutexGuard; -+using osl::Mutex; -+ -+using rtl::OUString; -+using rtl::OUStringBuffer; -+using rtl::OUStringToOString; -+ -+using com::sun::star::container::XNameAccess; -+using com::sun::star::container::XIndexAccess; -+using com::sun::star::container::ElementExistException; -+using com::sun::star::container::NoSuchElementException; -+ -+using com::sun::star::uno::Reference; -+using com::sun::star::uno::Exception; -+using com::sun::star::uno::UNO_QUERY; -+using com::sun::star::uno::XInterface; -+using com::sun::star::uno::Sequence; -+using com::sun::star::uno::Any; -+using com::sun::star::uno::makeAny; -+using com::sun::star::uno::Type; -+using com::sun::star::uno::RuntimeException; -+ -+using com::sun::star::lang::IllegalArgumentException; -+using com::sun::star::lang::IndexOutOfBoundsException; -+ -+using com::sun::star::beans::XPropertySetInfo; -+using com::sun::star::beans::XFastPropertySet; -+using com::sun::star::beans::XMultiPropertySet; -+using com::sun::star::beans::XPropertySet; -+using com::sun::star::beans::Property; -+ -+using com::sun::star::sdbc::XResultSet; -+using com::sun::star::sdbc::XPreparedStatement; -+using com::sun::star::sdbc::XStatement; -+using com::sun::star::sdbc::XParameters; -+using com::sun::star::sdbc::XRow; -+using com::sun::star::sdbc::SQLException; -+ -+namespace pq_sdbc_driver -+{ -+#define ASCII_STR(x) OUString( RTL_CONSTASCII_USTRINGPARAM( x ) ) -+ -+View::View( const ::rtl::Reference< RefCountedMutex > & refMutex, -+ const Reference< com::sun::star::sdbc::XConnection > & connection, -+ ConnectionSettings *pSettings) -+ : ReflectionBase( -+ getStatics().refl.view.implName, -+ getStatics().refl.view.serviceNames, -+ refMutex, -+ connection, -+ pSettings, -+ * getStatics().refl.view.pProps ) -+{} -+ -+Reference< XPropertySet > View::createDataDescriptor( ) throw (RuntimeException) -+{ -+ ViewDescriptor * pView = new ViewDescriptor( -+ m_refMutex, m_conn, m_pSettings ); -+ pView->copyValuesFrom( this ); -+ -+ return Reference< XPropertySet > ( pView ); -+} -+ -+void View::rename( const ::rtl::OUString& newName ) -+ throw (::com::sun::star::sdbc::SQLException, -+ ::com::sun::star::container::ElementExistException, -+ ::com::sun::star::uno::RuntimeException) -+{ -+ MutexGuard guard( m_refMutex->mutex ); -+ -+ Statics & st = getStatics(); -+ -+ ::rtl::OUString oldName = extractStringProperty(this,st.NAME ); -+ ::rtl::OUString schema = extractStringProperty(this,st.SCHEMA_NAME ); -+ ::rtl::OUString fullOldName = concatQualified( schema, oldName ); -+ -+ OUString newTableName; -+ OUString newSchemaName; -+ // OOo2.0 passes schema + dot + new-table-name while -+ // OO1.1.x passes new Name without schema -+ // in case name contains a dot, it is interpreted as schema.tablename -+ if( newName.indexOf( '.' ) >= 0 ) -+ { -+ splitConcatenatedIdentifier( newName, &newSchemaName, &newTableName ); -+ } -+ else -+ { -+ newTableName = newName; -+ newSchemaName = schema; -+ } -+ ::rtl::OUString fullNewName = concatQualified( newSchemaName, newTableName ); -+ -+ if( ! schema.equals( newSchemaName ) ) -+ { -+ try -+ { -+ OUStringBuffer buf(128); -+ buf.appendAscii( RTL_CONSTASCII_STRINGPARAM( "ALTER TABLE" ) ); -+ bufferQuoteQualifiedIdentifier(buf, schema, oldName ); -+ buf.appendAscii( RTL_CONSTASCII_STRINGPARAM("SET SCHEMA" ) ); -+ bufferQuoteIdentifier( buf, newSchemaName ); -+ Reference< XStatement > statement = m_conn->createStatement(); -+ statement->executeUpdate( buf.makeStringAndClear() ); -+ setPropertyValue_NoBroadcast_public( st.SCHEMA_NAME, makeAny(newSchemaName) ); -+ disposeNoThrow( statement ); -+ schema = newSchemaName; -+ } -+ catch( com::sun::star::sdbc::SQLException &e ) -+ { -+ OUStringBuffer buf( e.Message ); -+ buf.appendAscii( RTL_CONSTASCII_STRINGPARAM( "(NOTE: Only postgresql server >= V8.1 support changing a table's schema)" ) ); -+ e.Message = buf.makeStringAndClear(); -+ throw e; -+ } -+ -+ } -+ if( ! oldName.equals( newTableName ) ) -+ { -+ OUStringBuffer buf(128); -+ buf.appendAscii( RTL_CONSTASCII_STRINGPARAM( "ALTER TABLE" ) ); -+ bufferQuoteQualifiedIdentifier( buf, schema, oldName ); -+ buf.appendAscii( RTL_CONSTASCII_STRINGPARAM("RENAME TO" ) ); -+ bufferQuoteIdentifier( buf, newTableName ); -+ Reference< XStatement > statement = m_conn->createStatement(); -+ statement->executeUpdate( buf.makeStringAndClear() ); -+ setPropertyValue_NoBroadcast_public( st.NAME, makeAny(newTableName) ); -+ } -+ -+ // inform the container of the name change ! -+ if( m_pSettings->views.is() ) -+ { -+ m_pSettings->pViewsImpl->rename( fullOldName, fullNewName ); -+ } -+} -+ -+Sequence View::getTypes() throw( RuntimeException ) -+{ -+ static cppu::OTypeCollection *pCollection; -+ if( ! pCollection ) -+ { -+ MutexGuard guard( osl::Mutex::getGlobalMutex() ); -+ if( !pCollection ) -+ { -+ static cppu::OTypeCollection collection( -+ getCppuType( (Reference< com::sun::star::sdbcx::XRename> *) 0 ), -+ ReflectionBase::getTypes()); -+ pCollection = &collection; -+ } -+ } -+ return pCollection->getTypes(); -+} -+ -+Sequence< sal_Int8> View::getImplementationId() throw( RuntimeException ) -+{ -+ return getStatics().refl.view.implementationId; -+} -+ -+Any View::queryInterface( const Type & reqType ) throw (RuntimeException) -+{ -+ Any ret; -+ -+ ret = ReflectionBase::queryInterface( reqType ); -+ if( ! ret.hasValue() ) -+ ret = ::cppu::queryInterface( -+ reqType, -+ static_cast< com::sun::star::sdbcx::XRename * > ( this ) -+ ); -+ return ret; -+} -+ -+::rtl::OUString View::getName( ) throw (::com::sun::star::uno::RuntimeException) -+{ -+ Statics & st = getStatics(); -+ return concatQualified( -+ extractStringProperty( this, st.SCHEMA_NAME ), -+ extractStringProperty( this, st.NAME ) ); -+} -+ -+void View::setName( const ::rtl::OUString& aName ) throw (::com::sun::star::uno::RuntimeException) -+{ -+ rename( aName ); -+} -+ -+//____________________________________________________________________________________________ -+ -+ViewDescriptor::ViewDescriptor( -+ const ::rtl::Reference< RefCountedMutex > & refMutex, -+ const Reference< com::sun::star::sdbc::XConnection > & connection, -+ ConnectionSettings *pSettings) -+ : ReflectionBase( -+ getStatics().refl.viewDescriptor.implName, -+ getStatics().refl.viewDescriptor.serviceNames, -+ refMutex, -+ connection, -+ pSettings, -+ * getStatics().refl.viewDescriptor.pProps ) -+{} -+ -+Reference< XPropertySet > ViewDescriptor::createDataDescriptor( ) throw (RuntimeException) -+{ -+ ViewDescriptor * pView = new ViewDescriptor( -+ m_refMutex, m_conn, m_pSettings ); -+ pView->copyValuesFrom( this ); -+ -+ return Reference< XPropertySet > ( pView ); -+} -+ -+ -+} -diff --git connectivity/source/drivers/postgresql/pq_xview.hxx connectivity/source/drivers/postgresql/pq_xview.hxx -new file mode 100644 -index 0000000..77d40d1 ---- /dev/null -+++ connectivity/source/drivers/postgresql/pq_xview.hxx -@@ -0,0 +1,133 @@ -+/************************************************************************* -+ * -+ * $RCSfile: pq_xview.hxx,v $ -+ * -+ * $Revision: 1.1.2.2 $ -+ * -+ * last change: $Author: jbu $ $Date: 2004/06/10 15:27:13 $ -+ * -+ * The Contents of this file are made available subject to the terms of -+ * either of the following licenses -+ * -+ * - GNU Lesser General Public License Version 2.1 -+ * - Sun Industry Standards Source License Version 1.1 -+ * -+ * Sun Microsystems Inc., October, 2000 -+ * -+ * GNU Lesser General Public License Version 2.1 -+ * ============================================= -+ * Copyright 2000 by Sun Microsystems, Inc. -+ * 901 San Antonio Road, Palo Alto, CA 94303, USA -+ * -+ * This library is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License version 2.1, as published by the Free Software Foundation. -+ * -+ * This library is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public -+ * License along with this library; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, -+ * MA 02111-1307 USA -+ * -+ * -+ * Sun Industry Standards Source License Version 1.1 -+ * ================================================= -+ * The contents of this file are subject to the Sun Industry Standards -+ * Source License Version 1.1 (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.openoffice.org/license.html. -+ * -+ * Software provided under this License is provided on an "AS IS" basis, -+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, -+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, -+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. -+ * See the License for the specific provisions governing your rights and -+ * obligations concerning the Software. -+ * -+ * The Initial Developer of the Original Code is: Joerg Budischewski -+ * -+ * Copyright: 2000 by Sun Microsystems, Inc. -+ * -+ * All Rights Reserved. -+ * -+ * Contributor(s): Joerg Budischewski -+ * -+ * -+ ************************************************************************/ -+ -+#ifndef PQ_XVIEW_HXX -+#define PQ_XVIEW_HXX -+ -+#include -+#include -+ -+#include -+#include -+#include -+#include -+ -+#include "pq_xbase.hxx" -+ -+namespace pq_sdbc_driver -+{ -+class Views; -+class View : public ReflectionBase, -+ public com::sun::star::sdbcx::XRename -+{ -+public: -+ View( const ::rtl::Reference< RefCountedMutex > & refMutex, -+ const ::com::sun::star::uno::Reference< com::sun::star::sdbc::XConnection > & connection, -+ ConnectionSettings *pSettings); -+public: -+ void refetch(); -+ -+public: // XInterface -+ virtual void SAL_CALL acquire() throw() { OComponentHelper::acquire(); } -+ virtual void SAL_CALL release() throw() { OComponentHelper::release(); } -+ virtual com::sun::star::uno::Any SAL_CALL queryInterface( -+ const com::sun::star::uno::Type & reqType ) -+ throw (com::sun::star::uno::RuntimeException); -+ -+public: // XTypeProvider, first implemented by OPropertySetHelper -+ virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL getTypes() -+ throw( com::sun::star::uno::RuntimeException ); -+ virtual com::sun::star::uno::Sequence< sal_Int8> SAL_CALL getImplementationId() -+ throw( com::sun::star::uno::RuntimeException ); -+ -+public: // XDataDescriptorFactory -+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL -+ createDataDescriptor( ) throw (::com::sun::star::uno::RuntimeException); -+ -+public: // XRename -+ virtual void SAL_CALL rename( const ::rtl::OUString& newName ) -+ throw (::com::sun::star::sdbc::SQLException, -+ ::com::sun::star::container::ElementExistException, -+ ::com::sun::star::uno::RuntimeException); -+ -+public: // XNamed -+ virtual ::rtl::OUString SAL_CALL getName( ) throw (::com::sun::star::uno::RuntimeException); -+ virtual void SAL_CALL setName( const ::rtl::OUString& aName ) throw (::com::sun::star::uno::RuntimeException); -+ -+}; -+ -+ -+class ViewDescriptor : public ReflectionBase -+{ -+public: -+ ViewDescriptor( const ::rtl::Reference< RefCountedMutex > & refMutex, -+ const ::com::sun::star::uno::Reference< com::sun::star::sdbc::XConnection > & connection, -+ ConnectionSettings *pSettings); -+ -+public: // XDataDescriptorFactory -+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL -+ createDataDescriptor( ) throw (::com::sun::star::uno::RuntimeException); -+}; -+ -+} -+ -+ -+#endif -diff --git connectivity/source/drivers/postgresql/pq_xviews.cxx connectivity/source/drivers/postgresql/pq_xviews.cxx -new file mode 100644 -index 0000000..df6c13a ---- /dev/null -+++ connectivity/source/drivers/postgresql/pq_xviews.cxx -@@ -0,0 +1,304 @@ -+/************************************************************************* -+ * -+ * $RCSfile: pq_xviews.cxx,v $ -+ * -+ * $Revision: 1.1.2.4 $ -+ * -+ * last change: $Author: jbu $ $Date: 2006/05/01 19:19:09 $ -+ * -+ * The Contents of this file are made available subject to the terms of -+ * either of the following licenses -+ * -+ * - GNU Lesser General Public License Version 2.1 -+ * - Sun Industry Standards Source License Version 1.1 -+ * -+ * Sun Microsystems Inc., October, 2000 -+ * -+ * GNU Lesser General Public License Version 2.1 -+ * ============================================= -+ * Copyright 2000 by Sun Microsystems, Inc. -+ * 901 San Antonio Road, Palo Alto, CA 94303, USA -+ * -+ * This library is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License version 2.1, as published by the Free Software Foundation. -+ * -+ * This library is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public -+ * License along with this library; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, -+ * MA 02111-1307 USA -+ * -+ * -+ * Sun Industry Standards Source License Version 1.1 -+ * ================================================= -+ * The contents of this file are subject to the Sun Industry Standards -+ * Source License Version 1.1 (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.openoffice.org/license.html. -+ * -+ * Software provided under this License is provided on an "AS IS" basis, -+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, -+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, -+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. -+ * See the License for the specific provisions governing your rights and -+ * obligations concerning the Software. -+ * -+ * The Initial Developer of the Original Code is: Joerg Budischewski -+ * -+ * Copyright: 2000 by Sun Microsystems, Inc. -+ * -+ * All Rights Reserved. -+ * -+ * Contributor(s): Joerg Budischewski -+ * -+ * -+ ************************************************************************/ -+ -+#include -+ -+#include -+ -+#include -+#include -+#include -+ -+#include "pq_xviews.hxx" -+#include "pq_xview.hxx" -+#include "pq_xtables.hxx" -+#include "pq_statics.hxx" -+#include "pq_tools.hxx" -+ -+using osl::MutexGuard; -+ -+using rtl::OUString; -+using rtl::OUStringBuffer; -+using rtl::OUStringToOString; -+ -+using com::sun::star::beans::XPropertySet; -+ -+using com::sun::star::uno::Any; -+using com::sun::star::uno::makeAny; -+using com::sun::star::uno::UNO_QUERY; -+using com::sun::star::uno::Type; -+using com::sun::star::uno::XInterface; -+using com::sun::star::uno::Reference; -+using com::sun::star::uno::Sequence; -+using com::sun::star::uno::RuntimeException; -+ -+using com::sun::star::container::NoSuchElementException; -+using com::sun::star::lang::WrappedTargetException; -+ -+using com::sun::star::sdbc::XRow; -+using com::sun::star::sdbc::XCloseable; -+using com::sun::star::sdbc::XStatement; -+using com::sun::star::sdbc::XResultSet; -+using com::sun::star::sdbc::XParameters; -+using com::sun::star::sdbc::XPreparedStatement; -+using com::sun::star::sdbc::XDatabaseMetaData; -+ -+// using com::sun::star::sdbcx::Privilege; -+ -+namespace pq_sdbc_driver -+{ -+#define ASCII_STR(x) OUString( RTL_CONSTASCII_USTRINGPARAM( x ) ) -+Views::Views( -+ const ::rtl::Reference< RefCountedMutex > & refMutex, -+ const ::com::sun::star::uno::Reference< com::sun::star::sdbc::XConnection > & origin, -+ ConnectionSettings *pSettings ) -+ : Container( refMutex, origin, pSettings, getStatics().VIEW ) -+{} -+ -+Views::~Views() -+{} -+ -+void Views::refresh() -+ throw (::com::sun::star::uno::RuntimeException) -+{ -+ try -+ { -+ osl::MutexGuard guard( m_refMutex->mutex ); -+ Statics & st = getStatics(); -+ -+ Reference< XStatement > stmt = m_origin->createStatement(); -+ -+ Reference< XResultSet > rs = stmt->executeQuery( -+ ASCII_STR( "SELECT " -+ "DISTINCT ON( pg_namespace.nspname, relname) " // needed because of duplicates -+ "pg_namespace.nspname," // 1 -+ "relname," // 2 -+ "pg_get_viewdef(ev_class) " // 3 -+ "FROM pg_namespace, pg_class, pg_rewrite " -+ "WHERE pg_namespace.oid = relnamespace " -+ "AND pg_class.oid = ev_class " -+ "AND relkind='v'" ) ); -+ -+ Reference< XRow > xRow( rs , UNO_QUERY ); -+ -+ std::vector< Any, Allocator< Any> > vec; -+ String2IntMap map; -+ sal_Int32 viewIndex = 0; -+ -+ while( rs->next() ) -+ { -+ rtl::OUString table, schema, command; -+ schema = xRow->getString( 1 ); -+ table = xRow->getString( 2 ); -+ command = xRow->getString( 3 ); -+ -+ View *pView = new View (m_refMutex, m_origin, m_pSettings ); -+ Reference< com::sun::star::beans::XPropertySet > prop = pView; -+ -+ pView->setPropertyValue_NoBroadcast_public(st.NAME , makeAny(table) ); -+ pView->setPropertyValue_NoBroadcast_public(st.SCHEMA_NAME, makeAny(schema) ); -+ pView->setPropertyValue_NoBroadcast_public(st.COMMAND, makeAny(command) ); -+ vec.push_back( makeAny( prop ) ); -+ -+ OUStringBuffer buf( table.getLength() + schema.getLength() + 1); -+ buf.append( schema ).appendAscii( "." ).append( table ); -+ map[ buf.makeStringAndClear() ] = viewIndex; -+ viewIndex ++; -+ -+ } -+ m_values = Sequence< com::sun::star::uno::Any > ( &vec[0], vec.size() ); -+ m_name2index.swap( map ); -+ } -+ catch ( com::sun::star::sdbc::SQLException & e ) -+ { -+ throw RuntimeException( e.Message , e.Context ); -+ } -+ fire( RefreshedBroadcaster( *this ) ); -+} -+ -+ -+void Views::appendByDescriptor( -+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ) -+ throw (::com::sun::star::sdbc::SQLException, -+ ::com::sun::star::container::ElementExistException, -+ ::com::sun::star::uno::RuntimeException) -+{ -+ osl::MutexGuard guard( m_refMutex->mutex ); -+ -+ Statics &st = getStatics(); -+ OUString name,schema,command; -+ descriptor->getPropertyValue( st.SCHEMA_NAME ) >>= schema; -+ descriptor->getPropertyValue( st.NAME ) >>= name; -+ descriptor->getPropertyValue( st.COMMAND ) >>= command; -+ -+ Reference< XStatement > stmt = m_origin->createStatement(); -+ -+ OUStringBuffer buf( 128 ); -+ -+ buf.appendAscii( RTL_CONSTASCII_STRINGPARAM( "CREATE VIEW " ) ); -+ bufferQuoteQualifiedIdentifier( buf, schema, name ); -+ buf.appendAscii( RTL_CONSTASCII_STRINGPARAM( " AS " ) ); -+ buf.append( command ); -+ -+ stmt->executeUpdate( buf.makeStringAndClear() ); -+ -+ disposeNoThrow( stmt ); -+ refresh(); -+ if( m_pSettings->tables.is() ) -+ { -+ m_pSettings->pTablesImpl->refresh(); -+ } -+ // increase the vector -+// sal_Int32 index = m_values.getLength(); -+// m_values.realloc( index + 1 ); -+ -+// View * pView = -+// new View( m_refMutex, m_origin, m_pSettings, false /*modifiable*/ ); -+// Reference< com::sun::star::beans::XPropertySet > prop = pTable; -+// copyProperties( pTable, descriptor ); -+// m_values[index] = makeAny( prop ); -+// OUStringBuffer buf( name.getLength() + 1 + schema.getLength() ); -+// buf.append( schema ).appendAscii( "." ).append( name ); -+// m_name2index[ buf.makeStringAndClear() ] = index; -+} -+ -+void Views::dropByName( const ::rtl::OUString& elementName ) -+ throw (::com::sun::star::sdbc::SQLException, -+ ::com::sun::star::container::NoSuchElementException, -+ ::com::sun::star::uno::RuntimeException) -+{ -+ String2IntMap::const_iterator ii = m_name2index.find( elementName ); -+ if( ii == m_name2index.end() ) -+ { -+ OUStringBuffer buf( 128 ); -+ buf.appendAscii( "View " ); -+ buf.append( elementName ); -+ buf.appendAscii( " is unknown, so it can't be dropped" ); -+ throw com::sun::star::container::NoSuchElementException( -+ buf.makeStringAndClear(), *this ); -+ } -+ dropByIndex( ii->second ); -+} -+ -+void Views::dropByIndex( sal_Int32 index ) -+ throw (::com::sun::star::sdbc::SQLException, -+ ::com::sun::star::lang::IndexOutOfBoundsException, -+ ::com::sun::star::uno::RuntimeException) -+{ -+// throw SQLException( -+// ASCII_STR( "view deletion not supported" ), *this, OUString(), 1, Any() ); -+ osl::MutexGuard guard( m_refMutex->mutex ); -+ if( index < 0 || index >= m_values.getLength() ) -+ { -+ OUStringBuffer buf( 128 ); -+ buf.appendAscii( "VIEWS: Index out of range (allowed 0 to " ); -+ buf.append( (sal_Int32) (m_values.getLength() -1) ); -+ buf.appendAscii( ", got " ); -+ buf.append( index ); -+ buf.appendAscii( ")" ); -+ throw com::sun::star::lang::IndexOutOfBoundsException( -+ buf.makeStringAndClear(), *this ); -+ } -+ -+ Reference< XPropertySet > set; -+ m_values[index] >>= set; -+ Statics &st = getStatics(); -+ OUString name,schema; -+ set->getPropertyValue( st.SCHEMA_NAME ) >>= schema; -+ set->getPropertyValue( st.NAME ) >>= name; -+ -+ OUStringBuffer update( 128 ); -+ update.appendAscii( "DROP VIEW \"" ).append( schema ).appendAscii( "\".\"" ); -+ update.append( name ).appendAscii( "\"" ); -+ -+ Reference< XStatement > stmt = m_origin->createStatement( ); -+ -+ stmt->executeUpdate( update.makeStringAndClear() ); -+} -+ -+ -+::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > Views::createDataDescriptor() -+ throw (::com::sun::star::uno::RuntimeException) -+{ -+ return new ViewDescriptor( m_refMutex, m_origin, m_pSettings ); -+} -+ -+Reference< com::sun::star::container::XNameAccess > Views::create( -+ const ::rtl::Reference< RefCountedMutex > & refMutex, -+ const ::com::sun::star::uno::Reference< com::sun::star::sdbc::XConnection > & origin, -+ ConnectionSettings *pSettings, -+ Views **ppViews) -+{ -+ *ppViews = new Views( refMutex, origin, pSettings ); -+ Reference< com::sun::star::container::XNameAccess > ret = *ppViews; -+ (*ppViews)->refresh(); -+ -+ return ret; -+} -+ -+void Views::disposing() -+{ -+ Container::disposing(); -+} -+ -+ -+ -+}; -diff --git connectivity/source/drivers/postgresql/pq_xviews.hxx connectivity/source/drivers/postgresql/pq_xviews.hxx -new file mode 100644 -index 0000000..b1d7b9f ---- /dev/null -+++ connectivity/source/drivers/postgresql/pq_xviews.hxx -@@ -0,0 +1,118 @@ -+/************************************************************************* -+ * -+ * $RCSfile: pq_xviews.hxx,v $ -+ * -+ * $Revision: 1.1.2.1 $ -+ * -+ * last change: $Author: jbu $ $Date: 2004/05/09 19:47:26 $ -+ * -+ * The Contents of this file are made available subject to the terms of -+ * either of the following licenses -+ * -+ * - GNU Lesser General Public License Version 2.1 -+ * - Sun Industry Standards Source License Version 1.1 -+ * -+ * Sun Microsystems Inc., October, 2000 -+ * -+ * GNU Lesser General Public License Version 2.1 -+ * ============================================= -+ * Copyright 2000 by Sun Microsystems, Inc. -+ * 901 San Antonio Road, Palo Alto, CA 94303, USA -+ * -+ * This library is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License version 2.1, as published by the Free Software Foundation. -+ * -+ * This library is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public -+ * License along with this library; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, -+ * MA 02111-1307 USA -+ * -+ * -+ * Sun Industry Standards Source License Version 1.1 -+ * ================================================= -+ * The contents of this file are subject to the Sun Industry Standards -+ * Source License Version 1.1 (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.openoffice.org/license.html. -+ * -+ * Software provided under this License is provided on an "AS IS" basis, -+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, -+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, -+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. -+ * See the License for the specific provisions governing your rights and -+ * obligations concerning the Software. -+ * -+ * The Initial Developer of the Original Code is: Joerg Budischewski -+ * -+ * Copyright: 2000 by Sun Microsystems, Inc. -+ * -+ * All Rights Reserved. -+ * -+ * Contributor(s): Joerg Budischewski -+ * -+ * -+ ************************************************************************/ -+ -+#ifndef _PQ_VIEWS_HXX_ -+#define _PQ_VIEWS_HXX_ -+ -+#include "pq_xcontainer.hxx" -+ -+namespace pq_sdbc_driver -+{ -+ -+class Views : public Container -+{ -+ -+public: // instances Views 'exception safe' -+ static com::sun::star::uno::Reference< com::sun::star::container::XNameAccess > create( -+ const ::rtl::Reference< RefCountedMutex > & refMutex, -+ const ::com::sun::star::uno::Reference< com::sun::star::sdbc::XConnection > & origin, -+ ConnectionSettings *pSettings, -+ Views **ppViews ); -+ -+protected: -+ Views( -+ const ::rtl::Reference< RefCountedMutex > & refMutex, -+ const ::com::sun::star::uno::Reference< com::sun::star::sdbc::XConnection > & origin, -+ ConnectionSettings *pSettings); -+ -+ virtual ~Views(); -+ -+public: // XAppend -+ virtual void SAL_CALL appendByDescriptor( -+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ) -+ throw (::com::sun::star::sdbc::SQLException, -+ ::com::sun::star::container::ElementExistException, -+ ::com::sun::star::uno::RuntimeException); -+ -+public: // XDrop -+ virtual void SAL_CALL dropByName( const ::rtl::OUString& elementName ) -+ throw (::com::sun::star::sdbc::SQLException, -+ ::com::sun::star::container::NoSuchElementException, -+ ::com::sun::star::uno::RuntimeException); -+ virtual void SAL_CALL dropByIndex( sal_Int32 index ) -+ throw (::com::sun::star::sdbc::SQLException, -+ ::com::sun::star::lang::IndexOutOfBoundsException, -+ ::com::sun::star::uno::RuntimeException); -+ -+public: // XRefreshable -+ virtual void SAL_CALL refresh( ) throw (::com::sun::star::uno::RuntimeException); -+ -+public: // XDataDescriptorFactory -+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL createDataDescriptor( ) -+ throw (::com::sun::star::uno::RuntimeException); -+ -+protected: -+ virtual void SAL_CALL disposing(); -+ -+ -+}; -+} -+#endif --- -1.7.0.1 - diff --git a/802-sdbc-postgresql-build-lst.diff b/802-sdbc-postgresql-build-lst.diff deleted file mode 100644 index 1de8f6f..0000000 --- a/802-sdbc-postgresql-build-lst.diff +++ /dev/null @@ -1,19 +0,0 @@ ---- - connectivity/prj/build.lst | 1 + - 1 files changed, 1 insertions(+), 0 deletions(-) - -diff --git connectivity/prj/build.lst connectivity/prj/build.lst -index 0b15c06..b693d45 100644 ---- connectivity/prj/build.lst -+++ connectivity/prj/build.lst -@@ -18,6 +18,7 @@ cn connectivity\source\drivers\calc nmake - all cn_calc cn_f - cn connectivity\source\drivers\odbcbase nmake - all cn_odbcbase cn_dbtools cn_inc NULL - cn connectivity\source\drivers\odbc nmake - all cn_odbc cn_odbcbase cn_inc NULL - cn connectivity\source\drivers\mysql nmake - all cn_mysql cn_dbtools cn_inc NULL -+cn connectivity\source\drivers\postgresql nmake - all cn_postgresql cn_dbtools cn_inc NULL - cn connectivity\source\drivers\jdbc nmake - all cn_jdbc cn_dbtools cn_inc NULL - cn connectivity\source\drivers\adabas nmake - all cn_adabas cn_dbtools cn_odbcbase cn_inc NULL - cn connectivity\source\drivers\file nmake - all cn_file cn_dbtools cn_inc NULL --- -1.7.0.1 - diff --git a/803-connectivity-workben-postgresql.diff b/803-connectivity-workben-postgresql.diff deleted file mode 100644 index 0672888..0000000 --- a/803-connectivity-workben-postgresql.diff +++ /dev/null @@ -1,1402 +0,0 @@ ---- - connectivity/workben/postgresql/ddl.py | 185 ++++++++++++ - connectivity/workben/postgresql/main.py | 90 ++++++ - connectivity/workben/postgresql/makefile.mk | 103 +++++++ - connectivity/workben/postgresql/metadata.py | 151 ++++++++++ - .../workben/postgresql/preparedstatement.py | 228 +++++++++++++++ - connectivity/workben/postgresql/sdbcx.py | 306 ++++++++++++++++++++ - connectivity/workben/postgresql/statement.py | 277 ++++++++++++++++++ - 7 files changed, 1340 insertions(+), 0 deletions(-) - create mode 100644 connectivity/workben/postgresql/ddl.py - create mode 100644 connectivity/workben/postgresql/main.py - create mode 100644 connectivity/workben/postgresql/makefile.mk - create mode 100644 connectivity/workben/postgresql/metadata.py - create mode 100644 connectivity/workben/postgresql/preparedstatement.py - create mode 100644 connectivity/workben/postgresql/sdbcx.py - create mode 100644 connectivity/workben/postgresql/statement.py - -diff --git connectivity/workben/postgresql/ddl.py connectivity/workben/postgresql/ddl.py -new file mode 100644 -index 0000000..4c1c5e2 ---- /dev/null -+++ connectivity/workben/postgresql/ddl.py -@@ -0,0 +1,185 @@ -+#************************************************************************* -+# -+# $RCSfile: ddl.py,v $ -+# -+# $Revision: 1.1.2.5 $ -+# -+# last change: $Author: jbu $ $Date: 2007/01/07 13:50:38 $ -+# -+# The Contents of this file are made available subject to the terms of -+# either of the following licenses -+# -+# - GNU Lesser General Public License Version 2.1 -+# - Sun Industry Standards Source License Version 1.1 -+# -+# Sun Microsystems Inc., October, 2000 -+# -+# GNU Lesser General Public License Version 2.1 -+# ============================================= -+# Copyright 2000 by Sun Microsystems, Inc. -+# 901 San Antonio Road, Palo Alto, CA 94303, USA -+# -+# This library is free software; you can redistribute it and/or -+# modify it under the terms of the GNU Lesser General Public -+# License version 2.1, as published by the Free Software Foundation. -+# -+# This library is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+# Lesser General Public License for more details. -+# -+# You should have received a copy of the GNU Lesser General Public -+# License along with this library; if not, write to the Free Software -+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, -+# MA 02111-1307 USA -+# -+# -+# Sun Industry Standards Source License Version 1.1 -+# ================================================= -+# The contents of this file are subject to the Sun Industry Standards -+# Source License Version 1.1 (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.openoffice.org/license.html. -+# -+# Software provided under this License is provided on an "AS IS" basis, -+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, -+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, -+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. -+# See the License for the specific provisions governing your rights and -+# obligations concerning the Software. -+# -+# The Initial Developer of the Original Code is: Ralph Thomas -+# -+# Copyright: 2000 by Sun Microsystems, Inc. -+# -+# All Rights Reserved. -+# -+# Contributor(s): Ralph Thomas, Joerg Budischewski -+# -+#************************************************************************* -+from com.sun.star.sdbc import SQLException -+import sys -+ -+def dumpResultSet( rs ): -+ meta = rs.getMetaData() -+ for i in range(1, meta.getColumnCount()+1): -+ sys.stdout.write(meta.getColumnName( i ) + "\t") -+ sys.stdout.write( "\n" ) -+ while rs.next(): -+ for i in range( 1, meta.getColumnCount()+1): -+ sys.stdout.write( rs.getString( i ) + "\t" ) -+ sys.stdout.write( "\n" ) -+ rs.beforeFirst() -+ -+ -+ -+def executeIgnoringException( stmt, sql ): -+ try: -+ stmt.executeUpdate(sql) -+ except SQLException: -+ pass -+ -+def cleanGroupsAndUsers( stmt ): -+ rs = stmt.executeQuery("SELECT groname FROM pg_group WHERE groname LIKE 'pqsdbc_%'" ) -+ stmt2 = stmt.getConnection().createStatement() -+ while rs.next(): -+ stmt2.executeUpdate("DROP GROUP " + rs.getString(1) ) -+ -+ rs.close() -+ rs = stmt.executeQuery( "SELECT usename FROM pg_user WHERE usename LIKE 'pqsdbc_%'" ) -+ while rs.next(): -+ stmt2.executeUpdate( "DROP USER " + rs.getString(1) ) -+ -+ -+ -+ -+def executeDDLs( connection ): -+ -+ stmt = connection.createStatement() -+ -+ -+ executeIgnoringException( stmt, "DROP VIEW customer2" ) -+ executeIgnoringException( stmt, "DROP TABLE orderpos" ) -+ executeIgnoringException( stmt, "DROP TABLE ordertab" ) -+ executeIgnoringException( stmt, "DROP TABLE product" ) -+ executeIgnoringException( stmt, "DROP TABLE customer" ) -+ executeIgnoringException( stmt, "DROP TABLE blub" ) -+ executeIgnoringException( stmt, "DROP TABLE foo" ) -+ executeIgnoringException( stmt, "DROP TABLE nooid" ) -+ executeIgnoringException( stmt, "DROP TABLE nooid2" ) -+ cleanGroupsAndUsers( stmt ) -+ executeIgnoringException( stmt, "DROP DOMAIN pqsdbc_short" ) -+ executeIgnoringException( stmt, "DROP DOMAIN pqsdbc_amount" ) -+ executeIgnoringException( stmt, "DROP SCHEMA pqsdbc_test" ) -+ -+ ddls = ( -+ "BEGIN", -+ "CREATE DOMAIN pqsdbc_short AS int2", -+ "CREATE DOMAIN pqsdbc_amount AS integer", -+ "CREATE USER pqsdbc_joe", -+ "CREATE USER pqsdbc_susy", -+ "CREATE USER pqsdbc_boss", -+ "CREATE USER pqsdbc_customer", # technical user (e.g. a webfrontend) -+ "CREATE GROUP pqsdbc_employees WITH USER pqsdbc_joe,pqsdbc_susy", -+ "CREATE GROUP pqsdbc_admin WITH USER pqsdbc_susy,pqsdbc_boss", -+ "CREATE SCHEMA pqsdbc_test", -+ "CREATE TABLE customer ( "+ -+ "id char(8) UNIQUE PRIMARY KEY, "+ -+ "name text, " + -+ "dummySerial serial UNIQUE) WITH OIDS", -+ "COMMENT ON TABLE customer IS 'contains customer attributes'", -+ "COMMENT ON COLUMN customer.id IS 'unique id'", -+ "CREATE TABLE product ("+ -+ "id char(8) UNIQUE PRIMARY KEY,"+ -+ "name text,"+ -+ "price numeric(10,2),"+ -+ "image bytea) WITH OIDS", -+ -+ "CREATE TABLE ordertab ( "+ -+ "id char(8) UNIQUE PRIMARY KEY,"+ -+ "customerid char(8) CONSTRAINT cust REFERENCES customer(id) ON DELETE CASCADE ON UPDATE RESTRICT,"+ -+ "orderdate char(8),"+ -+ "delivered boolean ) WITH OIDS", -+ "CREATE TABLE orderpos ( "+ -+ "orderid char(8) REFERENCES ordertab(id),"+ -+ "id char(3),"+ -+ "productid char(8) REFERENCES product(id),"+ -+ "amount pqsdbc_amount,"+ -+ "shortamount pqsdbc_short,"+ -+ "PRIMARY KEY (orderid,id)) WITH OIDS", -+ "CREATE TABLE nooid ("+ -+ "id char(8) UNIQUE PRIMARY KEY,"+ -+ "name text) "+ -+ "WITHOUT OIDS", -+ "CREATE TABLE nooid2 ("+ -+ "id serial UNIQUE PRIMARY KEY,"+ -+ "name text) "+ -+ "WITHOUT OIDS", -+ "CREATE VIEW customer2 AS SELECT id,name FROM customer", -+ "GRANT SELECT ON TABLE customer,product,orderpos,ordertab TO pqsdbc_customer", -+ "GRANT SELECT ON TABLE product TO GROUP pqsdbc_employees", -+ "GRANT SELECT,UPDATE, INSERT ON TABLE customer TO GROUP pqsdbc_employees", -+ "GRANT ALL ON TABLE orderpos,ordertab TO GROUP pqsdbc_employees, GROUP pqsdbc_admin", -+ "GRANT ALL ON TABLE customer TO GROUP pqsdbc_admin", # the admin is allowed to delete customers -+ "GRANT ALL ON TABLE product TO pqsdbc_boss", # only the boss may change the product table -+ "INSERT INTO public.customer VALUES ('C1','John Doe')", -+ "INSERT INTO \"public\" . \"customer\" VALUES ('C2','Bruce Springsteen')", -+ -+ "INSERT INTO \"public\".product VALUES ('PZZ2','Pizza Mista',6.95,'\\003foo\\005')", -+ "INSERT INTO product VALUES ('PZZ5','Pizza Funghi',5.95,'\\001foo\\005')", -+ "INSERT INTO product VALUES ('PAS1','Lasagne',5.49,NULL)", -+ -+ "INSERT INTO ordertab VALUES ( '1', 'C2', '20030403','true')", -+ "INSERT INTO ordertab VALUES ( '2', 'C1', '20030402','false')", -+ -+ "INSERT INTO orderpos VALUES ( '1','001', 'PZZ2',2,0)", -+ "INSERT INTO orderpos VALUES ( '1','002', 'PZZ5',3,-1)", -+ "INSERT INTO orderpos VALUES ( '2','001', 'PAS1',5,1)", -+ "INSERT INTO orderpos VALUES ( '2','002', 'PZZ2',3,2)", -+ "COMMIT" ) -+ for i in ddls: -+ stmt.executeUpdate(i) -+ -+ connection.getTables() # force refresh of metadata -+ -+ stmt.close() -diff --git connectivity/workben/postgresql/main.py connectivity/workben/postgresql/main.py -new file mode 100644 -index 0000000..800dabc ---- /dev/null -+++ connectivity/workben/postgresql/main.py -@@ -0,0 +1,90 @@ -+#************************************************************************* -+# -+# $RCSfile: main.py,v $ -+# -+# $Revision: 1.1.2.2 $ -+# -+# last change: $Author: jbu $ $Date: 2004/05/09 20:04:59 $ -+# -+# The Contents of this file are made available subject to the terms of -+# either of the following licenses -+# -+# - GNU Lesser General Public License Version 2.1 -+# - Sun Industry Standards Source License Version 1.1 -+# -+# Sun Microsystems Inc., October, 2000 -+# -+# GNU Lesser General Public License Version 2.1 -+# ============================================= -+# Copyright 2000 by Sun Microsystems, Inc. -+# 901 San Antonio Road, Palo Alto, CA 94303, USA -+# -+# This library is free software; you can redistribute it and/or -+# modify it under the terms of the GNU Lesser General Public -+# License version 2.1, as published by the Free Software Foundation. -+# -+# This library is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+# Lesser General Public License for more details. -+# -+# You should have received a copy of the GNU Lesser General Public -+# License along with this library; if not, write to the Free Software -+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, -+# MA 02111-1307 USA -+# -+# -+# Sun Industry Standards Source License Version 1.1 -+# ================================================= -+# The contents of this file are subject to the Sun Industry Standards -+# Source License Version 1.1 (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.openoffice.org/license.html. -+# -+# Software provided under this License is provided on an "AS IS" basis, -+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, -+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, -+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. -+# See the License for the specific provisions governing your rights and -+# obligations concerning the Software. -+# -+# The Initial Developer of the Original Code is: Joerg Budischewski -+# -+# Copyright: 2000 by Sun Microsystems, Inc. -+# -+# All Rights Reserved. -+# -+# Contributor(s): Joerg Budischewski -+# -+# -+# -+#************************************************************************* -+import uno -+import unohelper -+import unittest -+import statement -+import preparedstatement -+import metadata -+import sdbcx -+import sys -+import os -+ -+ctx = uno.getComponentContext() -+ -+# needed for the tests -+unohelper.addComponentsToContext( -+ ctx,ctx, -+ ("postgresql-sdbc.uno","postgresql-sdbc-impl.uno","typeconverter.uno"), -+ "com.sun.star.loader.SharedLibrary") -+ -+runner = unittest.TextTestRunner(sys.stderr,1,2) -+dburl = sys.argv[1] # os.environ['USER'] + "_pqtest" -+print "dburl=" + dburl -+ -+suite = unittest.TestSuite() -+suite.addTest(statement.suite(ctx,dburl)) -+suite.addTest(preparedstatement.suite(ctx,dburl)) -+suite.addTest(metadata.suite(ctx,dburl)) -+suite.addTest(sdbcx.suite(ctx,dburl)) -+ -+runner.run(suite) -diff --git connectivity/workben/postgresql/makefile.mk connectivity/workben/postgresql/makefile.mk -new file mode 100644 -index 0000000..82ec2b6 ---- /dev/null -+++ connectivity/workben/postgresql/makefile.mk -@@ -0,0 +1,103 @@ -+#************************************************************************* -+# -+# $RCSfile: makefile.mk,v $ -+# -+# $Revision: 1.1.2.2 $ -+# -+# last change: $Author: jbu $ $Date: 2004/05/09 20:04:59 $ -+# -+# The Contents of this file are made available subject to the terms of -+# either of the following licenses -+# -+# - GNU Lesser General Public License Version 2.1 -+# - Sun Industry Standards Source License Version 1.1 -+# -+# Sun Microsystems Inc., October, 2000 -+# -+# GNU Lesser General Public License Version 2.1 -+# ============================================= -+# Copyright 2000 by Sun Microsystems, Inc. -+# 901 San Antonio Road, Palo Alto, CA 94303, USA -+# -+# This library is free software; you can redistribute it and/or -+# modify it under the terms of the GNU Lesser General Public -+# License version 2.1, as published by the Free Software Foundation. -+# -+# This library is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+# Lesser General Public License for more details. -+# -+# You should have received a copy of the GNU Lesser General Public -+# License along with this library; if not, write to the Free Software -+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, -+# MA 02111-1307 USA -+# -+# -+# Sun Industry Standards Source License Version 1.1 -+# ================================================= -+# The contents of this file are subject to the Sun Industry Standards -+# Source License Version 1.1 (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.openoffice.org/license.html. -+# -+# Software provided under this License is provided on an "AS IS" basis, -+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, -+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, -+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. -+# See the License for the specific provisions governing your rights and -+# obligations concerning the Software. -+# -+# The Initial Developer of the Original Code is: Sun Microsystems, Inc. -+# -+# Copyright: 2000 by Sun Microsystems, Inc. -+# -+# All Rights Reserved. -+# -+# Contributor(s): _______________________________________ -+# -+# -+# -+#************************************************************************* -+ -+PRJ=..$/.. -+ -+PRJNAME=connectivity -+TARGET=postgresql-test -+LIBTARGET=NO -+TARGETTYPE=CUI -+ENABLE_EXCEPTIONS=TRUE -+ -+# --- Settings ----------------------------------------------------- -+ -+.INCLUDE : settings.mk -+.INCLUDE : sv.mk -+# --- Files -------------------------------------------------------- -+ -+ -+PYFILES = \ -+ $(DLLDEST)$/statement.py \ -+ $(DLLDEST)$/preparedstatement.py \ -+ $(DLLDEST)$/main.py \ -+ $(DLLDEST)$/ddl.py \ -+ $(DLLDEST)$/sdbcx.py \ -+ $(DLLDEST)$/metadata.py -+ -+ALL : \ -+ $(PYFILES) \ -+ doc -+ -+.INCLUDE : target.mk -+ -+$(DLLDEST)$/%.py: %.py -+ +cp $? $@ -+ -+ -+.PHONY doc: -+ @echo "start test with dmake runtest dburl=your-url" -+ @echo " e.g. dmake runtest dburl=sdbc:postgresql:dbname=pqtest" -+ @echo " MUST: Create a separate datbases before (here pqtest)," -+ @echo " (SOME TABLES GET DROPPED)" -+ -+runtest : ALL -+ +cd $(DLLDEST) && python main.py "$(dburl)" -diff --git connectivity/workben/postgresql/metadata.py connectivity/workben/postgresql/metadata.py -new file mode 100644 -index 0000000..9485675 ---- /dev/null -+++ connectivity/workben/postgresql/metadata.py -@@ -0,0 +1,151 @@ -+#************************************************************************* -+# -+# $RCSfile: metadata.py,v $ -+# -+# $Revision: 1.1.2.4 $ -+# -+# last change: $Author: jbu $ $Date: 2006/05/27 11:33:11 $ -+# -+# The Contents of this file are made available subject to the terms of -+# either of the following licenses -+# -+# - GNU Lesser General Public License Version 2.1 -+# - Sun Industry Standards Source License Version 1.1 -+# -+# Sun Microsystems Inc., October, 2000 -+# -+# GNU Lesser General Public License Version 2.1 -+# ============================================= -+# Copyright 2000 by Sun Microsystems, Inc. -+# 901 San Antonio Road, Palo Alto, CA 94303, USA -+# -+# This library is free software; you can redistribute it and/or -+# modify it under the terms of the GNU Lesser General Public -+# License version 2.1, as published by the Free Software Foundation. -+# -+# This library is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+# Lesser General Public License for more details. -+# -+# You should have received a copy of the GNU Lesser General Public -+# License along with this library; if not, write to the Free Software -+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, -+# MA 02111-1307 USA -+# -+# -+# Sun Industry Standards Source License Version 1.1 -+# ================================================= -+# The contents of this file are subject to the Sun Industry Standards -+# Source License Version 1.1 (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.openoffice.org/license.html. -+# -+# Software provided under this License is provided on an "AS IS" basis, -+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, -+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, -+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. -+# See the License for the specific provisions governing your rights and -+# obligations concerning the Software. -+# -+# The Initial Developer of the Original Code is: Ralph Thomas -+# -+# Copyright: 2000 by Sun Microsystems, Inc. -+# -+# All Rights Reserved. -+# -+# Contributor(s): Ralph Thomas, Joerg Budischewski -+# -+#************************************************************************* -+import unittest -+import sys -+import ddl -+ -+from com.sun.star.sdbc.DataType import SMALLINT, INTEGER, BIGINT , DATE, TIME, TIMESTAMP, NUMERIC -+ -+def dumpResultSet( rs , count ): -+# for i in range(1, count): -+# sys.stdout.write(meta.getColumnName( i ) + "\t") -+ sys.stdout.write( "\n" ) -+ while rs.next(): -+ for i in range( 1, count+1): -+ sys.stdout.write( rs.getString( i ) + "\t" ) -+ sys.stdout.write( "\n" ) -+ rs.beforeFirst() -+ -+ -+ -+ -+def suite(ctx,dburl): -+ suite = unittest.TestSuite() -+ suite.addTest(TestCase("testDatabaseMetaData",ctx,dburl)) -+ suite.addTest(TestCase("testTypeGuess",ctx,dburl)) -+ return suite -+ -+class TestCase(unittest.TestCase): -+ def __init__(self,method,ctx,dburl): -+ unittest.TestCase.__init__(self,method) -+ self.ctx = ctx -+ self.dburl = dburl -+ -+ -+ def setUp( self ): -+ self.driver = self.ctx.ServiceManager.createInstanceWithContext( -+ 'org.openoffice.comp.connectivity.pq.Driver' , self.ctx ) -+ self.connection = self.driver.connect( self.dburl, () ) -+ ddl.executeDDLs( self.connection ) -+ -+ def tearDown( self ): -+ self.connection.close() -+ -+ def testDatabaseMetaData( self ): -+ meta = self.connection.getMetaData() -+ -+ rs = meta.getTables( None, "public", "%", () ) -+# dumpResultSet( rs, 5) -+ -+ rs = meta.getColumns( None, "%", "customer", "%" ) -+# dumpResultSet( rs, 18 ) -+ -+ rs = meta.getPrimaryKeys( None, "public" , "%" ) -+# dumpResultSet( rs , 6 ) -+ rs = meta.getTablePrivileges( None, "public" , "%" ) -+# dumpResultSet( rs , 7 ) -+ rs = meta.getColumns( None, "public" , "customer", "%" ) -+# dumpResultSet( rs , 18 ) -+ rs = meta.getTypeInfo() -+# dumpResultSet(rs, 18) -+ while rs.next(): -+ if rs.getString(1) == "pqsdbc_short": -+ self.failUnless( rs.getInt(2) == SMALLINT ) -+ break -+ self.failUnless( not rs.isAfterLast() ) # domain type cannot be found -+ -+ -+ rs = meta.getIndexInfo( None, "public" , "customer", False, False ) -+# dumpResultSet( rs, 13 ) -+ -+ def testTypeGuess( self ): -+ stmt = self.connection.createStatement() -+ rs = stmt.executeQuery( "SELECT sum(amount) FROM orderpos" ) -+ meta = rs.getMetaData() -+ self.failUnless( meta.getColumnType(1) == BIGINT ) -+ -+ stmt = self.connection.createStatement() -+ rs = stmt.executeQuery( "SELECT sum(price) FROM product" ) -+ meta = rs.getMetaData() -+ self.failUnless( meta.getColumnType(1) == NUMERIC ) -+ -+ rs = stmt.executeQuery( "SELECT max(ttime) FROM firsttable" ) -+ meta = rs.getMetaData() -+ self.failUnless( meta.getColumnType(1) == TIME ) -+ -+ rs = stmt.executeQuery( "SELECT max(tdate) FROM firsttable" ) -+ meta = rs.getMetaData() -+ self.failUnless( meta.getColumnType(1) == DATE ) -+ -+ rs = stmt.executeQuery( "SELECT max(ttimestamp) FROM firsttable" ) -+ meta = rs.getMetaData() -+ self.failUnless( meta.getColumnType(1) == TIMESTAMP ) -+# rs.next() -+# print rs.getString( 1 ) -diff --git connectivity/workben/postgresql/preparedstatement.py connectivity/workben/postgresql/preparedstatement.py -new file mode 100644 -index 0000000..d049c9f ---- /dev/null -+++ connectivity/workben/postgresql/preparedstatement.py -@@ -0,0 +1,228 @@ -+#************************************************************************* -+# -+# $RCSfile: preparedstatement.py,v $ -+# -+# $Revision: 1.1.2.9 $ -+# -+# last change: $Author: jbu $ $Date: 2008/07/07 21:37:11 $ -+# -+# The Contents of this file are made available subject to the terms of -+# either of the following licenses -+# -+# - GNU Lesser General Public License Version 2.1 -+# - Sun Industry Standards Source License Version 1.1 -+# -+# Sun Microsystems Inc., October, 2000 -+# -+# GNU Lesser General Public License Version 2.1 -+# ============================================= -+# Copyright 2000 by Sun Microsystems, Inc. -+# 901 San Antonio Road, Palo Alto, CA 94303, USA -+# -+# This library is free software; you can redistribute it and/or -+# modify it under the terms of the GNU Lesser General Public -+# License version 2.1, as published by the Free Software Foundation. -+# -+# This library is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+# Lesser General Public License for more details. -+# -+# You should have received a copy of the GNU Lesser General Public -+# License along with this library; if not, write to the Free Software -+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, -+# MA 02111-1307 USA -+# -+# -+# Sun Industry Standards Source License Version 1.1 -+# ================================================= -+# The contents of this file are subject to the Sun Industry Standards -+# Source License Version 1.1 (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.openoffice.org/license.html. -+# -+# Software provided under this License is provided on an "AS IS" basis, -+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, -+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, -+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. -+# See the License for the specific provisions governing your rights and -+# obligations concerning the Software. -+# -+# The Initial Developer of the Original Code is: Ralph Thomas -+# -+# Copyright: 2000 by Sun Microsystems, Inc. -+# -+# All Rights Reserved. -+# -+# Contributor(s): Ralph Thomas, Joerg Budischewski -+# -+#************************************************************************* -+import unittest -+import sys -+import ddl -+from uno import ByteSequence -+from com.sun.star.sdbc import SQLException -+from com.sun.star.sdbc.ResultSetConcurrency import UPDATABLE -+from com.sun.star.sdbc.DataType import NUMERIC,VARCHAR -+ -+def suite(ctx,dburl): -+ suite = unittest.TestSuite() -+ suite.addTest(TestCase("testQuery",ctx,dburl)) -+ suite.addTest(TestCase("testGeneratedResultSet",ctx,dburl)) -+ suite.addTest(TestCase("testUpdateableResultSet",ctx,dburl)) -+ suite.addTest(TestCase("testQuoteQuote",ctx,dburl)) -+ return suite -+ -+def realEquals( a,b,eps ): -+ val = a - b -+ if val < 0: -+ val = -1. * val -+ return val < eps -+ -+class TestCase(unittest.TestCase): -+ def __init__(self,method,ctx,dburl): -+ unittest.TestCase.__init__(self,method) -+ self.ctx = ctx -+ self.dburl = dburl -+ -+ def setUp(self): -+ self.driver = self.ctx.ServiceManager.createInstanceWithContext( -+ 'org.openoffice.comp.connectivity.pq.Driver', self.ctx ) -+ self.connection = self.driver.connect( self.dburl, () ) -+ ddl.executeDDLs( self.connection ) -+ -+ def testDown( self ): -+ self.connection.close() -+ -+ def testQuery( self ): -+ -+ stmts = "SELECT product.id FROM product WHERE product.price > :lowprice AND product.price < :upprice", \ -+ "SELECT product.id FROM product WHERE product.price > ? AND product.price < ?" , \ -+ "SELECT \"product\".\"id\" FROM product WHERE \"product\".\"price\" > :lowprice AND \"product\".\"price\" < :upprice" -+ -+ -+ for stmt in stmts: -+ prepstmt = self.connection.prepareStatement( stmt ) -+ prepstmt.setDouble( 1, 5.80 ) -+ prepstmt.setObjectWithInfo( 2, 7. , NUMERIC, 2) -+ prepstmt.setObjectWithInfo( 2, "7.0000", NUMERIC, 2 ) -+ rs = prepstmt.executeQuery( ) -+ self.failUnless( rs.getMetaData().getColumnCount() == 1 ) -+ self.failUnless( rs.getMetaData().getColumnName(1) == "id") -+ self.failUnless( prepstmt.getMetaData().getColumnCount() == 1 ) -+ self.failUnless( prepstmt.getMetaData().getColumnName(1) == "id" ) -+ self.failUnless( rs.next() ) -+ self.failUnless( rs.getString( 1 ).strip() == "PZZ2" ) -+ self.failUnless( rs.next() ) -+ self.failUnless( rs.getString( 1 ).strip() == "PZZ5" ) -+ self.failUnless( rs.isLast() ) -+ -+ prepstmt = self.connection.prepareStatement( -+ "SELECT name FROM product WHERE id = ?" ) -+ prepstmt.setString( 1, 'PZZ2' ) -+ rs = prepstmt.executeQuery() -+ self.failUnless( rs.next() ) -+ self.failUnless( rs.getString( 1 ) == "Pizza Mista" ) -+ self.failUnless( rs.isLast() ) -+ -+ prepstmt = self.connection.prepareStatement( -+ "SELECT name FROM product WHERE image = ?" ) -+ prepstmt.setBytes( 1, ByteSequence( "\001foo\005" ) ) -+ rs = prepstmt.executeQuery() -+ self.failUnless( rs.next() ) -+ self.failUnless( rs.getString( 1 ) == "Pizza Funghi" ) -+ self.failUnless( rs.isLast() ) -+ -+ prepstmt = self.connection.prepareStatement( -+ "SELECT * FROM ordertab WHERE delivered = ?" ) -+ prepstmt.setBoolean( 1 , False ) -+ rs = prepstmt.executeQuery() -+ self.failUnless( rs.next() ) -+ self.failUnless( rs.getString( 1 ).strip() == "2" ) -+ self.failUnless( rs.isLast() ) -+ -+ stmt = self.connection.createStatement() -+ rs = stmt.executeQuery( "SELECT * FROM \"public\".\"customer\"" ) -+ -+ stmt.executeUpdate( "DELETE FROM product where id='PAS5'" ) -+ prepstmt =self.connection.prepareStatement( -+ "INSERT INTO product VALUES(?,'Ravioli',?,NULL)" ); -+ prepstmt.setObjectWithInfo( 1, "PAS5" ,VARCHAR,0) -+ prepstmt.setObjectWithInfo( 2, "9.223" ,NUMERIC,2) -+ prepstmt.executeUpdate() -+ rs= stmt.executeQuery( "SELECT price FROM product WHERE id = 'PAS5'" ) -+ self.failUnless( rs.next() ) -+ self.failUnless( rs.getString( 1 ).strip() == "9.22" ) -+ -+ stmt.executeUpdate( "DELETE FROM product where id='PAS5'" ) -+ prepstmt =self.connection.prepareStatement( -+ "INSERT INTO product VALUES('PAS5','Ravioli',?,NULL)" ); -+ prepstmt.setObjectWithInfo( 1, 9.223,NUMERIC,2 ) -+ prepstmt.executeUpdate() -+ rs= stmt.executeQuery( "SELECT price FROM product WHERE id = 'PAS5'" ) -+ self.failUnless( rs.next() ) -+ self.failUnless( rs.getString( 1 ).strip() == "9.22" ) -+ -+ def testGeneratedResultSet( self ): -+ prepstmt = self.connection.prepareStatement( -+ "INSERT INTO customer VALUES( ?, ? )" ) -+ prepstmt.setString( 1, "C3" ) -+ prepstmt.setString( 2, "Norah Jones" ) -+ prepstmt.executeUpdate() -+ rs = prepstmt.getGeneratedValues() -+ self.failUnless( rs.next() ) -+ self.failUnless( rs.getInt( 3 ) == 3 ) -+ -+ prepstmt = self.connection.prepareStatement( -+ "INSERT INTO public.nooid (id,name) VALUES( ?, ? )" ) -+ prepstmt.setString( 1, "C3" ) -+ prepstmt.setString( 2, "Norah Jones" ) -+ prepstmt.executeUpdate() -+ rs = prepstmt.getGeneratedValues() -+ self.failUnless( rs.next() ) -+ self.failUnless( rs.getString(1).rstrip() == "C3" ) -+ -+ prepstmt = self.connection.prepareStatement( -+ "INSERT INTO public.nooid2 (name) VALUES( ? )" ) -+ prepstmt.setString( 1, "Norah Jones" ) -+ prepstmt.executeUpdate() -+ rs = prepstmt.getGeneratedValues() -+ self.failUnless( rs ) -+ self.failUnless( rs.next() ) -+ self.failUnless( rs.getString(2) == "Norah Jones" ) -+ self.failUnless( rs.getString(1) == "1" ) -+ -+ def testUpdateableResultSet( self ): -+ stmt = self.connection.createStatement() -+ stmt.ResultSetConcurrency = UPDATABLE -+ rs = stmt.executeQuery( "SELECT * FROM orderpos" ) -+# ddl.dumpResultSet( rs ) -+ rs.next() -+ rs.deleteRow() -+ rs.next() -+ rs.updateInt( 4 , 32 ) -+ rs.updateRow() -+ -+ rs.moveToInsertRow() -+ rs.updateString( 1 , '2' ) -+ rs.updateString( 2, '003' ) -+ rs.updateString( 3, 'PZZ5' ) -+ rs.updateInt( 4, 22 ) -+ rs.insertRow() -+ -+ rs = stmt.executeQuery( "SELECT * FROM orderpos" ) -+ rs = stmt.executeQuery( "SELECT * FROM \"public\".\"orderpos\"" ) -+# ddl.dumpResultSet( rs ) -+ -+ def testQuoteQuote( self ): -+ stmt = self.connection.prepareStatement( "select 'foo''l'" ) -+ rs = stmt.executeQuery() -+ self.failUnless( rs ) -+ self.failUnless( rs.next() ) -+ self.failUnless( rs.getString(1) == "foo'l" ) -+ -+ stmt = self.connection.prepareStatement( "select 'foo''''l'" ) -+ rs = stmt.executeQuery() -+ self.failUnless( rs ) -+ self.failUnless( rs.next() ) -+ self.failUnless( rs.getString(1) == "foo''l" ) -diff --git connectivity/workben/postgresql/sdbcx.py connectivity/workben/postgresql/sdbcx.py -new file mode 100644 -index 0000000..b864efc ---- /dev/null -+++ connectivity/workben/postgresql/sdbcx.py -@@ -0,0 +1,306 @@ -+#************************************************************************* -+# -+# $RCSfile: sdbcx.py,v $ -+# -+# $Revision: 1.1.2.6 $ -+# -+# last change: $Author: jbu $ $Date: 2007/01/07 13:50:38 $ -+# -+# The Contents of this file are made available subject to the terms of -+# either of the following licenses -+# -+# - GNU Lesser General Public License Version 2.1 -+# - Sun Industry Standards Source License Version 1.1 -+# -+# Sun Microsystems Inc., October, 2000 -+# -+# GNU Lesser General Public License Version 2.1 -+# ============================================= -+# Copyright 2000 by Sun Microsystems, Inc. -+# 901 San Antonio Road, Palo Alto, CA 94303, USA -+# -+# This library is free software; you can redistribute it and/or -+# modify it under the terms of the GNU Lesser General Public -+# License version 2.1, as published by the Free Software Foundation. -+# -+# This library is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+# Lesser General Public License for more details. -+# -+# You should have received a copy of the GNU Lesser General Public -+# License along with this library; if not, write to the Free Software -+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, -+# MA 02111-1307 USA -+# -+# -+# Sun Industry Standards Source License Version 1.1 -+# ================================================= -+# The contents of this file are subject to the Sun Industry Standards -+# Source License Version 1.1 (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.openoffice.org/license.html. -+# -+# Software provided under this License is provided on an "AS IS" basis, -+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, -+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, -+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. -+# See the License for the specific provisions governing your rights and -+# obligations concerning the Software. -+# -+# The Initial Developer of the Original Code is: Joerg Budischewski -+# -+# Copyright: 2000 by Sun Microsystems, Inc. -+# -+# All Rights Reserved. -+# -+# Contributor(s): Joerg Budischewski -+# -+# -+# -+#************************************************************************* -+import unittest -+import ddl -+import unohelper -+import sys -+from com.sun.star.sdbc import SQLException -+from com.sun.star.sdbc.DataType import VARCHAR, CHAR, DECIMAL, DOUBLE, BIGINT, NUMERIC -+from com.sun.star.sdbc.ColumnValue import NO_NULLS, NULLABLE -+from com.sun.star.sdbcx.KeyType import PRIMARY, FOREIGN, UNIQUE -+from com.sun.star.sdbc.KeyRule import RESTRICT, CASCADE, NO_ACTION -+ -+def suite(ctx,dburl): -+ suite = unittest.TestSuite() -+ suite.addTest(TestCase("testTables",ctx,dburl)) -+ suite.addTest(TestCase("testViews",ctx,dburl)) -+ suite.addTest(TestCase("testKeys",ctx,dburl)) -+ suite.addTest(TestCase("testUsers",ctx,dburl)) -+ suite.addTest(TestCase("testIndexes",ctx,dburl)) -+ return suite -+ -+def nullable2Str( v ): -+ if v == NO_NULLS: -+ return "NOT NULL" -+ return "" -+ -+def autoIncremtent2Str( v ): -+ if v: -+ return "auto increment" -+ return "" -+ -+def dumpColumns( columns ): -+ n = columns.getCount() -+ print "Name\t type\t prec\t scale\t" -+ for i in range( 0, n ): -+ col = columns.getByIndex( i ) -+ print col.Name + "\t "+col.TypeName + "\t " + str(col.Precision) + "\t " + str(col.Scale) + "\t "+\ -+ str( col.DefaultValue ) + "\t " + str( col.Description ) + "\t " +\ -+ autoIncremtent2Str( col.IsAutoIncrement ) + "\t " + \ -+ nullable2Str( col.IsNullable ) -+ -+ -+class TestCase(unittest.TestCase): -+ def __init__(self,method,ctx,dburl): -+ unittest.TestCase.__init__(self,method) -+ self.ctx = ctx -+ self.dburl = dburl -+ -+ def setUp( self ): -+ self.driver = self.ctx.ServiceManager.createInstanceWithContext( -+ 'org.openoffice.comp.connectivity.pq.Driver' , self.ctx ) -+ self.connection = self.driver.connect( self.dburl, () ) -+ ddl.executeDDLs( self.connection ) -+ -+ def tearDown( self ): -+ self.connection.close() -+ -+ def checkDescriptor( self, descriptor, name, typeName, type, prec, scale, defaultValue, desc ): -+ self.failUnless( descriptor.Name == name ) -+ self.failUnless( descriptor.TypeName == typeName ) -+ self.failUnless( descriptor.Type == type ) -+ self.failUnless( descriptor.Precision == prec ) -+ self.failUnless( descriptor.Scale == scale ) -+# print descriptor.DefaultValue + " == " + defaultValue -+# self.failUnless( descriptor.DefaultValue == defaultValue ) -+ self.failUnless( descriptor.Description == desc ) -+ -+ -+ def testKeys( self ): -+ dd = self.driver.getDataDefinitionByConnection( self.connection ) -+ tables = dd.getTables() -+ t = tables.getByName( "public.ordertab" ) -+ keys = t.getKeys() -+ key = keys.getByName( "cust" ) -+ self.failUnless( key.Name == "cust" ) -+ self.failUnless( key.Type == FOREIGN ) -+ self.failUnless( key.ReferencedTable == "public.customer" ) -+ self.failUnless( key.UpdateRule == RESTRICT ) -+ self.failUnless( key.DeleteRule == CASCADE ) -+ -+ keycolumns = keys.getByName( "ordertab_pkey" ).getColumns() -+ self.failUnless( keycolumns.getElementNames() == (u"id",) ) -+ -+ key = keys.getByName( "ordertab_pkey" ) -+ self.failUnless( key.Name == "ordertab_pkey" ) -+ self.failUnless( key.Type == PRIMARY ) -+ self.failUnless( key.UpdateRule == NO_ACTION ) -+ self.failUnless( key.DeleteRule == NO_ACTION ) -+ -+ keys = tables.getByName( "public.customer" ).getKeys() -+ key = keys.getByName( "customer_dummyserial_key" ) -+ self.failUnless( key.Name == "customer_dummyserial_key" ) -+ self.failUnless( key.Type == UNIQUE ) -+ self.failUnless( key.UpdateRule == NO_ACTION ) -+ self.failUnless( key.DeleteRule == NO_ACTION ) -+ -+ keys = tables.getByName( "public.orderpos" ).getKeys() -+ keyEnum = keys.createEnumeration() -+ while keyEnum.hasMoreElements(): -+ key = keyEnum.nextElement() -+ cols = key.getColumns() -+ colEnum = cols.createEnumeration() -+ while colEnum.hasMoreElements(): -+ col = colEnum.nextElement() -+ -+ def testViews( self ): -+ dd = self.driver.getDataDefinitionByConnection( self.connection ) -+ views = dd.getViews() -+ -+ v = views.getByName( "public.customer2" ) -+ self.failUnless( v.Name == "customer2" ) -+ self.failUnless( v.SchemaName == "public" ) -+ self.failUnless( v.Command != "" ) -+ -+ def testIndexes( self ): -+ dd = self.driver.getDataDefinitionByConnection( self.connection ) -+ tables = dd.getTables() -+ t = tables.getByName( "public.ordertab" ) -+ indexes = t.getIndexes() -+ index = indexes.getByName( "ordertab_pkey" ) -+ -+ self.failUnless( index.Name == "ordertab_pkey" ) -+ self.failUnless( index.IsPrimaryKeyIndex ) -+ self.failUnless( index.IsUnique ) -+ self.failUnless( not index.IsClustered ) -+ -+ columns = index.getColumns() -+ self.failUnless( columns.hasByName( "id" ) ) -+ -+ self.failUnless( columns.getByIndex(0).Name == "id" ) -+ -+ def checkRenameTable( self, t , tables): -+ t.rename( "foo" ) -+ self.failUnless( tables.hasByName( "public.foo" ) ) -+ -+ t.rename( "public.foo2" ) -+ self.failUnless( tables.hasByName( "public.foo2" ) ) -+ -+ try: -+ t.rename( "pqsdbc_test.foo2" ) -+ self.failUnless( tables.hasByName( "pqsdbc_test.foo2" ) ) -+ print "looks like a server 8.1 or later (changing a schema succeeded)" -+ t.rename( "pqsdbc_test.foo" ) -+ self.failUnless( tables.hasByName( "pqsdbc_test.foo" ) ) -+ t.rename( "public.foo2" ) -+ self.failUnless( tables.hasByName( "public.foo2" ) ) -+ except SQLException,e: -+ if e.Message.find( "support changing" ) >= 0: -+ print "looks like a server prior to 8.1 (changing schema failed with Message [" + e.Message.replace("\n", " ") + "])" -+ else: -+ raise e -+ tables.dropByName( "public.foo2" ) -+ -+ def testTables( self ): -+ dd = self.driver.getDataDefinitionByConnection( self.connection ) -+ tables = dd.getTables() -+ t = tables.getByName( "public.customer" ) -+ self.failUnless( t.Name == "customer" ) -+ self.failUnless( t.SchemaName == "public" ) -+ self.failUnless( t.Type == "TABLE" ) -+ -+ cols = t.getColumns() -+ self.failUnless( cols.hasByName( 'name' ) ) -+ self.failUnless( cols.hasByName( 'id' ) ) -+ col = cols.getByName( "dummyserial" ) -+# dumpColumns( cols ) -+ self.checkDescriptor( cols.getByName( "id" ), "id", "bpchar", CHAR, 8, 0, "", "unique id" ) -+ self.checkDescriptor( cols.getByName( "name" ), "name", "text", VARCHAR, 0, 0, "", "" ) -+ -+ dd = cols.createDataDescriptor() -+ dd.Name = "foo" -+ dd.TypeName = "CHAR" -+ dd.Type = CHAR -+ dd.Precision = 25 -+ dd.IsNullable = NULLABLE -+ cols.appendByDescriptor( dd ) -+ -+ dd.Name = "foo2" -+ dd.TypeName = "DECIMAL" -+ dd.Type = DECIMAL -+ dd.Precision = 12 -+ dd.Scale = 5 -+ dd.DefaultValue = "2.3423" -+ dd.Description = "foo2 description" -+ cols.appendByDescriptor( dd ) -+ -+ dd.Name = "cash" -+ dd.TypeName = "MONEY" -+ dd.Type = DOUBLE -+# dd.IsNullable = NO_NULLS -+ dd.DefaultValue = "'2.42'" -+ cols.appendByDescriptor( dd ) -+ -+ cols.refresh() -+ -+ self.checkDescriptor( cols.getByName( "foo"), "foo", "bpchar", CHAR, 25,0,"","") -+ self.checkDescriptor( -+ cols.getByName( "foo2"), "foo2", "numeric", NUMERIC, 12,5,"2.3423","foo2 description") -+# dumpColumns( cols ) -+ -+ datadesc = tables.createDataDescriptor() -+ datadesc.SchemaName = "public" -+ datadesc.Name = "blub" -+ datadesc.Description = "This describes blub" -+ -+ tables.appendByDescriptor( datadesc ) -+ -+ # make the appended descriptors known -+ tables.refresh() -+ -+ t = tables.getByName( "public.blub" ) -+ self.failUnless( t.Name == "blub" ) -+ self.failUnless( t.SchemaName == "public" ) -+ self.failUnless( t.Description == "This describes blub" ) -+ -+ cols = t.getColumns() -+ dd = cols.createDataDescriptor() -+ dd.Name = "mytext" -+ dd.TypeName = "text" -+ dd.Type = VARCHAR -+ dd.IsNullable = NO_NULLS -+ cols.appendByDescriptor( dd ) -+ -+ cols.refresh() -+ -+ dd.DefaultValue = "'myDefault'" -+ dd.Name = "mytext2" -+ dd.IsNullable = NULLABLE -+ dd.Description = "mytext-Description" -+ t.alterColumnByName( "mytext" , dd ) -+ -+ cols.refresh() -+ -+ self.checkDescriptor( cols.getByName( "mytext2" ), "mytext2", "text", VARCHAR, 0,0,"'myDefault'","mytext-Description" ) -+ -+ t = tables.getByName( "public.customer2" ) -+ self.checkRenameTable( t,tables ) -+ -+ t = tables.getByName( "public.blub" ) -+ self.checkRenameTable( t,tables ) -+ -+ -+ -+ def testUsers( self ): -+ dd = self.driver.getDataDefinitionByConnection( self.connection ) -+ users = dd.getUsers() -+ self.failUnless( "pqsdbc_joe" in users.getElementNames() ) -diff --git connectivity/workben/postgresql/statement.py connectivity/workben/postgresql/statement.py -new file mode 100644 -index 0000000..b471838 ---- /dev/null -+++ connectivity/workben/postgresql/statement.py -@@ -0,0 +1,277 @@ -+#************************************************************************* -+# -+# $RCSfile: statement.py,v $ -+# -+# $Revision: 1.1.2.5 $ -+# -+# last change: $Author: jbu $ $Date: 2006/05/27 11:33:11 $ -+# -+# The Contents of this file are made available subject to the terms of -+# either of the following licenses -+# -+# - GNU Lesser General Public License Version 2.1 -+# - Sun Industry Standards Source License Version 1.1 -+# -+# Sun Microsystems Inc., October, 2000 -+# -+# GNU Lesser General Public License Version 2.1 -+# ============================================= -+# Copyright 2000 by Sun Microsystems, Inc. -+# 901 San Antonio Road, Palo Alto, CA 94303, USA -+# -+# This library is free software; you can redistribute it and/or -+# modify it under the terms of the GNU Lesser General Public -+# License version 2.1, as published by the Free Software Foundation. -+# -+# This library is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+# Lesser General Public License for more details. -+# -+# You should have received a copy of the GNU Lesser General Public -+# License along with this library; if not, write to the Free Software -+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, -+# MA 02111-1307 USA -+# -+# -+# Sun Industry Standards Source License Version 1.1 -+# ================================================= -+# The contents of this file are subject to the Sun Industry Standards -+# Source License Version 1.1 (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.openoffice.org/license.html. -+# -+# Software provided under this License is provided on an "AS IS" basis, -+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, -+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, -+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. -+# See the License for the specific provisions governing your rights and -+# obligations concerning the Software. -+# -+# The Initial Developer of the Original Code is: Joerg Budischewski -+# -+# Copyright: 2000 by Sun Microsystems, Inc. -+# -+# All Rights Reserved. -+# -+# Contributor(s): Joerg Budischewski -+# -+# -+# -+#************************************************************************* -+import unohelper -+import unittest -+import ddl -+from com.sun.star.sdbc import SQLException, XArray -+from com.sun.star.sdbc.DataType import VARCHAR -+from com.sun.star.util import Date -+from com.sun.star.util import Time -+from com.sun.star.util import DateTime -+ -+# todo -+class MyArray( unohelper.Base, XArray ): -+ def __init__( self, data ): -+ self.data = data -+ def getBaseType( self ): -+ return VARCHAR -+ def getBaseTypeName( self ): -+ return "varchar" -+ def getArray( self, foo ): -+ return self.data -+ def getArrayAtIndex( self, startIndex, count, foo ): -+ return self.data[startIndex:startIndex+count-1] -+ def getResultSet( self, foo): -+ return None -+ def getResultSetAtIndex( self, startIndex, count, foo ): -+ return None -+ -+def suite(ctx,dburl): -+ suite = unittest.TestSuite() -+ suite.addTest(TestCase("testRobustness",ctx,dburl)) -+ suite.addTest(TestCase("testRow",ctx,dburl)) -+ suite.addTest(TestCase("testNavigation",ctx,dburl)) -+ suite.addTest(TestCase("testDatabaseMetaData",ctx,dburl)) -+ suite.addTest(TestCase("testGeneratedResultSet",ctx,dburl)) -+ suite.addTest(TestCase("testResultSetMetaData",ctx,dburl)) -+ suite.addTest(TestCase("testArray",ctx,dburl)) -+ return suite -+ -+def realEquals( a,b,eps ): -+ val = a - b -+ if val < 0: -+ val = -1. * val -+ return val < eps -+ -+class TestCase(unittest.TestCase): -+ def __init__(self,method,ctx,dburl): -+ unittest.TestCase.__init__(self,method) -+ self.ctx = ctx -+ self.dburl = dburl -+ -+ def setUp(self): -+ self.driver = self.ctx.ServiceManager.createInstanceWithContext( -+ 'org.openoffice.comp.connectivity.pq.Driver' , self.ctx ) -+ self.connection = self.driver.connect( self.dburl, () ) -+ self.stmt = self.connection.createStatement() -+ try: -+ self.stmt.executeUpdate( "DROP TABLE firsttable" ) -+ except SQLException,e: -+ pass -+ -+ ddls = ( -+ "BEGIN", -+ "CREATE TABLE firsttable (tString text,tInteger integer,tShort smallint,tLong bigint,tFloat real,"+ -+ "tDouble double precision,tByteSeq bytea,tBool boolean, tDate date, tTime time, tTimestamp timestamp, tIntArray integer[], tStringArray text[], tSerial serial ) WITH OIDS", -+ "INSERT INTO firsttable VALUES ( 'foo', 70000, 12000, 70001, 2.4, 2.45, 'huhu', 'true', '1999-01-08','04:05:06','1999-01-08 04:05:06', '{2,3,4}', '{\"huhu\",\"hi\"}')", -+ "INSERT INTO firsttable VALUES ( 'foo2', 69999, 12001, 70002, -2.4, 2.55, 'huhu', 'false', '1999-01-08','04:05:06','1999-01-08 04:05:06', NULL , '{\"bla\"}' )", -+ "INSERT INTO firsttable VALUES ( 'foo2', 69999, 12001, 70002, -2.4, 2.55, 'huhu', null, '1999-01-08', '04:05:06','1999-01-08 04:05:06', '{}' , '{\"bl ubs\",\"bl\\\\\\\\a}}b\\\\\"a\",\"blub\"}' )", -+ "COMMIT" ) -+ for i in ddls: -+ self.stmt.executeUpdate(i) -+ -+ def tearDown(self): -+ self.stmt.close() -+ self.connection.close() -+ -+ def testRow(self): -+ row = ("foo",70000,12000,70001,2.4,2.45, "huhu", True , -+ Date(8,1,1999), Time(0,6,5,4),DateTime(0,6,5,4,8,1,1999) ) -+ row2 = ("foo2",69999,12001,70002,-2.4,2.55, "huhu", False ) -+ -+ rs = self.stmt.executeQuery( "SELECT * from firsttable" ) -+ self.failUnless( rs.next() ) -+ -+ self.failUnless( rs.getString(1) == row[0] ) -+ self.failUnless( rs.getInt(2) == row[1] ) -+ self.failUnless( rs.getShort(3) == row[2] ) -+ self.failUnless( rs.getLong(4) == row[3] ) -+ self.failUnless( realEquals(rs.getFloat(5), row[4], 0.001)) -+ self.failUnless( realEquals(rs.getDouble(6), row[5], 0.00001)) -+ self.failUnless( rs.getBytes(7) == row[6] ) -+ self.failUnless( rs.getBoolean(8) == row[7] ) -+ self.failUnless( rs.getDate(9) == row[8] ) -+ self.failUnless( rs.getTime(10) == row[9] ) -+ self.failUnless( rs.getTimestamp(11) == row[10] ) -+ -+ a = rs.getArray(12) -+ data = a.getArray( None ) -+ self.failUnless( len( data ) == 3 ) -+ self.failUnless( int(data[0] ) == 2 ) -+ self.failUnless( int(data[1] ) == 3 ) -+ self.failUnless( int(data[2] ) == 4 ) -+ -+ self.failUnless( rs.next() ) -+ -+ self.failUnless( rs.next() ) -+ data = rs.getArray(13).getArray(None) -+ self.failUnless( data[0] == "bl ubs" ) -+ self.failUnless( data[1] == "bl\\a}}b\"a" ) # check special keys -+ self.failUnless( data[2] == "blub" ) -+ -+ rs.getString(8) -+ self.failUnless( rs.wasNull() ) -+ rs.getString(7) -+ self.failUnless( not rs.wasNull() ) -+ -+ self.failUnless( rs.findColumn( "tShort" ) == 3 ) -+ rs.close() -+ -+ def testNavigation( self ): -+ rs = self.stmt.executeQuery( "SELECT * from firsttable" ) -+ self.failUnless( rs.isBeforeFirst() ) -+ self.failUnless( not rs.isAfterLast() ) -+ self.failUnless( rs.isBeforeFirst() ) -+ -+ self.failUnless( rs.next() ) -+ self.failUnless( rs.isFirst() ) -+ self.failUnless( not rs.isLast() ) -+ self.failUnless( not rs.isBeforeFirst() ) -+ -+ self.failUnless( rs.next() ) -+ self.failUnless( rs.next() ) -+ self.failUnless( not rs.next() ) -+ self.failUnless( rs.isAfterLast() ) -+ -+ rs.absolute( 1 ) -+ self.failUnless( rs.isFirst() ) -+ -+ rs.absolute( 3 ) -+ self.failUnless( rs.isLast() ) -+ -+ rs.relative( -1 ) -+ self.failUnless( rs.getRow() == 2 ) -+ -+ rs.relative( 1 ) -+ self.failUnless( rs.getRow() == 3 ) -+ -+ rs.close() -+ -+ def testRobustness( self ): -+ rs = self.stmt.executeQuery( "SELECT * from firsttable" ) -+ -+ self.failUnlessRaises( SQLException, rs.getString , 1 ) -+ -+ rs.next() -+ self.failUnlessRaises( SQLException, rs.getString , 24 ) -+ self.failUnlessRaises( SQLException, rs.getString , 0 ) -+ -+ self.connection.close() -+ self.failUnlessRaises( SQLException, rs.getString , 1 ) -+ self.failUnlessRaises( SQLException, self.stmt.executeQuery, "SELECT * from firsttable" ) -+ rs.close() -+ -+ -+ def testDatabaseMetaData( self ): -+ meta = self.connection.getMetaData() -+ -+ self.failUnless( not meta.isReadOnly() ) -+ -+ def testGeneratedResultSet( self ): -+ self.stmt.executeUpdate( -+ "INSERT INTO firsttable VALUES ( 'foo3', 69998, 12001, 70002, -2.4, 2.55, 'huhu2')" ) -+ #ddl.dumpResultSet( self.stmt.getGeneratedValues() ) -+ rs = self.stmt.getGeneratedValues() -+ self.failUnless( rs.next() ) -+ self.failUnless( rs.getInt( 14 ) == 4 ) -+ -+ def testResultSetMetaData( self ): -+ rs = self.stmt.executeQuery( "SELECT * from firsttable" ) -+ -+ # just check, if we get results ! -+ meta = rs.getMetaData() -+ -+ count = meta.getColumnCount() -+ for i in range( 1, count+1): -+ meta.isNullable( i ) -+ meta.isCurrency( i ) -+ meta.isCaseSensitive( i ) -+ meta.isSearchable( i ) -+ meta.isSigned( i ) -+ meta.getColumnDisplaySize( i ) -+ meta.getColumnName( i ) -+ meta.getColumnLabel( i ) -+ meta.getSchemaName( i ) -+ meta.getPrecision( i ) -+ meta.getScale( i ) -+ meta.getTableName( i ) -+ meta.getColumnTypeName( i ) -+ meta.getColumnType( i ) -+ meta.isReadOnly( i ) -+ meta.isWritable( i ) -+ meta.isDefinitelyWritable( i ) -+ meta.getColumnServiceName( i ) -+ -+ def testArray( self ): -+ stmt = self.connection.prepareStatement( -+ "INSERT INTO firsttable VALUES ( 'insertedArray', 70000, 12000, 70001, 2.4, 2.45, 'huhu', 'true', '1999-01-08','04:05:06','1999-01-08 04:05:06', '{2,3,4}', ? )" ) -+ myarray = ( "a", "\"c", "}d{" ) -+ stmt.setArray( 1, MyArray( myarray ) ) -+ stmt.executeUpdate() -+ -+ stmt = self.connection.createStatement() -+ rs = stmt.executeQuery( "SELECT tStringArray FROM firsttable WHERE tString = 'insertedArray'" ) -+ rs.next() -+ data = rs.getArray(1).getArray(None) -+ self.failUnless( data[0] == myarray[0] ) -+ self.failUnless( data[1] == myarray[1] ) -+ self.failUnless( data[2] == myarray[2] ) --- -1.7.0.1 - diff --git a/804-gcc-4.3-postgresql.diff b/804-gcc-4.3-postgresql.diff deleted file mode 100644 index 6ad57c1..0000000 --- a/804-gcc-4.3-postgresql.diff +++ /dev/null @@ -1,87 +0,0 @@ ---- - .../drivers/postgresql/pq_preparedstatement.cxx | 2 ++ - .../drivers/postgresql/pq_resultsetmetadata.cxx | 1 + - .../source/drivers/postgresql/pq_statement.cxx | 1 + - .../source/drivers/postgresql/pq_statics.cxx | 2 ++ - .../source/drivers/postgresql/pq_tools.cxx | 1 + - .../drivers/postgresql/pq_updateableresultset.cxx | 2 ++ - 6 files changed, 9 insertions(+), 0 deletions(-) - -diff --git connectivity/source/drivers/postgresql/pq_preparedstatement.cxx connectivity/source/drivers/postgresql/pq_preparedstatement.cxx -index 1d66a8a..5fadf16 100644 ---- connectivity/source/drivers/postgresql/pq_preparedstatement.cxx -+++ connectivity/source/drivers/postgresql/pq_preparedstatement.cxx -@@ -77,6 +77,8 @@ - #include - #include - -+#include -+ - using osl::Mutex; - using osl::MutexGuard; - -diff --git connectivity/source/drivers/postgresql/pq_resultsetmetadata.cxx connectivity/source/drivers/postgresql/pq_resultsetmetadata.cxx -index d351b4c..1c7b768 100644 ---- connectivity/source/drivers/postgresql/pq_resultsetmetadata.cxx -+++ connectivity/source/drivers/postgresql/pq_resultsetmetadata.cxx -@@ -69,6 +69,7 @@ - #include - #include - -+#include - - using osl::Mutex; - using osl::MutexGuard; -diff --git connectivity/source/drivers/postgresql/pq_statement.cxx connectivity/source/drivers/postgresql/pq_statement.cxx -index b60edfc..086cd22 100644 ---- connectivity/source/drivers/postgresql/pq_statement.cxx -+++ connectivity/source/drivers/postgresql/pq_statement.cxx -@@ -86,6 +86,7 @@ - #include - #include - -+#include - - using osl::Mutex; - using osl::MutexGuard; -diff --git connectivity/source/drivers/postgresql/pq_statics.cxx connectivity/source/drivers/postgresql/pq_statics.cxx -index 177571d..71fbbff 100644 ---- connectivity/source/drivers/postgresql/pq_statics.cxx -+++ connectivity/source/drivers/postgresql/pq_statics.cxx -@@ -64,6 +64,8 @@ - #include - #include - -+#include -+ - using rtl::OUString; - using com::sun::star::uno::Sequence; - using com::sun::star::uno::Any; -diff --git connectivity/source/drivers/postgresql/pq_tools.cxx connectivity/source/drivers/postgresql/pq_tools.cxx -index c6b16e0..1f91984 100644 ---- connectivity/source/drivers/postgresql/pq_tools.cxx -+++ connectivity/source/drivers/postgresql/pq_tools.cxx -@@ -16,6 +16,7 @@ - #include "pq_statics.hxx" - - #include -+#include - - using rtl::OUString; - using rtl::OUStringBuffer; -diff --git connectivity/source/drivers/postgresql/pq_updateableresultset.cxx connectivity/source/drivers/postgresql/pq_updateableresultset.cxx -index 7efa005..6793373 100644 ---- connectivity/source/drivers/postgresql/pq_updateableresultset.cxx -+++ connectivity/source/drivers/postgresql/pq_updateableresultset.cxx -@@ -12,6 +12,8 @@ - #include "pq_tools.hxx" - #include "pq_statics.hxx" - -+#include -+ - using osl::MutexGuard; - - using rtl::OUString; --- -1.7.0.1 - diff --git a/805-sdbc-postgresql-config_office.diff b/805-sdbc-postgresql-config_office.diff deleted file mode 100644 index 00208ce..0000000 --- a/805-sdbc-postgresql-config_office.diff +++ /dev/null @@ -1,48 +0,0 @@ ---- - configure.in | 17 +++++++++++++++++ - set_soenv.in | 1 + - 2 files changed, 18 insertions(+), 0 deletions(-) - -diff --git configure.in configure.in -index cc0f65b..3620984 100644 ---- configure.in -+++ configure.in -@@ -4239,6 +4239,23 @@ AC_SUBST(SYSTEM_HSQLDB) - AC_SUBST(HSQLDB_JAR) - - dnl =================================================================== -+dnl Check for PostgreSQL stuff -+dnl =================================================================== -+AC_PATH_PROG(PGCONFIG, pg_config) -+if test -z "$PGCONFIG"; then -+ AC_MSG_ERROR([pg_config needed]) -+fi -+save_CFLAGS=$CFLAGS -+save_LIBS=$LIBS -+CFLAGS="-I`pg_config --includedir`" -+AC_CHECK_HEADER([libpq-fe.h], [], [AC_MSG_ERROR([libpq-fe.h is needed])], []) -+AC_HAVE_LIBRARY(pq, [], [AC_MSG_ERROR(libpq is needed)], []) -+CFLAGS=$save_CFLAGS -+LIBS=$save_LIBS -+SYSTEM_POSTGRESQL=YES # only option atm :-) -+AC_SUBST(SYSTEM_POSTGRESQL) -+ -+dnl =================================================================== - dnl Check for system beanshell - dnl =================================================================== - AC_MSG_CHECKING([which beanshell to use]) -diff --git set_soenv.in set_soenv.in -index d36115a..ababa63 100644 ---- set_soenv.in -+++ set_soenv.in -@@ -1935,6 +1935,7 @@ ToFile( "USE_XINERAMA", "@USE_XINERAMA@", "e" ); - ToFile( "SYSTEM_REDLAND", "@SYSTEM_REDLAND@", "e" ); - ToFile( "REDLAND_CFLAGS", "@REDLAND_CFLAGS@", "e" ); - ToFile( "REDLAND_LIBS", "@REDLAND_LIBS@", "e" ); -+ToFile( "SYSTEM_POSTGRESQL", "@SYSTEM_POSTGRESQL@", "e" ); - ToFile( "SYSTEM_HUNSPELL", "@SYSTEM_HUNSPELL@", "e" ); - ToFile( "HUNSPELL_CFLAGS", "@HUNSPELL_CFLAGS@", "e" ); - ToFile( "HUNSPELL_LIBS", "@HUNSPELL_LIBS@", "e" ); --- -1.7.0.1 - diff --git a/806-sdbc-postgresql-oxt.diff b/806-sdbc-postgresql-oxt.diff deleted file mode 100644 index e3a7537..0000000 --- a/806-sdbc-postgresql-oxt.diff +++ /dev/null @@ -1,72 +0,0 @@ ---- connectivity/source/drivers/postgresql/manifest.xml.old 2010-11-26 19:01:13.000000000 +0100 -+++ connectivity/source/drivers/postgresql/manifest.xml 2010-11-25 21:18:03.000000000 +0100 -@@ -0,0 +1,10 @@ -+ -+ -+ -+ -+ -+ -+ ---- connectivity/source/drivers/postgresql/description.xml.old 2010-11-26 19:01:26.000000000 +0100 -+++ connectivity/source/drivers/postgresql/description.xml 2010-11-26 18:59:36.000000000 +0100 -@@ -0,0 +1,14 @@ -+ -+ -+ -+ -+ -+ Postgresql-SDBC Driver -+ -+ -+ -+ -+ -+ Oracle -+ -+ ---- connectivity/source/drivers/postgresql/makefile.mk.old 2010-11-19 22:21:03.000000000 +0100 -+++ connectivity/source/drivers/postgresql/makefile.mk 2010-11-26 19:54:38.000000000 +0100 -@@ -176,7 +176,7 @@ SHL2VERSIONMAP=$(SOLARENV)$/src$/compone - SLOFILES= $(LIB1OBJFILES) $(LIB2OBJFILES) - - --DRIVERNAME=postgresql-sdbc-$(PQ_SDBC_MAJOR).$(PQ_SDBC_MINOR).$(PQ_SDBC_MICRO).zip -+DRIVERNAME=postgresql-sdbc-$(PQ_SDBC_MAJOR).$(PQ_SDBC_MINOR).$(PQ_SDBC_MICRO).oxt - ALLTAR : $(DLLDEST)$/$(DRIVERNAME) - - # --- Targets ------------------------------------------------------ -@@ -191,19 +191,29 @@ - $(DLLDEST)$/$(SHL1TARGET)$(INI_EXT): $(SHL1TARGET) - +cp $? $@ - -- - $(DLLDEST)$/$(DRIVERNAME): \ -+ $(DLLDEST)$/META-INF$/manifest.xml \ -+ $(DLLDEST)$/description.xml \ - $(DLLDEST)$/postgresql.xcu \ - $(DLLDEST)$/$(SHL1TARGET)$(DLLPOST) \ - $(DLLDEST)$/$(SHL2TARGET)$(DLLPOST) \ - $(DLLDEST)$/$(SHL1TARGET)$(INI_EXT) - +cd $(DLLDEST) && \ - zip -r $(DRIVERNAME) \ -+ META-INF$/manifest.xml \ - $(SHL1TARGET)$(DLLPOST) \ - $(SHL2TARGET)$(DLLPOST) \ - $(SHL1TARGET)$(INI_EXT) \ -+ description.xml \ - postgresql.xcu - -+$(DLLDEST)$/META-INF$/manifest.xml : manifest.xml -+ -mkdir -p $(DLLDEST)$/META-INF -+ +cp $? $@ -+ -+$(DLLDEST)$/description.xml : description.xml -+ +cp $? $@ -+ - $(DLLDEST)$/postgresql.xcu : postgresql.xcu - -rm -f $@ - cat postgresql.xcu > $@ diff --git a/807-sdbc-postgresql-obsolete-hash-map.diff b/807-sdbc-postgresql-obsolete-hash-map.diff deleted file mode 100644 index 90fa91b..0000000 --- a/807-sdbc-postgresql-obsolete-hash-map.diff +++ /dev/null @@ -1,101 +0,0 @@ ---- connectivity/source/drivers/postgresql/pq_connection.hxx.old 2011-08-16 12:26:22.000000000 +0200 -+++ connectivity/source/drivers/postgresql/pq_connection.hxx 2011-08-16 16:39:55.000000000 +0200 -@@ -61,7 +61,7 @@ - - #ifndef _PQ_CONNECTION_HXX_ - #define _PQ_CONNECTION_HXX_ --#include -+#include - #include - - #include -@@ -168,7 +168,7 @@ struct HashByteSequence - } - }; - --typedef ::std::hash_map< -+typedef std::tr1::unordered_map< - ::rtl::ByteSequence, - ::com::sun::star::uno::WeakReference< com::sun::star::sdbc::XCloseable >, - HashByteSequence, -@@ -179,11 +179,11 @@ typedef ::std::vector< rtl::OString, All - - - --typedef std::hash_map -+typedef std::tr1::unordered_map - < - const sal_Int32, - rtl::OUString, -- ::std::hash< sal_Int32 >, -+ ::std::tr1::hash< sal_Int32 >, - ::std::equal_to< sal_Int32 >, - Allocator< ::std::pair< sal_Int32, ::rtl::OUString > > - > Int2StringMap; ---- connectivity/source/drivers/postgresql/pq_statics.hxx.old 2011-08-16 12:26:22.000000000 +0200 -+++ connectivity/source/drivers/postgresql/pq_statics.hxx 2011-08-16 16:45:07.000000000 +0200 -@@ -61,7 +61,7 @@ - #ifndef _PQ_STATICS_HXX_ - #define _PQ_STATICS_HXX_ - --#include -+#include - #include - - #include -@@ -131,7 +131,7 @@ struct TypeDetails - sal_Bool isSearchable; - }; - --typedef ::std::hash_map -+typedef ::std::tr1::unordered_map - < - rtl::OUString, - sal_Int32, ---- connectivity/source/drivers/postgresql/pq_xcontainer.hxx.old 2011-08-16 12:26:22.000000000 +0200 -+++ connectivity/source/drivers/postgresql/pq_xcontainer.hxx 2011-08-16 16:44:56.000000000 +0200 -@@ -61,7 +61,7 @@ - - #ifndef _PQ_CONTAINER_HXX_ - #define _PQ_CONTAINER_HXX_ --#include -+#include - #include - - #include -@@ -111,7 +111,7 @@ public: - } - }; - --typedef ::std::hash_map -+typedef ::std::tr1::unordered_map - < - rtl::OUString, - sal_Int32, ---- connectivity/source/drivers/postgresql/pq_tools.hxx.old 2011-08-16 12:26:22.000000000 +0200 -+++ connectivity/source/drivers/postgresql/pq_tools.hxx 2011-08-16 16:46:51.000000000 +0200 -@@ -154,7 +154,7 @@ com::sun::star::uno::Sequence< sal_Int32 - com::sun::star::uno::Sequence< rtl::OUString > convertMappedIntArray2StringArray( - const Int2StringMap &map, const com::sun::star::uno::Sequence< sal_Int32> &source ); - --typedef std::hash_map -+typedef std::tr1::unordered_map - < - ::rtl::OString, - ::rtl::OString, ---- connectivity/source/drivers/postgresql/pq_databasemetadata.cxx.old 2011-08-16 12:26:22.000000000 +0200 -+++ connectivity/source/drivers/postgresql/pq_databasemetadata.cxx 2011-08-16 16:50:26.000000000 +0200 -@@ -1107,11 +1107,11 @@ struct DatabaseTypeDescription - OUString typeType; - }; - --typedef std::hash_map -+typedef std::tr1::unordered_map - < - sal_Int32, - DatabaseTypeDescription, -- ::std::hash< sal_Int32 >, -+ ::std::tr1::hash< sal_Int32 >, - ::std::equal_to< sal_Int32 >, - Allocator< ::std::pair< sal_Int32, DatabaseTypeDescription > > - > Oid2DatabaseTypeDescriptionMap; diff --git a/808-sdbc-postgresql-deliver.diff b/808-sdbc-postgresql-deliver.diff deleted file mode 100644 index 3d10e54..0000000 --- a/808-sdbc-postgresql-deliver.diff +++ /dev/null @@ -1,9 +0,0 @@ ---- connectivity/prj/d.lst.old 2011-05-19 12:27:40.000000000 +0200 -+++ connectivity/prj/d.lst 2011-08-16 17:29:34.000000000 +0200 -@@ -1,5 +1,6 @@ - ..\%__SRC%\bin\*.dll %_DEST%\bin%_EXT%\*.dll - ..\%__SRC%\bin\*.res %_DEST%\bin%_EXT%\*.res -+..\%__SRC%\lib\*.oxt %_DEST%\bin%_EXT%\*.oxt - ..\%__SRC%\lib\lib*.so %_DEST%\lib%_EXT%\lib*.so - ..\%__SRC%\lib\*.dylib %_DEST%\lib%_EXT%\*.dylib - ..\%__SRC%\lib\*.jnilib %_DEST%\lib%_EXT%\*.jnilib diff --git a/809-sdbc-postgresql-gcc-4.6.diff b/809-sdbc-postgresql-gcc-4.6.diff deleted file mode 100644 index 82f3239..0000000 --- a/809-sdbc-postgresql-gcc-4.6.diff +++ /dev/null @@ -1,15 +0,0 @@ ---- connectivity/source/drivers/postgresql/pq_allocator.hxx.old 2011-08-18 20:20:44.000000000 +0200 -+++ connectivity/source/drivers/postgresql/pq_allocator.hxx 2011-08-18 20:20:44.000000000 +0200 -@@ -176,6 +176,12 @@ public: - } - - //----------------------------------------- -+ void construct (pointer p) -+ { -+ new ((void*)p)T; -+ } -+ -+ //----------------------------------------- - void destroy (pointer p) - { - p->~T(); diff --git a/810-sdbc-postgresql-lo-3.4-registration.diff b/810-sdbc-postgresql-lo-3.4-registration.diff deleted file mode 100644 index 1d3d2f6..0000000 --- a/810-sdbc-postgresql-lo-3.4-registration.diff +++ /dev/null @@ -1,20 +0,0 @@ ---- connectivity/source/drivers/postgresql/makefile.mk.old 2011-08-29 19:17:52.000000000 +0200 -+++ connectivity/source/drivers/postgresql/makefile.mk 2011-08-29 19:17:52.000000000 +0200 -@@ -115,7 +115,7 @@ SHL1STDLIBS= \ - SHL1LIBS= $(LIB1TARGET) - SHL1DEF= $(MISC)$/$(SHL1TARGET).def - DEF1NAME= $(SHL1TARGET) --SHL1VERSIONMAP=$(SOLARENV)$/src$/component.map -+SHL1VERSIONMAP=$(SOLARENV)$/src$/reg-component.map - - # use the static version - .IF "$(GUI)"=="WNT" -@@ -170,7 +170,7 @@ SHL2STDLIBS= \ - SHL2LIBS= $(LIB2TARGET) - SHL2DEF= $(MISC)$/$(SHL2TARGET).def - DEF2NAME= $(SHL2TARGET) --SHL2VERSIONMAP=$(SOLARENV)$/src$/component.map -+SHL2VERSIONMAP=$(SOLARENV)$/src$/reg-component.map - - - SLOFILES= $(LIB1OBJFILES) $(LIB2OBJFILES) diff --git a/831-mozilla-no-xul-config.diff b/831-mozilla-no-xul-config.diff deleted file mode 100644 index cf3efbd..0000000 --- a/831-mozilla-no-xul-config.diff +++ /dev/null @@ -1,52 +0,0 @@ ---- configure.in.old 2011-08-25 18:51:45.000000000 +0200 -+++ configure.in 2011-08-29 14:29:38.000000000 +0200 -@@ -5093,13 +5093,20 @@ if test -n "$with_system_mozilla" && tes - PKG_CHECK_MODULES( MOZ_NSPR, $MOZ_FLAVOUR-nspr ) - fi - -- if test "$MOZ_FLAVOUR" != "libxul"; then -+ WITH_MOZILLA_XUL=YES -+ if test "$MOZ_FLAVOUR" = "mozilla"; then -+ # firefox changed the development model, so there is not longer a stable API -+ # some distros provide only mozilla-nss and mozilla-nspr but not the XUL stuff -+ PKG_CHECK_EXISTS($MOZ_FLAVOUR-xpcom, , [WITH_MOZILLA_XUL=NO]) -+ fi -+ -+ if test "$MOZ_FLAVOUR" != "libxul" -a "$WITH_MOZILLA_XUL" = "YES" ; then - PKG_CHECK_MODULES( MOZILLAXPCOM, $MOZ_FLAVOUR-xpcom, HASXPCOM="TRUE", HASXPCOM="" ) - MOZ_INC=`$PKG_CONFIG --variable=includedir $MOZ_FLAVOUR-xpcom` - MOZ_LIB=`$PKG_CONFIG --variable=libdir $MOZ_FLAVOUR-xpcom` - fi - -- if test -z "$HASXPCOM"; then -+ if test -z "$HASXPCOM" -a "$WITH_MOZILLA_XUL" = "YES" ; then - PKG_CHECK_MODULES( MOZILLAXPCOM, libxul ) - MOZ_INC=`$PKG_CONFIG --variable=includedir libxul` - MOZ_LIB=`$PKG_CONFIG --variable=libdir libxul` -@@ -5327,6 +5332,7 @@ AC_SUBST(ENABLE_NSS_MODULE) - AC_SUBST(MOZILLABUILD) - AC_SUBST(SYSTEM_MOZILLA) - AC_SUBST(MOZ_FLAVOUR) -+AC_SUBST(WITH_MOZILLA_XUL) - AC_SUBST(MOZ_INC) - AC_SUBST(MOZ_LIB) - AC_SUBST(MOZ_LIB_XPCOM) ---- set_soenv.in.old 2011-08-25 18:51:45.000000000 +0200 -+++ set_soenv.in 2011-08-29 14:52:00.000000000 +0200 -@@ -1411,7 +1411,7 @@ elsif ($platform =~ m/darwin/) - - } - --if ($SYSTEM_MOZILLA eq "YES") -+if ($SYSTEM_MOZILLA eq "YES" && "@MOZ_LIB@" ne "") - { - $SOLARLIB .= $L."@MOZ_LIB@" - } -@@ -1892,6 +1892,7 @@ ToFile( "WITH_OPENLDAP", "@WITH_OPEN - ToFile( "WITH_MOZILLA", "@WITH_MOZILLA@", "e" ); - ToFile( "SYSTEM_MOZILLA", "@SYSTEM_MOZILLA@", "e" ); - ToFile( "MOZ_FLAVOUR", "@MOZ_FLAVOUR@", "e" ); -+ToFile( "WITH_MOZILLA_XUL", "@WITH_MOZILLA_XUL@", "e" ); - ToFile( "NSPR_LIB", "@NSPR_LIB@", "e" ); - ToFile( "NSS_LIB", "@NSS_LIB@", "e" ); - ToFile( "MOZ_INC", "@MOZ_INC@", "e" ); diff --git a/831126a1ee5af269923cfab6050769fe-mysql-connector-cpp.zip b/831126a1ee5af269923cfab6050769fe-mysql-connector-cpp.zip deleted file mode 100644 index 626dfaa..0000000 --- a/831126a1ee5af269923cfab6050769fe-mysql-connector-cpp.zip +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:ba148991ebb48988ddd97706574ff6fec8a60d06c88d0e26961979636f7a5a6a -size 169510 diff --git a/832-mozilla-no-xul-cui.diff b/832-mozilla-no-xul-cui.diff deleted file mode 100644 index 01c8919..0000000 --- a/832-mozilla-no-xul-cui.diff +++ /dev/null @@ -1,24 +0,0 @@ ---- cui/source/options/treeopt.cxx.old 2011-05-20 18:05:12.000000000 +0200 -+++ cui/source/options/treeopt.cxx 2011-08-29 17:03:53.000000000 +0200 -@@ -2128,7 +2128,7 @@ void OfaTreeOptionsDialog::Initialize( c - if ( nPageId == RID_SVXPAGE_INET_MAIL ) - continue; - #endif --#if defined MACOSX -+#if defined MACOSX || !defined WITH_MOZILLA_XUL - // Disable Mozilla Plug-in tab-page on Mac - if ( nPageId == RID_SVXPAGE_INET_MOZPLUGIN ) - continue; ---- cui/source/options/makefile.mk.old 2011-08-29 18:30:17.000000000 +0200 -+++ cui/source/options/makefile.mk 2011-08-29 16:28:25.000000000 +0200 -@@ -38,6 +38,10 @@ ENABLE_EXCEPTIONS=TRUE - CFLAGS+= -DENABLE_LAYOUT=1 -I../$(PRJ)/layout/inc -I../$(PRJ)/layout/$(INPATH)/inc - .ENDIF # ENABLE_LAYOUT == TRUE - -+.IF "$(WITH_MOZILLA_XUL)" == "YES" -+CFLAGS+= -DWITH_MOZILLA_XUL -+.ENDIF -+ - # --- Files -------------------------------------------------------- - - SRS1NAME=options diff --git a/833-mozilla-no-xul-extensions.diff b/833-mozilla-no-xul-extensions.diff deleted file mode 100644 index 1576bb0..0000000 --- a/833-mozilla-no-xul-extensions.diff +++ /dev/null @@ -1,53 +0,0 @@ ---- extensions/source/plugin/unx/makefile.mk.old 2011-05-20 18:05:12.000000000 +0200 -+++ extensions/source/plugin/unx/makefile.mk 2011-08-29 16:36:14.000000000 +0200 -@@ -48,7 +48,7 @@ INCPRE+=-I$(SOLARINCDIR)$/mozilla$/nspr - CDEFS+=-DOJI - .ENDIF - --.IF "$(WITH_MOZILLA)" != "NO" -+.IF "$(WITH_MOZILLA)" != "NO" && "$(WITH_MOZILLA_XUL)" != "NO" - - .IF "$(DISABLE_XAW)" == "TRUE" - CDEFS+=-DDISABLE_XAW ---- extensions/source/plugin/base/makefile.mk.old 2011-05-20 18:05:12.000000000 +0200 -+++ extensions/source/plugin/base/makefile.mk 2011-08-29 14:57:18.000000000 +0200 -@@ -44,7 +44,7 @@ CDEFS+=-DOJI - CDEFS+=-DDISABLE_XAW - .ENDIF - --.IF "$(WITH_MOZILLA)" != "NO" -+.IF "$(WITH_MOZILLA)" != "NO" && "$(WITH_MOZILLA_XUL)" != "NO" - - .IF "$(GUIBASE)"=="aqua" - CFLAGSCXX+=$(OBJCXXFLAGS) ---- extensions/source/plugin/util/makefile.pmk.old 2011-05-19 11:11:12.000000000 +0200 -+++ extensions/source/plugin/util/makefile.pmk 2011-08-29 14:58:04.000000000 +0200 -@@ -28,7 +28,7 @@ NOUNODOC=true - - .INCLUDE : settings.mk - --.IF "$(SYSTEM_MOZILLA)" == "YES" -+.IF "$(SYSTEM_MOZILLA)" == "YES" && "$(WITH_MOZILLA_XUL)" != "NO" - CFLAGS+=-DSYSTEM_MOZILLA - PKGCONFIG_MODULES+=$(MOZ_FLAVOUR)-plugin - .ENDIF ---- extensions/source/plugin/util/makefile.mk.old 2011-05-19 11:11:12.000000000 +0200 -+++ extensions/source/plugin/util/makefile.mk 2011-08-29 16:30:52.000000000 +0200 -@@ -36,7 +36,7 @@ TARGETTYPE=GUI - - # --- Files -------------------------------------------------------- - --.IF "$(WITH_MOZILLA)" != "NO" -+.IF "$(WITH_MOZILLA)" != "NO" && "$(WITH_MOZILLA_XUL)" != "NO" - - LIB1TARGET = $(SLB)$/plall.lib - LIB1FILES = \ -@@ -91,7 +91,7 @@ SHL1STDLIBS+=$(X11LINK_DYNAMIC) - - SHL1STDLIBS+=$(SHL1OWNLIBS) - --.ENDIF # $(WITH_MOZILLA) != "NO" -+.ENDIF # $(WITH_MOZILLA) != "NO" && "$(WITH_MOZILLA_XUL)" != "NO" - - # --- Targets ------------------------------------------------------ - diff --git a/834-mozilla-no-xul-scp2.diff b/834-mozilla-no-xul-scp2.diff deleted file mode 100644 index 6c8390e..0000000 --- a/834-mozilla-no-xul-scp2.diff +++ /dev/null @@ -1,62 +0,0 @@ ---- scp2/source/ooo/makefile.mk.old 2011-08-23 18:42:11.000000000 +0200 -+++ scp2/source/ooo/makefile.mk 2011-08-29 15:18:24.000000000 +0200 -@@ -127,6 +127,10 @@ SCPDEFS+=-DSYSTEM_DB - SCPDEFS+=-DWITHOUT_MOZILLA - .ENDIF - -+.IF "$(WITH_MOZILLA_XUL)" == "YES" -+SCPDEFS+=-DWITH_MOZILLA_XUL -+.ENDIF -+ - .IF "$(WITH_MYSPELL_DICTS)" == "NO" - SCPDEFS+=-DWITHOUT_MYSPELL_DICTS - .ENDIF ---- scp2/source/ooo/file_library_ooo.scp.old 2011-08-23 18:42:11.000000000 +0200 -+++ scp2/source/ooo/file_library_ooo.scp 2011-08-29 15:19:43.000000000 +0200 -@@ -1086,7 +1086,7 @@ End - - STD_LIB_FILE(gid_File_Lib_DeploymentMisc, deploymentmisc) - --#ifndef WITHOUT_MOZILLA -+#if ! defined(WITHOUT_MOZILLA) && defined (WITH_MOZILLA_XUL) - STD_LIB_FILE( gid_File_Lib_Pl , pl) - #endif - ---- scp2/source/ooo/common_brand.scp.old 2011-08-25 18:51:45.000000000 +0200 -+++ scp2/source/ooo/common_brand.scp 2011-08-29 16:42:11.000000000 +0200 -@@ -618,7 +618,7 @@ File gid_Brand_File_Bin_Libxml2 - End - #endif - --#if !defined WITHOUT_MOZILLA && (!defined UNX || defined ENABLE_GTK) -+#if !defined WITHOUT_MOZILLA && (!defined UNX || defined ENABLE_GTK) && defined WITH_MOZILLA_XUL - File gid_Brand_File_Lib_Npsoplugin - BIN_FILE_BODY; - Name = SPECIAL_NAME(npsoplugin); ---- scp2/source/ooo/file_ooo.scp.old 2011-08-25 18:51:45.000000000 +0200 -+++ scp2/source/ooo/file_ooo.scp 2011-08-29 16:44:15.000000000 +0200 -@@ -122,6 +122,7 @@ End - #ifndef WITHOUT_MOZILLA - - #if !defined(UNX) || defined(ENABLE_GTK) -+#if defined(WITH_MOZILLA_XUL) - File gid_File_Exe_Nsplugin - BIN_FILE_BODY; - Styles = (PACKED); -@@ -134,6 +135,7 @@ File gid_File_Exe_Nsplugin - End - #endif - #endif -+#endif - - File gid_File_Bin_Gengal - BIN_FILE_BODY; -@@ -164,7 +166,7 @@ File gid_File_Profile_Gengal - Name = PROFILENAME(gengal); - End - --#if !defined(WITHOUT_MOZILLA) && defined(UNX) && !defined(QUARTZ) -+#if !defined(WITHOUT_MOZILLA) && defined(UNX) && !defined(QUARTZ) && defined(WITH_MOZILLA_XUL) - - File gid_File_Bin_Pluginapp - BIN_FILE_BODY; diff --git a/83d4029aebf290c0a9a8fee9c99638d3-libwps-0.2.1.tar.bz2 b/83d4029aebf290c0a9a8fee9c99638d3-libwps-0.2.1.tar.bz2 deleted file mode 100644 index 2d46ee4..0000000 --- a/83d4029aebf290c0a9a8fee9c99638d3-libwps-0.2.1.tar.bz2 +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:4b5eea01d2579e1371b18c676a4fc6fe8ff303d8d63fed0c2c090b2e55339892 -size 295533 diff --git a/8d265a592619166f29c4672ea54812b7-libwpd-0.9.2.tar.bz2 b/8d265a592619166f29c4672ea54812b7-libwpd-0.9.2.tar.bz2 deleted file mode 100644 index 518f039..0000000 --- a/8d265a592619166f29c4672ea54812b7-libwpd-0.9.2.tar.bz2 +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:cc52efc05136876f90166d9bb778fb0d6be1dd05f3bce4435d42baa281109f1a -size 614862 diff --git a/9d283e02441d8cebdcd1e5d9df227d67-libwpg-0.2.1.tar.bz2 b/9d283e02441d8cebdcd1e5d9df227d67-libwpg-0.2.1.tar.bz2 new file mode 100644 index 0000000..3da1f95 --- /dev/null +++ b/9d283e02441d8cebdcd1e5d9df227d67-libwpg-0.2.1.tar.bz2 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a0bc8854af5affbcf6f91731d867163b96c4991220f8e3b28b9d49ca3cfba169 +size 335521 diff --git a/README-mono.txt b/README-mono.txt new file mode 100644 index 0000000..bd4f19f --- /dev/null +++ b/README-mono.txt @@ -0,0 +1,8 @@ +Dear customer, + +the mono support is temporary disabled due to technical problems. We will +provide it in a later bugfix release. Thanks for understanding. + + +Sincerely, +Your openSUSE team diff --git a/SUSE-10.1.conf b/SUSE-10.1.conf index 3542df0..47d4100 100644 --- a/SUSE-10.1.conf +++ b/SUSE-10.1.conf @@ -3,7 +3,6 @@ --without-fonts --with-system-jpeg --with-system-libxml ---with-system-mozilla --with-system-openssl --with-system-python --with-system-stdlibs @@ -39,7 +38,6 @@ --with-system-dicts --with-system-expat --with-system-libxslt ---with-system-mozilla=xulrunner --with-system-neon --with-system-odbc --with-xulrunner diff --git a/SUSE-11.1.conf b/SUSE-11.1.conf index dae250e..9c922d7 100644 --- a/SUSE-11.1.conf +++ b/SUSE-11.1.conf @@ -3,7 +3,6 @@ --without-fonts --with-system-jpeg --with-system-libxml ---with-system-mozilla --with-system-openssl --with-system-python --with-system-stdlibs @@ -47,7 +46,6 @@ --with-system-icu --with-system-libxslt --with-system-lpsolve ---with-system-mozilla=libxul --with-system-neon --with-system-odbc --with-system-sablot diff --git a/SUSE-11.2.conf b/SUSE-11.2.conf index d2ce23a..61ed329 100644 --- a/SUSE-11.2.conf +++ b/SUSE-11.2.conf @@ -3,7 +3,6 @@ --without-fonts --with-system-jpeg --with-system-libxml ---with-system-mozilla --with-system-openssl --with-system-python --with-system-stdlibs @@ -48,7 +47,6 @@ --with-system-icu --with-system-libxslt --with-system-lpsolve ---with-system-mozilla=libxul --with-system-neon --with-system-odbc --with-system-sablot diff --git a/SUSE-11.3.conf b/SUSE-11.3.conf index 0ff40c1..b47b7bb 100644 --- a/SUSE-11.3.conf +++ b/SUSE-11.3.conf @@ -3,7 +3,6 @@ --without-fonts --with-system-jpeg --with-system-libxml ---with-system-mozilla --with-system-openssl --with-system-python --with-system-stdlibs @@ -48,7 +47,6 @@ --with-system-icu --with-system-libxslt --with-system-lpsolve ---with-system-mozilla=libxul --with-system-neon --with-system-odbc --with-system-sablot diff --git a/SUSE-11.4.conf b/SUSE-11.4.conf index 0ff40c1..b47b7bb 100644 --- a/SUSE-11.4.conf +++ b/SUSE-11.4.conf @@ -3,7 +3,6 @@ --without-fonts --with-system-jpeg --with-system-libxml ---with-system-mozilla --with-system-openssl --with-system-python --with-system-stdlibs @@ -48,7 +47,6 @@ --with-system-icu --with-system-libxslt --with-system-lpsolve ---with-system-mozilla=libxul --with-system-neon --with-system-odbc --with-system-sablot diff --git a/SUSE.conf b/SUSE.conf index 0ff40c1..b47b7bb 100644 --- a/SUSE.conf +++ b/SUSE.conf @@ -3,7 +3,6 @@ --without-fonts --with-system-jpeg --with-system-libxml ---with-system-mozilla --with-system-openssl --with-system-python --with-system-stdlibs @@ -48,7 +47,6 @@ --with-system-icu --with-system-libxslt --with-system-lpsolve ---with-system-mozilla=libxul --with-system-neon --with-system-odbc --with-system-sablot diff --git a/b4cae0700aa1c2aef7eb7f345365e6f1-translate-toolkit-1.8.1.tar.bz2 b/b4cae0700aa1c2aef7eb7f345365e6f1-translate-toolkit-1.8.1.tar.bz2 deleted file mode 100644 index 6711285..0000000 --- a/b4cae0700aa1c2aef7eb7f345365e6f1-translate-toolkit-1.8.1.tar.bz2 +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:2c3ed36476e1279ba35d7c675961bfa9c40b1360153472e80508a99963c8d46c -size 11922684 diff --git a/b8cbca7b3363e6ca2d02bc0ba2b63904-numbertext_0.9.4.oxt b/b8cbca7b3363e6ca2d02bc0ba2b63904-numbertext_0.9.4.oxt new file mode 100644 index 0000000..c4fb8de --- /dev/null +++ b/b8cbca7b3363e6ca2d02bc0ba2b63904-numbertext_0.9.4.oxt @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:27ac68831ff430882b29a23e4af041fff646c1bfd143b76cd1b1ecbc09e0f29d +size 72340 diff --git a/bash-completion-for-loffice.diff b/bash-completion-for-loffice.diff deleted file mode 100644 index e52ddd9..0000000 --- a/bash-completion-for-loffice.diff +++ /dev/null @@ -1,88 +0,0 @@ ---- bin/generate-bash-completion.old 2011-07-11 20:30:31.000000000 +0200 -+++ bin/generate-bash-completion 2011-10-19 16:23:32.000000000 +0200 -@@ -43,6 +43,7 @@ my @EXTENSIONS=("oxt"); - # use "" if you want to disable any wrapper - my %APPS = ( - office => "libreoffice", -+ office_short => "loffice", - master => "", - base => "lobase", - calc => "localc", -@@ -65,6 +66,7 @@ sub usage() - print " $0 [--binsuffix=suffix]\n"; - print "\t\t[--compat-oowrappers]\n"; - print "\t\t[--office=wrapper_name]\n"; -+ print "\t\t[--office-short=wrapper_name]\n"; - print "\t\t[--master=wrapper_name]\n"; - print "\t\t[--base=wrapper_name]\n"; - print "\t\t[--calc=wrapper_name]\n"; -@@ -97,22 +99,25 @@ foreach my $arg (@ARGV) { - usage(); - exit 0; - } elsif ( $arg =~ /--compat-oowrappers/ ) { -- $APPS{'office'} = "ooffice"; -- $APPS{'master'} = ""; -- $APPS{'base'} = "oobase"; -- $APPS{'calc'} = "oocalc"; -- $APPS{'draw'} = "oodraw"; -- $APPS{'impress'} = "ooimpress"; -- $APPS{'math'} = "oomath"; -- $APPS{'template'} = "oofromtemplate"; -- $APPS{'unopkg'} = "unopkg"; -- $APPS{'web'} = "ooweb"; -- $APPS{'writer'} = "oowriter"; -+ $APPS{'office'} = "openoffice"; -+ $APPS{'office_short'} = "ooffice"; -+ $APPS{'master'} = ""; -+ $APPS{'base'} = "oobase"; -+ $APPS{'calc'} = "oocalc"; -+ $APPS{'draw'} = "oodraw"; -+ $APPS{'impress'} = "ooimpress"; -+ $APPS{'math'} = "oomath"; -+ $APPS{'template'} = "oofromtemplate"; -+ $APPS{'unopkg'} = "unopkg"; -+ $APPS{'web'} = "ooweb"; -+ $APPS{'writer'} = "oowriter"; - $office_shell_function = "_ooexp_"; - } elsif ( $arg =~ /--binsuffix=(.*)/ ) { - $binsuffix = "$1"; - } elsif ( $arg =~ /--office=(.*)/ ) { - $APPS{'office'} = "$1"; -+ } elsif ( $arg =~ /--office-short=(.*)/ ) { -+ $APPS{'office_short'} = "$1"; - } elsif ( $arg =~ /--master=(.*)/ ) { - $APPS{'master'} = "$1"; - } elsif ( $arg =~ /--base=(.*)/ ) { -@@ -182,19 +187,20 @@ sub print_suffixes_checks { - # skip the disabled wrapper - next if ( $APPS{$app} eq "" ); - -- if ($app eq "draw" ) { print_suffixes_check ($APPS{$app}, @DRAWDOCS); } -- if ($app eq "writer") { print_suffixes_check ($APPS{$app}, @WRITERDOCS, @MASTERDOCS); } -- if ($app eq "web") { print_suffixes_check ($APPS{$app}, @WEBDOCS); } -- if ($app eq "math") { print_suffixes_check ($APPS{$app}, @MATHDOCS); } -- if ($app eq "impress") { print_suffixes_check ($APPS{$app}, @IMPRESSDOCS); } -- if ($app eq "base") { print_suffixes_check ($APPS{$app}, @BASEDOCS); } -- if ($app eq "calc") { print_suffixes_check ($APPS{$app}, @CALCDOCS); } -- if ($app eq "master") { print_suffixes_check ($APPS{$app}, @MASTERDOCS); } -- if ($app eq "template") { print_suffixes_check ($APPS{$app}, @TEMPLATES); } -- # libreoffice should contain all... -- if ($app eq "office") { print_suffixes_check ($APPS{$app}, @DRAWDOCS, @WRITERDOCS, @MATHDOCS, @IMPRESSDOCS, @BASEDOCS, @CALCDOCS, @MASTERDOCS, @TEMPLATES, @WEBDOCS); } -+ if ($app eq "draw" ) { print_suffixes_check ($APPS{$app}, @DRAWDOCS); } -+ if ($app eq "writer") { print_suffixes_check ($APPS{$app}, @WRITERDOCS, @MASTERDOCS); } -+ if ($app eq "web") { print_suffixes_check ($APPS{$app}, @WEBDOCS); } -+ if ($app eq "math") { print_suffixes_check ($APPS{$app}, @MATHDOCS); } -+ if ($app eq "impress") { print_suffixes_check ($APPS{$app}, @IMPRESSDOCS); } -+ if ($app eq "base") { print_suffixes_check ($APPS{$app}, @BASEDOCS); } -+ if ($app eq "calc") { print_suffixes_check ($APPS{$app}, @CALCDOCS); } -+ if ($app eq "master") { print_suffixes_check ($APPS{$app}, @MASTERDOCS); } -+ if ($app eq "template") { print_suffixes_check ($APPS{$app}, @TEMPLATES); } -+ # libreoffice should contain all... -+ if (($app eq "office") || ($app eq "office_short")) -+ { print_suffixes_check ($APPS{$app}, @DRAWDOCS, @WRITERDOCS, @MATHDOCS, @IMPRESSDOCS, @BASEDOCS, @CALCDOCS, @MASTERDOCS, @TEMPLATES, @WEBDOCS); } - # unopkg is a standalone tool -- if ($app eq "unopkg") { print_suffixes_check ($APPS{$app}, @EXTENSIONS); } -+ if ($app eq "unopkg") { print_suffixes_check ($APPS{$app}, @EXTENSIONS); } - } - } - diff --git a/build-helpcontent-do-not-check-cups.diff b/build-helpcontent-do-not-check-cups.diff new file mode 100644 index 0000000..4405c8b --- /dev/null +++ b/build-helpcontent-do-not-check-cups.diff @@ -0,0 +1,11 @@ +--- configure.in.old 2012-03-22 18:15:24.000000000 +0100 ++++ configure.in 2012-03-22 18:30:53.000000000 +0100 +@@ -72,7 +72,7 @@ dnl ==================================== + #defaults unless the os test overrides this: + test_randr=yes + test_xrender=yes +-test_cups=yes ++test_cups=no + test_fontconfig=yes + + case "$host_os" in diff --git a/buildfix-ucb-glib-2.31.diff b/buildfix-ucb-glib-2.31.diff deleted file mode 100644 index 310c4c9..0000000 --- a/buildfix-ucb-glib-2.31.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- ucb/source/ucp/gvfs/gvfs_content.hxx.old 2011-05-19 12:27:43.000000000 +0200 -+++ ucb/source/ucp/gvfs/gvfs_content.hxx 2012-01-11 15:00:28.000000000 +0100 -@@ -35,7 +35,7 @@ - #include - #include - --#include -+#include - #include - #include - diff --git a/c01351d7db2b205de755d58769288224-libwpd-0.9.4.tar.bz2 b/c01351d7db2b205de755d58769288224-libwpd-0.9.4.tar.bz2 new file mode 100644 index 0000000..0ee0513 --- /dev/null +++ b/c01351d7db2b205de755d58769288224-libwpd-0.9.4.tar.bz2 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7895f0cf07ac98bd88f6d5cf26ba7f1d72fd8acaeb43b27ffa24846fccc80343 +size 629054 diff --git a/d28864eb2b59bb57b034c0d4662a3cee-libvisio-0.0.15.tar.bz2 b/d28864eb2b59bb57b034c0d4662a3cee-libvisio-0.0.15.tar.bz2 new file mode 100644 index 0000000..87968bd --- /dev/null +++ b/d28864eb2b59bb57b034c0d4662a3cee-libvisio-0.0.15.tar.bz2 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8433f409d36bba672b80062f9f72842a174aeb4363ff54288b132f05a88940db +size 382285 diff --git a/d7a242ca43e33e1b63d3073f9d46a6a8-librsvg-2.32.1.tar.gz b/d7a242ca43e33e1b63d3073f9d46a6a8-librsvg-2.32.1.tar.gz new file mode 100644 index 0000000..27e310b --- /dev/null +++ b/d7a242ca43e33e1b63d3073f9d46a6a8-librsvg-2.32.1.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:92565e1283cd9834bfef155ba29ff6f4e62699ef0debdf86687e21e9fbc9b68e +size 636510 diff --git a/desktop-submenu.diff b/desktop-submenu.diff index 26fe91c..b751728 100644 --- a/desktop-submenu.diff +++ b/desktop-submenu.diff @@ -1,5 +1,5 @@ ---- sysui/desktop/menus/math.desktop.old 2011-10-19 14:20:44.000000000 +0200 -+++ sysui/desktop/menus/math.desktop 2011-10-19 16:04:05.000000000 +0200 +--- sysui/desktop/menus/math.desktop.old 2012-02-24 16:34:51.000000000 +0100 ++++ sysui/desktop/menus/math.desktop 2012-03-01 16:35:23.000000000 +0100 @@ -4,7 +4,7 @@ Terminal=false NoDisplay=true Icon=math @@ -7,10 +7,10 @@ -Categories=Office;X-Red-Hat-Base;X-SuSE-Core-Office;X-MandrivaLinux-Office-Other; +Categories=Office;Math;X-Red-Hat-Base;X-MandrivaLinux-Office-Other; Exec=${UNIXBASISROOTNAME} --math %U - MimeType=application/vnd.oasis.opendocument.formula;application/vnd.sun.xml.math;application/vnd.stardivision.math;application/vnd.oasis.opendocument.formula-template;text/mathml; + MimeType=application/vnd.oasis.opendocument.formula;application/vnd.sun.xml.math;application/vnd.stardivision.math; Name=%PRODUCTNAME Math ---- sysui/desktop/menus/base.desktop.old 2011-05-20 18:05:59.000000000 +0200 -+++ sysui/desktop/menus/base.desktop 2011-10-19 16:01:23.000000000 +0200 +--- sysui/desktop/menus/base.desktop.old 2012-02-24 16:34:51.000000000 +0100 ++++ sysui/desktop/menus/base.desktop 2012-03-01 16:35:23.000000000 +0100 @@ -3,7 +3,7 @@ Version=1.0 Terminal=false Icon=base @@ -20,8 +20,8 @@ Exec=${UNIXBASISROOTNAME} --base %U MimeType=application/vnd.oasis.opendocument.database;application/vnd.sun.xml.base; Name=%PRODUCTNAME Base ---- sysui/desktop/menus/calc.desktop.old 2011-09-06 19:50:30.000000000 +0200 -+++ sysui/desktop/menus/calc.desktop 2011-10-19 16:01:50.000000000 +0200 +--- sysui/desktop/menus/calc.desktop.old 2012-02-24 16:34:51.000000000 +0100 ++++ sysui/desktop/menus/calc.desktop 2012-03-01 16:35:23.000000000 +0100 @@ -3,7 +3,7 @@ Version=1.0 Terminal=false Icon=calc @@ -29,10 +29,10 @@ -Categories=Office;X-Red-Hat-Base;X-SuSE-Core-Office;X-MandrivaLinux-Office-Spreadsheets; +Categories=Office;Spreadsheet;X-Red-Hat-Base;X-MandrivaLinux-Office-Spreadsheets; Exec=${UNIXBASISROOTNAME} --calc %U - MimeType=application/vnd.oasis.opendocument.spreadsheet;application/vnd.oasis.opendocument.spreadsheet-flat-xml;application/vnd.oasis.opendocument.spreadsheet-template;application/vnd.sun.xml.calc;application/vnd.sun.xml.calc.template;application/vnd.stardivision.calc;application/vnd.stardivision.chart;application/msexcel;application/vnd.ms-excel;application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;application/vnd.ms-excel.sheet.macroenabled.12;application/vnd.openxmlformats-officedocument.spreadsheetml.template;application/vnd.ms-excel.template.macroenabled.12;application/vnd.ms-excel.sheet.binary.macroenabled.12;text/csv;application/x-dbf;application/csv;application/excel;application/tab-separated-values;application/vnd.lotus-1-2-3;application/vnd.oasis.opendocument.chart;application/vnd.oasis.opendocument.chart-template;application/x-dbase;application/x-dos_ms_excel;application/x-excel;application/x-msexcel;application/x-ms-excel;application/x-quattropro;application/x-123;text/comma-separated-values;text/spreadsheet;text/tab-separated-values;text/x-comma-separated-values;text/x-csv; + MimeType=application/vnd.oasis.opendocument.spreadsheet;application/vnd.oasis.opendocument.spreadsheet-flat-xml;application/vnd.oasis.opendocument.spreadsheet-template;application/vnd.sun.xml.calc;application/vnd.sun.xml.calc.template;application/vnd.stardivision.calc;application/vnd.stardivision.chart;application/msexcel;application/vnd.ms-excel;application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;application/vnd.ms-excel.sheet.macroenabled.12;application/vnd.openxmlformats-officedocument.spreadsheetml.template;application/vnd.ms-excel.template.macroenabled.12;application/vnd.ms-excel.sheet.binary.macroenabled.12;text/csv;application/x-dbf;text/spreadsheet; Name=%PRODUCTNAME Calc ---- sysui/desktop/menus/draw.desktop.old 2011-09-06 19:50:30.000000000 +0200 -+++ sysui/desktop/menus/draw.desktop 2011-10-19 16:02:22.000000000 +0200 +--- sysui/desktop/menus/draw.desktop.old 2012-02-24 16:34:51.000000000 +0100 ++++ sysui/desktop/menus/draw.desktop 2012-03-01 16:35:23.000000000 +0100 @@ -3,7 +3,7 @@ Version=1.0 Terminal=false Icon=draw @@ -40,10 +40,10 @@ -Categories=Office;X-Red-Hat-Base;X-SuSE-Core-Office;X-MandrivaLinux-Office-Drawing; +Categories=Office;FlowChart;VectorGraphics;X-Red-Hat-Base;X-MandrivaLinux-Office-Drawing; Exec=${UNIXBASISROOTNAME} --draw %U - MimeType=application/vnd.oasis.opendocument.graphics;application/vnd.oasis.opendocument.graphics-flat-xml;application/vnd.oasis.opendocument.graphics-template;application/vnd.sun.xml.draw;application/vnd.sun.xml.draw.template;application/vnd.stardivision.draw;application/x-wpg; + MimeType=application/vnd.oasis.opendocument.graphics;application/vnd.oasis.opendocument.graphics-flat-xml;application/vnd.oasis.opendocument.graphics-template;application/vnd.sun.xml.draw;application/vnd.sun.xml.draw.template;application/vnd.stardivision.draw; Name=%PRODUCTNAME Draw ---- sysui/desktop/menus/impress.desktop.old 2011-09-06 19:50:30.000000000 +0200 -+++ sysui/desktop/menus/impress.desktop 2011-10-19 16:02:59.000000000 +0200 +--- sysui/desktop/menus/impress.desktop.old 2012-02-24 16:34:51.000000000 +0100 ++++ sysui/desktop/menus/impress.desktop 2012-03-01 16:35:23.000000000 +0100 @@ -3,7 +3,7 @@ Version=1.0 Terminal=false Icon=impress @@ -51,10 +51,10 @@ -Categories=Office;X-Red-Hat-Base;X-SuSE-Core-Office;X-MandrivaLinux-Office-Presentations; +Categories=Office;Presentation;X-Red-Hat-Base;X-MandrivaLinux-Office-Presentations; Exec=${UNIXBASISROOTNAME} --impress %U - MimeType=application/vnd.oasis.opendocument.presentation;application/vnd.oasis.opendocument.presentation-flat-xml;application/vnd.oasis.opendocument.presentation-template;application/vnd.sun.xml.impress;application/vnd.sun.xml.impress.template;application/vnd.stardivision.impress;application/mspowerpoint;application/vnd.ms-powerpoint;application/vnd.openxmlformats-officedocument.presentationml.presentation;application/vnd.ms-powerpoint.presentation.macroenabled.12;application/vnd.openxmlformats-officedocument.presentationml.template;application/vnd.ms-powerpoint.template.macroenabled.12;application/vnd.ms-powerpoint.slideshow.macroEnabled.12;application/vnd.openxmlformats-officedocument.presentationml.slideshow; + MimeType=application/vnd.oasis.opendocument.presentation;application/vnd.oasis.opendocument.presentation-flat-xml;application/vnd.oasis.opendocument.presentation-template;application/vnd.sun.xml.impress;application/vnd.sun.xml.impress.template;application/vnd.stardivision.impress;application/mspowerpoint;application/vnd.ms-powerpoint;application/vnd.openxmlformats-officedocument.presentationml.presentation;application/vnd.ms-powerpoint.presentation.macroenabled.12;application/vnd.openxmlformats-officedocument.presentationml.template;application/vnd.ms-powerpoint.template.macroenabled.12; Name=%PRODUCTNAME Impress ---- sysui/desktop/menus/writer.desktop.old 2011-09-06 19:50:30.000000000 +0200 -+++ sysui/desktop/menus/writer.desktop 2011-10-19 16:05:38.000000000 +0200 +--- sysui/desktop/menus/writer.desktop.old 2012-02-24 16:34:51.000000000 +0100 ++++ sysui/desktop/menus/writer.desktop 2012-03-01 16:35:23.000000000 +0100 @@ -3,7 +3,7 @@ Version=1.0 Terminal=false Icon=writer @@ -62,5 +62,5 @@ -Categories=Office;X-Red-Hat-Base;X-SuSE-Core-Office;X-MandrivaLinux-Office-Wordprocessors; +Categories=Office;WordProcessor;X-Red-Hat-Base;X-MandrivaLinux-Office-Wordprocessors; Exec=${UNIXBASISROOTNAME} --writer %U - MimeType=application/vnd.oasis.opendocument.text;application/vnd.oasis.opendocument.text-flat-xml;application/vnd.oasis.opendocument.text-template;application/vnd.oasis.opendocument.text-web;application/vnd.oasis.opendocument.text-master;application/vnd.sun.xml.writer;application/vnd.sun.xml.writer.template;application/vnd.sun.xml.writer.global;application/vnd.stardivision.writer;application/msword;application/vnd.ms-word;application/x-doc;application/rtf;text/rtf;application/vnd.wordperfect;application/wordperfect;application/vnd.openxmlformats-officedocument.wordprocessingml.document;application/vnd.ms-word.document.macroenabled.12;application/vnd.openxmlformats-officedocument.wordprocessingml.template;application/vnd.ms-word.template.macroenabled.12;application/vnd.ms-works;application/vnd.stardivision.writer-global;application/x-extension-txt;application/x-t602;text/plain; + MimeType=application/vnd.oasis.opendocument.text;application/vnd.oasis.opendocument.text-flat-xml;application/vnd.oasis.opendocument.text-template;application/vnd.oasis.opendocument.text-web;application/vnd.oasis.opendocument.text-master;application/vnd.sun.xml.writer;application/vnd.sun.xml.writer.template;application/vnd.sun.xml.writer.global;application/vnd.stardivision.writer;application/msword;application/vnd.ms-word;application/x-doc;application/x-hwp;application/rtf;text/rtf;application/vnd.wordperfect;application/wordperfect;application/vnd.lotus-wordpro;application/vnd.openxmlformats-officedocument.wordprocessingml.document;application/vnd.ms-word.document.macroenabled.12;application/vnd.openxmlformats-officedocument.wordprocessingml.template;application/vnd.ms-word.template.macroenabled.12; Name=%PRODUCTNAME Writer diff --git a/distro-install-file-lists-3.5.diff b/distro-install-file-lists-3.5.diff new file mode 100644 index 0000000..2c69f2e --- /dev/null +++ b/distro-install-file-lists-3.5.diff @@ -0,0 +1,75 @@ +--- bin/distro-install-file-lists.old 2012-03-21 18:45:58.000000000 +0100 ++++ bin/distro-install-file-lists 2012-03-22 10:37:48.000000000 +0100 +@@ -74,7 +74,6 @@ if test "z$OOO_VENDOR" != "zDebian" ; th + + rm -f common_list.txt + for module in gid_Module_Root gid_Module_Root_Brand \ +- gid_Module_Root_Files_Images \ + gid_Module_Root_Files_[0-9] \ + gid_Module_Root_Hack \ + gid_Module_Oo_Linguistic \ +@@ -82,6 +81,9 @@ if test "z$OOO_VENDOR" != "zDebian" ; th + merge_flists $module $FILELISTSDIR/common_list.txt + done + ++ # it is not a real extension; it used to be in the main package... ++ merge_flists gid_Module_Optional_Extensions_Script_Provider_For_Javascript $FILELISTSDIR/common_list.txt ++ + if test "$SPLIT_APP_MODULES" = "YES" ; then + merge_flists gid_Module_Prg_Base_Bin $FILELISTSDIR/base_list.txt + merge_flists gid_Module_Prg_Calc_Bin $FILELISTSDIR/calc_list.txt +@@ -114,6 +116,15 @@ if test "z$OOO_VENDOR" != "zDebian" ; th + merge_flists gid_Module_Optional_OGLTrans $FILELISTSDIR/common_list.txt + fi + ++ if test "$SPLIT_APP_MODULES" = "YES" -a "$OOO_VENDOR" = "Novell, Inc." ; then ++ # move the prebuilt icons into a hacky temporary package ++ # we want to repack them into a noarch package as soon as possible ++ # without the build dependency on the huge devel package ++ merge_flists gid_Module_Root_Files_Images $FILELISTSDIR/icon_themes_prebuilt.txt ++ else ++ merge_flists gid_Module_Root_Files_Images $FILELISTSDIR/common_list.txt ++ fi ++ + if test "$SPLIT_OPT_FEATURES" = "YES" ; then + if test "z$OOO_VENDOR" = "zMandriva" ; then + merge_flists gid_Module_Optional_Binfilter $FILELISTSDIR/filter-binfilter_list.txt +@@ -235,6 +246,9 @@ if test "z$OOO_VENDOR" != "zDebian" ; th + add_used_directories mono_list.txt common_list.txt + # add the files from GAC if it was installed + test -f mono_gac && cat mono_gac >>mono_list.txt ++ ++ # postgresql subpackage ++ test -f $DESTDIR/gid_Module_Optional_PostgresqlSdbc && cp $DESTDIR/gid_Module_Optional_PostgresqlSdbc postgresql_list.txt || : + + # mailmerge + if test "$SPLIT_OPT_FEATURES" = "YES" ; then +@@ -247,8 +261,9 @@ if test "z$OOO_VENDOR" != "zDebian" ; th + add_used_directories $flist common_list.txt + fi + +- if test "z$OOO_VENDOR" = "zNovell" ; then ++ if test "z$OOO_VENDOR" = "zNovell, Inc." ; then + # officebean subpackage ++ test -f $DESTDIR/gid_Module_Optional_Extensions_Script_Provider_For_Beanshell && cp $DESTDIR/gid_Module_Optional_Extensions_Script_Provider_For_Beanshell officebean_list.txt || : + mv_file_between_flists officebean_list.txt common_list.txt $INSTALLDIR/program/classes/officebean.jar + mv_file_between_flists officebean_list.txt common_list.txt $INSTALLDIR/program/libofficebean.so + add_used_directories officebean_list.txt common_list.txt +@@ -267,17 +282,6 @@ if test "z$OOO_VENDOR" != "zDebian" ; th + add_used_directories sdk_doc_list.txt sdk_list.txt + fi + +- if test "$OOO_VENDOR" = "Novell, Inc." -a "$SPLIT_APP_MODULES" = "YES" ; then +- # move the prebuilt icons into a hacky temporary package +- # we want to repack them into a noarch package as soon as possible +- # without the build dependency on the huge devel package +- mv_file_between_flists icon_themes_prebuilt.txt common_list.txt $INSTALLDIR/share/config/images_classic8.zip +- mv_file_between_flists icon_themes_prebuilt.txt common_list.txt $INSTALLDIR/share/config/images_crystal.zip +- mv_file_between_flists icon_themes_prebuilt.txt common_list.txt $INSTALLDIR/share/config/images_hicontrast.zip +- mv_file_between_flists icon_themes_prebuilt.txt common_list.txt $INSTALLDIR/share/config/images_industrial.zip +- mv_file_between_flists icon_themes_prebuilt.txt common_list.txt $INSTALLDIR/share/config/images_tango.zip +- mv_file_between_flists icon_themes_prebuilt.txt common_list.txt $INSTALLDIR/share/config/images.zip +- fi + + # Mandriva packaging + if test "$OOO_VENDOR" = "Mandriva"; then diff --git a/do-not-display-math-in-desktop-menu.diff b/do-not-display-math-in-desktop-menu.diff deleted file mode 100644 index c70fe9c..0000000 --- a/do-not-display-math-in-desktop-menu.diff +++ /dev/null @@ -1,10 +0,0 @@ ---- sysui/desktop/menus/math.desktop.old 2011-09-06 19:50:30.000000000 +0200 -+++ sysui/desktop/menus/math.desktop 2011-10-19 14:20:44.000000000 +0200 -@@ -1,6 +1,7 @@ - [Desktop Entry] - Version=1.0 - Terminal=false -+NoDisplay=true - Icon=math - Type=Application - Categories=Office;X-Red-Hat-Base;X-SuSE-Core-Office;X-MandrivaLinux-Office-Other; diff --git a/e1c178b18f130b40494561f02bc1a948-libexttextcat-3.2.0.tar.bz2 b/e1c178b18f130b40494561f02bc1a948-libexttextcat-3.2.0.tar.bz2 new file mode 100644 index 0000000..5080612 --- /dev/null +++ b/e1c178b18f130b40494561f02bc1a948-libexttextcat-3.2.0.tar.bz2 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:389e95ebf50f32c261185897cca877101eb9e10660e16de4f2dfbe7194ea1a3c +size 947288 diff --git a/gengal-scp2.diff b/gengal-scp2.diff deleted file mode 100644 index 81f1f6d..0000000 --- a/gengal-scp2.diff +++ /dev/null @@ -1,38 +0,0 @@ ---- scp2/source/ooo/file_ooo.scp.old 2011-08-04 13:43:31.000000000 +0200 -+++ scp2/source/ooo/file_ooo.scp 2011-08-04 20:04:29.000000000 +0200 -@@ -135,6 +135,35 @@ End - #endif - #endif - -+File gid_File_Bin_Gengal -+ BIN_FILE_BODY; -+ Dir = gid_Brand_Dir_Program; -+ Styles = (PACKED); -+ #ifdef UNX -+ Name = "gengal.bin"; -+ #else -+ Name = "gengal.exe"; -+ #endif -+End -+ -+#ifdef UNX -+ -+File gid_File_Script_Gengal -+ BIN_FILE_BODY; -+ Dir = gid_Brand_Dir_Program; -+ Styles = (PACKED); -+ Name = "gengal"; -+End -+ -+#endif -+ -+File gid_File_Profile_Gengal -+ BIN_FILE_BODY; -+ Dir = gid_Brand_Dir_Program; -+ Styles = (PACKED); -+ Name = PROFILENAME(gengal); -+End -+ - #if !defined(WITHOUT_MOZILLA) && defined(UNX) && !defined(QUARTZ) - - File gid_File_Bin_Pluginapp diff --git a/gengal-svx.diff b/gengal-svx.diff deleted file mode 100644 index e1902ef..0000000 --- a/gengal-svx.diff +++ /dev/null @@ -1,281 +0,0 @@ ---- svx/source/gengal/gengal.sh.old 2011-08-04 14:29:39.000000000 +0200 -+++ svx/source/gengal/gengal.sh 2011-08-04 20:00:34.000000000 +0200 -@@ -0,0 +1,103 @@ -+#!/bin/sh -+#************************************************************************* -+# -+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -+# -+# Copyright 2000, 2010 Oracle and/or its affiliates. -+# -+# OpenOffice.org - a multi-platform office productivity suite -+# -+# This file is part of OpenOffice.org. -+# -+# OpenOffice.org is free software: you can redistribute it and/or modify -+# it under the terms of the GNU Lesser General Public License version 3 -+# only, as published by the Free Software Foundation. -+# -+# OpenOffice.org is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+# GNU Lesser General Public License version 3 for more details -+# (a copy is included in the LICENSE file that accompanied this code). -+# -+# You should have received a copy of the GNU Lesser General Public License -+# version 3 along with OpenOffice.org. If not, see -+# -+# for a copy of the LGPLv3 License. -+# -+#************************************************************************* -+ -+# enable file locking -+SAL_ENABLE_FILE_LOCKING=1 -+export SAL_ENABLE_FILE_LOCKING -+ -+# resolve installation directory -+sd_cwd="`pwd`" -+if [ -h "$0" ] ; then -+ sd_basename=`basename "$0"` -+ sd_script=`ls -l "$0" | sed "s/.*${sd_basename} -> //g"` -+ cd "`dirname "$0"`" -+ cd "`dirname "$sd_script"`" -+else -+ cd "`dirname "$0"`" -+fi -+ -+sd_prog="`pwd`" -+ -+cd .. -+sd_binary=`basename "$0"`".bin" -+sd_inst="`pwd`" -+ -+# change back directory -+cd "$sd_cwd" -+ -+# check if all required patches are installed -+if [ -x "$sd_prog/sopatchlevel.sh" ]; then -+ "$sd_prog/sopatchlevel.sh" -+ if [ $? -eq 1 ]; then -+ exit 0 -+ fi -+fi -+ -+# set search path for shared libraries -+sd_platform=`uname -s` -+sd_prog1="$sd_prog/../basis-link/program" -+sd_prog2="$sd_prog/../basis-link/ure-link/lib" -+case $sd_platform in -+ AIX) -+ LIBPATH=${sd_prog1}:${sd_prog2}${LIBPATH+:${LIBPATH}} -+ export LIBPATH -+ ;; -+ -+ Darwin) -+ DYLD_LIBRARY_PATH=${sd_prog1}:${sd_prog2}${DYLD_LIBRARY_PATH:+:${DYLD_LIBRARY_PATH}} -+ export DYLD_LIBRARY_PATH -+ ;; -+ -+ HP-UX) -+ SHLIB_PATH=${sd_prog1}:${sd_prog2}:/usr/openwin/lib${SHLIB_PATH:+:${SHLIB_PATH}} -+ export SHLIB_PATH -+ ;; -+ -+ *) -+ LD_LIBRARY_PATH=${sd_prog1}:${sd_prog2}${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH} -+ export LD_LIBRARY_PATH -+ ;; -+esac -+ -+# misc. environment variables -+unset XENVIRONMENT -+ -+# set path so that other apps can be started just by name -+PATH="$sd_prog":$PATH -+export PATH -+ -+OOO_INSTALL_PREFIX=${OOO_INSTALL_PREFIX-$sd_prog/../..} -+if ! test -e $OOO_INSTALL_PREFIX/basis-link; then -+ # Hack for vanilla OOo binaries' split install layout -+ OOO_INSTALL_PREFIX=$OOO_INSTALL_PREFIX/../openoffice.org3 -+fi -+ -+export OOO_INSTALL_PREFIX -+ -+# execute binary -+exec "$sd_prog/$sd_binary" "$@" ---- svx/source/gengal/gengalrc.in.old 2011-08-04 14:29:39.000000000 +0200 -+++ svx/source/gengal/gengalrc.in 2011-08-04 17:16:04.000000000 +0200 -@@ -0,0 +1,12 @@ -+OOO_INSTALL_PREFIX_URL=file://${OOO_INSTALL_PREFIX} -+OOO_BASIS_URL=${OOO_INSTALL_PREFIX_URL}/basis-link -+OOO_BASIS_BIN_URL=${OOO_BASIS_URL}/program -+OOO_URE_URL=${OOO_BASIS_URL}/ure-link -+# -+#CFG_INIFILE=${OOO_BASIS_BIN_URL}/configmgrrc -+#BaseInstallation=${OOO_BASIS_URL} -+BRAND_BASE_DIR=${OOO_INSTALL_PREFIX_URL} -+OOO_BASE_DIR=${OOO_BASIS_URL} -+# -+UNO_TYPES=${OOO_URE_URL}/share/misc/types.rdb ${OOO_BASIS_BIN_URL}/offapi.rdb -+UNO_SERVICES=${OOO_URE_URL}/share/misc/services.rdb ${OOO_BASIS_BIN_URL}/services.rdb ---- svx/source/gengal/gengal.cxx.old 2011-05-19 12:27:42.000000000 +0200 -+++ svx/source/gengal/gengal.cxx 2011-08-04 17:16:04.000000000 +0200 -@@ -68,7 +68,7 @@ - #include - #include - --#include -+#include - #include - - using namespace ::com::sun::star::uno; -@@ -101,7 +101,7 @@ void disposeGallery( Gallery* pGallery ) - static void createTheme( rtl::OUString aThemeName, - rtl::OUString aGalleryURL, - rtl::OUString aDestDir, -- UINT32 nNumFrom, -+ sal_uInt32 nNumFrom, - FileNameList &rFiles ) - { - Gallery * pGallery( createGallery( aGalleryURL ) ); -@@ -279,10 +279,10 @@ int GalApp::Main() - bool bHelp = false; - rtl::OUString aPath, aDestDir; - rtl::OUString aName(RTL_CONSTASCII_USTRINGPARAM("Default name")); -- UINT32 nNumFrom = 0; -+ sal_uInt32 nNumFrom = 0; - FileNameList aFiles; - -- for( USHORT i = 0; i < GetCommandLineParamCount(); i++ ) -+ for( sal_uInt16 i = 0; i < GetCommandLineParamCount(); i++ ) - { - rtl::OUString aParam = GetCommandLineParam( i ); - ---- svx/Module_svx.mk.old 2011-05-19 12:27:42.000000000 +0200 -+++ svx/Module_svx.mk 2011-08-04 17:38:49.000000000 +0200 -@@ -37,6 +37,8 @@ $(eval $(call gb_Module_add_targets,svx, - AllLangResTarget_textconversiondlgs \ - Package_inc \ - Package_sdi \ -+ Package_gengal \ -+ Executable_gengal.bin \ - )) - - $(eval $(call gb_Module_add_subsequentcheck_targets,svx,\ ---- svx/Executable_gengal.bin.mk.old 2011-08-04 14:29:39.000000000 +0200 -+++ svx/Executable_gengal.bin.mk 2011-08-04 17:38:02.000000000 +0200 -@@ -0,0 +1,78 @@ -+#************************************************************************* -+# -+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -+# -+# Copyright 2000, 2010 Oracle and/or its affiliates. -+# -+# OpenOffice.org - a multi-platform office productivity suite -+# -+# This file is part of OpenOffice.org. -+# -+# OpenOffice.org is free software: you can redistribute it and/or modify -+# it under the terms of the GNU Lesser General Public License version 3 -+# only, as published by the Free Software Foundation. -+# -+# OpenOffice.org is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+# GNU Lesser General Public License version 3 for more details -+# (a copy is included in the LICENSE file that accompanied this code). -+# -+# You should have received a copy of the GNU Lesser General Public License -+# version 3 along with OpenOffice.org. If not, see -+# -+# for a copy of the LGPLv3 License. -+# -+#************************************************************************* -+ -+$(eval $(call gb_Executable_Executable,gengal.bin)) -+ -+$(eval $(call gb_Executable_set_include,gengal.bin,\ -+ $$(INCLUDE) \ -+ -I$(SRCDIR)/svx/inc/ \ -+ -I$(SRCDIR)/svx/inc/pch \ -+ -I$(OUTDIR)/inc/offuh \ -+)) -+ -+$(eval $(call gb_Executable_set_cxxflags,gengal.bin,\ -+ $$(CXXFLAGS) \ -+)) -+ -+$(eval $(call gb_Executable_add_linked_libs,gengal.bin,\ -+ sal \ -+ tl \ -+ svl \ -+ comphelper \ -+ cppu \ -+ cppuhelper \ -+ vcl \ -+ ucbhelper \ -+ svxcore \ -+)) -+ -+$(eval $(call gb_Executable_add_exception_objects,gengal.bin,\ -+ svx/source/gengal/gengal \ -+)) -+ -+$(eval $(call gb_Executable_add_linked_static_libs,gengal.bin,\ -+ vclmain \ -+)) -+ -+ifeq ($(OS),WNT) -+$(eval $(call gb_Executable_add_linked_libs,gengal.bin,\ -+ kernel32 \ -+ msvcrt \ -+ oldnames \ -+ user32 \ -+ uwinapi \ -+)) -+endif -+ -+ifeq ($(OS),LINUX) -+$(eval $(call gb_Executable_add_linked_libs,gengal.bin,\ -+ dl \ -+ pthread \ -+)) -+endif -+ -+# vim: set noet sw=4 ts=4: ---- svx/Package_gengal.mk.old 2011-08-04 17:36:37.000000000 +0200 -+++ svx/Package_gengal.mk 2011-08-04 17:38:29.000000000 +0200 -@@ -0,0 +1,32 @@ -+#************************************************************************* -+# -+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -+# -+# Copyright 2000, 2011 Oracle and/or its affiliates. -+# -+# OpenOffice.org - a multi-platform office productivity suite -+# -+# This file is part of OpenOffice.org. -+# -+# OpenOffice.org is free software: you can redistribute it and/or modify -+# it under the terms of the GNU Lesser General Public License version 3 -+# only, as published by the Free Software Foundation. -+# -+# OpenOffice.org is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+# GNU Lesser General Public License version 3 for more details -+# (a copy is included in the LICENSE file that accompanied this code). -+# -+# You should have received a copy of the GNU Lesser General Public License -+# version 3 along with OpenOffice.org. If not, see -+# -+# for a copy of the LGPLv3 License. -+# -+#************************************************************************* -+ -+$(eval $(call gb_Package_Package,svx_gengal,$(SRCDIR)/svx/source/gengal)) -+$(eval $(call gb_Package_add_file,svx_gengal,bin/gengalrc,gengalrc.in)) -+$(eval $(call gb_Package_add_file,svx_gengal,bin/gengal,gengal.sh)) -+ -+# vim: set noet ts=4 sw=4: diff --git a/javasetting-mark-config.diff b/javasetting-mark-config.diff new file mode 100644 index 0000000..d65bdfc --- /dev/null +++ b/javasetting-mark-config.diff @@ -0,0 +1,10 @@ +--- bin/distro-install-file-lists.old 2012-02-24 16:34:51.000000000 +0100 ++++ bin/distro-install-file-lists 2012-03-19 11:56:31.000000000 +0100 +@@ -539,6 +539,7 @@ if test "z$RPM_CONFIG_FILE_TAGS" != "z" + -e "s|^($INSTALLDIR/program/[a-zA-Z0-9_\.]*rc)\$|$RPM_CONFIG_FILE_TAGS \\1|;" \ + -e "s|^($INSTALLDIR/program/.*\.xsl)\$|$RPM_CONFIG_FILE_TAGS \\1|;" \ + -e "s|^($INSTALLDIR/share/config/[a-zA-Z0-9]*rc)\$|$RPM_CONFIG_FILE_TAGS \\1|;" \ ++ -e "s|^($INSTALLDIR/share/config/javasettingsunopkginstall.xml)\$|$RPM_CONFIG_FILE_TAGS \\1|;" \ + -e "s|^($INSTALLDIR/share/dict/ooo/.*\.lst)\$|$RPM_CONFIG_FILE_TAGS \\1|;" \ + -e "s|^($INSTALLDIR/share/psprint/.*\.conf)\$|$RPM_CONFIG_FILE_TAGS \\1|;" \ + -e "s|^($INSTALLDIR/share/registry/.*\.xcu)\$|$RPM_CONFIG_FILE_TAGS \\1|;" \ diff --git a/kde4-tooltips-style.diff b/kde4-tooltips-style.diff deleted file mode 100644 index 54591d6..0000000 --- a/kde4-tooltips-style.diff +++ /dev/null @@ -1,58 +0,0 @@ -commit c2f539bcd920de8d2fa2983e700895a7ea308c9b -Author: LuboÅ¡ Luňák -Date: Tue Oct 18 17:37:22 2011 +0200 - - style tooltips properly with KDE4 vclplug (fdo#40461) - - ACK by Kendy. - -diff --git a/vcl/unx/kde4/KDESalFrame.cxx b/vcl/unx/kde4/KDESalFrame.cxx -index ab6bf1a..f9ae9f3 100644 ---- a/vcl/unx/kde4/KDESalFrame.cxx -+++ b/vcl/unx/kde4/KDESalFrame.cxx -@@ -38,6 +38,8 @@ - #include - #include - #include -+#include -+#include - - #undef Region - -@@ -240,11 +242,9 @@ void KDESalFrame::UpdateSettings( AllSettings& rSettings ) - style.SetFieldTextColor( aText ); - style.SetFieldRolloverTextColor( aText ); - style.SetWindowTextColor( aText ); -- style.SetHelpTextColor( aText ); - - // Base - style.SetFieldColor( aBase ); -- style.SetHelpColor( aBase ); - style.SetWindowColor( aBase ); - style.SetActiveTabColor( aBase ); - -@@ -280,11 +280,14 @@ void KDESalFrame::UpdateSettings( AllSettings& rSettings ) - style.SetHighlightColor( aHigh ); - style.SetHighlightTextColor( toColor(pal.color( QPalette::HighlightedText)) ); - -+ // Tooltip -+ style.SetHelpColor( toColor( QToolTip::palette().color( QPalette::Active, QPalette::ToolTipBase ))); -+ style.SetHelpTextColor( toColor( QToolTip::palette().color( QPalette::Active, QPalette::ToolTipText ))); -+ - // Font - Font aFont = toFont( kapp->font(), rSettings.GetUILocale() ); - - style.SetAppFont( aFont ); -- style.SetHelpFont( aFont ); - - style.SetMenuFont( aFont ); // will be changed according to pMenuBar - //style.SetToolFont( aFont ); //already set above -@@ -303,6 +306,8 @@ void KDESalFrame::UpdateSettings( AllSettings& rSettings ) - } - style.SetFloatTitleFont( aFont ); - -+ style.SetHelpFont( toFont( QToolTip::font(), rSettings.GetUILocale())); -+ - int flash_time = QApplication::cursorFlashTime(); - style.SetCursorBlinkTime( flash_time != 0 ? flash_time/2 : STYLE_CURSOR_NOBLINKTIME ); - diff --git a/library-link-order-to-build-with-as-needed.diff b/library-link-order-to-build-with-as-needed.diff new file mode 100644 index 0000000..ff7b9b1 --- /dev/null +++ b/library-link-order-to-build-with-as-needed.diff @@ -0,0 +1,73 @@ +From 29fe15039fd1d99b9597c51c96e1c429bcdcefe3 Mon Sep 17 00:00:00 2001 +From: Petr Mladek +Date: Tue, 23 Aug 2011 18:56:03 +0200 +Subject: [PATCH] fix library link order to build with --as-needed + +--- + connectivity/source/drivers/kab/makefile.mk | 4 ++-- + fpicker/source/unx/kde/makefile.mk | 7 +++++-- + sfx2/Library_qstart.mk | 4 ++++ + shell/source/backends/kdebe/makefile.mk | 5 +++-- + 4 files changed, 14 insertions(+), 6 deletions(-) + +diff --git a/connectivity/source/drivers/kab/makefile.mk b/connectivity/source/drivers/kab/makefile.mk +index 13d4857..1894558 100755 +--- a/connectivity/source/drivers/kab/makefile.mk ++++ b/connectivity/source/drivers/kab/makefile.mk +@@ -110,14 +110,14 @@ SHL2VERSIONMAP=$(TARGET2).map + + SHL2TARGET= $(TARGET2)$(KAB_MAJOR) + SHL2OBJS=$(SLO2FILES) +-SHL2LINKFLAGS+=$(KAB_LIB) + SHL2STDLIBS=\ + $(CPPULIB) \ + $(CPPUHELPERLIB) \ + $(SALLIB) \ + $(SALHELPERLIB) \ + $(DBTOOLSLIB) \ +- $(COMPHELPERLIB) ++ $(COMPHELPERLIB) \ ++ $(KAB_LIB) + + SHL2DEPN= + SHL2IMPLIB= i$(TARGET2) +diff --git a/fpicker/source/unx/kde/makefile.mk b/fpicker/source/unx/kde/makefile.mk +index e1bc4db..d131aa9 100644 +--- a/fpicker/source/unx/kde/makefile.mk ++++ b/fpicker/source/unx/kde/makefile.mk +@@ -60,8 +60,11 @@ SLOFILES =\ + APP1TARGET=$(TARGET) + APP1OBJS=$(SLOFILES) + APP1RPATH=OOO +-APP1LINKFLAGS=$(KDE_LIBS) -lkio -lX11 +-APP1STDLIBS=$(SALLIB) ++APP1STDLIBS=\ ++ $(SALLIB) \ ++ $(KDE_LIBS) \ ++ -lkio \ ++ -lX11 + + .ENDIF # "$(GUIBASE)" != "unx" || "$(ENABLE_KDE)" != "TRUE" + +diff --git a/shell/source/backends/kdebe/makefile.mk b/shell/source/backends/kdebe/makefile.mk +index b1b12ad..265a3b6 100755 +--- a/shell/source/backends/kdebe/makefile.mk ++++ b/shell/source/backends/kdebe/makefile.mk +@@ -63,11 +63,12 @@ SHL1OBJS=$(SLOFILES) + SHL1DEF=$(MISC)$/$(SHL1TARGET).def + + SHL1IMPLIB=i$(SHL1TARGET) +-SHL1LINKFLAGS+=$(KDE_LIBS) -lkio + SHL1STDLIBS= \ + $(CPPUHELPERLIB) \ + $(CPPULIB) \ +- $(SALLIB) ++ $(SALLIB) \ ++ $(KDE_LIBS) \ ++ -lkio + + SHL1DEF=$(MISC)$/$(SHL1TARGET).def + DEF1NAME=$(SHL1TARGET) +-- +1.7.8.3 + diff --git a/libreoffice-3.5-unpack-sources.diff b/libreoffice-3.5-unpack-sources.diff new file mode 100644 index 0000000..0612d3e --- /dev/null +++ b/libreoffice-3.5-unpack-sources.diff @@ -0,0 +1,70 @@ +--- bin/unpack-sources ++++ bin/unpack-sources +@@ -73,13 +73,13 @@ + echo "Error: Please, define where to unpack sources, try --help" + fi + +-if ! test -d $start_dir/src -a -f $start_dir/solenv/inc/target.mk ; then +- echo "Error: $start_dir is not a valid bootstrap directory" ++if ! test -f $start_dir/Repository.mk -a -f $start_dir/solenv/inc/target.mk ; then ++ echo "Error: $start_dir is not a valid LibreOffice core source directory" + exit 1; + fi + +-if test ! -f $start_dir/bootstrap.ver -o -d $start_dir/.git ; then +- echo "Warning: bootstrap sources are from git and not from tarball" ++if test ! -f $start_dir/core.ver -o -d $start_dir/.git ; then ++ echo "Warning: core sources are from git and not from tarball" + echo " Do nothing." + exit 0; + fi +@@ -89,17 +89,18 @@ + mkdir -p "$lo_src_dir" + + for tarball in $tarballs ; do +- tarname=`basename $tarball | sed -e "s/.tar.bz2//"` ++ tarname=`basename $tarball | sed -e "s/\.tar\..*//"` + if test -d $lo_src_dir/$tarname ; then + echo "Warning: $lo_src_dir/$tarname already exists => skipping" + continue; + fi + + echo "Unpacking $tarname..." +- tar -xjf "$tarball" -C "$lo_src_dir" ++ echo tar -xf "$tarball" -C "$lo_src_dir" ++ tar -xf "$tarball" -C "$lo_src_dir" + +- # create symlinks +- for dir in `find "$lo_src_dir/$tarname" -mindepth 1 -maxdepth 1 -type d -printf "$tarname/%f\n"` ; do ++ # create symlinks for module directories; ignore git-hooks directory ++ for dir in `find "$lo_src_dir/$tarname" -mindepth 1 -maxdepth 1 -type d -path $lo_src_dir/$tarname/git-hooks -o -printf "$tarname/%f\n"` ; do + ln -sf "src/$dir" "$start_dir" + done + done +--- download.old 2012-02-24 16:34:51.000000000 +0100 ++++ download 2012-03-01 14:51:54.000000000 +0100 +@@ -181,17 +181,17 @@ if [ "$COM" = "MSC" ]; then + downloaditem "http://download.microsoft.com/download/a/b/c/abc45517-97a0-4cee-a362-1957be2f24e1/" "WindowsXP-KB975337-x86-ENU.exe" "946d00d87e4094f3a6e425e2d538eadd" + fi + +-if [ -f $start_dir/bootstrap.ver -a ! -d $start_dir/.git ] ; then +- # bootstrap is from sources, so get the other source tarballs +- . $start_dir/bootstrap.ver ++if [ -f $start_dir/core.ver -a ! -d $start_dir/.git ] ; then ++ # core is from sources, so get the other source tarballs ++ . $start_dir/core.ver + lo_src_dir="$start_dir/src" + mkdir -p "$lo_src_dir" + for piece in `cat $start_dir/bin/repo-list` ; do +- tarname="libreoffice-$piece-$lo_bootstrap_ver" +- if [ ! -f "$TARFILE_LOCATION/$tarname.tar.bz2" ] ; then +- downloaditem "http://download.documentfoundation.org/libreoffice/src/" "$tarname.tar.bz2" "" ++ tarname="libreoffice-$piece-$lo_core_ver" ++ if [ ! -f "$TARFILE_LOCATION/$tarname.tar.xz" ] ; then ++ downloaditem "http://download.documentfoundation.org/libreoffice/src/" "$tarname.tar.xz" "" + fi +- $start_dir/bin/unpack-sources $start_dir $TARFILE_LOCATION/$tarname.tar.bz2 ++ $start_dir/bin/unpack-sources $start_dir $TARFILE_LOCATION/$tarname.tar.xz + done + fi + diff --git a/libreoffice-artwork-3.4.5.4.tar.bz2 b/libreoffice-artwork-3.4.5.4.tar.bz2 deleted file mode 100644 index 2383b31..0000000 --- a/libreoffice-artwork-3.4.5.4.tar.bz2 +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:36f208c9935a353265c0fafd86e64be2b8edf8aec69b20a860c07912b6ad347c -size 13725486 diff --git a/libreoffice-base-3.4.5.4.tar.bz2 b/libreoffice-base-3.4.5.4.tar.bz2 deleted file mode 100644 index 0a77e74..0000000 --- a/libreoffice-base-3.4.5.4.tar.bz2 +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:79c83d786f92a9c56ab9458eec498db960dc1fae0b7cf7cbdb6a80ef5b058ef1 -size 2071694 diff --git a/libreoffice-binfilter-3.5.2.2.tar.bz2 b/libreoffice-binfilter-3.5.2.2.tar.bz2 new file mode 100644 index 0000000..981ce53 --- /dev/null +++ b/libreoffice-binfilter-3.5.2.2.tar.bz2 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9cf26a246babe2813008dc195227c2c3c8ea95871c3fa7a568b05d284327d029 +size 6493757 diff --git a/libreoffice-bootstrap-3.4.5.4.tar.bz2 b/libreoffice-bootstrap-3.4.5.4.tar.bz2 deleted file mode 100644 index 209446a..0000000 --- a/libreoffice-bootstrap-3.4.5.4.tar.bz2 +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:1d5c66393840f90aba7d523514bafbfdf81020c4f920d120873cc4caea6f625a -size 2756195 diff --git a/libreoffice-bootstrap-optional-helpcontent.diff b/libreoffice-bootstrap-optional-helpcontent.diff deleted file mode 100644 index 1df4ef1..0000000 --- a/libreoffice-bootstrap-optional-helpcontent.diff +++ /dev/null @@ -1,264 +0,0 @@ ---- configure.in.old 2011-07-07 19:22:48.000000000 +0200 -+++ configure.in 2011-07-08 17:09:18.000000000 +0200 -@@ -167,6 +167,11 @@ AC_ARG_ENABLE(activex_component, - [Remove support for ActiveX embedding of LibO.]), - ,enable_activex_component=yes) - -+AC_ARG_ENABLE(helpcontent, -+ AS_HELP_STRING([--disable-helpcontent], -+ [Do not build helpcontent. The wiki help is enough.]), -+,) -+ - AC_ARG_ENABLE(odk, - AS_HELP_STRING([--disable-odk], - [LibO includes an ODK, office development kit which some packagers may -@@ -3837,6 +3842,18 @@ fi - AC_SUBST(BUILD_STAX) - - dnl =================================================================== -+dnl Check for building helpcontent -+dnl =================================================================== -+AC_MSG_CHECKING([whether to build helpcontent]) -+if test "$enable_helpcontent" != "no" ; then -+ BUILD_TYPE="$BUILD_TYPE HELPCONTENT2" -+ SCPDEFS="$SCPDEFS -DWITH_HELPCONTENT2" -+ AC_MSG_RESULT([yes]) -+else -+ AC_MSG_RESULT([no, wikihelp is enough]) -+fi -+ -+dnl =================================================================== - dnl Check for building ODK - dnl =================================================================== - AC_MSG_CHECKING([whether to build the ODK]) ---- scp2/source/draw/file_draw.scp.old 2011-05-18 17:51:47.000000000 +0200 -+++ scp2/source/draw/file_draw.scp 2011-07-08 16:59:32.000000000 +0200 -@@ -34,6 +34,8 @@ File gid_File_Share_Registry_Draw_Xcd - Name = "draw.xcd"; - End - -+#ifdef WITH_HELPCONTENT2 -+ - File gid_File_Help_Sdraw_Zip - Dir = gid_Dir_Help_Isolanguage; - ARCHIVE_TXT_FILE_BODY_HELPPACK; -@@ -41,6 +43,8 @@ File gid_File_Help_Sdraw_Zip - Patchfiles = (); - End - -+#endif -+ - File gid_File_Exe_Sdraw - BIN_FILE_BODY; - Dir = gid_Brand_Dir_Program; ---- scp2/source/base/file_base.scp.old 2011-05-18 17:51:47.000000000 +0200 -+++ scp2/source/base/file_base.scp 2011-07-08 17:00:37.000000000 +0200 -@@ -72,6 +72,8 @@ STD_RES_FILE( gid_File_Res_Rptui, rptui) - - STD_LIB_FILE( gid_File_Lib_Rptxml, rptxml ) - -+#ifdef WITH_HELPCONTENT2 -+ - File gid_File_Help_Sdatabase_Zip - Dir = gid_Dir_Help_Isolanguage; - ARCHIVE_TXT_FILE_BODY_HELPPACK; -@@ -79,6 +81,8 @@ File gid_File_Help_Sdatabase_Zip - Patchfiles = (); - End - -+#endif -+ - File gid_File_Share_Registry_Base_Xcd - TXT_FILE_BODY; - Styles = (PACKED); ---- scp2/source/writer/file_writer.scp.old 2011-05-18 17:51:47.000000000 +0200 -+++ scp2/source/writer/file_writer.scp 2011-07-08 16:59:11.000000000 +0200 -@@ -53,6 +53,8 @@ File gid_File_Exe_Sweb - End - #endif - -+#ifdef WITH_HELPCONTENT2 -+ - File gid_File_Help_Swriter_Zip - Dir = gid_Dir_Help_Isolanguage; - ARCHIVE_TXT_FILE_BODY_HELPPACK; -@@ -60,6 +62,8 @@ File gid_File_Help_Swriter_Zip - Patchfiles = (); - End - -+#endif -+ - /* - File gid_File_Share_Config_Sofficecfg_Writer_Menubar_Xml - TXT_FILE_BODY; ---- scp2/source/calc/file_calc.scp.old 2011-05-18 17:51:47.000000000 +0200 -+++ scp2/source/calc/file_calc.scp 2011-07-08 16:58:38.000000000 +0200 -@@ -65,6 +65,8 @@ STD_RES_FILE( gid_File_Res_Date, date) - - STD_RES_FILE( gid_File_Res_Sc, sc ) - -+#ifdef WITH_HELPCONTENT2 -+ - File gid_File_Help_Scalc_Zip - Dir = gid_Dir_Help_Isolanguage; - ARCHIVE_TXT_FILE_BODY_HELPPACK; -@@ -72,6 +74,8 @@ File gid_File_Help_Scalc_Zip - Patchfiles = (); - End - -+#endif -+ - // new user interface configuration files - /* - File gid_File_Share_Config_Sofficecfg_Calc_Menubar_Xml ---- scp2/source/impress/file_impress.scp.old 2011-05-18 17:51:47.000000000 +0200 -+++ scp2/source/impress/file_impress.scp 2011-07-08 16:58:11.000000000 +0200 -@@ -44,6 +44,8 @@ File gid_File_Share_Registry_Impress_Xcd - Name = "impress.xcd"; - End - -+#ifdef WITH_HELPCONTENT2 -+ - File gid_File_Help_Simpress_Zip - Dir = gid_Dir_Help_Isolanguage; - ARCHIVE_TXT_FILE_BODY_HELPPACK; -@@ -51,6 +53,8 @@ File gid_File_Help_Simpress_Zip - Patchfiles = (); - End - -+#endif -+ - File gid_File_Exe_Simpress - BIN_FILE_BODY; - Dir = gid_Brand_Dir_Program; ---- scp2/source/math/file_math.scp.old 2011-05-18 17:51:47.000000000 +0200 -+++ scp2/source/math/file_math.scp 2011-07-08 16:57:51.000000000 +0200 -@@ -50,6 +50,8 @@ File gid_File_Share_Registry_Math_Xcd - Name = "math.xcd"; - End - -+#ifdef WITH_HELPCONTENT2 -+ - File gid_File_Help_Smath_Zip - Dir = gid_Dir_Help_Isolanguage; - ARCHIVE_TXT_FILE_BODY_HELPPACK; -@@ -57,6 +59,8 @@ File gid_File_Help_Smath_Zip - Patchfiles = (); - End - -+#endif -+ - File gid_File_Exe_Smath - BIN_FILE_BODY; - Dir = gid_Brand_Dir_Program; ---- scp2/source/ooo/directory_ooo.scp.old 2011-06-13 10:46:50.000000000 +0200 -+++ scp2/source/ooo/directory_ooo.scp 2011-07-08 13:26:42.000000000 +0200 -@@ -1215,6 +1215,8 @@ Directory gid_Dir_Basis_Sdk - DosName = "sdk"; - End - -+#ifdef WITH_HELPCONTENT2 -+ - Directory gid_Dir_Help - #if defined MACOSX - ParentID = gid_Brand_Dir_BasisLink; -@@ -1234,6 +1236,8 @@ Directory gid_Dir_Help_Isolanguage - #endif - End - -+#endif -+ - #ifdef UNX - - Directory gid_Dir_User_Psprint ---- scp2/source/ooo/file_ooo.scp.old 2011-05-20 18:04:45.000000000 +0200 -+++ scp2/source/ooo/file_ooo.scp 2011-07-08 16:12:23.000000000 +0200 -@@ -362,6 +362,8 @@ STD_FILTER_FILE( gid_File_Filter_Iti, it - - STD_RES_FILE( gid_File_Res_Eps, eps ) - -+#ifdef WITH_HELPCONTENT2 -+ - File gid_File_Help_Common_Zip - Dir = gid_Dir_Help_Isolanguage; - ARCHIVE_TXT_FILE_BODY_HELPPACK; -@@ -388,6 +390,8 @@ File gid_File_Help_Schart_Zip - EXTRA_ALL_GOOD_HELP_LOCALIZATIONS_LANG(schart); - End - -+#endif -+ - #if defined WNT - - File gid_File_Jar_Accessbridge ---- scp2/source/ooo/common_brand.scp.old 2011-05-20 18:04:45.000000000 +0200 -+++ scp2/source/ooo/common_brand.scp 2011-07-08 16:13:36.000000000 +0200 -@@ -167,6 +167,8 @@ Directory gid_Brand_Dir_Readme - DosName = "readmes"; - End - -+#ifdef WITH_HELPCONTENT2 -+ - Directory gid_Brand_Dir_Help - #if defined MACOSX - ParentID = gid_Dir_Bundle_Contents; -@@ -181,6 +183,8 @@ Directory gid_Brand_Dir_Help_Isolanguage - DIR_ISOLANGUAGE_ALL_LANG; - End - -+#endif -+ - Directory gid_Brand_Dir_Share - #if defined MACOSX - ParentID = gid_Dir_Bundle_Contents; ---- scp2/source/ooo/module_helppack.scp.old 2011-05-18 17:51:47.000000000 +0200 -+++ scp2/source/ooo/module_helppack.scp 2011-07-08 16:15:09.000000000 +0200 -@@ -27,6 +27,8 @@ - - #include "macros.inc" - -+#ifdef WITH_HELPCONTENT2 -+ - Module gid_Module_Helppack_Helproot - ParentID = gid_Module_Root; - XPDParentID = "root"; -@@ -40,3 +42,5 @@ Module gid_Module_Helppack_Helproot - End - - #include "allhelpmodules.inc" -+ -+#endif ---- scp2/source/ooo/module_help_template.scp.old 2011-05-18 17:51:47.000000000 +0200 -+++ scp2/source/ooo/module_help_template.scp 2011-07-08 16:16:14.000000000 +0200 -@@ -25,6 +25,8 @@ - * - ************************************************************************/ - -+#ifdef WITH_HELPCONTENT2 -+ - Module gid_Module_Helppack_Help_Template - ParentID = gid_Module_Helppack_Helproot; - Name = "gid_Module_Helppack_Help_Template"; -@@ -44,3 +46,5 @@ Module gid_Module_Helppack_Help_Template - End - - #include "allhelpmodules_root.inc" -+ -+#endif ---- scp2/source/templates/module_helppack_root.sct.old 2011-05-18 17:51:47.000000000 +0200 -+++ scp2/source/templates/module_helppack_root.sct 2011-07-08 16:19:16.000000000 +0200 -@@ -25,6 +25,8 @@ - * - ************************************************************************/ - -+#ifdef WITH_HELPCONTENT2 -+ - Module gid_Module_Helppack_Help_ - ParentID = gid_Module_Helppack_Root_; - Sortkey = "200"; -@@ -35,3 +37,5 @@ Module gid_Module_Helppack_Help_= 2.2.0]) diff --git a/libreoffice-core-3.5.2.2.tar.bz2 b/libreoffice-core-3.5.2.2.tar.bz2 new file mode 100644 index 0000000..4a8fe57 --- /dev/null +++ b/libreoffice-core-3.5.2.2.tar.bz2 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:449118133af40cc73871debf0eac7eebd5c8b4978fd97c22055a39640860d570 +size 128070188 diff --git a/libreoffice-extensions-3.4.5.4.tar.bz2 b/libreoffice-extensions-3.4.5.4.tar.bz2 deleted file mode 100644 index d5a5e7b..0000000 --- a/libreoffice-extensions-3.4.5.4.tar.bz2 +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:71ab90d8e98a4f700e450ee417e80b1c2c9a4090d5f1a0a192cd1fac61c0c0fc -size 4224264 diff --git a/libreoffice-extras-3.4.5.4.tar.bz2 b/libreoffice-extras-3.4.5.4.tar.bz2 deleted file mode 100644 index cd653ea..0000000 --- a/libreoffice-extras-3.4.5.4.tar.bz2 +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:f059c7c632708b0f26bd498b573f05f3b1ba7c770db8346d8506828fba557469 -size 38652624 diff --git a/libreoffice-filters-3.4.5.4.tar.bz2 b/libreoffice-filters-3.4.5.4.tar.bz2 deleted file mode 100644 index 95eb83b..0000000 --- a/libreoffice-filters-3.4.5.4.tar.bz2 +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:cfb6fb9e61d285c23120cd0e41570642b8f2bc57a3cd9886fa065582ef43a220 -size 11923110 diff --git a/libreoffice-help-3.4.5.4.tar.bz2 b/libreoffice-help-3.4.5.4.tar.bz2 deleted file mode 100644 index 3c9512c..0000000 --- a/libreoffice-help-3.4.5.4.tar.bz2 +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:5a1175a36cf339945e7c4db09d6a540b073adb591951daebe3041708e4dcc667 -size 1846985 diff --git a/libreoffice-help-3.5.2.2.tar.bz2 b/libreoffice-help-3.5.2.2.tar.bz2 new file mode 100644 index 0000000..d259c86 --- /dev/null +++ b/libreoffice-help-3.5.2.2.tar.bz2 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:556d112f9a2358925bb795fba34ae20bc8b4e60695e0973c63f73338d3e3d77e +size 1872179 diff --git a/libreoffice-help-en-US.changes b/libreoffice-help-en-US.changes index 6ccba71..bb4845c 100644 --- a/libreoffice-help-en-US.changes +++ b/libreoffice-help-en-US.changes @@ -1,3 +1,36 @@ +------------------------------------------------------------------- +Wed Apr 4 13:39:46 UTC 2012 - pmladek@suse.com + +- clean up lo-help-gen-spec according to lo-l10n-gen-spec +- do not supplement l10n packages; we provide support for the given locale; + the extra recommends annoys users when updating on Live-CD (bnc#551003) +- use Requires(pre) instead of PreReq on never distributions + +------------------------------------------------------------------- +Wed Mar 28 15:43:47 UTC 2012 - pmladek@suse.com + +- updated to libreoffice-3.5.5.2 (3.5.2-rc2) +- basis subdirectory does not longer exists on the installed system +- mozilla is not longer used for build: + * use --disable-mozilla, --without-system-mozilla, --with-system-nss, + --disable-ldap, --enable-xmlsec instead of --with-system-mozilla, + --with-system-mozilla=xulrunner +- use internal hacked make version 3.82, snapshot 20120301 to get fast + and reliable parallel build +- build zip-3.0 on openSUSE < 11.4; --filesync is needed during build +- libreoffice-3.5-unpack-sources.diff: allow to unpack source tarballs +- build-helpcontent-do-not-check-cups.diff: cups is not needed for helpcontent + +------------------------------------------------------------------- +Wed Mar 14 14:34:11 UTC 2012 - pmladek@suse.com + +- libreoffice-3.4.5.5 == SUSE 3.4.5-rc3 == final + +------------------------------------------------------------------- +Mon Mar 12 18:58:39 UTC 2012 - pmladek@suse.com + +- updated to libreoffice-3.4.5.5 (SUSE 3.4.5-rc3) + ------------------------------------------------------------------- Tue Mar 6 15:55:09 UTC 2012 - pmladek@suse.com diff --git a/libreoffice-help-en-US.spec b/libreoffice-help-en-US.spec index 468c88e..1e6a9ca 100644 --- a/libreoffice-help-en-US.spec +++ b/libreoffice-help-en-US.spec @@ -22,15 +22,13 @@ Name: libreoffice-help-en-US ## Generated by: ## perl lo-help-gen-spec libreoffice-help-en-US.spec.in lo-help-en-US ################################################################### -Version: 3.4.5.4 +Version: 3.5.2.2 Release: 0 -%define piece help -%define lo_build_version 3.4.5.4 -%define lo_piece_version 3.4.5.4 +%define gnu_make_version 3.82 +%define gnu_make_snapshot 20120301 +%define zip_version 3.0 %define lo_langs "" -%define lo_sourcedirname libreoffice-build-%lo_piece_version -%define lo_home libreoffice -%define lo_basis_dir basis3.4 +%define lo_home libreoffice # prepare_build: 0 = no # 1 = yes (just build, install and create packages; without %%prep section and configure) %define prepare_build 1 @@ -69,10 +67,20 @@ BuildRequires: update-alternatives BuildRequires: perl-Compress-Zlib %endif Provides: locale(libreoffice:en_US) -PreReq: libreoffice = %version -%if 0%{?suse_version} -Supplements: libreoffice-l10n-en-US +%if 0%{?suse_version} > 01120 +Requires(post): coreutils +Requires(post): grep +Requires(post): libreoffice >= 3.5 +Requires(postun): coreutils +Requires(postun): grep +Requires(postun): libreoffice >= 3.5 %endif +%if 0%{?suse_version} && 0%{?suse_version} <= 01120 +PreReq: coreutils +PreReq: grep +PreReq: libreoffice >= 3.5 +%endif +Requires: libreoffice = %{version} # compat stuff Provides: OpenOffice_org-help-en-US = %version Obsoletes: OpenOffice_org-help-en-US < %version @@ -94,16 +102,15 @@ Summary: American Help Localization for LibreOffice License: LGPL-3.0 Group: Productivity/Office/Suite Url: http://www.documentfoundation.org/ -Source0: libreoffice-bootstrap-%version.tar.bz2 -Source1: libreoffice-artwork-%version.tar.bz2 -Source2: libreoffice-help-%version.tar.bz2 -Source3: libreoffice-libs-core-%version.tar.bz2 -Source4: libreoffice-libs-extern-sys-%version.tar.bz2 -Source5: libreoffice-libs-extern-%version.tar.bz2 -Source6: libreoffice-libs-gui-%version.tar.bz2 -Source7: libreoffice-testing-%version.tar.bz2 -Source8: libreoffice-translations-%version.tar.bz2 -Source9: libreoffice-ure-%version.tar.bz2 +Source0: libreoffice-core-%version.tar.bz2 +Source1: libreoffice-help-%version.tar.bz2 +Source2: libreoffice-translations-%version.tar.bz2 +# make-3.82 is needed for parallel build +# this version extends plain make-3.82 with --warn-undefined-functions option +# URL: http://cgit.freedesktop.org/libreoffice/contrib/dev-tools/tree/make-3.82-gbuild, snapshot 2011-08-17 +Source30: make-%gnu_make_version-gbuild-%gnu_make_snapshot.tar.bz2 +# zip-3.0 or newer is required because of the --filesync feature +Source31: zip-%zip_version.tar.bz2 # SUSE config files Source100: SUSE.conf Source101: SUSE-10.1.conf @@ -115,11 +122,10 @@ Source105: SUSE-11.4.conf Source200: libreoffice-help-en-US.spec.in Source201: lo-help-gen-spec Source202: lo-help-en-US -# -Patch0: libreoffice-configure-typo-fontconfig.diff -# OBJEXT variable was not set correctly if AC_PROC_CC was not called early -# I think that it worked only by chance when there was checks for more system librarires -Patch1: libreoffice-cc-detection.diff +# allow to unpack source tarballs +Patch0: libreoffice-3.5-unpack-sources.diff +# cups is not needed for helpcontent build +Patch1: build-helpcontent-do-not-check-cups.diff BuildRoot: %{_tmppath}/%{name}-%{version}-build #!ExclusiveArch: %ix86 x86_64 ppc BuildArch: noarch @@ -131,21 +137,29 @@ stuff is in LibreOffice-l10n-en-US. %prep %if %prepare_build == 0 -%setup -D -T -q -n libreoffice-bootstrap-%version +%setup -D -T -q -n libreoffice-core-%version %else -%setup -q -n libreoffice-bootstrap-%version -bin/unpack-sources `pwd` \ - %{S:1} %{S:2} %{S:3} %{S:4} %{S:5} \ - %{S:6} %{S:7} %{S:8} %{S:9} +%setup -q -a30 -a31 -n libreoffice-core-%version +%patch0 +bin/unpack-sources `pwd` %{S:1} %{S:2} # SUSE config files cp %{S:100} %{S:101} %{S:102} %{S:103} %{S:104} %{S:105} distro-configs # extra fixes -%patch0 %patch1 %endif %build %if %prepare_build != 0 +# first build make-3.82 +cd make-* +CFLAGS=$RPM_OPT_FLAGS ./configure +make %{?_smp_mflags} +cd - +# +# second build zip-3.0 +cd zip30 +make %{?jobs:-j%jobs} -f unix/Makefile prefix=/usr CC="gcc $RPM_OPT_FLAGS -DLARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64" generic_gcc +cd - # # Parallel build settings ... # parallel build of modules; it makes sense on machines with more CPUs @@ -186,7 +200,8 @@ export JAVA_HOME=%{java_home} # use RPM_OPT_FLAGS, ... export ARCH_FLAGS="`echo $RPM_OPT_FLAGS | sed -e 's/\-O[0-9s]//g' -e 's/\-fexceptions//g'` -fno-strict-aliasing" # FIXME: genccode from the system icu is in /usr/sbin -export PATH="$PATH:/usr/sbin" +# FIXME: we need make-3.82 for parallel build +export PATH="$RPM_BUILD_DIR/libreoffice-core-%version/make-%gnu_make_version-gbuild:$RPM_BUILD_DIR/libreoffice-core-%version/zip30:$PATH:/usr/sbin" %if %prepare_build != 0 ./autogen.sh \ --with-external-tar="$RPM_SOURCE_DIR" \ @@ -228,27 +243,26 @@ export PATH="$PATH:/usr/sbin" --disable-evolution2 %endif ./bootstrap -. ./*[Ee]nv.[Ss]et.sh +. ./Env.Host.sh cd helpcontent2 build --all $PARALLEL_BUILD %install -. ./*Env.Set.sh -test -z "%lo_langs" && langs="en-US" || langs="%lo_langs" +. ./Env.Host.sh +test -z %lo_langs && langs="en-US" || langs=%lo_langs mkdir -p file-lists for lang in $langs ; do test "$lang" = "en-US" && langdir="en" || langdir="$lang" - mkdir -p $RPM_BUILD_ROOT/%_datadir/%lo_home/%lo_basis_dir/help/$langdir + mkdir -p $RPM_BUILD_ROOT/%_datadir/%lo_home/help/$langdir for pack in helpcontent2/$INPATH/bin/s*$lang.zip ; do - unzip $pack -d $RPM_BUILD_ROOT/%_datadir/%lo_home/%lo_basis_dir/help/$langdir + unzip $pack -d $RPM_BUILD_ROOT/%_datadir/%lo_home/help/$langdir done lang_underscore=`echo $lang | sed "s/-/_/g"` filelist=help_${lang_underscore}_list.txt echo "%dir %_datadir/%lo_home" >file-lists/$filelist - echo "%dir %_datadir/%lo_home/%lo_basis_dir" >>file-lists/$filelist - echo "%dir %_datadir/%lo_home/%lo_basis_dir/help" >>file-lists/$filelist - find $RPM_BUILD_ROOT/%_datadir/%lo_home/%lo_basis_dir/help/$langdir -type d -printf "%%%%dir %_datadir/%lo_home/%lo_basis_dir/help/$langdir/%%P\n" >>file-lists/$filelist - find $RPM_BUILD_ROOT/%_datadir/%lo_home/%lo_basis_dir/help/$langdir -type f -printf "%_datadir/%lo_home/%lo_basis_dir/help/$langdir/%%P\n" >>file-lists/$filelist + echo "%dir %_datadir/%lo_home/help" >>file-lists/$filelist + find $RPM_BUILD_ROOT/%_datadir/%lo_home/help/$langdir -type d -printf "%%%%dir %_datadir/%lo_home/help/$langdir/%%P\n" >>file-lists/$filelist + find $RPM_BUILD_ROOT/%_datadir/%lo_home/help/$langdir -type f -printf "%_datadir/%lo_home/help/$langdir/%%P\n" >>file-lists/$filelist # the file list is needed to create compat symlinks cp file-lists/$filelist $RPM_BUILD_ROOT/%_datadir/%lo_home echo "%_datadir/%lo_home/$filelist" >>file-lists/$filelist diff --git a/libreoffice-help-en-US.spec.in b/libreoffice-help-en-US.spec.in index b978d2f..ce7c964 100644 --- a/libreoffice-help-en-US.spec.in +++ b/libreoffice-help-en-US.spec.in @@ -15,40 +15,68 @@ # Please submit bugfixes or comments via http://bugs.opensuse.org/ # -# norootforbuild - Name: libreoffice-help-en-US @DO_NOT_EDIT_COMMENT@ -Version: 3.4.5.4 -Release: 1 -%define piece help -%define lo_build_version 3.4.5.4 -%define lo_piece_version 3.4.5.4 +Version: 3.5.2.2 +Release: 0 +%define gnu_make_version 3.82 +%define gnu_make_snapshot 20120301 +%define zip_version 3.0 %define lo_langs "" -%define lo_sourcedirname libreoffice-build-%lo_piece_version -%define lo_home libreoffice -%define lo_basis_dir basis3.4 +%define lo_home libreoffice # prepare_build: 0 = no # 1 = yes (just build, install and create packages; without %%prep section and configure) %define prepare_build 1 #!BuildIgnore: libreoffice # both zip and perl-Archive-Zip are needed; tested with ooo320-m3, 2009-10-22 -BuildRequires: ant ant-apache-regexp automake bison boost-devel db-devel flac-devel flex freetype2-devel gcc-c++ gperf icu java-devel libcppunit-devel libexpat-devel libicu-devel libxml2-devel libxslt-devel openssl-devel perl-Archive-Zip perl-Compress-Zlib pkg-config python-devel unzip xorg-x11-devel zip +BuildRequires: ant +BuildRequires: ant-apache-regexp +BuildRequires: automake +BuildRequires: bison +BuildRequires: boost-devel +BuildRequires: db-devel +BuildRequires: flac-devel +BuildRequires: flex +BuildRequires: freetype2-devel +BuildRequires: gcc-c++ +BuildRequires: gperf +BuildRequires: icu +BuildRequires: java-devel +BuildRequires: libcppunit-devel +BuildRequires: libexpat-devel +BuildRequires: libicu-devel +BuildRequires: libxml2-devel +BuildRequires: libxslt-devel +BuildRequires: openssl-devel +BuildRequires: perl-Archive-Zip +BuildRequires: perl-Compress-Zlib +BuildRequires: pkg-config +BuildRequires: python-devel +BuildRequires: unzip +BuildRequires: xorg-x11-devel +BuildRequires: zip %if 0%{?suse_version} == 01010 # is not required by Java SDKs by mistake on SLED10 BuildRequires: update-alternatives # needed by perl-Archive-Zip; is included in main perl package on newer distros BuildRequires: perl-Compress-Zlib %endif -License: LGPL-3.0 -Group: Productivity/Office/Suite -AutoReqProv: on Provides: locale(libreoffice:en_US) -PreReq: libreoffice = %version -%if 0%{?suse_version} -Supplements: libreoffice-l10n-en-US +%if 0%{?suse_version} > 01120 +Requires(post): coreutils +Requires(post): grep +Requires(post): libreoffice >= 3.5 +Requires(postun): coreutils +Requires(postun): grep +Requires(postun): libreoffice >= 3.5 %endif +%if 0%{?suse_version} && 0%{?suse_version} <= 01120 +PreReq: coreutils +PreReq: grep +PreReq: libreoffice >= 3.5 +%endif +Requires: libreoffice = %{version} # compat stuff Provides: OpenOffice_org-help-en-US = %version Obsoletes: OpenOffice_org-help-en-US < %version @@ -67,17 +95,18 @@ Provides: libreoffice-help-pa-IN = %version Obsoletes: libreoffice-help-pa-IN < %version # Summary: American Help Localization for LibreOffice +License: LGPL-3.0 +Group: Productivity/Office/Suite Url: http://www.documentfoundation.org/ -Source0: libreoffice-bootstrap-%version.tar.bz2 -Source1: libreoffice-artwork-%version.tar.bz2 -Source2: libreoffice-help-%version.tar.bz2 -Source3: libreoffice-libs-core-%version.tar.bz2 -Source4: libreoffice-libs-extern-sys-%version.tar.bz2 -Source5: libreoffice-libs-extern-%version.tar.bz2 -Source6: libreoffice-libs-gui-%version.tar.bz2 -Source7: libreoffice-testing-%version.tar.bz2 -Source8: libreoffice-translations-%version.tar.bz2 -Source9: libreoffice-ure-%version.tar.bz2 +Source0: libreoffice-core-%version.tar.bz2 +Source1: libreoffice-help-%version.tar.bz2 +Source2: libreoffice-translations-%version.tar.bz2 +# make-3.82 is needed for parallel build +# this version extends plain make-3.82 with --warn-undefined-functions option +# URL: http://cgit.freedesktop.org/libreoffice/contrib/dev-tools/tree/make-3.82-gbuild, snapshot 2011-08-17 +Source30: make-%gnu_make_version-gbuild-%gnu_make_snapshot.tar.bz2 +# zip-3.0 or newer is required because of the --filesync feature +Source31: zip-%zip_version.tar.bz2 # SUSE config files Source100: SUSE.conf Source101: SUSE-10.1.conf @@ -89,16 +118,14 @@ Source105: SUSE-11.4.conf Source200: libreoffice-help-en-US.spec.in Source201: lo-help-gen-spec Source202: lo-help-en-US -# -Patch0: libreoffice-configure-typo-fontconfig.diff -# OBJEXT variable was not set correctly if AC_PROC_CC was not called early -# I think that it worked only by chance when there was checks for more system librarires -Patch1: libreoffice-cc-detection.diff +# allow to unpack source tarballs +Patch0: libreoffice-3.5-unpack-sources.diff +# cups is not needed for helpcontent build +Patch1: build-helpcontent-do-not-check-cups.diff BuildRoot: %{_tmppath}/%{name}-%{version}-build #!ExclusiveArch: %ix86 x86_64 ppc BuildArch: noarch - %description American help localization for LibreOffice. The other localized stuff is in LibreOffice-l10n-en-US. @@ -106,22 +133,29 @@ stuff is in LibreOffice-l10n-en-US. %prep %if %prepare_build == 0 -%setup -D -T -q -n libreoffice-bootstrap-%version +%setup -D -T -q -n libreoffice-core-%version %else -%setup -q -n libreoffice-bootstrap-%version -bin/unpack-sources `pwd` \ - %{S:1} %{S:2} %{S:3} %{S:4} %{S:5} \ - %{S:6} %{S:7} %{S:8} %{S:9} +%setup -q -a30 -a31 -n libreoffice-core-%version +%patch0 +bin/unpack-sources `pwd` %{S:1} %{S:2} # SUSE config files cp %{S:100} %{S:101} %{S:102} %{S:103} %{S:104} %{S:105} distro-configs # extra fixes -%patch0 %patch1 %endif - %build %if %prepare_build != 0 +# first build make-3.82 +cd make-* +CFLAGS=$RPM_OPT_FLAGS ./configure +make %{?_smp_mflags} +cd - +# +# second build zip-3.0 +cd zip30 +make %{?jobs:-j%jobs} -f unix/Makefile prefix=/usr CC="gcc $RPM_OPT_FLAGS -DLARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64" generic_gcc +cd - # # Parallel build settings ... # parallel build of modules; it makes sense on machines with more CPUs @@ -162,7 +196,8 @@ export JAVA_HOME=%{java_home} # use RPM_OPT_FLAGS, ... export ARCH_FLAGS="`echo $RPM_OPT_FLAGS | sed -e 's/\-O[0-9s]//g' -e 's/\-fexceptions//g'` -fno-strict-aliasing" # FIXME: genccode from the system icu is in /usr/sbin -export PATH="$PATH:/usr/sbin" +# FIXME: we need make-3.82 for parallel build +export PATH="$RPM_BUILD_DIR/libreoffice-core-%version/make-%gnu_make_version-gbuild:$RPM_BUILD_DIR/libreoffice-core-%version/zip30:$PATH:/usr/sbin" %if %prepare_build != 0 ./autogen.sh \ --with-external-tar="$RPM_SOURCE_DIR" \ @@ -204,40 +239,34 @@ export PATH="$PATH:/usr/sbin" --disable-evolution2 %endif ./bootstrap -. ./*[Ee]nv.[Ss]et.sh +. ./Env.Host.sh cd helpcontent2 build --all $PARALLEL_BUILD - %install -. ./*Env.Set.sh -test -z "%lo_langs" && langs="en-US" || langs="%lo_langs" +. ./Env.Host.sh +test -z %lo_langs && langs="en-US" || langs=%lo_langs mkdir -p file-lists for lang in $langs ; do test "$lang" = "en-US" && langdir="en" || langdir="$lang" - mkdir -p $RPM_BUILD_ROOT/%_datadir/%lo_home/%lo_basis_dir/help/$langdir + mkdir -p $RPM_BUILD_ROOT/%_datadir/%lo_home/help/$langdir for pack in helpcontent2/$INPATH/bin/s*$lang.zip ; do - unzip $pack -d $RPM_BUILD_ROOT/%_datadir/%lo_home/%lo_basis_dir/help/$langdir + unzip $pack -d $RPM_BUILD_ROOT/%_datadir/%lo_home/help/$langdir done lang_underscore=`echo $lang | sed "s/-/_/g"` filelist=help_${lang_underscore}_list.txt echo "%dir %_datadir/%lo_home" >file-lists/$filelist - echo "%dir %_datadir/%lo_home/%lo_basis_dir" >>file-lists/$filelist - echo "%dir %_datadir/%lo_home/%lo_basis_dir/help" >>file-lists/$filelist - find $RPM_BUILD_ROOT/%_datadir/%lo_home/%lo_basis_dir/help/$langdir -type d -printf "%%%%dir %_datadir/%lo_home/%lo_basis_dir/help/$langdir/%%P\n" >>file-lists/$filelist - find $RPM_BUILD_ROOT/%_datadir/%lo_home/%lo_basis_dir/help/$langdir -type f -printf "%_datadir/%lo_home/%lo_basis_dir/help/$langdir/%%P\n" >>file-lists/$filelist + echo "%dir %_datadir/%lo_home/help" >>file-lists/$filelist + find $RPM_BUILD_ROOT/%_datadir/%lo_home/help/$langdir -type d -printf "%%%%dir %_datadir/%lo_home/help/$langdir/%%P\n" >>file-lists/$filelist + find $RPM_BUILD_ROOT/%_datadir/%lo_home/help/$langdir -type f -printf "%_datadir/%lo_home/help/$langdir/%%P\n" >>file-lists/$filelist # the file list is needed to create compat symlinks cp file-lists/$filelist $RPM_BUILD_ROOT/%_datadir/%lo_home echo "%_datadir/%lo_home/$filelist" >>file-lists/$filelist done - %clean rm -rf $RPM_BUILD_ROOT @SUBPACKAGES_SCRIPTS@ - @SUBPACKAGES_FILELIST@ - - %changelog diff --git a/libreoffice-help-group1.changes b/libreoffice-help-group1.changes index 53c7f83..8d6bed8 100644 --- a/libreoffice-help-group1.changes +++ b/libreoffice-help-group1.changes @@ -1,3 +1,37 @@ +------------------------------------------------------------------- +Wed Apr 4 13:39:46 UTC 2012 - pmladek@suse.com + +- clean up lo-help-gen-spec according to lo-l10n-gen-spec +- do not supplement l10n packages; we provide support for the given locale; + the extra recommends annoys users when updating on Live-CD (bnc#551003) +- use Requires(pre) instead of PreReq on never distributions + +------------------------------------------------------------------- +Wed Mar 28 15:43:47 UTC 2012 - pmladek@suse.com + +- updated to libreoffice-3.5.5.2 (3.5.2-rc2) +- basis subdirectory does not longer exists on the installed system +- mozilla is not longer used for build: + * use --disable-mozilla, --without-system-mozilla, --with-system-nss, + --disable-ldap, --enable-xmlsec instead of --with-system-mozilla, + --with-system-mozilla=xulrunner +- enable python during build; it is needed to localize the sources +- use internal hacked make version 3.82, snapshot 20120301 to get fast + and reliable parallel build +- build zip-3.0 on openSUSE < 11.4; --filesync is needed during build +- libreoffice-3.5-unpack-sources.diff: allow to unpack source tarballs +- build-helpcontent-do-not-check-cups.diff: cups is not needed for helpcontent + +------------------------------------------------------------------- +Wed Mar 14 14:34:11 UTC 2012 - pmladek@suse.com + +- libreoffice-3.4.5.5 == SUSE 3.4.5-rc3 == final + +------------------------------------------------------------------- +Mon Mar 12 18:58:39 UTC 2012 - pmladek@suse.com + +- updated to libreoffice-3.4.5.5 (SUSE 3.4.5-rc3) + ------------------------------------------------------------------- Tue Mar 6 15:55:09 UTC 2012 - pmladek@suse.com diff --git a/libreoffice-help-group1.spec b/libreoffice-help-group1.spec index 2de5913..9134ff2 100644 --- a/libreoffice-help-group1.spec +++ b/libreoffice-help-group1.spec @@ -22,14 +22,12 @@ Name: libreoffice-help-group1 ## Generated by: ## perl lo-help-gen-spec libreoffice-help-groupX.spec.in lo-help-groupX ################################################################### -Version: 3.4.5.4 +Version: 3.5.2.2 Release: 0 -%define piece help -%define lo_build_version 3.4.5.4 -%define lo_piece_version 3.4.5.4 -%define lo_sourcedirname libreoffice-build-%lo_piece_version -%define lo_home libreoffice -%define lo_basis_dir basis3.4 +%define gnu_make_version 3.82 +%define gnu_make_snapshot 20120301 +%define zip_version 3.0 +%define lo_home libreoffice # test_build_langs: 1 = de and cs # 2 = all supported languages %define test_build_langs 2 @@ -89,16 +87,15 @@ Summary: LibreOffice Help Development License: LGPL-3.0 Group: Productivity/Office/Suite Url: http://www.documentfoundation.org/ -Source0: libreoffice-bootstrap-%version.tar.bz2 -Source1: libreoffice-artwork-%version.tar.bz2 -Source2: libreoffice-help-%version.tar.bz2 -Source3: libreoffice-libs-core-%version.tar.bz2 -Source4: libreoffice-libs-extern-sys-%version.tar.bz2 -Source5: libreoffice-libs-extern-%version.tar.bz2 -Source6: libreoffice-libs-gui-%version.tar.bz2 -Source7: libreoffice-testing-%version.tar.bz2 -Source8: libreoffice-translations-%version.tar.bz2 -Source9: libreoffice-ure-%version.tar.bz2 +Source0: libreoffice-core-%version.tar.bz2 +Source1: libreoffice-help-%version.tar.bz2 +Source2: libreoffice-translations-%version.tar.bz2 +# make-3.82 is needed for parallel build +# this version extends plain make-3.82 with --warn-undefined-functions option +# URL: http://cgit.freedesktop.org/libreoffice/contrib/dev-tools/tree/make-3.82-gbuild, snapshot 2011-08-17 +Source30: make-%gnu_make_version-gbuild-%gnu_make_snapshot.tar.bz2 +# zip-3.0 or newer is required because of the --filesync feature +Source31: zip-%zip_version.tar.bz2 # SUSE config files Source100: SUSE.conf Source101: SUSE-10.1.conf @@ -110,13 +107,10 @@ Source105: SUSE-11.4.conf Source200: libreoffice-help-groupX.spec.in Source201: lo-help-gen-spec Source202: lo-help-groupX -# -Patch0: libreoffice-configure-typo-fontconfig.diff -# OBJEXT variable was not set correctly if AC_PROC_CC was not called early -# I think that it worked only by chance when there was checks for more system librarires -Patch1: libreoffice-cc-detection.diff -# it created 3.8GB build log; Build Service refused to build such package -Patch2: translations-no-warnigns-from-po2oo.diff +# allow to unpack source tarballs +Patch0: libreoffice-3.5-unpack-sources.diff +# cups is not needed for helpcontent build +Patch1: build-helpcontent-do-not-check-cups.diff BuildRoot: %{_tmppath}/%{name}-%{version}-build #!ExclusiveArch: %ix86 x86_64 ppc BuildArch: noarch @@ -125,17 +119,25 @@ BuildArch: noarch This package provides files related to the LibreOffice help development. - %if %test_build_langs >= 1 - %package -n libreoffice-help-cs Summary: Czech Help Localization for LibreOffice Group: Productivity/Office/Suite Provides: locale(libreoffice:cs) -PreReq: libreoffice = %version -%if 0%{?suse_version} -Supplements: libreoffice-l10n-cs +%if 0%{?suse_version} > 01120 +Requires(post): coreutils +Requires(post): grep +Requires(post): libreoffice >= 3.5 +Requires(postun): coreutils +Requires(postun): grep +Requires(postun): libreoffice >= 3.5 %endif +%if 0%{?suse_version} && 0%{?suse_version} <= 01120 +PreReq: coreutils +PreReq: grep +PreReq: libreoffice >= 3.5 +%endif +Requires: libreoffice = %{version} # compat stuff Provides: OpenOffice_org-help-cs = %version Obsoletes: OpenOffice_org-help-cs <= %version @@ -145,7 +147,6 @@ Provides: OpenOffice_org-cs:%_prefix/ooo-2.0/help/cs/default.css Czech help localization for LibreOffice. The other localized stuff is in libreoffice-l10n-cs. - %endif %if %test_build_langs >= 2 @@ -153,10 +154,20 @@ is in libreoffice-l10n-cs. Summary: Danish Help Localization for LibreOffice Group: Productivity/Office/Suite Provides: locale(libreoffice:da) -PreReq: libreoffice = %version -%if 0%{?suse_version} -Supplements: libreoffice-l10n-da +%if 0%{?suse_version} > 01120 +Requires(post): coreutils +Requires(post): grep +Requires(post): libreoffice >= 3.5 +Requires(postun): coreutils +Requires(postun): grep +Requires(postun): libreoffice >= 3.5 %endif +%if 0%{?suse_version} && 0%{?suse_version} <= 01120 +PreReq: coreutils +PreReq: grep +PreReq: libreoffice >= 3.5 +%endif +Requires: libreoffice = %{version} # compat stuff Provides: OpenOffice_org-help-da = %version Obsoletes: OpenOffice_org-help-da <= %version @@ -166,7 +177,6 @@ Provides: OpenOffice_org-da:%_prefix/ooo-2.0/help/da/default.css Danish help localization for LibreOffice. The other localized stuff is in libreoffice-l10n-da. - %endif %if %test_build_langs >= 1 @@ -174,10 +184,20 @@ is in libreoffice-l10n-da. Summary: German Help Localization for LibreOffice Group: Productivity/Office/Suite Provides: locale(libreoffice:de) -PreReq: libreoffice = %version -%if 0%{?suse_version} -Supplements: libreoffice-l10n-de +%if 0%{?suse_version} > 01120 +Requires(post): coreutils +Requires(post): grep +Requires(post): libreoffice >= 3.5 +Requires(postun): coreutils +Requires(postun): grep +Requires(postun): libreoffice >= 3.5 %endif +%if 0%{?suse_version} && 0%{?suse_version} <= 01120 +PreReq: coreutils +PreReq: grep +PreReq: libreoffice >= 3.5 +%endif +Requires: libreoffice = %{version} # compat stuff Provides: OpenOffice_org-help-de = %version Obsoletes: OpenOffice_org-help-de <= %version @@ -187,7 +207,6 @@ Provides: OpenOffice_org-de:%_prefix/ooo-2.0/help/de/default.css German help localization for LibreOffice. The other localized stuff is in libreoffice-l10n-de. - %endif %if %test_build_langs >= 2 @@ -195,10 +214,20 @@ is in libreoffice-l10n-de. Summary: British Help Localization for LibreOffice Group: Productivity/Office/Suite Provides: locale(libreoffice:en_GB) -PreReq: libreoffice = %version -%if 0%{?suse_version} -Supplements: libreoffice-l10n-en-GB +%if 0%{?suse_version} > 01120 +Requires(post): coreutils +Requires(post): grep +Requires(post): libreoffice >= 3.5 +Requires(postun): coreutils +Requires(postun): grep +Requires(postun): libreoffice >= 3.5 %endif +%if 0%{?suse_version} && 0%{?suse_version} <= 01120 +PreReq: coreutils +PreReq: grep +PreReq: libreoffice >= 3.5 +%endif +Requires: libreoffice = %{version} # compat stuff Provides: OpenOffice_org-help-en-GB = %version Obsoletes: OpenOffice_org-help-en-GB <= %version @@ -212,22 +241,29 @@ is in libreoffice-l10n-en-GB. %prep %if %prepare_build == 0 -%setup -D -T -q -n libreoffice-bootstrap-%version +%setup -D -T -q -n libreoffice-core-%version %else -%setup -q -n libreoffice-bootstrap-%version -bin/unpack-sources `pwd` \ - %{S:1} %{S:2} %{S:3} %{S:4} %{S:5} \ - %{S:6} %{S:7} %{S:8} %{S:9} +%setup -q -a30 -a31 -n libreoffice-core-%version +%patch0 +bin/unpack-sources `pwd` %{S:1} %{S:2} # SUSE config files cp %{S:100} %{S:101} %{S:102} %{S:103} %{S:104} %{S:105} distro-configs # extra fixes -%patch0 %patch1 -%patch2 %endif %build %if %prepare_build != 0 +# first build make-3.82 +cd make-* +CFLAGS=$RPM_OPT_FLAGS ./configure +make %{?_smp_mflags} +cd - +# +# second build zip-3.0 +cd zip30 +make %{?jobs:-j%jobs} -f unix/Makefile prefix=/usr CC="gcc $RPM_OPT_FLAGS -DLARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64" generic_gcc +cd - # # Parallel build settings ... # parallel build of modules; it makes sense on machines with more CPUs @@ -268,7 +304,8 @@ export JAVA_HOME=%{java_home} # use RPM_OPT_FLAGS, ... export ARCH_FLAGS="`echo $RPM_OPT_FLAGS | sed -e 's/\-O[0-9s]//g' -e 's/\-fexceptions//g'` -fno-strict-aliasing" # FIXME: genccode from the system icu is in /usr/sbin -export PATH="$PATH:/usr/sbin" +# FIXME: we need make-3.82 for parallel build +export PATH="$RPM_BUILD_DIR/libreoffice-core-%version/make-%gnu_make_version-gbuild:$RPM_BUILD_DIR/libreoffice-core-%version/zip30:$PATH:/usr/sbin" %if %prepare_build != 0 ./autogen.sh \ --with-external-tar="$RPM_SOURCE_DIR" \ @@ -288,7 +325,6 @@ export PATH="$PATH:/usr/sbin" --disable-fontconfig \ --without-junit \ --without-system-jpeg \ - --disable-python \ --disable-mozilla \ --disable-mono \ --without-system-curl \ @@ -310,27 +346,26 @@ export PATH="$PATH:/usr/sbin" --disable-evolution2 %endif ./bootstrap -. ./*[Ee]nv.[Ss]et.sh +. ./Env.Host.sh cd helpcontent2 build --all $PARALLEL_BUILD %install -. ./*Env.Set.sh +. ./Env.Host.sh test -z %lo_langs && langs="en-US" || langs=%lo_langs mkdir -p file-lists for lang in $langs ; do test "$lang" = "en-US" && langdir="en" || langdir="$lang" - mkdir -p $RPM_BUILD_ROOT/%_datadir/%lo_home/%lo_basis_dir/help/$langdir + mkdir -p $RPM_BUILD_ROOT/%_datadir/%lo_home/help/$langdir for pack in helpcontent2/$INPATH/bin/s*$lang.zip ; do - unzip $pack -d $RPM_BUILD_ROOT/%_datadir/%lo_home/%lo_basis_dir/help/$langdir + unzip $pack -d $RPM_BUILD_ROOT/%_datadir/%lo_home/help/$langdir done lang_underscore=`echo $lang | sed "s/-/_/g"` filelist=help_${lang_underscore}_list.txt echo "%dir %_datadir/%lo_home" >file-lists/$filelist - echo "%dir %_datadir/%lo_home/%lo_basis_dir" >>file-lists/$filelist - echo "%dir %_datadir/%lo_home/%lo_basis_dir/help" >>file-lists/$filelist - find $RPM_BUILD_ROOT/%_datadir/%lo_home/%lo_basis_dir/help/$langdir -type d -printf "%%%%dir %_datadir/%lo_home/%lo_basis_dir/help/$langdir/%%P\n" >>file-lists/$filelist - find $RPM_BUILD_ROOT/%_datadir/%lo_home/%lo_basis_dir/help/$langdir -type f -printf "%_datadir/%lo_home/%lo_basis_dir/help/$langdir/%%P\n" >>file-lists/$filelist + echo "%dir %_datadir/%lo_home/help" >>file-lists/$filelist + find $RPM_BUILD_ROOT/%_datadir/%lo_home/help/$langdir -type d -printf "%%%%dir %_datadir/%lo_home/help/$langdir/%%P\n" >>file-lists/$filelist + find $RPM_BUILD_ROOT/%_datadir/%lo_home/help/$langdir -type f -printf "%_datadir/%lo_home/help/$langdir/%%P\n" >>file-lists/$filelist # the file list is needed to create compat symlinks cp file-lists/$filelist $RPM_BUILD_ROOT/%_datadir/%lo_home echo "%_datadir/%lo_home/$filelist" >>file-lists/$filelist @@ -351,9 +386,9 @@ test "$1" = "0" && cp %_datadir/%lo_home/help_cs_list.txt %_datadir/%lo_home/hel %postun -n libreoffice-help-cs test "$1" = "0" && %_datadir/%lo_home/link-to-ooo-home --unlink %_datadir/%lo_home/help_cs_list.txt.postun || true rm -f %_datadir/%lo_home/help_cs_list.txt.postun 2>/dev/null - %endif %if %test_build_langs >= 2 + # da %posttrans -n libreoffice-help-da @@ -365,9 +400,9 @@ test "$1" = "0" && cp %_datadir/%lo_home/help_da_list.txt %_datadir/%lo_home/hel %postun -n libreoffice-help-da test "$1" = "0" && %_datadir/%lo_home/link-to-ooo-home --unlink %_datadir/%lo_home/help_da_list.txt.postun || true rm -f %_datadir/%lo_home/help_da_list.txt.postun 2>/dev/null - %endif %if %test_build_langs >= 1 + # de %posttrans -n libreoffice-help-de @@ -379,9 +414,9 @@ test "$1" = "0" && cp %_datadir/%lo_home/help_de_list.txt %_datadir/%lo_home/hel %postun -n libreoffice-help-de test "$1" = "0" && %_datadir/%lo_home/link-to-ooo-home --unlink %_datadir/%lo_home/help_de_list.txt.postun || true rm -f %_datadir/%lo_home/help_de_list.txt.postun 2>/dev/null - %endif %if %test_build_langs >= 2 + # en-GB %posttrans -n libreoffice-help-en-GB @@ -396,7 +431,6 @@ rm -f %_datadir/%lo_home/help_en_GB_list.txt.postun 2>/dev/null %endif %if %test_build_langs >= 1 - %files -f file-lists/help_cs_list.txt -n libreoffice-help-cs %defattr(-,root,root) @@ -417,6 +451,7 @@ rm -f %_datadir/%lo_home/help_en_GB_list.txt.postun 2>/dev/null %files -f file-lists/help_en_GB_list.txt -n libreoffice-help-en-GB %defattr(-,root,root) + %endif %changelog diff --git a/libreoffice-help-group2.changes b/libreoffice-help-group2.changes index ec3f4d1..cb19c09 100644 --- a/libreoffice-help-group2.changes +++ b/libreoffice-help-group2.changes @@ -1,3 +1,37 @@ +------------------------------------------------------------------- +Wed Apr 4 13:39:46 UTC 2012 - pmladek@suse.com + +- clean up lo-help-gen-spec according to lo-l10n-gen-spec +- do not supplement l10n packages; we provide support for the given locale; + the extra recommends annoys users when updating on Live-CD (bnc#551003) +- use Requires(pre) instead of PreReq on never distributions + +------------------------------------------------------------------- +Wed Mar 28 15:43:47 UTC 2012 - pmladek@suse.com + +- updated to libreoffice-3.5.5.2 (3.5.2-rc2) +- basis subdirectory does not longer exists on the installed system +- mozilla is not longer used for build: + * use --disable-mozilla, --without-system-mozilla, --with-system-nss, + --disable-ldap, --enable-xmlsec instead of --with-system-mozilla, + --with-system-mozilla=xulrunner +- enable python during build; it is needed to localize the sources +- use internal hacked make version 3.82, snapshot 20120301 to get fast + and reliable parallel build +- build zip-3.0 on openSUSE < 11.4; --filesync is needed during build +- libreoffice-3.5-unpack-sources.diff: allow to unpack source tarballs +- build-helpcontent-do-not-check-cups.diff: cups is not needed for helpcontent + +------------------------------------------------------------------- +Wed Mar 14 14:34:11 UTC 2012 - pmladek@suse.com + +- libreoffice-3.4.5.5 == SUSE 3.4.5-rc3 == final + +------------------------------------------------------------------- +Mon Mar 12 18:58:39 UTC 2012 - pmladek@suse.com + +- updated to libreoffice-3.4.5.5 (SUSE 3.4.5-rc3) + ------------------------------------------------------------------- Tue Mar 6 15:55:09 UTC 2012 - pmladek@suse.com diff --git a/libreoffice-help-group2.spec b/libreoffice-help-group2.spec index 88ba973..24cae99 100644 --- a/libreoffice-help-group2.spec +++ b/libreoffice-help-group2.spec @@ -22,14 +22,12 @@ Name: libreoffice-help-group2 ## Generated by: ## perl lo-help-gen-spec libreoffice-help-groupX.spec.in lo-help-groupX ################################################################### -Version: 3.4.5.4 +Version: 3.5.2.2 Release: 0 -%define piece help -%define lo_build_version 3.4.5.4 -%define lo_piece_version 3.4.5.4 -%define lo_sourcedirname libreoffice-build-%lo_piece_version -%define lo_home libreoffice -%define lo_basis_dir basis3.4 +%define gnu_make_version 3.82 +%define gnu_make_snapshot 20120301 +%define zip_version 3.0 +%define lo_home libreoffice # test_build_langs: 1 = de and cs # 2 = all supported languages %define test_build_langs 2 @@ -89,16 +87,15 @@ Summary: LibreOffice Help Development License: LGPL-3.0 Group: Productivity/Office/Suite Url: http://www.documentfoundation.org/ -Source0: libreoffice-bootstrap-%version.tar.bz2 -Source1: libreoffice-artwork-%version.tar.bz2 -Source2: libreoffice-help-%version.tar.bz2 -Source3: libreoffice-libs-core-%version.tar.bz2 -Source4: libreoffice-libs-extern-sys-%version.tar.bz2 -Source5: libreoffice-libs-extern-%version.tar.bz2 -Source6: libreoffice-libs-gui-%version.tar.bz2 -Source7: libreoffice-testing-%version.tar.bz2 -Source8: libreoffice-translations-%version.tar.bz2 -Source9: libreoffice-ure-%version.tar.bz2 +Source0: libreoffice-core-%version.tar.bz2 +Source1: libreoffice-help-%version.tar.bz2 +Source2: libreoffice-translations-%version.tar.bz2 +# make-3.82 is needed for parallel build +# this version extends plain make-3.82 with --warn-undefined-functions option +# URL: http://cgit.freedesktop.org/libreoffice/contrib/dev-tools/tree/make-3.82-gbuild, snapshot 2011-08-17 +Source30: make-%gnu_make_version-gbuild-%gnu_make_snapshot.tar.bz2 +# zip-3.0 or newer is required because of the --filesync feature +Source31: zip-%zip_version.tar.bz2 # SUSE config files Source100: SUSE.conf Source101: SUSE-10.1.conf @@ -110,13 +107,10 @@ Source105: SUSE-11.4.conf Source200: libreoffice-help-groupX.spec.in Source201: lo-help-gen-spec Source202: lo-help-groupX -# -Patch0: libreoffice-configure-typo-fontconfig.diff -# OBJEXT variable was not set correctly if AC_PROC_CC was not called early -# I think that it worked only by chance when there was checks for more system librarires -Patch1: libreoffice-cc-detection.diff -# it created 3.8GB build log; Build Service refused to build such package -Patch2: translations-no-warnigns-from-po2oo.diff +# allow to unpack source tarballs +Patch0: libreoffice-3.5-unpack-sources.diff +# cups is not needed for helpcontent build +Patch1: build-helpcontent-do-not-check-cups.diff BuildRoot: %{_tmppath}/%{name}-%{version}-build #!ExclusiveArch: %ix86 x86_64 ppc BuildArch: noarch @@ -125,17 +119,25 @@ BuildArch: noarch This package provides files related to the LibreOffice help development. - %if %test_build_langs >= 2 - %package -n libreoffice-help-en-ZA Summary: South Africa English Help Localization for LibreOffice Group: Productivity/Office/Suite Provides: locale(libreoffice:en_ZA) -PreReq: libreoffice = %version -%if 0%{?suse_version} -Supplements: libreoffice-l10n-en-ZA +%if 0%{?suse_version} > 01120 +Requires(post): coreutils +Requires(post): grep +Requires(post): libreoffice >= 3.5 +Requires(postun): coreutils +Requires(postun): grep +Requires(postun): libreoffice >= 3.5 %endif +%if 0%{?suse_version} && 0%{?suse_version} <= 01120 +PreReq: coreutils +PreReq: grep +PreReq: libreoffice >= 3.5 +%endif +Requires: libreoffice = %{version} # compat stuff Provides: OpenOffice_org-help-en-ZA = %version Obsoletes: OpenOffice_org-help-en-ZA <= %version @@ -145,16 +147,24 @@ Provides: OpenOffice_org-en-ZA:%_prefix/ooo-2.0/help/en-ZA/default.css South Africa English help localization for LibreOffice. The other localized stuff is in libreoffice-l10n-en-ZA. - - %package -n libreoffice-help-es Summary: Spanish Help Localization for LibreOffice Group: Productivity/Office/Suite Provides: locale(libreoffice:es) -PreReq: libreoffice = %version -%if 0%{?suse_version} -Supplements: libreoffice-l10n-es +%if 0%{?suse_version} > 01120 +Requires(post): coreutils +Requires(post): grep +Requires(post): libreoffice >= 3.5 +Requires(postun): coreutils +Requires(postun): grep +Requires(postun): libreoffice >= 3.5 %endif +%if 0%{?suse_version} && 0%{?suse_version} <= 01120 +PreReq: coreutils +PreReq: grep +PreReq: libreoffice >= 3.5 +%endif +Requires: libreoffice = %{version} # compat stuff Provides: OpenOffice_org-help-es = %version Obsoletes: OpenOffice_org-help-es <= %version @@ -164,16 +174,24 @@ Provides: OpenOffice_org-es:%_prefix/ooo-2.0/help/es/default.css Spanish help localization for LibreOffice. The other localized stuff is in libreoffice-l10n-es. - - %package -n libreoffice-help-et Summary: Estonian Help Localization for LibreOffice Group: Productivity/Office/Suite Provides: locale(libreoffice:et) -PreReq: libreoffice = %version -%if 0%{?suse_version} -Supplements: libreoffice-l10n-et +%if 0%{?suse_version} > 01120 +Requires(post): coreutils +Requires(post): grep +Requires(post): libreoffice >= 3.5 +Requires(postun): coreutils +Requires(postun): grep +Requires(postun): libreoffice >= 3.5 %endif +%if 0%{?suse_version} && 0%{?suse_version} <= 01120 +PreReq: coreutils +PreReq: grep +PreReq: libreoffice >= 3.5 +%endif +Requires: libreoffice = %{version} # compat stuff Provides: OpenOffice_org-help-et = %version Obsoletes: OpenOffice_org-help-et <= %version @@ -183,16 +201,24 @@ Provides: OpenOffice_org-et:%_prefix/ooo-2.0/help/et/default.css Estonian help localization for LibreOffice. The other localized stuff is in libreoffice-l10n-et. - - %package -n libreoffice-help-fr Summary: French Help Localization for LibreOffice Group: Productivity/Office/Suite Provides: locale(libreoffice:fr) -PreReq: libreoffice = %version -%if 0%{?suse_version} -Supplements: libreoffice-l10n-fr +%if 0%{?suse_version} > 01120 +Requires(post): coreutils +Requires(post): grep +Requires(post): libreoffice >= 3.5 +Requires(postun): coreutils +Requires(postun): grep +Requires(postun): libreoffice >= 3.5 %endif +%if 0%{?suse_version} && 0%{?suse_version} <= 01120 +PreReq: coreutils +PreReq: grep +PreReq: libreoffice >= 3.5 +%endif +Requires: libreoffice = %{version} # compat stuff Provides: OpenOffice_org-help-fr = %version Obsoletes: OpenOffice_org-help-fr <= %version @@ -202,16 +228,24 @@ Provides: OpenOffice_org-fr:%_prefix/ooo-2.0/help/fr/default.css French help localization for LibreOffice. The other localized stuff is in libreoffice-l10n-fr. - - %package -n libreoffice-help-gl Summary: Galician Help Localization for LibreOffice Group: Productivity/Office/Suite Provides: locale(libreoffice:gl) -PreReq: libreoffice = %version -%if 0%{?suse_version} -Supplements: libreoffice-l10n-gl +%if 0%{?suse_version} > 01120 +Requires(post): coreutils +Requires(post): grep +Requires(post): libreoffice >= 3.5 +Requires(postun): coreutils +Requires(postun): grep +Requires(postun): libreoffice >= 3.5 %endif +%if 0%{?suse_version} && 0%{?suse_version} <= 01120 +PreReq: coreutils +PreReq: grep +PreReq: libreoffice >= 3.5 +%endif +Requires: libreoffice = %{version} # compat stuff Provides: OpenOffice_org-help-gl = %version Obsoletes: OpenOffice_org-help-gl <= %version @@ -225,22 +259,29 @@ is in libreoffice-l10n-gl. %prep %if %prepare_build == 0 -%setup -D -T -q -n libreoffice-bootstrap-%version +%setup -D -T -q -n libreoffice-core-%version %else -%setup -q -n libreoffice-bootstrap-%version -bin/unpack-sources `pwd` \ - %{S:1} %{S:2} %{S:3} %{S:4} %{S:5} \ - %{S:6} %{S:7} %{S:8} %{S:9} +%setup -q -a30 -a31 -n libreoffice-core-%version +%patch0 +bin/unpack-sources `pwd` %{S:1} %{S:2} # SUSE config files cp %{S:100} %{S:101} %{S:102} %{S:103} %{S:104} %{S:105} distro-configs # extra fixes -%patch0 %patch1 -%patch2 %endif %build %if %prepare_build != 0 +# first build make-3.82 +cd make-* +CFLAGS=$RPM_OPT_FLAGS ./configure +make %{?_smp_mflags} +cd - +# +# second build zip-3.0 +cd zip30 +make %{?jobs:-j%jobs} -f unix/Makefile prefix=/usr CC="gcc $RPM_OPT_FLAGS -DLARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64" generic_gcc +cd - # # Parallel build settings ... # parallel build of modules; it makes sense on machines with more CPUs @@ -281,7 +322,8 @@ export JAVA_HOME=%{java_home} # use RPM_OPT_FLAGS, ... export ARCH_FLAGS="`echo $RPM_OPT_FLAGS | sed -e 's/\-O[0-9s]//g' -e 's/\-fexceptions//g'` -fno-strict-aliasing" # FIXME: genccode from the system icu is in /usr/sbin -export PATH="$PATH:/usr/sbin" +# FIXME: we need make-3.82 for parallel build +export PATH="$RPM_BUILD_DIR/libreoffice-core-%version/make-%gnu_make_version-gbuild:$RPM_BUILD_DIR/libreoffice-core-%version/zip30:$PATH:/usr/sbin" %if %prepare_build != 0 ./autogen.sh \ --with-external-tar="$RPM_SOURCE_DIR" \ @@ -301,7 +343,6 @@ export PATH="$PATH:/usr/sbin" --disable-fontconfig \ --without-junit \ --without-system-jpeg \ - --disable-python \ --disable-mozilla \ --disable-mono \ --without-system-curl \ @@ -323,27 +364,26 @@ export PATH="$PATH:/usr/sbin" --disable-evolution2 %endif ./bootstrap -. ./*[Ee]nv.[Ss]et.sh +. ./Env.Host.sh cd helpcontent2 build --all $PARALLEL_BUILD %install -. ./*Env.Set.sh +. ./Env.Host.sh test -z %lo_langs && langs="en-US" || langs=%lo_langs mkdir -p file-lists for lang in $langs ; do test "$lang" = "en-US" && langdir="en" || langdir="$lang" - mkdir -p $RPM_BUILD_ROOT/%_datadir/%lo_home/%lo_basis_dir/help/$langdir + mkdir -p $RPM_BUILD_ROOT/%_datadir/%lo_home/help/$langdir for pack in helpcontent2/$INPATH/bin/s*$lang.zip ; do - unzip $pack -d $RPM_BUILD_ROOT/%_datadir/%lo_home/%lo_basis_dir/help/$langdir + unzip $pack -d $RPM_BUILD_ROOT/%_datadir/%lo_home/help/$langdir done lang_underscore=`echo $lang | sed "s/-/_/g"` filelist=help_${lang_underscore}_list.txt echo "%dir %_datadir/%lo_home" >file-lists/$filelist - echo "%dir %_datadir/%lo_home/%lo_basis_dir" >>file-lists/$filelist - echo "%dir %_datadir/%lo_home/%lo_basis_dir/help" >>file-lists/$filelist - find $RPM_BUILD_ROOT/%_datadir/%lo_home/%lo_basis_dir/help/$langdir -type d -printf "%%%%dir %_datadir/%lo_home/%lo_basis_dir/help/$langdir/%%P\n" >>file-lists/$filelist - find $RPM_BUILD_ROOT/%_datadir/%lo_home/%lo_basis_dir/help/$langdir -type f -printf "%_datadir/%lo_home/%lo_basis_dir/help/$langdir/%%P\n" >>file-lists/$filelist + echo "%dir %_datadir/%lo_home/help" >>file-lists/$filelist + find $RPM_BUILD_ROOT/%_datadir/%lo_home/help/$langdir -type d -printf "%%%%dir %_datadir/%lo_home/help/$langdir/%%P\n" >>file-lists/$filelist + find $RPM_BUILD_ROOT/%_datadir/%lo_home/help/$langdir -type f -printf "%_datadir/%lo_home/help/$langdir/%%P\n" >>file-lists/$filelist # the file list is needed to create compat symlinks cp file-lists/$filelist $RPM_BUILD_ROOT/%_datadir/%lo_home echo "%_datadir/%lo_home/$filelist" >>file-lists/$filelist @@ -411,7 +451,6 @@ rm -f %_datadir/%lo_home/help_gl_list.txt.postun 2>/dev/null %endif %if %test_build_langs >= 2 - %files -f file-lists/help_en_ZA_list.txt -n libreoffice-help-en-ZA %defattr(-,root,root) @@ -426,6 +465,7 @@ rm -f %_datadir/%lo_home/help_gl_list.txt.postun 2>/dev/null %files -f file-lists/help_gl_list.txt -n libreoffice-help-gl %defattr(-,root,root) + %endif %changelog diff --git a/libreoffice-help-group3.changes b/libreoffice-help-group3.changes index 66e292e..0640c9d 100644 --- a/libreoffice-help-group3.changes +++ b/libreoffice-help-group3.changes @@ -1,3 +1,37 @@ +------------------------------------------------------------------- +Wed Apr 4 13:39:46 UTC 2012 - pmladek@suse.com + +- clean up lo-help-gen-spec according to lo-l10n-gen-spec +- do not supplement l10n packages; we provide support for the given locale; + the extra recommends annoys users when updating on Live-CD (bnc#551003) +- use Requires(pre) instead of PreReq on never distributions + +------------------------------------------------------------------- +Wed Mar 28 15:43:47 UTC 2012 - pmladek@suse.com + +- updated to libreoffice-3.5.5.2 (3.5.2-rc2) +- basis subdirectory does not longer exists on the installed system +- mozilla is not longer used for build: + * use --disable-mozilla, --without-system-mozilla, --with-system-nss, + --disable-ldap, --enable-xmlsec instead of --with-system-mozilla, + --with-system-mozilla=xulrunner +- enable python during build; it is needed to localize the sources +- use internal hacked make version 3.82, snapshot 20120301 to get fast + and reliable parallel build +- build zip-3.0 on openSUSE < 11.4; --filesync is needed during build +- libreoffice-3.5-unpack-sources.diff: allow to unpack source tarballs +- build-helpcontent-do-not-check-cups.diff: cups is not needed for helpcontent + +------------------------------------------------------------------- +Wed Mar 14 14:34:11 UTC 2012 - pmladek@suse.com + +- libreoffice-3.4.5.5 == SUSE 3.4.5-rc3 == final + +------------------------------------------------------------------- +Mon Mar 12 18:58:39 UTC 2012 - pmladek@suse.com + +- updated to libreoffice-3.4.5.5 (SUSE 3.4.5-rc3) + ------------------------------------------------------------------- Tue Mar 6 15:55:09 UTC 2012 - pmladek@suse.com diff --git a/libreoffice-help-group3.spec b/libreoffice-help-group3.spec index e094d85..5c62f2d 100644 --- a/libreoffice-help-group3.spec +++ b/libreoffice-help-group3.spec @@ -22,14 +22,12 @@ Name: libreoffice-help-group3 ## Generated by: ## perl lo-help-gen-spec libreoffice-help-groupX.spec.in lo-help-groupX ################################################################### -Version: 3.4.5.4 +Version: 3.5.2.2 Release: 0 -%define piece help -%define lo_build_version 3.4.5.4 -%define lo_piece_version 3.4.5.4 -%define lo_sourcedirname libreoffice-build-%lo_piece_version -%define lo_home libreoffice -%define lo_basis_dir basis3.4 +%define gnu_make_version 3.82 +%define gnu_make_snapshot 20120301 +%define zip_version 3.0 +%define lo_home libreoffice # test_build_langs: 1 = de and cs # 2 = all supported languages %define test_build_langs 2 @@ -89,16 +87,15 @@ Summary: LibreOffice Help Development License: LGPL-3.0 Group: Productivity/Office/Suite Url: http://www.documentfoundation.org/ -Source0: libreoffice-bootstrap-%version.tar.bz2 -Source1: libreoffice-artwork-%version.tar.bz2 -Source2: libreoffice-help-%version.tar.bz2 -Source3: libreoffice-libs-core-%version.tar.bz2 -Source4: libreoffice-libs-extern-sys-%version.tar.bz2 -Source5: libreoffice-libs-extern-%version.tar.bz2 -Source6: libreoffice-libs-gui-%version.tar.bz2 -Source7: libreoffice-testing-%version.tar.bz2 -Source8: libreoffice-translations-%version.tar.bz2 -Source9: libreoffice-ure-%version.tar.bz2 +Source0: libreoffice-core-%version.tar.bz2 +Source1: libreoffice-help-%version.tar.bz2 +Source2: libreoffice-translations-%version.tar.bz2 +# make-3.82 is needed for parallel build +# this version extends plain make-3.82 with --warn-undefined-functions option +# URL: http://cgit.freedesktop.org/libreoffice/contrib/dev-tools/tree/make-3.82-gbuild, snapshot 2011-08-17 +Source30: make-%gnu_make_version-gbuild-%gnu_make_snapshot.tar.bz2 +# zip-3.0 or newer is required because of the --filesync feature +Source31: zip-%zip_version.tar.bz2 # SUSE config files Source100: SUSE.conf Source101: SUSE-10.1.conf @@ -110,13 +107,10 @@ Source105: SUSE-11.4.conf Source200: libreoffice-help-groupX.spec.in Source201: lo-help-gen-spec Source202: lo-help-groupX -# -Patch0: libreoffice-configure-typo-fontconfig.diff -# OBJEXT variable was not set correctly if AC_PROC_CC was not called early -# I think that it worked only by chance when there was checks for more system librarires -Patch1: libreoffice-cc-detection.diff -# it created 3.8GB build log; Build Service refused to build such package -Patch2: translations-no-warnigns-from-po2oo.diff +# allow to unpack source tarballs +Patch0: libreoffice-3.5-unpack-sources.diff +# cups is not needed for helpcontent build +Patch1: build-helpcontent-do-not-check-cups.diff BuildRoot: %{_tmppath}/%{name}-%{version}-build #!ExclusiveArch: %ix86 x86_64 ppc BuildArch: noarch @@ -125,17 +119,25 @@ BuildArch: noarch This package provides files related to the LibreOffice help development. - %if %test_build_langs >= 2 - %package -n libreoffice-help-gu-IN Summary: Gujarati Help Localization for LibreOffice Group: Productivity/Office/Suite Provides: locale(libreoffice:gu) -PreReq: libreoffice = %version -%if 0%{?suse_version} -Supplements: libreoffice-l10n-gu-IN +%if 0%{?suse_version} > 01120 +Requires(post): coreutils +Requires(post): grep +Requires(post): libreoffice >= 3.5 +Requires(postun): coreutils +Requires(postun): grep +Requires(postun): libreoffice >= 3.5 %endif +%if 0%{?suse_version} && 0%{?suse_version} <= 01120 +PreReq: coreutils +PreReq: grep +PreReq: libreoffice >= 3.5 +%endif +Requires: libreoffice = %{version} # compat stuff Provides: OpenOffice_org-help-gu-IN = %version Obsoletes: OpenOffice_org-help-gu-IN <= %version @@ -145,16 +147,24 @@ Provides: OpenOffice_org-gu-IN:%_prefix/ooo-2.0/help/gu-IN/default.css Gujarati help localization for LibreOffice. The other localized stuff is in libreoffice-l10n-gu-IN. - - %package -n libreoffice-help-hi-IN Summary: Hindi Help Localization for LibreOffice Group: Productivity/Office/Suite Provides: locale(libreoffice:hi) -PreReq: libreoffice = %version -%if 0%{?suse_version} -Supplements: libreoffice-l10n-hi-IN +%if 0%{?suse_version} > 01120 +Requires(post): coreutils +Requires(post): grep +Requires(post): libreoffice >= 3.5 +Requires(postun): coreutils +Requires(postun): grep +Requires(postun): libreoffice >= 3.5 %endif +%if 0%{?suse_version} && 0%{?suse_version} <= 01120 +PreReq: coreutils +PreReq: grep +PreReq: libreoffice >= 3.5 +%endif +Requires: libreoffice = %{version} # compat stuff Provides: OpenOffice_org-help-hi-IN = %version Obsoletes: OpenOffice_org-help-hi-IN <= %version @@ -164,7 +174,6 @@ Provides: OpenOffice_org-hi-IN:%_prefix/ooo-2.0/help/hi-IN/default.css Hindi help localization for LibreOffice. The other localized stuff is in libreoffice-l10n-hi-IN. - %endif %if %test_build_langs >= 1 @@ -172,10 +181,20 @@ is in libreoffice-l10n-hi-IN. Summary: Hungarian Help Localization for LibreOffice Group: Productivity/Office/Suite Provides: locale(libreoffice:hu) -PreReq: libreoffice = %version -%if 0%{?suse_version} -Supplements: libreoffice-l10n-hu +%if 0%{?suse_version} > 01120 +Requires(post): coreutils +Requires(post): grep +Requires(post): libreoffice >= 3.5 +Requires(postun): coreutils +Requires(postun): grep +Requires(postun): libreoffice >= 3.5 %endif +%if 0%{?suse_version} && 0%{?suse_version} <= 01120 +PreReq: coreutils +PreReq: grep +PreReq: libreoffice >= 3.5 +%endif +Requires: libreoffice = %{version} # compat stuff Provides: OpenOffice_org-help-hu = %version Obsoletes: OpenOffice_org-help-hu <= %version @@ -185,7 +204,6 @@ Provides: OpenOffice_org-hu:%_prefix/ooo-2.0/help/hu/default.css Hungarian help localization for LibreOffice. The other localized stuff is in libreoffice-l10n-hu. - %endif %if %test_build_langs >= 2 @@ -193,10 +211,20 @@ is in libreoffice-l10n-hu. Summary: Italian Help Localization for LibreOffice Group: Productivity/Office/Suite Provides: locale(libreoffice:it) -PreReq: libreoffice = %version -%if 0%{?suse_version} -Supplements: libreoffice-l10n-it +%if 0%{?suse_version} > 01120 +Requires(post): coreutils +Requires(post): grep +Requires(post): libreoffice >= 3.5 +Requires(postun): coreutils +Requires(postun): grep +Requires(postun): libreoffice >= 3.5 %endif +%if 0%{?suse_version} && 0%{?suse_version} <= 01120 +PreReq: coreutils +PreReq: grep +PreReq: libreoffice >= 3.5 +%endif +Requires: libreoffice = %{version} # compat stuff Provides: OpenOffice_org-help-it = %version Obsoletes: OpenOffice_org-help-it <= %version @@ -206,7 +234,6 @@ Provides: OpenOffice_org-it:%_prefix/ooo-2.0/help/it/default.css Italian help localization for LibreOffice. The other localized stuff is in libreoffice-l10n-it. - %endif %if %test_build_langs >= 1 @@ -214,10 +241,20 @@ is in libreoffice-l10n-it. Summary: Japanese Help Localization for LibreOffice Group: Productivity/Office/Suite Provides: locale(libreoffice:ja) -PreReq: libreoffice = %version -%if 0%{?suse_version} -Supplements: libreoffice-l10n-ja +%if 0%{?suse_version} > 01120 +Requires(post): coreutils +Requires(post): grep +Requires(post): libreoffice >= 3.5 +Requires(postun): coreutils +Requires(postun): grep +Requires(postun): libreoffice >= 3.5 %endif +%if 0%{?suse_version} && 0%{?suse_version} <= 01120 +PreReq: coreutils +PreReq: grep +PreReq: libreoffice >= 3.5 +%endif +Requires: libreoffice = %{version} # compat stuff Provides: OpenOffice_org-help-ja = %version Obsoletes: OpenOffice_org-help-ja <= %version @@ -227,7 +264,6 @@ Provides: OpenOffice_org-ja:%_prefix/ooo-2.0/help/ja/default.css Japanese help localization for LibreOffice. The other localized stuff is in libreoffice-l10n-ja. - %endif %if %test_build_langs >= 2 @@ -235,10 +271,20 @@ is in libreoffice-l10n-ja. Summary: Khmer Help Localization for LibreOffice Group: Productivity/Office/Suite Provides: locale(libreoffice:km) -PreReq: libreoffice = %version -%if 0%{?suse_version} -Supplements: libreoffice-l10n-km +%if 0%{?suse_version} > 01120 +Requires(post): coreutils +Requires(post): grep +Requires(post): libreoffice >= 3.5 +Requires(postun): coreutils +Requires(postun): grep +Requires(postun): libreoffice >= 3.5 %endif +%if 0%{?suse_version} && 0%{?suse_version} <= 01120 +PreReq: coreutils +PreReq: grep +PreReq: libreoffice >= 3.5 +%endif +Requires: libreoffice = %{version} # compat stuff Provides: OpenOffice_org-help-km = %version Obsoletes: OpenOffice_org-help-km <= %version @@ -252,22 +298,29 @@ is in libreoffice-l10n-km. %prep %if %prepare_build == 0 -%setup -D -T -q -n libreoffice-bootstrap-%version +%setup -D -T -q -n libreoffice-core-%version %else -%setup -q -n libreoffice-bootstrap-%version -bin/unpack-sources `pwd` \ - %{S:1} %{S:2} %{S:3} %{S:4} %{S:5} \ - %{S:6} %{S:7} %{S:8} %{S:9} +%setup -q -a30 -a31 -n libreoffice-core-%version +%patch0 +bin/unpack-sources `pwd` %{S:1} %{S:2} # SUSE config files cp %{S:100} %{S:101} %{S:102} %{S:103} %{S:104} %{S:105} distro-configs # extra fixes -%patch0 %patch1 -%patch2 %endif %build %if %prepare_build != 0 +# first build make-3.82 +cd make-* +CFLAGS=$RPM_OPT_FLAGS ./configure +make %{?_smp_mflags} +cd - +# +# second build zip-3.0 +cd zip30 +make %{?jobs:-j%jobs} -f unix/Makefile prefix=/usr CC="gcc $RPM_OPT_FLAGS -DLARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64" generic_gcc +cd - # # Parallel build settings ... # parallel build of modules; it makes sense on machines with more CPUs @@ -308,7 +361,8 @@ export JAVA_HOME=%{java_home} # use RPM_OPT_FLAGS, ... export ARCH_FLAGS="`echo $RPM_OPT_FLAGS | sed -e 's/\-O[0-9s]//g' -e 's/\-fexceptions//g'` -fno-strict-aliasing" # FIXME: genccode from the system icu is in /usr/sbin -export PATH="$PATH:/usr/sbin" +# FIXME: we need make-3.82 for parallel build +export PATH="$RPM_BUILD_DIR/libreoffice-core-%version/make-%gnu_make_version-gbuild:$RPM_BUILD_DIR/libreoffice-core-%version/zip30:$PATH:/usr/sbin" %if %prepare_build != 0 ./autogen.sh \ --with-external-tar="$RPM_SOURCE_DIR" \ @@ -328,7 +382,6 @@ export PATH="$PATH:/usr/sbin" --disable-fontconfig \ --without-junit \ --without-system-jpeg \ - --disable-python \ --disable-mozilla \ --disable-mono \ --without-system-curl \ @@ -350,27 +403,26 @@ export PATH="$PATH:/usr/sbin" --disable-evolution2 %endif ./bootstrap -. ./*[Ee]nv.[Ss]et.sh +. ./Env.Host.sh cd helpcontent2 build --all $PARALLEL_BUILD %install -. ./*Env.Set.sh +. ./Env.Host.sh test -z %lo_langs && langs="en-US" || langs=%lo_langs mkdir -p file-lists for lang in $langs ; do test "$lang" = "en-US" && langdir="en" || langdir="$lang" - mkdir -p $RPM_BUILD_ROOT/%_datadir/%lo_home/%lo_basis_dir/help/$langdir + mkdir -p $RPM_BUILD_ROOT/%_datadir/%lo_home/help/$langdir for pack in helpcontent2/$INPATH/bin/s*$lang.zip ; do - unzip $pack -d $RPM_BUILD_ROOT/%_datadir/%lo_home/%lo_basis_dir/help/$langdir + unzip $pack -d $RPM_BUILD_ROOT/%_datadir/%lo_home/help/$langdir done lang_underscore=`echo $lang | sed "s/-/_/g"` filelist=help_${lang_underscore}_list.txt echo "%dir %_datadir/%lo_home" >file-lists/$filelist - echo "%dir %_datadir/%lo_home/%lo_basis_dir" >>file-lists/$filelist - echo "%dir %_datadir/%lo_home/%lo_basis_dir/help" >>file-lists/$filelist - find $RPM_BUILD_ROOT/%_datadir/%lo_home/%lo_basis_dir/help/$langdir -type d -printf "%%%%dir %_datadir/%lo_home/%lo_basis_dir/help/$langdir/%%P\n" >>file-lists/$filelist - find $RPM_BUILD_ROOT/%_datadir/%lo_home/%lo_basis_dir/help/$langdir -type f -printf "%_datadir/%lo_home/%lo_basis_dir/help/$langdir/%%P\n" >>file-lists/$filelist + echo "%dir %_datadir/%lo_home/help" >>file-lists/$filelist + find $RPM_BUILD_ROOT/%_datadir/%lo_home/help/$langdir -type d -printf "%%%%dir %_datadir/%lo_home/help/$langdir/%%P\n" >>file-lists/$filelist + find $RPM_BUILD_ROOT/%_datadir/%lo_home/help/$langdir -type f -printf "%_datadir/%lo_home/help/$langdir/%%P\n" >>file-lists/$filelist # the file list is needed to create compat symlinks cp file-lists/$filelist $RPM_BUILD_ROOT/%_datadir/%lo_home echo "%_datadir/%lo_home/$filelist" >>file-lists/$filelist @@ -402,9 +454,9 @@ test "$1" = "0" && cp %_datadir/%lo_home/help_hi_list.txt %_datadir/%lo_home/hel %postun -n libreoffice-help-hi-IN test "$1" = "0" && %_datadir/%lo_home/link-to-ooo-home --unlink %_datadir/%lo_home/help_hi_list.txt.postun || true rm -f %_datadir/%lo_home/help_hi_list.txt.postun 2>/dev/null - %endif %if %test_build_langs >= 1 + # hu %posttrans -n libreoffice-help-hu @@ -416,9 +468,9 @@ test "$1" = "0" && cp %_datadir/%lo_home/help_hu_list.txt %_datadir/%lo_home/hel %postun -n libreoffice-help-hu test "$1" = "0" && %_datadir/%lo_home/link-to-ooo-home --unlink %_datadir/%lo_home/help_hu_list.txt.postun || true rm -f %_datadir/%lo_home/help_hu_list.txt.postun 2>/dev/null - %endif %if %test_build_langs >= 2 + # it %posttrans -n libreoffice-help-it @@ -430,9 +482,9 @@ test "$1" = "0" && cp %_datadir/%lo_home/help_it_list.txt %_datadir/%lo_home/hel %postun -n libreoffice-help-it test "$1" = "0" && %_datadir/%lo_home/link-to-ooo-home --unlink %_datadir/%lo_home/help_it_list.txt.postun || true rm -f %_datadir/%lo_home/help_it_list.txt.postun 2>/dev/null - %endif %if %test_build_langs >= 1 + # ja %posttrans -n libreoffice-help-ja @@ -444,9 +496,9 @@ test "$1" = "0" && cp %_datadir/%lo_home/help_ja_list.txt %_datadir/%lo_home/hel %postun -n libreoffice-help-ja test "$1" = "0" && %_datadir/%lo_home/link-to-ooo-home --unlink %_datadir/%lo_home/help_ja_list.txt.postun || true rm -f %_datadir/%lo_home/help_ja_list.txt.postun 2>/dev/null - %endif %if %test_build_langs >= 2 + # km %posttrans -n libreoffice-help-km @@ -461,7 +513,6 @@ rm -f %_datadir/%lo_home/help_km_list.txt.postun 2>/dev/null %endif %if %test_build_langs >= 2 - %files -f file-lists/help_gu_list.txt -n libreoffice-help-gu-IN %defattr(-,root,root) @@ -491,6 +542,7 @@ rm -f %_datadir/%lo_home/help_km_list.txt.postun 2>/dev/null %files -f file-lists/help_km_list.txt -n libreoffice-help-km %defattr(-,root,root) + %endif %changelog diff --git a/libreoffice-help-group4.changes b/libreoffice-help-group4.changes index 79adfc3..d00c22e 100644 --- a/libreoffice-help-group4.changes +++ b/libreoffice-help-group4.changes @@ -1,3 +1,37 @@ +------------------------------------------------------------------- +Wed Apr 4 13:39:46 UTC 2012 - pmladek@suse.com + +- clean up lo-help-gen-spec according to lo-l10n-gen-spec +- do not supplement l10n packages; we provide support for the given locale; + the extra recommends annoys users when updating on Live-CD (bnc#551003) +- use Requires(pre) instead of PreReq on never distributions + +------------------------------------------------------------------- +Wed Mar 28 15:43:47 UTC 2012 - pmladek@suse.com + +- updated to libreoffice-3.5.5.2 (3.5.2-rc2) +- basis subdirectory does not longer exists on the installed system +- mozilla is not longer used for build: + * use --disable-mozilla, --without-system-mozilla, --with-system-nss, + --disable-ldap, --enable-xmlsec instead of --with-system-mozilla, + --with-system-mozilla=xulrunner +- enable python during build; it is needed to localize the sources +- use internal hacked make version 3.82, snapshot 20120301 to get fast + and reliable parallel build +- build zip-3.0 on openSUSE < 11.4; --filesync is needed during build +- libreoffice-3.5-unpack-sources.diff: allow to unpack source tarballs +- build-helpcontent-do-not-check-cups.diff: cups is not needed for helpcontent + +------------------------------------------------------------------- +Wed Mar 14 14:34:11 UTC 2012 - pmladek@suse.com + +- libreoffice-3.4.5.5 == SUSE 3.4.5-rc3 == final + +------------------------------------------------------------------- +Mon Mar 12 18:58:39 UTC 2012 - pmladek@suse.com + +- updated to libreoffice-3.4.5.5 (SUSE 3.4.5-rc3) + ------------------------------------------------------------------- Tue Mar 6 15:55:09 UTC 2012 - pmladek@suse.com diff --git a/libreoffice-help-group4.spec b/libreoffice-help-group4.spec index 84657ae..9a83b3b 100644 --- a/libreoffice-help-group4.spec +++ b/libreoffice-help-group4.spec @@ -22,14 +22,12 @@ Name: libreoffice-help-group4 ## Generated by: ## perl lo-help-gen-spec libreoffice-help-groupX.spec.in lo-help-groupX ################################################################### -Version: 3.4.5.4 +Version: 3.5.2.2 Release: 0 -%define piece help -%define lo_build_version 3.4.5.4 -%define lo_piece_version 3.4.5.4 -%define lo_sourcedirname libreoffice-build-%lo_piece_version -%define lo_home libreoffice -%define lo_basis_dir basis3.4 +%define gnu_make_version 3.82 +%define gnu_make_snapshot 20120301 +%define zip_version 3.0 +%define lo_home libreoffice # test_build_langs: 1 = de and cs # 2 = all supported languages %define test_build_langs 2 @@ -89,16 +87,15 @@ Summary: LibreOffice Help Development License: LGPL-3.0 Group: Productivity/Office/Suite Url: http://www.documentfoundation.org/ -Source0: libreoffice-bootstrap-%version.tar.bz2 -Source1: libreoffice-artwork-%version.tar.bz2 -Source2: libreoffice-help-%version.tar.bz2 -Source3: libreoffice-libs-core-%version.tar.bz2 -Source4: libreoffice-libs-extern-sys-%version.tar.bz2 -Source5: libreoffice-libs-extern-%version.tar.bz2 -Source6: libreoffice-libs-gui-%version.tar.bz2 -Source7: libreoffice-testing-%version.tar.bz2 -Source8: libreoffice-translations-%version.tar.bz2 -Source9: libreoffice-ure-%version.tar.bz2 +Source0: libreoffice-core-%version.tar.bz2 +Source1: libreoffice-help-%version.tar.bz2 +Source2: libreoffice-translations-%version.tar.bz2 +# make-3.82 is needed for parallel build +# this version extends plain make-3.82 with --warn-undefined-functions option +# URL: http://cgit.freedesktop.org/libreoffice/contrib/dev-tools/tree/make-3.82-gbuild, snapshot 2011-08-17 +Source30: make-%gnu_make_version-gbuild-%gnu_make_snapshot.tar.bz2 +# zip-3.0 or newer is required because of the --filesync feature +Source31: zip-%zip_version.tar.bz2 # SUSE config files Source100: SUSE.conf Source101: SUSE-10.1.conf @@ -110,13 +107,10 @@ Source105: SUSE-11.4.conf Source200: libreoffice-help-groupX.spec.in Source201: lo-help-gen-spec Source202: lo-help-groupX -# -Patch0: libreoffice-configure-typo-fontconfig.diff -# OBJEXT variable was not set correctly if AC_PROC_CC was not called early -# I think that it worked only by chance when there was checks for more system librarires -Patch1: libreoffice-cc-detection.diff -# it created 3.8GB build log; Build Service refused to build such package -Patch2: translations-no-warnigns-from-po2oo.diff +# allow to unpack source tarballs +Patch0: libreoffice-3.5-unpack-sources.diff +# cups is not needed for helpcontent build +Patch1: build-helpcontent-do-not-check-cups.diff BuildRoot: %{_tmppath}/%{name}-%{version}-build #!ExclusiveArch: %ix86 x86_64 ppc BuildArch: noarch @@ -125,17 +119,25 @@ BuildArch: noarch This package provides files related to the LibreOffice help development. - %if %test_build_langs >= 2 - %package -n libreoffice-help-ko Summary: Korean Help Localization for LibreOffice Group: Productivity/Office/Suite Provides: locale(libreoffice:ko) -PreReq: libreoffice = %version -%if 0%{?suse_version} -Supplements: libreoffice-l10n-ko +%if 0%{?suse_version} > 01120 +Requires(post): coreutils +Requires(post): grep +Requires(post): libreoffice >= 3.5 +Requires(postun): coreutils +Requires(postun): grep +Requires(postun): libreoffice >= 3.5 %endif +%if 0%{?suse_version} && 0%{?suse_version} <= 01120 +PreReq: coreutils +PreReq: grep +PreReq: libreoffice >= 3.5 +%endif +Requires: libreoffice = %{version} # compat stuff Provides: OpenOffice_org-help-ko = %version Obsoletes: OpenOffice_org-help-ko <= %version @@ -145,16 +147,24 @@ Provides: OpenOffice_org-ko:%_prefix/ooo-2.0/help/ko/default.css Korean help localization for LibreOffice. The other localized stuff is in libreoffice-l10n-ko. - - %package -n libreoffice-help-nl Summary: Dutch Help Localization for LibreOffice Group: Productivity/Office/Suite Provides: locale(libreoffice:nl) -PreReq: libreoffice = %version -%if 0%{?suse_version} -Supplements: libreoffice-l10n-nl +%if 0%{?suse_version} > 01120 +Requires(post): coreutils +Requires(post): grep +Requires(post): libreoffice >= 3.5 +Requires(postun): coreutils +Requires(postun): grep +Requires(postun): libreoffice >= 3.5 %endif +%if 0%{?suse_version} && 0%{?suse_version} <= 01120 +PreReq: coreutils +PreReq: grep +PreReq: libreoffice >= 3.5 +%endif +Requires: libreoffice = %{version} # compat stuff Provides: OpenOffice_org-help-nl = %version Obsoletes: OpenOffice_org-help-nl <= %version @@ -164,16 +174,24 @@ Provides: OpenOffice_org-nl:%_prefix/ooo-2.0/help/nl/default.css Dutch help localization for LibreOffice. The other localized stuff is in libreoffice-l10n-nl. - - %package -n libreoffice-help-pl Summary: Polish Help Localization for LibreOffice Group: Productivity/Office/Suite Provides: locale(libreoffice:pl) -PreReq: libreoffice = %version -%if 0%{?suse_version} -Supplements: libreoffice-l10n-pl +%if 0%{?suse_version} > 01120 +Requires(post): coreutils +Requires(post): grep +Requires(post): libreoffice >= 3.5 +Requires(postun): coreutils +Requires(postun): grep +Requires(postun): libreoffice >= 3.5 %endif +%if 0%{?suse_version} && 0%{?suse_version} <= 01120 +PreReq: coreutils +PreReq: grep +PreReq: libreoffice >= 3.5 +%endif +Requires: libreoffice = %{version} # compat stuff Provides: OpenOffice_org-help-pl = %version Obsoletes: OpenOffice_org-help-pl <= %version @@ -183,16 +201,24 @@ Provides: OpenOffice_org-pl:%_prefix/ooo-2.0/help/pl/default.css Polish help localization for LibreOffice. The other localized stuff is in libreoffice-l10n-pl. - - %package -n libreoffice-help-pt Summary: Portuguese Help Localization for LibreOffice Group: Productivity/Office/Suite Provides: locale(libreoffice:pt) -PreReq: libreoffice = %version -%if 0%{?suse_version} -Supplements: libreoffice-l10n-pt +%if 0%{?suse_version} > 01120 +Requires(post): coreutils +Requires(post): grep +Requires(post): libreoffice >= 3.5 +Requires(postun): coreutils +Requires(postun): grep +Requires(postun): libreoffice >= 3.5 %endif +%if 0%{?suse_version} && 0%{?suse_version} <= 01120 +PreReq: coreutils +PreReq: grep +PreReq: libreoffice >= 3.5 +%endif +Requires: libreoffice = %{version} # compat stuff Provides: OpenOffice_org-help-pt = %version Obsoletes: OpenOffice_org-help-pt <= %version @@ -206,22 +232,29 @@ is in libreoffice-l10n-pt. %prep %if %prepare_build == 0 -%setup -D -T -q -n libreoffice-bootstrap-%version +%setup -D -T -q -n libreoffice-core-%version %else -%setup -q -n libreoffice-bootstrap-%version -bin/unpack-sources `pwd` \ - %{S:1} %{S:2} %{S:3} %{S:4} %{S:5} \ - %{S:6} %{S:7} %{S:8} %{S:9} +%setup -q -a30 -a31 -n libreoffice-core-%version +%patch0 +bin/unpack-sources `pwd` %{S:1} %{S:2} # SUSE config files cp %{S:100} %{S:101} %{S:102} %{S:103} %{S:104} %{S:105} distro-configs # extra fixes -%patch0 %patch1 -%patch2 %endif %build %if %prepare_build != 0 +# first build make-3.82 +cd make-* +CFLAGS=$RPM_OPT_FLAGS ./configure +make %{?_smp_mflags} +cd - +# +# second build zip-3.0 +cd zip30 +make %{?jobs:-j%jobs} -f unix/Makefile prefix=/usr CC="gcc $RPM_OPT_FLAGS -DLARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64" generic_gcc +cd - # # Parallel build settings ... # parallel build of modules; it makes sense on machines with more CPUs @@ -262,7 +295,8 @@ export JAVA_HOME=%{java_home} # use RPM_OPT_FLAGS, ... export ARCH_FLAGS="`echo $RPM_OPT_FLAGS | sed -e 's/\-O[0-9s]//g' -e 's/\-fexceptions//g'` -fno-strict-aliasing" # FIXME: genccode from the system icu is in /usr/sbin -export PATH="$PATH:/usr/sbin" +# FIXME: we need make-3.82 for parallel build +export PATH="$RPM_BUILD_DIR/libreoffice-core-%version/make-%gnu_make_version-gbuild:$RPM_BUILD_DIR/libreoffice-core-%version/zip30:$PATH:/usr/sbin" %if %prepare_build != 0 ./autogen.sh \ --with-external-tar="$RPM_SOURCE_DIR" \ @@ -282,7 +316,6 @@ export PATH="$PATH:/usr/sbin" --disable-fontconfig \ --without-junit \ --without-system-jpeg \ - --disable-python \ --disable-mozilla \ --disable-mono \ --without-system-curl \ @@ -304,27 +337,26 @@ export PATH="$PATH:/usr/sbin" --disable-evolution2 %endif ./bootstrap -. ./*[Ee]nv.[Ss]et.sh +. ./Env.Host.sh cd helpcontent2 build --all $PARALLEL_BUILD %install -. ./*Env.Set.sh +. ./Env.Host.sh test -z %lo_langs && langs="en-US" || langs=%lo_langs mkdir -p file-lists for lang in $langs ; do test "$lang" = "en-US" && langdir="en" || langdir="$lang" - mkdir -p $RPM_BUILD_ROOT/%_datadir/%lo_home/%lo_basis_dir/help/$langdir + mkdir -p $RPM_BUILD_ROOT/%_datadir/%lo_home/help/$langdir for pack in helpcontent2/$INPATH/bin/s*$lang.zip ; do - unzip $pack -d $RPM_BUILD_ROOT/%_datadir/%lo_home/%lo_basis_dir/help/$langdir + unzip $pack -d $RPM_BUILD_ROOT/%_datadir/%lo_home/help/$langdir done lang_underscore=`echo $lang | sed "s/-/_/g"` filelist=help_${lang_underscore}_list.txt echo "%dir %_datadir/%lo_home" >file-lists/$filelist - echo "%dir %_datadir/%lo_home/%lo_basis_dir" >>file-lists/$filelist - echo "%dir %_datadir/%lo_home/%lo_basis_dir/help" >>file-lists/$filelist - find $RPM_BUILD_ROOT/%_datadir/%lo_home/%lo_basis_dir/help/$langdir -type d -printf "%%%%dir %_datadir/%lo_home/%lo_basis_dir/help/$langdir/%%P\n" >>file-lists/$filelist - find $RPM_BUILD_ROOT/%_datadir/%lo_home/%lo_basis_dir/help/$langdir -type f -printf "%_datadir/%lo_home/%lo_basis_dir/help/$langdir/%%P\n" >>file-lists/$filelist + echo "%dir %_datadir/%lo_home/help" >>file-lists/$filelist + find $RPM_BUILD_ROOT/%_datadir/%lo_home/help/$langdir -type d -printf "%%%%dir %_datadir/%lo_home/help/$langdir/%%P\n" >>file-lists/$filelist + find $RPM_BUILD_ROOT/%_datadir/%lo_home/help/$langdir -type f -printf "%_datadir/%lo_home/help/$langdir/%%P\n" >>file-lists/$filelist # the file list is needed to create compat symlinks cp file-lists/$filelist $RPM_BUILD_ROOT/%_datadir/%lo_home echo "%_datadir/%lo_home/$filelist" >>file-lists/$filelist @@ -381,7 +413,6 @@ rm -f %_datadir/%lo_home/help_pt_list.txt.postun 2>/dev/null %endif %if %test_build_langs >= 2 - %files -f file-lists/help_ko_list.txt -n libreoffice-help-ko %defattr(-,root,root) @@ -393,6 +424,7 @@ rm -f %_datadir/%lo_home/help_pt_list.txt.postun 2>/dev/null %files -f file-lists/help_pt_list.txt -n libreoffice-help-pt %defattr(-,root,root) + %endif %changelog diff --git a/libreoffice-help-group5.changes b/libreoffice-help-group5.changes index ec3f4d1..cb19c09 100644 --- a/libreoffice-help-group5.changes +++ b/libreoffice-help-group5.changes @@ -1,3 +1,37 @@ +------------------------------------------------------------------- +Wed Apr 4 13:39:46 UTC 2012 - pmladek@suse.com + +- clean up lo-help-gen-spec according to lo-l10n-gen-spec +- do not supplement l10n packages; we provide support for the given locale; + the extra recommends annoys users when updating on Live-CD (bnc#551003) +- use Requires(pre) instead of PreReq on never distributions + +------------------------------------------------------------------- +Wed Mar 28 15:43:47 UTC 2012 - pmladek@suse.com + +- updated to libreoffice-3.5.5.2 (3.5.2-rc2) +- basis subdirectory does not longer exists on the installed system +- mozilla is not longer used for build: + * use --disable-mozilla, --without-system-mozilla, --with-system-nss, + --disable-ldap, --enable-xmlsec instead of --with-system-mozilla, + --with-system-mozilla=xulrunner +- enable python during build; it is needed to localize the sources +- use internal hacked make version 3.82, snapshot 20120301 to get fast + and reliable parallel build +- build zip-3.0 on openSUSE < 11.4; --filesync is needed during build +- libreoffice-3.5-unpack-sources.diff: allow to unpack source tarballs +- build-helpcontent-do-not-check-cups.diff: cups is not needed for helpcontent + +------------------------------------------------------------------- +Wed Mar 14 14:34:11 UTC 2012 - pmladek@suse.com + +- libreoffice-3.4.5.5 == SUSE 3.4.5-rc3 == final + +------------------------------------------------------------------- +Mon Mar 12 18:58:39 UTC 2012 - pmladek@suse.com + +- updated to libreoffice-3.4.5.5 (SUSE 3.4.5-rc3) + ------------------------------------------------------------------- Tue Mar 6 15:55:09 UTC 2012 - pmladek@suse.com diff --git a/libreoffice-help-group5.spec b/libreoffice-help-group5.spec index 3ba888c..609fffb 100644 --- a/libreoffice-help-group5.spec +++ b/libreoffice-help-group5.spec @@ -22,14 +22,12 @@ Name: libreoffice-help-group5 ## Generated by: ## perl lo-help-gen-spec libreoffice-help-groupX.spec.in lo-help-groupX ################################################################### -Version: 3.4.5.4 +Version: 3.5.2.2 Release: 0 -%define piece help -%define lo_build_version 3.4.5.4 -%define lo_piece_version 3.4.5.4 -%define lo_sourcedirname libreoffice-build-%lo_piece_version -%define lo_home libreoffice -%define lo_basis_dir basis3.4 +%define gnu_make_version 3.82 +%define gnu_make_snapshot 20120301 +%define zip_version 3.0 +%define lo_home libreoffice # test_build_langs: 1 = de and cs # 2 = all supported languages %define test_build_langs 2 @@ -89,16 +87,15 @@ Summary: LibreOffice Help Development License: LGPL-3.0 Group: Productivity/Office/Suite Url: http://www.documentfoundation.org/ -Source0: libreoffice-bootstrap-%version.tar.bz2 -Source1: libreoffice-artwork-%version.tar.bz2 -Source2: libreoffice-help-%version.tar.bz2 -Source3: libreoffice-libs-core-%version.tar.bz2 -Source4: libreoffice-libs-extern-sys-%version.tar.bz2 -Source5: libreoffice-libs-extern-%version.tar.bz2 -Source6: libreoffice-libs-gui-%version.tar.bz2 -Source7: libreoffice-testing-%version.tar.bz2 -Source8: libreoffice-translations-%version.tar.bz2 -Source9: libreoffice-ure-%version.tar.bz2 +Source0: libreoffice-core-%version.tar.bz2 +Source1: libreoffice-help-%version.tar.bz2 +Source2: libreoffice-translations-%version.tar.bz2 +# make-3.82 is needed for parallel build +# this version extends plain make-3.82 with --warn-undefined-functions option +# URL: http://cgit.freedesktop.org/libreoffice/contrib/dev-tools/tree/make-3.82-gbuild, snapshot 2011-08-17 +Source30: make-%gnu_make_version-gbuild-%gnu_make_snapshot.tar.bz2 +# zip-3.0 or newer is required because of the --filesync feature +Source31: zip-%zip_version.tar.bz2 # SUSE config files Source100: SUSE.conf Source101: SUSE-10.1.conf @@ -110,13 +107,10 @@ Source105: SUSE-11.4.conf Source200: libreoffice-help-groupX.spec.in Source201: lo-help-gen-spec Source202: lo-help-groupX -# -Patch0: libreoffice-configure-typo-fontconfig.diff -# OBJEXT variable was not set correctly if AC_PROC_CC was not called early -# I think that it worked only by chance when there was checks for more system librarires -Patch1: libreoffice-cc-detection.diff -# it created 3.8GB build log; Build Service refused to build such package -Patch2: translations-no-warnigns-from-po2oo.diff +# allow to unpack source tarballs +Patch0: libreoffice-3.5-unpack-sources.diff +# cups is not needed for helpcontent build +Patch1: build-helpcontent-do-not-check-cups.diff BuildRoot: %{_tmppath}/%{name}-%{version}-build #!ExclusiveArch: %ix86 x86_64 ppc BuildArch: noarch @@ -125,17 +119,25 @@ BuildArch: noarch This package provides files related to the LibreOffice help development. - %if %test_build_langs >= 2 - %package -n libreoffice-help-pt-BR Summary: Brazilian Portuguese Help Localization for LibreOffice Group: Productivity/Office/Suite Provides: locale(libreoffice:pt_BR) -PreReq: libreoffice = %version -%if 0%{?suse_version} -Supplements: libreoffice-l10n-pt-BR +%if 0%{?suse_version} > 01120 +Requires(post): coreutils +Requires(post): grep +Requires(post): libreoffice >= 3.5 +Requires(postun): coreutils +Requires(postun): grep +Requires(postun): libreoffice >= 3.5 %endif +%if 0%{?suse_version} && 0%{?suse_version} <= 01120 +PreReq: coreutils +PreReq: grep +PreReq: libreoffice >= 3.5 +%endif +Requires: libreoffice = %{version} # compat stuff Provides: OpenOffice_org-help-pt-BR = %version Obsoletes: OpenOffice_org-help-pt-BR <= %version @@ -145,16 +147,24 @@ Provides: OpenOffice_org-pt-BR:%_prefix/ooo-2.0/help/pt-BR/default.css Brazilian Portuguese help localization for LibreOffice. The other localized stuff is in libreoffice-l10n-pt-BR. - - %package -n libreoffice-help-ru Summary: Russian Help Localization for LibreOffice Group: Productivity/Office/Suite Provides: locale(libreoffice:ru) -PreReq: libreoffice = %version -%if 0%{?suse_version} -Supplements: libreoffice-l10n-ru +%if 0%{?suse_version} > 01120 +Requires(post): coreutils +Requires(post): grep +Requires(post): libreoffice >= 3.5 +Requires(postun): coreutils +Requires(postun): grep +Requires(postun): libreoffice >= 3.5 %endif +%if 0%{?suse_version} && 0%{?suse_version} <= 01120 +PreReq: coreutils +PreReq: grep +PreReq: libreoffice >= 3.5 +%endif +Requires: libreoffice = %{version} # compat stuff Provides: OpenOffice_org-help-ru = %version Obsoletes: OpenOffice_org-help-ru <= %version @@ -164,16 +174,24 @@ Provides: OpenOffice_org-ru:%_prefix/ooo-2.0/help/ru/default.css Russian help localization for LibreOffice. The other localized stuff is in libreoffice-l10n-ru. - - %package -n libreoffice-help-sl Summary: Slovene Help Localization for LibreOffice Group: Productivity/Office/Suite Provides: locale(libreoffice:sl) -PreReq: libreoffice = %version -%if 0%{?suse_version} -Supplements: libreoffice-l10n-sl +%if 0%{?suse_version} > 01120 +Requires(post): coreutils +Requires(post): grep +Requires(post): libreoffice >= 3.5 +Requires(postun): coreutils +Requires(postun): grep +Requires(postun): libreoffice >= 3.5 %endif +%if 0%{?suse_version} && 0%{?suse_version} <= 01120 +PreReq: coreutils +PreReq: grep +PreReq: libreoffice >= 3.5 +%endif +Requires: libreoffice = %{version} # compat stuff Provides: OpenOffice_org-help-sl = %version Obsoletes: OpenOffice_org-help-sl <= %version @@ -183,16 +201,24 @@ Provides: OpenOffice_org-sl:%_prefix/ooo-2.0/help/sl/default.css Slovene help localization for LibreOffice. The other localized stuff is in libreoffice-l10n-sl. - - %package -n libreoffice-help-sv Summary: Swedish Help Localization for LibreOffice Group: Productivity/Office/Suite Provides: locale(libreoffice:sv) -PreReq: libreoffice = %version -%if 0%{?suse_version} -Supplements: libreoffice-l10n-sv +%if 0%{?suse_version} > 01120 +Requires(post): coreutils +Requires(post): grep +Requires(post): libreoffice >= 3.5 +Requires(postun): coreutils +Requires(postun): grep +Requires(postun): libreoffice >= 3.5 %endif +%if 0%{?suse_version} && 0%{?suse_version} <= 01120 +PreReq: coreutils +PreReq: grep +PreReq: libreoffice >= 3.5 +%endif +Requires: libreoffice = %{version} # compat stuff Provides: OpenOffice_org-help-sv = %version Obsoletes: OpenOffice_org-help-sv <= %version @@ -202,16 +228,24 @@ Provides: OpenOffice_org-sv:%_prefix/ooo-2.0/help/sv/default.css Swedish help localization for LibreOffice. The other localized stuff is in libreoffice-l10n-sv. - - %package -n libreoffice-help-zh-CN Summary: Chinese Simplified Help Localization for LibreOffice Group: Productivity/Office/Suite Provides: locale(libreoffice:zh_CN) -PreReq: libreoffice = %version -%if 0%{?suse_version} -Supplements: libreoffice-l10n-zh-CN +%if 0%{?suse_version} > 01120 +Requires(post): coreutils +Requires(post): grep +Requires(post): libreoffice >= 3.5 +Requires(postun): coreutils +Requires(postun): grep +Requires(postun): libreoffice >= 3.5 %endif +%if 0%{?suse_version} && 0%{?suse_version} <= 01120 +PreReq: coreutils +PreReq: grep +PreReq: libreoffice >= 3.5 +%endif +Requires: libreoffice = %{version} # compat stuff Provides: OpenOffice_org-help-zh-CN = %version Obsoletes: OpenOffice_org-help-zh-CN <= %version @@ -221,16 +255,24 @@ Provides: OpenOffice_org-zh-CN:%_prefix/ooo-2.0/help/zh-CN/default.css Chinese Simplified help localization for LibreOffice. The other localized stuff is in libreoffice-l10n-zh-CN. - - %package -n libreoffice-help-zh-TW Summary: Chinese Traditional Help Localization for LibreOffice Group: Productivity/Office/Suite Provides: locale(libreoffice:zh_TW) -PreReq: libreoffice = %version -%if 0%{?suse_version} -Supplements: libreoffice-l10n-zh-TW +%if 0%{?suse_version} > 01120 +Requires(post): coreutils +Requires(post): grep +Requires(post): libreoffice >= 3.5 +Requires(postun): coreutils +Requires(postun): grep +Requires(postun): libreoffice >= 3.5 %endif +%if 0%{?suse_version} && 0%{?suse_version} <= 01120 +PreReq: coreutils +PreReq: grep +PreReq: libreoffice >= 3.5 +%endif +Requires: libreoffice = %{version} # compat stuff Provides: OpenOffice_org-help-zh-TW = %version Obsoletes: OpenOffice_org-help-zh-TW <= %version @@ -244,22 +286,29 @@ is in libreoffice-l10n-zh-TW. %prep %if %prepare_build == 0 -%setup -D -T -q -n libreoffice-bootstrap-%version +%setup -D -T -q -n libreoffice-core-%version %else -%setup -q -n libreoffice-bootstrap-%version -bin/unpack-sources `pwd` \ - %{S:1} %{S:2} %{S:3} %{S:4} %{S:5} \ - %{S:6} %{S:7} %{S:8} %{S:9} +%setup -q -a30 -a31 -n libreoffice-core-%version +%patch0 +bin/unpack-sources `pwd` %{S:1} %{S:2} # SUSE config files cp %{S:100} %{S:101} %{S:102} %{S:103} %{S:104} %{S:105} distro-configs # extra fixes -%patch0 %patch1 -%patch2 %endif %build %if %prepare_build != 0 +# first build make-3.82 +cd make-* +CFLAGS=$RPM_OPT_FLAGS ./configure +make %{?_smp_mflags} +cd - +# +# second build zip-3.0 +cd zip30 +make %{?jobs:-j%jobs} -f unix/Makefile prefix=/usr CC="gcc $RPM_OPT_FLAGS -DLARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64" generic_gcc +cd - # # Parallel build settings ... # parallel build of modules; it makes sense on machines with more CPUs @@ -300,7 +349,8 @@ export JAVA_HOME=%{java_home} # use RPM_OPT_FLAGS, ... export ARCH_FLAGS="`echo $RPM_OPT_FLAGS | sed -e 's/\-O[0-9s]//g' -e 's/\-fexceptions//g'` -fno-strict-aliasing" # FIXME: genccode from the system icu is in /usr/sbin -export PATH="$PATH:/usr/sbin" +# FIXME: we need make-3.82 for parallel build +export PATH="$RPM_BUILD_DIR/libreoffice-core-%version/make-%gnu_make_version-gbuild:$RPM_BUILD_DIR/libreoffice-core-%version/zip30:$PATH:/usr/sbin" %if %prepare_build != 0 ./autogen.sh \ --with-external-tar="$RPM_SOURCE_DIR" \ @@ -320,7 +370,6 @@ export PATH="$PATH:/usr/sbin" --disable-fontconfig \ --without-junit \ --without-system-jpeg \ - --disable-python \ --disable-mozilla \ --disable-mono \ --without-system-curl \ @@ -342,27 +391,26 @@ export PATH="$PATH:/usr/sbin" --disable-evolution2 %endif ./bootstrap -. ./*[Ee]nv.[Ss]et.sh +. ./Env.Host.sh cd helpcontent2 build --all $PARALLEL_BUILD %install -. ./*Env.Set.sh +. ./Env.Host.sh test -z %lo_langs && langs="en-US" || langs=%lo_langs mkdir -p file-lists for lang in $langs ; do test "$lang" = "en-US" && langdir="en" || langdir="$lang" - mkdir -p $RPM_BUILD_ROOT/%_datadir/%lo_home/%lo_basis_dir/help/$langdir + mkdir -p $RPM_BUILD_ROOT/%_datadir/%lo_home/help/$langdir for pack in helpcontent2/$INPATH/bin/s*$lang.zip ; do - unzip $pack -d $RPM_BUILD_ROOT/%_datadir/%lo_home/%lo_basis_dir/help/$langdir + unzip $pack -d $RPM_BUILD_ROOT/%_datadir/%lo_home/help/$langdir done lang_underscore=`echo $lang | sed "s/-/_/g"` filelist=help_${lang_underscore}_list.txt echo "%dir %_datadir/%lo_home" >file-lists/$filelist - echo "%dir %_datadir/%lo_home/%lo_basis_dir" >>file-lists/$filelist - echo "%dir %_datadir/%lo_home/%lo_basis_dir/help" >>file-lists/$filelist - find $RPM_BUILD_ROOT/%_datadir/%lo_home/%lo_basis_dir/help/$langdir -type d -printf "%%%%dir %_datadir/%lo_home/%lo_basis_dir/help/$langdir/%%P\n" >>file-lists/$filelist - find $RPM_BUILD_ROOT/%_datadir/%lo_home/%lo_basis_dir/help/$langdir -type f -printf "%_datadir/%lo_home/%lo_basis_dir/help/$langdir/%%P\n" >>file-lists/$filelist + echo "%dir %_datadir/%lo_home/help" >>file-lists/$filelist + find $RPM_BUILD_ROOT/%_datadir/%lo_home/help/$langdir -type d -printf "%%%%dir %_datadir/%lo_home/help/$langdir/%%P\n" >>file-lists/$filelist + find $RPM_BUILD_ROOT/%_datadir/%lo_home/help/$langdir -type f -printf "%_datadir/%lo_home/help/$langdir/%%P\n" >>file-lists/$filelist # the file list is needed to create compat symlinks cp file-lists/$filelist $RPM_BUILD_ROOT/%_datadir/%lo_home echo "%_datadir/%lo_home/$filelist" >>file-lists/$filelist @@ -441,7 +489,6 @@ rm -f %_datadir/%lo_home/help_zh_TW_list.txt.postun 2>/dev/null %endif %if %test_build_langs >= 2 - %files -f file-lists/help_pt_BR_list.txt -n libreoffice-help-pt-BR %defattr(-,root,root) @@ -459,6 +506,7 @@ rm -f %_datadir/%lo_home/help_zh_TW_list.txt.postun 2>/dev/null %files -f file-lists/help_zh_TW_list.txt -n libreoffice-help-zh-TW %defattr(-,root,root) + %endif %changelog diff --git a/libreoffice-help-groupX.spec.in b/libreoffice-help-groupX.spec.in index 39c181c..d7a8505 100644 --- a/libreoffice-help-groupX.spec.in +++ b/libreoffice-help-groupX.spec.in @@ -15,19 +15,15 @@ # Please submit bugfixes or comments via http://bugs.opensuse.org/ # -# norootforbuild - Name: libreoffice-help-group@GROUP_NUMBER@ @DO_NOT_EDIT_COMMENT@ -Version: 3.4.5.4 -Release: 1 -%define piece help -%define lo_build_version 3.4.5.4 -%define lo_piece_version 3.4.5.4 -%define lo_sourcedirname libreoffice-build-%lo_piece_version -%define lo_home libreoffice -%define lo_basis_dir basis3.4 +Version: 3.5.2.2 +Release: 0 +%define gnu_make_version 3.82 +%define gnu_make_snapshot 20120301 +%define zip_version 3.0 +%define lo_home libreoffice # test_build_langs: 1 = de and cs # 2 = all supported languages %define test_build_langs 2 @@ -50,29 +46,52 @@ Release: 1 %endif #!BuildIgnore: libreoffice # both zip and perl-Archive-Zip are needed; tested with ooo320-m3, 2009-10-22 -BuildRequires: ant ant-apache-regexp automake bison boost-devel db-devel flac-devel flex freetype2-devel gcc-c++ gperf icu java-devel libcppunit-devel libexpat-devel libicu-devel libxml2-devel libxslt-devel openssl-devel perl-Archive-Zip perl-Compress-Zlib pkg-config python-devel unzip xorg-x11-devel zip +BuildRequires: ant +BuildRequires: ant-apache-regexp +BuildRequires: automake +BuildRequires: bison +BuildRequires: boost-devel +BuildRequires: db-devel +BuildRequires: flac-devel +BuildRequires: flex +BuildRequires: freetype2-devel +BuildRequires: gcc-c++ +BuildRequires: gperf +BuildRequires: icu +BuildRequires: java-devel +BuildRequires: libcppunit-devel +BuildRequires: libexpat-devel +BuildRequires: libicu-devel +BuildRequires: libxml2-devel +BuildRequires: libxslt-devel +BuildRequires: openssl-devel +BuildRequires: perl-Archive-Zip +BuildRequires: perl-Compress-Zlib +BuildRequires: pkg-config +BuildRequires: python-devel +BuildRequires: unzip +BuildRequires: xorg-x11-devel +BuildRequires: zip %if 0%{?suse_version} == 01010 # is not required by Java SDKs by mistake on SLED10 BuildRequires: update-alternatives %endif -License: LGPL-3.0 -Group: Productivity/Office/Suite -AutoReqProv: on # compat stuff Provides: OpenOffice_org-help-group@GROUP_NUMBER@ = %version Obsoletes: OpenOffice_org-help-group@GROUP_NUMBER@ <= %version Summary: LibreOffice Help Development +License: LGPL-3.0 +Group: Productivity/Office/Suite Url: http://www.documentfoundation.org/ -Source0: libreoffice-bootstrap-%version.tar.bz2 -Source1: libreoffice-artwork-%version.tar.bz2 -Source2: libreoffice-help-%version.tar.bz2 -Source3: libreoffice-libs-core-%version.tar.bz2 -Source4: libreoffice-libs-extern-sys-%version.tar.bz2 -Source5: libreoffice-libs-extern-%version.tar.bz2 -Source6: libreoffice-libs-gui-%version.tar.bz2 -Source7: libreoffice-testing-%version.tar.bz2 -Source8: libreoffice-translations-%version.tar.bz2 -Source9: libreoffice-ure-%version.tar.bz2 +Source0: libreoffice-core-%version.tar.bz2 +Source1: libreoffice-help-%version.tar.bz2 +Source2: libreoffice-translations-%version.tar.bz2 +# make-3.82 is needed for parallel build +# this version extends plain make-3.82 with --warn-undefined-functions option +# URL: http://cgit.freedesktop.org/libreoffice/contrib/dev-tools/tree/make-3.82-gbuild, snapshot 2011-08-17 +Source30: make-%gnu_make_version-gbuild-%gnu_make_snapshot.tar.bz2 +# zip-3.0 or newer is required because of the --filesync feature +Source31: zip-%zip_version.tar.bz2 # SUSE config files Source100: SUSE.conf Source101: SUSE-10.1.conf @@ -84,42 +103,44 @@ Source105: SUSE-11.4.conf Source200: libreoffice-help-groupX.spec.in Source201: lo-help-gen-spec Source202: lo-help-groupX -# -Patch0: libreoffice-configure-typo-fontconfig.diff -# OBJEXT variable was not set correctly if AC_PROC_CC was not called early -# I think that it worked only by chance when there was checks for more system librarires -Patch1: libreoffice-cc-detection.diff -# it created 3.8GB build log; Build Service refused to build such package -Patch2: translations-no-warnigns-from-po2oo.diff +# allow to unpack source tarballs +Patch0: libreoffice-3.5-unpack-sources.diff +# cups is not needed for helpcontent build +Patch1: build-helpcontent-do-not-check-cups.diff BuildRoot: %{_tmppath}/%{name}-%{version}-build #!ExclusiveArch: %ix86 x86_64 ppc BuildArch: noarch - %description This package provides files related to the LibreOffice help development. @SUBPACKAGES_METAINFO@ - %prep %if %prepare_build == 0 -%setup -D -T -q -n libreoffice-bootstrap-%version +%setup -D -T -q -n libreoffice-core-%version %else -%setup -q -n libreoffice-bootstrap-%version -bin/unpack-sources `pwd` \ - %{S:1} %{S:2} %{S:3} %{S:4} %{S:5} \ - %{S:6} %{S:7} %{S:8} %{S:9} +%setup -q -a30 -a31 -n libreoffice-core-%version +%patch0 +bin/unpack-sources `pwd` %{S:1} %{S:2} # SUSE config files cp %{S:100} %{S:101} %{S:102} %{S:103} %{S:104} %{S:105} distro-configs # extra fixes -%patch0 %patch1 -%patch2 %endif %build %if %prepare_build != 0 +# first build make-3.82 +cd make-* +CFLAGS=$RPM_OPT_FLAGS ./configure +make %{?_smp_mflags} +cd - +# +# second build zip-3.0 +cd zip30 +make %{?jobs:-j%jobs} -f unix/Makefile prefix=/usr CC="gcc $RPM_OPT_FLAGS -DLARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64" generic_gcc +cd - # # Parallel build settings ... # parallel build of modules; it makes sense on machines with more CPUs @@ -160,7 +181,8 @@ export JAVA_HOME=%{java_home} # use RPM_OPT_FLAGS, ... export ARCH_FLAGS="`echo $RPM_OPT_FLAGS | sed -e 's/\-O[0-9s]//g' -e 's/\-fexceptions//g'` -fno-strict-aliasing" # FIXME: genccode from the system icu is in /usr/sbin -export PATH="$PATH:/usr/sbin" +# FIXME: we need make-3.82 for parallel build +export PATH="$RPM_BUILD_DIR/libreoffice-core-%version/make-%gnu_make_version-gbuild:$RPM_BUILD_DIR/libreoffice-core-%version/zip30:$PATH:/usr/sbin" %if %prepare_build != 0 ./autogen.sh \ --with-external-tar="$RPM_SOURCE_DIR" \ @@ -180,7 +202,6 @@ export PATH="$PATH:/usr/sbin" --disable-fontconfig \ --without-junit \ --without-system-jpeg \ - --disable-python \ --disable-mozilla \ --disable-mono \ --without-system-curl \ @@ -202,39 +223,34 @@ export PATH="$PATH:/usr/sbin" --disable-evolution2 %endif ./bootstrap -. ./*[Ee]nv.[Ss]et.sh +. ./Env.Host.sh cd helpcontent2 build --all $PARALLEL_BUILD - %install -. ./*Env.Set.sh +. ./Env.Host.sh test -z %lo_langs && langs="en-US" || langs=%lo_langs mkdir -p file-lists for lang in $langs ; do test "$lang" = "en-US" && langdir="en" || langdir="$lang" - mkdir -p $RPM_BUILD_ROOT/%_datadir/%lo_home/%lo_basis_dir/help/$langdir + mkdir -p $RPM_BUILD_ROOT/%_datadir/%lo_home/help/$langdir for pack in helpcontent2/$INPATH/bin/s*$lang.zip ; do - unzip $pack -d $RPM_BUILD_ROOT/%_datadir/%lo_home/%lo_basis_dir/help/$langdir + unzip $pack -d $RPM_BUILD_ROOT/%_datadir/%lo_home/help/$langdir done lang_underscore=`echo $lang | sed "s/-/_/g"` filelist=help_${lang_underscore}_list.txt echo "%dir %_datadir/%lo_home" >file-lists/$filelist - echo "%dir %_datadir/%lo_home/%lo_basis_dir" >>file-lists/$filelist - echo "%dir %_datadir/%lo_home/%lo_basis_dir/help" >>file-lists/$filelist - find $RPM_BUILD_ROOT/%_datadir/%lo_home/%lo_basis_dir/help/$langdir -type d -printf "%%%%dir %_datadir/%lo_home/%lo_basis_dir/help/$langdir/%%P\n" >>file-lists/$filelist - find $RPM_BUILD_ROOT/%_datadir/%lo_home/%lo_basis_dir/help/$langdir -type f -printf "%_datadir/%lo_home/%lo_basis_dir/help/$langdir/%%P\n" >>file-lists/$filelist + echo "%dir %_datadir/%lo_home/help" >>file-lists/$filelist + find $RPM_BUILD_ROOT/%_datadir/%lo_home/help/$langdir -type d -printf "%%%%dir %_datadir/%lo_home/help/$langdir/%%P\n" >>file-lists/$filelist + find $RPM_BUILD_ROOT/%_datadir/%lo_home/help/$langdir -type f -printf "%_datadir/%lo_home/help/$langdir/%%P\n" >>file-lists/$filelist # the file list is needed to create compat symlinks cp file-lists/$filelist $RPM_BUILD_ROOT/%_datadir/%lo_home echo "%_datadir/%lo_home/$filelist" >>file-lists/$filelist done - %clean rm -rf $RPM_BUILD_ROOT + @SUBPACKAGES_SCRIPTS@ - @SUBPACKAGES_FILELIST@ - - %changelog diff --git a/libreoffice-impress-3.4.5.4.tar.bz2 b/libreoffice-impress-3.4.5.4.tar.bz2 deleted file mode 100644 index 6838e92..0000000 --- a/libreoffice-impress-3.4.5.4.tar.bz2 +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:e22d5a6ec37f8ee26f498e2f3b1211ab5a1d8a332d520d7635ad2cae66a633c0 -size 2654960 diff --git a/libreoffice-libs-core-3.4.5.4.tar.bz2 b/libreoffice-libs-core-3.4.5.4.tar.bz2 deleted file mode 100644 index fb11b52..0000000 --- a/libreoffice-libs-core-3.4.5.4.tar.bz2 +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:7341def5ef4d8361180083889258a859d3e58f34f67c3f987b3b09f0d537f11a -size 15599920 diff --git a/libreoffice-libs-extern-3.4.5.4.tar.bz2 b/libreoffice-libs-extern-3.4.5.4.tar.bz2 deleted file mode 100644 index 3bb5043..0000000 --- a/libreoffice-libs-extern-3.4.5.4.tar.bz2 +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:092ce3e851d9341c3f08f3bd8c67ef415a0da02865bc98739361ddd2d498c0fe -size 643107 diff --git a/libreoffice-libs-extern-sys-3.4.5.4.tar.bz2 b/libreoffice-libs-extern-sys-3.4.5.4.tar.bz2 deleted file mode 100644 index 69331ba..0000000 --- a/libreoffice-libs-extern-sys-3.4.5.4.tar.bz2 +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:24988af940be0476ebe9e09a3deeed679b2ee253d064506da6d1dc9d8e094ca4 -size 44696189 diff --git a/libreoffice-libs-gui-3.4.5.4.tar.bz2 b/libreoffice-libs-gui-3.4.5.4.tar.bz2 deleted file mode 100644 index 3b72bf7..0000000 --- a/libreoffice-libs-gui-3.4.5.4.tar.bz2 +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:9be8b974a995b0439ec068825d25919c966293ac247a241411aa51eb1a054ee1 -size 10871543 diff --git a/libreoffice-poppler-0.17.0-reject-fix.diff b/libreoffice-poppler-0.17.0-reject-fix.diff index ebbc514..d0911c4 100644 --- a/libreoffice-poppler-0.17.0-reject-fix.diff +++ b/libreoffice-poppler-0.17.0-reject-fix.diff @@ -1,6 +1,6 @@ ---- configure.in -+++ configure.in -@@ -6598,16 +6598,6 @@ +--- configure.in.old 2012-03-01 14:58:45.000000000 +0100 ++++ configure.in 2012-03-01 16:20:38.000000000 +0100 +@@ -7259,16 +7259,6 @@ if test "x$enable_ext_pdfimport" != "xno AC_MSG_RESULT([external]) SYSTEM_POPPLER=YES PKG_CHECK_MODULES( POPPLER, poppler >= 0.8.0 ) @@ -17,9 +17,9 @@ else AC_MSG_RESULT([internal]) SYSTEM_POPPLER=NO ---- sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx -+++ sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx -@@ -150,11 +150,7 @@ +--- sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx.old 2012-02-24 16:34:51.000000000 +0100 ++++ sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx 2012-03-01 16:20:38.000000000 +0100 +@@ -150,11 +150,7 @@ void writeBinaryBuffer( const OutputBuff void writeJpeg_( OutputBuffer& o_rOutputBuf, Stream* str, bool bWithLinefeed ) { // dump JPEG file as-is @@ -31,7 +31,7 @@ str->reset(); int c; -@@ -493,11 +489,7 @@ +@@ -493,11 +489,7 @@ void PDFOutDev::endPage() printf("endPage\n"); } @@ -43,9 +43,9 @@ { assert(link); ---- sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.hxx -+++ sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.hxx -@@ -65,14 +65,7 @@ +--- sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.hxx.old 2012-02-24 16:34:51.000000000 +0100 ++++ sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.hxx 2012-03-01 16:20:38.000000000 +0100 +@@ -65,14 +65,7 @@ class GfxPath; class GfxFont; class PDFDoc; #ifndef SYSTEM_POPPLER @@ -60,16 +60,16 @@ #endif namespace pdfi -@@ -201,12 +194,8 @@ +@@ -201,12 +194,8 @@ namespace pdfi // virtual void cvtDevToUser(double dx, double dy, double *ux, double *uy); // virtual void cvtUserToDev(double ux, double uy, int *dx, int *dy); - + - #if POPPLER_CHECK_VERSION(0, 17, 0) - virtual void processLink(AnnotLink *link, Catalog *catalog); - #else //----- link borders virtual void processLink(Link *link, Catalog *catalog); -- #endif - +- #endif + //----- save/restore graphics state virtual void saveState(GfxState *state); diff --git a/libreoffice-postprocess-3.4.5.4.tar.bz2 b/libreoffice-postprocess-3.4.5.4.tar.bz2 deleted file mode 100644 index 3928554..0000000 --- a/libreoffice-postprocess-3.4.5.4.tar.bz2 +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:a53efd2418bc86ca6a064941aa9d789db4d8c23fdde41702eab30bc427a75bb4 -size 51752 diff --git a/libreoffice-postprocess-optional-helpcontent.diff b/libreoffice-postprocess-optional-helpcontent.diff deleted file mode 100644 index e60ba22..0000000 --- a/libreoffice-postprocess-optional-helpcontent.diff +++ /dev/null @@ -1,8 +0,0 @@ ---- postprocess/prj/build.lst.old 2011-05-20 18:06:23.000000000 +0200 -+++ postprocess/prj/build.lst 2011-07-08 13:00:11.000000000 +0200 -@@ -1,4 +1,4 @@ --po postprocess :: accessibility automation basctl bean BINFILTER:binfilter chart2 configmgr CRASHREP:crashrep CT2N:ct2n cui dbaccess desktop dtrans embeddedobj embedserv EPM:epm eventattacher extensions extras fileaccess filter forms fpicker helpcontent2 hwpfilter io lingucomponent MATHMLDTD:MathMLDTD ODK:odk officecfg package padmin psprint_config remotebridges sc scaddins sccomp scp2 scripting sd setup_native slideshow starmath sw sysui testtools ucb UnoControls unoxml ure wizards xmerge xmlsecurity MORE_FONTS:more_fonts DICTIONARIES:dictionaries PYUNO:pyuno readlicense_oo unodevtools JFREEREPORT:jfreereport REPORTBUILDER:reportbuilder reportdesign LANGUAGETOOL:languagetool SDEXT:sdext SWEXT:swext uui writerfilter oox MYSQLC:mysqlc NLPSOLVER:nlpsolver STLPORT:stlport LIBXSLT:libxslt NULL -+po postprocess :: accessibility automation basctl bean BINFILTER:binfilter chart2 configmgr CRASHREP:crashrep CT2N:ct2n cui dbaccess desktop dtrans embeddedobj embedserv EPM:epm eventattacher extensions extras fileaccess filter forms fpicker HELPCONTENT2:helpcontent2 hwpfilter io lingucomponent MATHMLDTD:MathMLDTD ODK:odk officecfg package padmin psprint_config remotebridges sc scaddins sccomp scp2 scripting sd setup_native slideshow starmath sw sysui testtools ucb UnoControls unoxml ure wizards xmerge xmlsecurity MORE_FONTS:more_fonts DICTIONARIES:dictionaries PYUNO:pyuno readlicense_oo unodevtools JFREEREPORT:jfreereport REPORTBUILDER:reportbuilder reportdesign LANGUAGETOOL:languagetool SDEXT:sdext SWEXT:swext uui writerfilter oox MYSQLC:mysqlc NLPSOLVER:nlpsolver STLPORT:stlport LIBXSLT:libxslt NULL - po postprocess usr1 - all po_mkout NULL - po postprocess\checkxml nmake - all po_checkxml NULL - po postprocess\checkdeliver nmake - all po_checkdlv NULL diff --git a/libreoffice-sdk-3.4.5.4.tar.bz2 b/libreoffice-sdk-3.4.5.4.tar.bz2 deleted file mode 100644 index c9c07ba..0000000 --- a/libreoffice-sdk-3.4.5.4.tar.bz2 +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:564504c2d4f92c122e7fc7050ec3220b199f32a9778e5f3b7f4b33238e7cdf43 -size 1722647 diff --git a/libreoffice-testing-3.4.5.4.tar.bz2 b/libreoffice-testing-3.4.5.4.tar.bz2 deleted file mode 100644 index 36b68b6..0000000 --- a/libreoffice-testing-3.4.5.4.tar.bz2 +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:a5001274f433d05c8e011a4a8e696246a1b01ea403e77237844cea5a265a0fdf -size 50847830 diff --git a/libreoffice-translations-3.4.5.4.tar.bz2 b/libreoffice-translations-3.4.5.4.tar.bz2 deleted file mode 100644 index ac2de99..0000000 --- a/libreoffice-translations-3.4.5.4.tar.bz2 +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:f8642c3810af15fa578d82145fdca5c0c8676e85ad50e07b1c3b6202a8c53225 -size 137849561 diff --git a/libreoffice-translations-3.5.2.2.tar.bz2 b/libreoffice-translations-3.5.2.2.tar.bz2 new file mode 100644 index 0000000..e7ca309 --- /dev/null +++ b/libreoffice-translations-3.5.2.2.tar.bz2 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3c1136c4170c189b83c5f26d5c933f7d11cdd3b51ed0ee9e6745761a978ceba5 +size 139013566 diff --git a/libreoffice-ure-3.4.5.4.tar.bz2 b/libreoffice-ure-3.4.5.4.tar.bz2 deleted file mode 100644 index 1cb15c7..0000000 --- a/libreoffice-ure-3.4.5.4.tar.bz2 +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:3007a927ab97ca781c45038acac63efb77b57f4069fb3d590e738fcf76c3c0e0 -size 6237557 diff --git a/libreoffice-writer-3.4.5.4.tar.bz2 b/libreoffice-writer-3.4.5.4.tar.bz2 deleted file mode 100644 index f3242f8..0000000 --- a/libreoffice-writer-3.4.5.4.tar.bz2 +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:79b97d83fafaeefc2fabda34679dfc1c2c07c3e272ca6bb82229adccda24d54d -size 7309016 diff --git a/libreoffice.changes b/libreoffice.changes index 55830b3..fe916fd 100644 --- a/libreoffice.changes +++ b/libreoffice.changes @@ -1,3 +1,145 @@ +------------------------------------------------------------------- +Wed Apr 4 12:44:47 UTC 2012 - pmladek@suse.com + +- solenv-java-source-version.diff: generate selected bytecode + version also in gbuild +- enable again the brp check for byte code version + +------------------------------------------------------------------- +Wed Mar 28 15:43:47 UTC 2012 - pmladek@suse.com + +- updated to libreoffice-3.5.5.2 (3.5.2-rc2) + * general + * support Java 7 (1.7) + * produce ODF 1.2 conforming documents by default + * more secure encryption algorithm (AES-256) for password protection + * core GUI changes + * better color picker + * transparent object handles + * better handle unused toolbar menus + * move context-sensitive toolbars to the bottom + * several GTK+ right-to-left interface glitches + * menus list their entries in a natural sort order + * "Link" checkbox in "Insert Movie and Sound" dialog + * filter bundled, shared, and user extensions in the manager dialog + * writer + * RTF import rewrite + * new numbering types + * grammar checking improvements + * better page breaks indicators + * TOC use hyperlinks by default + * various DOCX import improvements + * support comments DOCX export/import + * label printing positioning (fdo#36874) + * display bitmap image resolution in PPI + * numbering in DOC, DOCX, and RTF import + * better UI for Header and Footers handling + * Basic Fonts (Western) option page removed + * handling of tab stop behind the end margin + * new typographic features by improved Graphite port + * display non-printable characters on the end of line + * modeless word count dialog; being updated when typing + * corrected autotext "Formula numbering" for most locales + * calc + * more new line ends + * supports 10000 sheets + * new multiline input bar + * additional data point markers + * updated line chart's smoothing + * re-designed all range name dialogs + * re-designed Autofilter popup window + * improved performance of ODS/XLS/XLSX import + * improved performance of many sheet operations + * better handling DDE and external links failures + * unlimited number of rules for conditional formatting + * configurable initial number of sheets in new documents + * "Protect Sheet" also from the context menu of the sheet tab + * allow pasting a single cell range to multiple destination ranges + * new Calc Functions: BITAND, BITOR, BITXOR BITRSHIFT, BITLSHIFT, SEC, + CSC, SECH, and CSCH + * impress / draw + * elliptical arcs in path + * better hidden slides PDF export + * better Smart Art in PPTX import + * MS Visio documents import/export + * better handling of custom animation list + * start Impress without the wizard by default + * better custom shapes and their presets in PPTX import + * support embedding palettes and other property list types + * math + * new "does not exist" symbol + * new symbols for Games theory + * support math formulas in DOCX import/export + * base + * lots fixes + * integrated PostgreSQL native driver + * Basic IDE + * new menu item View->Goto Line + * new menu item View->Line Numbers + * dialog controls have a spinbutton + * presenter console extension + * "Exchange Screen Images" button to work around problems with + detecting projector and laptop screen + * Python scripting + * allow to initialize UNO structures by name instead of by position + * localization + * update translations + * better date handling +- remove obsolete testtool subpackage; not longer supported and maintained +- basis subdirectory does not longer exists on the installed system +- mozilla is not longer needed for build: + * use --disable-mozilla, --without-system-mozilla, --with-system-nss, + --disable-ldap, --enable-xmlsec instead of --with-system-mozilla, + --with-system-mozilla=xulrunner +- numbretext and GoogleDocs extensions are integrated upstream: + * use --enable-ext-google-docs and --enable-ext-numbertext +- use --without-help to build help separately instead of the patches +- use internal hacked make version 3.82, snapshot 20120301 to get fast + and reliable parallel build +- build zip-3.0 on openSUSE < 11.4; --filesync is needed during build +- temporary disable check for bytecode version until we produce right + bytecode again +- temporary disable mono support +- update numbertext to version 0.9.4 +- update libexttextcat to version 3.2.0 +- update mysql-connector-c++ to version 1.1.0 +- update libwpg to version 0.2.1 +- update libwpd to version 0.9.4 +- update libwps to version 0.2.4 +- remove obsolete translate-toolkit +- add libcmis, version 0.1.0 +- add libvisio, version 0.0.15 +- add librsvg, version 2.32.1 +- add postgresql, version 9.1.1 for SLED11; the system one is perfectly fine + for newer systems +- libreoffice-3.5-unpack-sources.diff: allow to unpack source tarballs +- javasetting-mark-config.diff: mark share/config/javasettingsunopkginstall.xml + as %config; it is updated by unopkg in %post +- scripting-prefer-internal-rhino.diff: put internal rhino into XBootClasspath + to fix build with OpenJDK +- distro-install-file-lists-3.5.diff: update file list generation for 3.5 +- library-link-order-to-build-with-as-needed.diff: fix build with link as needed +- mediawiki-no-broken-help.diff: disable non-working help also in the mediawiki + extensions +- zip-3.0-*.patch: fixes from zip source package + +------------------------------------------------------------------- +Wed Mar 14 14:34:11 UTC 2012 - pmladek@suse.com + +- libreoffice-3.4.5.5 == SUSE 3.4.5-rc3 == final + +------------------------------------------------------------------- +Mon Mar 12 18:58:39 UTC 2012 - pmladek@suse.com + +- updated to libreoffice-3.4.5.5 (SUSE 3.4.5-rc3): + * extras + * add SUSE color palette (fate#312645) + * filters + * crash when loading embedded elements (bnc#693238) + * crash when importing an empty paragraph (rh#667082) + * writer + * do not use an invalidated iterator (fdo#46337) + ------------------------------------------------------------------- Tue Mar 6 15:55:09 UTC 2012 - pmladek@suse.com diff --git a/libreoffice.spec b/libreoffice.spec index fce37d2..e43231a 100644 --- a/libreoffice.spec +++ b/libreoffice.spec @@ -222,16 +222,18 @@ BuildRequires: xml-commons-apis # LO paths %define lo_prefix %_libdir %define lo_home libreoffice -%define lo_basis_dir basis3.4 +%define gnu_make_version 3.82 +%define gnu_make_snapshot 20120301 +%define zip_version 3.0 # extensions %define ct2n_version 1.3.2 %define gdocs_version 3.0.0 -%define numbertext_version 0.8.2 +%define numbertext_version 0.9.4 %if 0%{?meego_version} # the manifest file must be in the right place; registration does not work with some repacked jars %define __jar_repack %{nil} %endif -Version: 3.4.5.4 +Version: 3.5.2.2 Release: 0 Requires: libreoffice-branding < 4 Requires: libreoffice-branding > 3.2.99.3 @@ -387,6 +389,11 @@ Provides: OpenOffice_org-testing = %version Obsoletes: OpenOffice_org-testing < %version Provides: libreoffice-testing = %version Obsoletes: libreoffice-testing < %version +# testool does not longer exists +Provides: OpenOffice_org-testtool = %version +Obsoletes: OpenOffice_org-testtool < %version +Provides: libreoffice-testtool = %version +Obsoletes: libreoffice-testtool < %version # ure Provides: OpenOffice_org-ure = %version Obsoletes: OpenOffice_org-ure < %version @@ -476,28 +483,18 @@ Summary: A Free Office Suite (Framework) License: Apache-2.0 and Artistic-1.0 and BSD-3-Clause and GPL-2.0+ and LPPL-1.3c and LGPL-2.1+ and LGPL-3.0 and MPL-1.1 and MIT Group: Productivity/Office/Suite Url: http://www.documentfoundation.org/ -Source0: libreoffice-bootstrap-%version.tar.bz2 -Source1: libreoffice-artwork-%version.tar.bz2 -Source2: libreoffice-base-%version.tar.bz2 -Source3: libreoffice-calc-%version.tar.bz2 -Source4: libreoffice-components-%version.tar.bz2 -Source5: libreoffice-extensions-%version.tar.bz2 -Source6: libreoffice-extras-%version.tar.bz2 -Source7: libreoffice-filters-%version.tar.bz2 -Source8: libreoffice-help-%version.tar.bz2 -Source9: libreoffice-impress-%version.tar.bz2 -Source10: libreoffice-libs-core-%version.tar.bz2 -Source11: libreoffice-libs-extern-sys-%version.tar.bz2 -Source12: libreoffice-libs-extern-%version.tar.bz2 -Source13: libreoffice-libs-gui-%version.tar.bz2 -Source14: libreoffice-postprocess-%version.tar.bz2 -Source15: libreoffice-sdk-%version.tar.bz2 -Source16: libreoffice-testing-%version.tar.bz2 -Source17: libreoffice-translations-%version.tar.bz2 -Source18: libreoffice-ure-%version.tar.bz2 -Source19: libreoffice-writer-%version.tar.bz2 +Source0: libreoffice-core-%version.tar.bz2 +Source1: libreoffice-binfilter-%version.tar.bz2 +Source2: libreoffice-help-%version.tar.bz2 +Source3: libreoffice-translations-%version.tar.bz2 # 256x256 desktop icons (bnc#722644) Source20: libreoffice-desktop-icons-256x256.tar.bz2 +# make-3.82 is needed for parallel build +# this version extends plain make-3.82 with --warn-undefined-functions option +# URL: http://cgit.freedesktop.org/libreoffice/contrib/dev-tools/tree/make-3.82-gbuild, snapshot 2011-08-17 +Source30: make-%gnu_make_version-gbuild-%gnu_make_snapshot.tar.bz2 +# zip-3.0 or newer is required because of the --filesync feature +Source31: zip-%zip_version.tar.bz2 # SUSE config files Source100: SUSE.conf Source101: SUSE-10.1.conf @@ -514,6 +511,8 @@ Source200: %name-rpmlintrc Source201: sofficerc-upstream # This background is used by another Novell product, added 2006-02-08 Source202: Draft.jpg +# temporary disabled mono package +Source203: README-mono.txt # helper scripts # create compat symlinks from /usr/share to /usr/lib(64); used by noarch packages Source300: link-to-ooo-home @@ -521,7 +520,7 @@ Source300: link-to-ooo-home Source400: README-scsolver.txt # prebuilt extensions Source401: cea0f63d5985ba4fcbd882031df44346-gdocs_%{gdocs_version}_modified.oxt -Source402: numbertext-%{numbertext_version}.oxt +Source402: b8cbca7b3363e6ca2d02bc0ba2b63904-numbertext_0.9.4.oxt # used extensions sources Source450: 451ccf439a36a568653b024534669971-ConvertTextToNumber-1.3.2.oxt Source451: 451ccf439a36a568653b024534669971-ConvertTextToNumber-1.3.2.zip @@ -560,7 +559,7 @@ Source1001: ada24d37d8d638b3d8a9985e80bc2978-source-9.0.0.7-bj.zip Source1002: af3c3acf618de6108d65fcdc92b492e1-commons-codec-1.3-src.tar.gz Source1003: a7983f859eafb2677d7ff386a023bc40-xsltml_2.1.2.zip Source1004: ba2930200c9f019c2d93a8c88c651a0f-flow-engine-0.9.4.zip -Source1005: b4cae0700aa1c2aef7eb7f345365e6f1-translate-toolkit-1.8.1.tar.bz2 +Source1005: 061a9f17323117c9358ed60f33ecff78-postgresql-9.1.1.tar.bz2 Source1006: ca66e26082cab8bb817185a116db809b-redland-1.0.8.tar.gz Source1007: db60e4fde8dd6d6807523deb71ee34dc-liblayout-0.2.10.zip Source1008: d8bd5eed178db6e2b18eeed243f85aa8-flute-1.1.6.zip @@ -573,7 +572,7 @@ Source1014: f94d9870737518e3b597f9265f4e9803-libserializer-1.1.6.zip Source1015: 3bf481ca95109b14435125c0dd1f2217-graphite2-1.0.3.tgz Source1016: 067201ea8b126597670b5eff72e1f66c-mythes-1.2.0.tar.gz Source1017: 1f24ab1d39f4a51faf22244c94a6203f-xmlsec1-1.2.14.tar.gz -Source1018: 128cfc86ed5953e57fe0f5ae98b62c2e-libtextcat-2.2.tar.gz +Source1018: e1c178b18f130b40494561f02bc1a948-libexttextcat-3.2.0.tar.bz2 Source1019: 17410483b5b5f267aa18b7e00b65e6e0-hsqldb_1_8_0.zip Source1020: 1756c4fa6c616ae15973c104cd8cb256-Adobe-Core35_AFMs-314.tar.gz Source1021: 185d60944ea767075d27247c3162b3bc-unowinreg.dll @@ -588,18 +587,22 @@ Source1029: 35c94d2df8893241173de1d16b6034c0-swingExSrc.zip Source1030: 39bb3fcea1514f1369fcfc87542390fd-sacjava-1.3.zip Source1031: 48a9f787f43a09c0a9b7b00cd1fddbbf-hyphen-2.7.1.tar.gz Source1032: 48d8169acc35f97e05d8dcdfd45be7f2-lucene-2.3.2.tar.gz -Source1033: 5ba6a61a2f66dfd5fee8cdd4cd262a37-libwpg-0.2.0.tar.bz2 +Source1033: 9d283e02441d8cebdcd1e5d9df227d67-libwpg-0.2.1.tar.bz2 Source1034: 0ff7d225d087793c8c2c680d77aac3e7-mdds_0.5.3.tar.bz2 Source1035: 798b2ffdc8bcfe7bca2cf92b62caf685-rhino1_5R5.zip Source1036: 8ce2fcd72becf06c41f7201d15373ed9-librepository-1.1.6.zip -Source1037: 8d265a592619166f29c4672ea54812b7-libwpd-0.9.2.tar.bz2 -Source1038: 83d4029aebf290c0a9a8fee9c99638d3-libwps-0.2.1.tar.bz2 +Source1037: c01351d7db2b205de755d58769288224-libwpd-0.9.4.tar.bz2 +Source1038: 34dd7951abbda99b7a75a09993a37965-libwps-0.2.4.tar.bz2 Source1039: 97b2d4dba862397f446b217e2b623e71-libloader-1.1.6.zip -Source1040: 831126a1ee5af269923cfab6050769fe-mysql-connector-cpp.zip +Source1040: 0981bda6548a8c8233ffce2b6e4b2a23-mysql-connector-c++-1.1.0.tar.gz +Source1041: 7c2549f6b0a8bb604e6c4c729ffdcfe6-libcmis-0.1.0.tar.gz +Source1042: d28864eb2b59bb57b034c0d4662a3cee-libvisio-0.0.15.tar.bz2 +Source1043: d7a242ca43e33e1b63d3073f9d46a6a8-librsvg-2.32.1.tar.gz # -# allow to build without helpcontent2 -Patch0: libreoffice-bootstrap-optional-helpcontent.diff -Patch1: libreoffice-postprocess-optional-helpcontent.diff +# allow to unpack source tarballs +Patch0: libreoffice-3.5-unpack-sources.diff +# mark share/config/javasettingsunopkginstall.xml as %config; it is updated by unopkg in %post +Patch1: javasetting-mark-config.diff # search application icons in /usr/share # FIXME: search both lib and lib64 and push into git Patch2: split-icons-search-usr-share.diff @@ -611,11 +614,12 @@ Patch4: solenv-carefull-patching-hack.diff # change user config dir name from ~/.libreoffice/3 to ~/.libreoffice/3-suse # to avoid BerkleyDB incompatibility with the plain build Patch5: scp2-user-config-suse.diff -# it created 3.8GB build log; Build Service refused to build such package -Patch6: translations-no-warnigns-from-po2oo.diff -# build gengal again -Patch7: gengal-svx.diff -Patch8: gengal-scp2.diff +# fix library link order to work with link as needed +Patch6: library-link-order-to-build-with-as-needed.diff +# put internal rhino into XBootClasspath to fix build with OpenJDK +Patch7: scripting-prefer-internal-rhino.diff +# update file list generation for 3.5 +Patch8: distro-install-file-lists-3.5.diff # search /share/template/common for language independent templates # will not push it upstream because it will be replaced by upcomming kendy's work Patch9: office-cfg-linux-common-template-dir.diff @@ -624,53 +628,30 @@ Patch10: system-python-ure-bootstrap.diff # do not use the broken help; unopkg complained about it when registering extensions # FIXME: the right fix is to compile the help and produce the .db_, .ht_, and other files Patch11: nlpsolver-no-broken-help.diff -# make sure that the extra jar files are bundled with the script provider extensions -Patch12: scripting-provider-build-dep.diff +Patch12: mediawiki-no-broken-help.diff # revert problematic build fix for poppler 0.17.0 on older distributions Patch13: libreoffice-poppler-0.17.0-reject-fix.diff +# generate selected bytecode version also in gbuild +Patch14: solenv-java-source-version.diff # fix build dependency problem in svx Patch15: svx-globlmn-hrc-build-dep.diff -# tooltips are all black in KDE4 (bnc#723074, fdo#40461) -Patch19: kde4-tooltips-style.diff -# do not display math in desktop menu (fdo#41681) -Patch20: do-not-display-math-in-desktop-menu.diff # display LO application in the right desktop submenu (bnc#718694) Patch21: desktop-submenu.diff -# define bash completion for 'loffice' wrapper (bnc#719656) -Patch22: bash-completion-for-loffice.diff # add pyuno to python path Patch26: pyuno-path.diff -# fix build with glib-2.31; glib/gthread.h can't be included directly -Patch27: buildfix-ucb-glib-2.31.diff -# -# PostgreSQL SDBC driver -Patch801: 801-sdbc-postgresql.diff -Patch802: 802-sdbc-postgresql-build-lst.diff -Patch803: 803-connectivity-workben-postgresql.diff -Patch804: 804-gcc-4.3-postgresql.diff -Patch805: 805-sdbc-postgresql-config_office.diff -Patch806: 806-sdbc-postgresql-oxt.diff -Patch807: 807-sdbc-postgresql-obsolete-hash-map.diff -Patch808: 808-sdbc-postgresql-deliver.diff -Patch809: 809-sdbc-postgresql-gcc-4.6.diff -# fix component mapping to get the symbol component_writeInfo; related to http://www.openoffice.org/issues/show_bug.cgi?id=115423 -Patch810: 810-sdbc-postgresql-lo-3.4-registration.diff -# Firefox changed the development model, so there is not longer a stable API -# only mozilla-nss and mozilla-nspr packages are supported but not the XUL stuff -# these patches disable the mozilla plugin that needed the XUL stuff -# it was not enabled by default; it newer worked well -Patch831: 831-mozilla-no-xul-config.diff -Patch832: 832-mozilla-no-xul-cui.diff -Patch833: 833-mozilla-no-xul-extensions.diff -Patch834: 834-mozilla-no-xul-scp2.diff # # default to MS Office 97/2000/XP file formats on MeeGo; asked by HP Patch900: officecfg-defaul-export-ms-file-formats.diff -# fix build with gcc-4.6 on openSUSE-12.0; hack my Caolan McNamara, see http://permalink.gmane.org/gmane.comp.documentfoundation.libreoffice.devel/10987 -Patch910: vbahelper-sc-gcc-4.6-link-fix.diff # crazy hack to avoid /usr/lib64 in RPATH and pass brp-rpath check (bnc#717262) Patch920: redland-rpath-hack.diff # +# Patches against zip-3.0 +Patch2000: zip-3.0-iso8859_2.patch +Patch2001: zip-3.0-add_options_to_help.patch +Patch2002: zip-3.0-nonexec-stack.patch +Patch2003: zip-3.0-optflags.patch +Patch2004: zip-3.0-tempfile.patch +Patch2005: zip-notimestamp.patch BuildRoot: %{_tmppath}/%{name}-%{version}-build ExclusiveArch: %ix86 x86_64 ppc @@ -955,20 +936,6 @@ http://udk.openoffice.org/python/python-bridge.html -%package testtool -Summary: LibreOffice Test Tool -License: LGPL-3.0 -Group: Productivity/Office/Suite -Requires: %name = %version -# compat stuff -Provides: OpenOffice_org-testtool = %version -Obsoletes: OpenOffice_org-testtool < %version - -%description testtool -A Tool needed for automatic testing of LibreOffice office suite. - - - %package gnome Summary: GNOME Extensions for LibreOffice License: LGPL-3.0 @@ -1357,14 +1324,11 @@ the LibreOffice localizations separately. %prep %if %prepare_build == 0 -%setup -D -T -q -n libreoffice-bootstrap-%version +%setup -D -T -q -n libreoffice-core-%version %else -%setup -q -n libreoffice-bootstrap-%version -bin/unpack-sources `pwd` \ - %{S:1} %{S:2} %{S:3} %{S:4} %{S:5} \ - %{S:6} %{S:7} %{S:8} %{S:9} %{S:10} \ - %{S:11} %{S:12} %{S:13} %{S:14} %{S:15} \ - %{S:16} %{S:17} %{S:18} %{S:19} +%setup -q -a30 -n libreoffice-core-%version +%patch0 +bin/unpack-sources `pwd` %{S:1} %{S:2} %{S:3} # 256x256 icons tar -xjf %{S:20} # SUSE config files @@ -1372,13 +1336,12 @@ cp $RPM_SOURCE_DIR/SUSE*.conf distro-configs # READMEs cp $RPM_SOURCE_DIR/README* . # extra fixes -%patch0 %patch1 %patch2 %patch3 %patch4 %patch5 -%patch6 +%patch6 -p1 %patch7 %patch8 %patch9 @@ -1389,49 +1352,49 @@ cp $RPM_SOURCE_DIR/README* . # cpp/poppler-version.h is not included in older poppler packages %patch13 %endif +%patch14 %patch15 -%patch19 -p1 -%patch20 %patch21 -%patch22 %patch26 -%patch27 -# PostgreSQL SDBC driver -%patch801 -%patch802 -%patch803 -%patch804 -%patch805 -%patch806 -%patch807 -%patch808 -%patch809 -%patch810 -# No XUL -%patch831 -%patch832 -%patch833 -%patch834 # %if 0%{?meego_version} # default to MS Office 97/2000/XP file formats on MeeGo; asked by HP %patch900 %endif # -%if %suse_version > 1130 -# fix build with gcc-4.6 on openSUSE-12.0; hack my Caolan McNamara, see http://permalink.gmane.org/gmane.comp.documentfoundation.libreoffice.devel/10987 -%patch910 -%endif -# %if %suse_version > 1140 # crazy hack to avoid /usr/lib64 in RPATH and pass brp-rpath check (bnc#717262) %patch920 %endif # +# patch zip-3.0 +%if %suse_version < 1140 +tar -xjf %{S:31} +cd zip30 +%patch2000 +%patch2001 +%patch2002 +%patch2003 +%patch2004 +%patch2005 +cd - +%endif %endif %build %if %prepare_build != 0 +# first build make-3.82 +cd make-* +CFLAGS=$RPM_OPT_FLAGS ./configure +make %{?_smp_mflags} +cd - +# +# second build zip-3.0 on older distributions +%if %suse_version < 1140 +cd zip30 +make %{?jobs:-j%jobs} -f unix/Makefile prefix=/usr CC="gcc $RPM_OPT_FLAGS -DLARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64" generic_gcc +cd - +%endif # # Parallel build settings ... PARALLEL_BUILD= @@ -1481,7 +1444,12 @@ CFLAGS="$ARCH_FLAGS" CXXFLAGS="$ARCH_FLAGS" export ARCH_FLAGS CFLAGS CXXFLAGS # FIXME: genccode from the system icu is in /usr/sbin -export PATH="$PATH:/usr/sbin" +# FIXME: we need make-3.82 for parallel build +export PATH="$RPM_BUILD_DIR/libreoffice-core-%version/make-%gnu_make_version-gbuild:$PATH:/usr/sbin" +# use the extra built zip-3.0 on older distributions +%if %suse_version < 1140 +export PATH="$RPM_BUILD_DIR/libreoffice-core-%version/zip30:$PATH:/usr/sbin" +%endif %if %prepare_build != 0 ./autogen.sh $PARALLEL_BUILD \ --with-external-tar="$RPM_SOURCE_DIR" \ @@ -1494,6 +1462,7 @@ export PATH="$PATH:/usr/sbin" --with-distro="$with_distro" \ --without-git \ --without-download \ + --disable-fetch-external \ --with-lang=%lo_langs \ --with-poor-help-localizations=%lo_poor_help_localizations \ --with-mono-gac-root=%{_prefix}/lib \ @@ -1507,9 +1476,6 @@ export PATH="$PATH:/usr/sbin" %if %lo_build_sdk == yes --enable-odk \ %endif -%if 0%{?suse_version} && 0%{?suse_version} <= 01030 - --with-additional-sections="PostgreSQL" \ -%endif %if 0%{?meego_version} --without-system-cairo \ --with-system-icu \ @@ -1525,7 +1491,6 @@ export PATH="$PATH:/usr/sbin" %if %suse_version <= 1110 --without-junit \ %endif - --with-system-mozilla=mozilla \ --disable-access \ --disable-post-install-scripts \ --disable-strip \ @@ -1537,6 +1502,17 @@ export PATH="$PATH:/usr/sbin" --enable-build-noarch \ --enable-ext-ct2n \ --enable-ext-nlpsolver \ + --enable-ext-google-docs \ + --enable-ext-numbertext \ + --without-help \ + --disable-mozilla \ + --without-system-mozilla \ + --disable-ldap \ + --enable-xmlsec \ + --with-system-nss \ +%if 0%{?suse_version} > 01110 + --with-system-postgresql \ +%endif %if 0%{?suse_version} --with-system-mysql \ --enable-ext-mysql-connector \ @@ -1555,11 +1531,16 @@ export PATH="$PATH:/usr/sbin" --enable-split-app-modules \ --enable-split-opt-features %endif -# hack to add icons for helpcontent that is build separately +# prebuilt stuff ( - . ./*Env.Set.sh + . ./Env.Host.sh + # hack to add icons for helpcontent that is build separately mkdir -p $SOLARVER/$INPATH/res/img perl helpcontent2/helpers/create_ilst.pl -dir=default_images/res/helpimg >$SOLARVER/$INPATH/res/img/helpimg.ilst + # copy prebuilt extensions into solver + mkdir -p $SOLARVER/$INPATH/bin + install -m 644 $RPM_SOURCE_DIR/*-gdocs_%{gdocs_version}_modified.oxt $SOLARVER/$INPATH/bin/gdocs.oxt + install -m 644 $RPM_SOURCE_DIR/*-numbertext_%{numbertext_version}.oxt $SOLARVER/$INPATH/bin/numbertext.oxt ) # hack to correctly bootstrap python stuff with system python, (deb#501028, i#90701) sed -i -e "s|@INSTALLDIR@|%lo_prefix/%lo_home|" pyuno/source/module/uno.py @@ -1612,13 +1593,9 @@ done ################ # compat stuff for noarch packages mkdir -p $RPM_BUILD_ROOT/%_datadir/%lo_home/program -mkdir -p $RPM_BUILD_ROOT/%_datadir/%lo_home/%lo_basis_dir -ln -sf %lo_basis_dir $RPM_BUILD_ROOT/%_datadir/%lo_home/basis-link install -m 755 $RPM_SOURCE_DIR/link-to-ooo-home $RPM_BUILD_ROOT%_datadir/%lo_home/ echo "%dir %_datadir/%lo_home" >>file-lists/common_list.txt echo "%dir %_datadir/%lo_home/program" >>file-lists/common_list.txt -echo "%dir %_datadir/%lo_home/%lo_basis_dir" >>file-lists/common_list.txt -echo "%_datadir/%lo_home/basis-link" >>file-lists/common_list.txt echo "%_datadir/%lo_home/link-to-ooo-home" >>file-lists/common_list.txt ################ # compat symlink to correctly uninstall OOo @@ -1651,15 +1628,15 @@ test -z "$icon_found" && echo "ERROR: Can't find compat icon for ooo-gulls.png" ################ # common helpcontent files # create symlinks to /usr/share for noarch help packages -mkdir -p $RPM_BUILD_ROOT/%lo_prefix/%lo_home/%lo_basis_dir/help -mkdir -p $RPM_BUILD_ROOT/%_datadir/%lo_home/%lo_basis_dir/help -echo "%dir %lo_prefix/%lo_home/%lo_basis_dir/help" >>file-lists/common_list.txt -echo "%dir %_datadir/%lo_home/%lo_basis_dir/help" >>file-lists/common_list.txt +mkdir -p $RPM_BUILD_ROOT/%lo_prefix/%lo_home/help +mkdir -p $RPM_BUILD_ROOT/%_datadir/%lo_home/help +echo "%dir %lo_prefix/%lo_home/help" >>file-lists/common_list.txt +echo "%dir %_datadir/%lo_home/help" >>file-lists/common_list.txt for file in idxcaption.xsl idxcontent.xsl main_transform.xsl ; do - install -m 644 solver/*/unxlng*.pro/bin/$file $RPM_BUILD_ROOT/%lo_prefix/%lo_home/%lo_basis_dir/help - ln -sf %lo_prefix/%lo_home/%lo_basis_dir/help/$file $RPM_BUILD_ROOT/%_datadir/%lo_home/%lo_basis_dir/help - echo "%lo_prefix/%lo_home/%lo_basis_dir/help/$file" >>file-lists/common_list.txt - echo "%_datadir/%lo_home/%lo_basis_dir/help/$file" >>file-lists/common_list.txt + install -m 644 solver/unxlng*.pro/bin/$file $RPM_BUILD_ROOT/%lo_prefix/%lo_home/help + ln -sf %lo_prefix/%lo_home/help/$file $RPM_BUILD_ROOT/%_datadir/%lo_home/help + echo "%lo_prefix/%lo_home/help/$file" >>file-lists/common_list.txt + echo "%_datadir/%lo_home/help/$file" >>file-lists/common_list.txt done ################ # branding will be in separate packages @@ -1687,7 +1664,7 @@ for file in sofficerc \ done ################ # extra background picture into the gallery -export galdir="%lo_prefix/%lo_home/%lo_basis_dir/share/gallery" +export galdir="%lo_prefix/%lo_home/share/gallery" install -m 644 "$RPM_SOURCE_DIR/Draft.jpg" "$RPM_BUILD_ROOT$galdir/www-back/" echo "$galdir/www-back/Draft.jpg" >>file-lists/common_list.txt # make sure that the existing galleries can be modified @@ -1697,8 +1674,8 @@ LC_ALL=en_US.UTF-8 $RPM_BUILD_ROOT%lo_prefix/%lo_home/program/gengal -headless - ################ # FIXME: fast hack to solve a customer issue, n#364523 # we need a more generic solution -ln -sf acor_fr-FR.dat $RPM_BUILD_ROOT%lo_prefix/%lo_home/%lo_basis_dir/share/autocorr/acor_fr-CA.dat -echo "%lo_prefix/%lo_home/%lo_basis_dir/share/autocorr/acor_fr-CA.dat" >>file-lists/common_list.txt +ln -sf acor_fr-FR.dat $RPM_BUILD_ROOT%lo_prefix/%lo_home/share/autocorr/acor_fr-CA.dat +echo "%lo_prefix/%lo_home/share/autocorr/acor_fr-CA.dat" >>file-lists/common_list.txt ################ # helper script to create libstlport compat symlink (bnc#458952) %ifarch %ix86 @@ -1725,7 +1702,7 @@ cat << EOF > $RPM_BUILD_ROOT/%_prefix/sbin/unopkg-sync-bundled #Create the command which creates a temporary directory INSTDIR=\`mktemp -d -t "userinstall.XXXXXX"\` -unopkg sync "-env:BUNDLED_EXTENSIONS_USER=file://%lo_prefix/%lo_home/share/prereg/bundled" "-env:UserInstallation=file://\$INSTDIR" '-env:UNO_JAVA_JFW_INSTALL_DATA=file://%lo_prefix/%lo_home/%lo_basis_dir/share/config/javasettingsunopkginstall.xml' '-env:JFW_PLUGIN_DO_NOT_CHECK_ACCESSIBILITY=1' +unopkg sync "-env:BUNDLED_EXTENSIONS_USER=file://%lo_prefix/%lo_home/share/prereg/bundled" "-env:UserInstallation=file://\$INSTDIR" '-env:UNO_JAVA_JFW_INSTALL_DATA=file://%lo_prefix/%lo_home/share/config/javasettingsunopkginstall.xml' '-env:JFW_PLUGIN_DO_NOT_CHECK_ACCESSIBILITY=1' find "%lo_prefix/%lo_home/share/prereg/bundled" -type f -exec chmod 644 {} \\; rm -rf "\$INSTDIR" @@ -1754,38 +1731,11 @@ EOF echo "%doc %dir \"%{_docdir}/%name-kde4\"" >>file-lists/kde4_list.txt echo "%doc \"%{_docdir}/%name-kde4/README.txt\"" >>file-lists/kde4_list.txt fi -################ -# officebean subpackage -rm -f file-lists/officebean_list.txt -for file in %lo_prefix/%lo_home/%lo_basis_dir/program/classes/officebean.jar \ - %lo_prefix/%lo_home/%lo_basis_dir/program/libofficebean.so ; do - grep -v $file file-lists/common_list.txt >file-lists/common_list.txt.new - mv file-lists/common_list.txt.new file-lists/common_list.txt - echo $file >>file-lists/officebean_list.txt -done -################ -# extensions -mkdir -p $RPM_BUILD_ROOT%lo_prefix/%lo_home/share/extensions -find solver -name "*.oxt" -exec cp {} $RPM_BUILD_ROOT%lo_prefix/%lo_home/share/extensions \; -# prebuilt extensions -cp $RPM_SOURCE_DIR/*-gdocs_%{gdocs_version}_modified.oxt $RPM_BUILD_ROOT%lo_prefix/%lo_home/share/extensions/gdocs_%{gdocs_version}_modified.oxt -cp $RPM_SOURCE_DIR/numbertext-%{numbertext_version}.oxt $RPM_BUILD_ROOT%lo_prefix/%lo_home/share/extensions -# unpack the extensions -cd $RPM_BUILD_ROOT%lo_prefix/%lo_home/share/extensions -for file in *.oxt ; do - dir=`echo $file | sed s/.oxt$//` - mkdir $dir - # FIXME: gdocs_2.1.0_modified.oxt includes AbsoluteLayout.jar twice => we must force overwriting - unzip -o -d $dir $file - rm $file -done -cd - >/dev/null - ################ # Symlink uno.py and unohelper.py so that python can find them mkdir -p $RPM_BUILD_ROOT%python_sitelib -ln -s %_libdir/libreoffice/basis-link/program/uno.py $RPM_BUILD_ROOT%python_sitelib/uno.py -ln -s %_libdir/libreoffice/basis-link/program/unohelper.py $RPM_BUILD_ROOT%python_sitelib/unohelper.py +ln -s %_libdir/libreoffice/program/uno.py $RPM_BUILD_ROOT%python_sitelib/uno.py +ln -s %_libdir/libreoffice/program/unohelper.py $RPM_BUILD_ROOT%python_sitelib/unohelper.py %clean rm -rf $RPM_BUILD_ROOT @@ -1851,10 +1801,10 @@ fi %ifarch %ix86 %triggerin -- mysql-connector-java -%lo_prefix/%lo_home/basis-link/program/java-set-classpath /usr/share/java/mysql-connector-java.jar || true +%lo_prefix/%lo_home/program/java-set-classpath /usr/share/java/mysql-connector-java.jar || true %triggerpostun -- mysql-connector-java -%lo_prefix/%lo_home/basis-link/program/java-set-classpath /usr/share/java/mysql-connector-java.jar || true +%lo_prefix/%lo_home/program/java-set-classpath /usr/share/java/mysql-connector-java.jar || true %triggerin -- libstlport_gcc4 # create compat link needed to run upstream extensions (bnc#458952) @@ -2197,7 +2147,6 @@ fi %files -f file-lists/common_list.txt %defattr(-,root,root) # common extensions -%lo_prefix/%lo_home/share/extensions/script-provider-for-javascript # ignore helper files for brp-symlink check %exclude %_datadir/%lo_home/program/sofficerc %exclude %_datadir/%lo_home/program/*.png @@ -2221,9 +2170,8 @@ fi %files -f file-lists/writer_list.txt writer %defattr(-,root,root) -%files base-drivers-postgresql +%files -f file-lists/postgresql_list.txt base-drivers-postgresql %defattr(-,root,root) -%lo_prefix/%lo_home/share/extensions/postgresql-sdbc-* %files -f file-lists/filters_list.txt filters-optional %defattr(-,root,root) @@ -2235,6 +2183,7 @@ fi %files -f file-lists/mono_list.txt mono %defattr(-,root,root) +%doc README-mono.txt %endif %files -f file-lists/pyuno_list.txt pyuno @@ -2243,9 +2192,6 @@ fi %python_sitelib/uno.py %python_sitelib/unohelper.py -%files -f file-lists/testtool_list.txt testtool -%defattr(-,root,root) - %files -f file-lists/gnome_list.txt gnome %defattr(-,root,root) @@ -2257,7 +2203,6 @@ fi %files -f file-lists/officebean_list.txt officebean %defattr(-,root,root) -%lo_prefix/%lo_home/share/extensions/script-provider-for-beanshell %if %lo_build_sdk == yes @@ -2286,8 +2231,8 @@ fi %defattr(-,root,root) %doc README-scsolver.txt %lo_prefix/%lo_home/share/extensions/ConvertTextToNumber -%lo_prefix/%lo_home/share/extensions/NLPSolver -%lo_prefix/%lo_home/share/extensions/numbertext-%{numbertext_version} +%lo_prefix/%lo_home/share/extensions/nlpsolver +%lo_prefix/%lo_home/share/extensions/numbertext %files draw-extensions %defattr(-,root,root) @@ -2300,7 +2245,7 @@ fi %files writer-extensions %defattr(-,root,root) -%lo_prefix/%lo_home/share/extensions/gdocs_%{gdocs_version}_modified +%lo_prefix/%lo_home/share/extensions/gdocs %lo_prefix/%lo_home/share/extensions/wiki-publisher %files -f file-lists/icon_themes_prebuilt.txt icon-themes-prebuilt diff --git a/lo-help-gen-spec b/lo-help-gen-spec index 156f52c..1888a80 100644 --- a/lo-help-gen-spec +++ b/lo-help-gen-spec @@ -5,12 +5,13 @@ use strict; use File::Copy; +my $args = join ' ', @ARGV; my $max_level = 2; sub init_lang_data($$$$$) { - my ($datap, $lang_code, $long_name, $level, $group) = @_; + my ($pdata, $lang_code, $long_name, $level, $group) = @_; my $curLang; my $upstreamLang; @@ -26,33 +27,37 @@ sub init_lang_data($$$$$) die "Syntax error: unknown format of the language code: $lang_code, line $."; } - $datap->{'lang'}{$curLang}{'long_name'} = $long_name; - $datap->{'lang'}{$curLang}{'level'} = $level; - $datap->{'lang'}{$curLang}{'group'} = $group; - $datap->{'lang'}{$curLang}{'locale'} = $upstreamLang; - $datap->{'lang'}{$curLang}{'locale'} =~ s/-/_/g; - $datap->{'lang'}{$curLang}{'package-help'} = (); + % {$pdata->{'lang'}{$curLang}} = (); + my $pld = \% {$pdata->{'lang'}{$curLang}}; - $datap->{'max_group'} = $group if ($group > $datap->{'max_group'}); + $pld->{'long_name'} = $long_name; + $pld->{'level'} = $level; + $pld->{'group'} = $group; + $pld->{'locale'} = $upstreamLang; + $pld->{'locale'} =~ s/-/_/g; + $pld->{'package-help'} = (); + + $pdata->{'max_group'} = $group if ($group > $pdata->{'max_group'}); ($level <= $max_level) || die "Error: Maximum allowed level is $max_level, line $."; foreach my $l ($level .. $max_level) { - @ {$datap->{'level_langs_list'}[$l]} = () unless (defined $datap->{'level_langs_list'}[$l]); - push @ {$datap->{'level_langs_list'}[$l]}, $upstreamLang; + @ {$pdata->{'level_langs_list'}[$l]} = () unless (defined $pdata->{'level_langs_list'}[$l]); + push @ {$pdata->{'level_langs_list'}[$l]}, $upstreamLang; $l++; } - return $curLang; + return $pld; } sub read_data($$) { - my ($data_file, $datap) = @_; - my $curLang; + my ($data_file, $pdata) = @_; + # pointer to locale data + my $pld = undef; - $datap->{'max_group'} = 0; - $datap->{'level_langs_list'} = (); - @ {$datap->{'level_langs_list'}[$_]} = () foreach (0 .. $max_level); + $pdata->{'max_group'} = 0; + $pdata->{'level_langs_list'} = (); + @ {$pdata->{'level_langs_list'}[$_]} = () foreach (0 .. $max_level); open DATA , "< $data_file" or die "Can't open '$data_file'\n"; @@ -63,16 +68,14 @@ sub read_data($$) if ( $line =~ m/^\s*\%lang\s+([\w\-\/]+)\s+(\w+)\s+(\d+)\s+(\d+)\s*$/ ) { # long name without without quotation marks, e.g. %lang de German 1 1 # the language code might be different for the packages for upstream file list, e.g. %lang gu-IN/gu Gujarati 2 3 - $curLang = init_lang_data($datap, "$1", "$2", "$3", "$4"); + $pld = init_lang_data($pdata, "$1", "$2", "$3", "$4"); } elsif ( $line =~ m/^\s*\%lang\s+([\w\-\/]+)\s+\"([\w\s]+)\"\s+(\d+)\s+(\d+)\s*$/ ) { # long name with with quotation marks, e.g. %lang en-ZA "South Africa English" 2 2 - $curLang = init_lang_data($datap, "$1", "$2", "$3", "$4"); + $pld = init_lang_data($pdata, "$1", "$2", "$3", "$4"); } elsif ( $line =~ /^\s*\%poor-help\s*$/ ) { - $datap->{'lang'}{$curLang}{'poor-help'} = 1; - } elsif ( $line =~ /^\s*\%package-help\s+(.*)$/ ) { - push @ {$datap->{'lang'}{$curLang}{'package-help'}}, "$1"; - } elsif ( $line =~ /^\s*\%files-help\s+(.*)$/ ) { - push @ {$datap->{'lang'}{$curLang}{'files-help'}}, "$1"; + $pld->{'poor-help'} = 1; + } elsif ( $line =~ /^\s*\%package\s+(.*)$/ ) { + push @ {$pld->{'package'}}, "$1"; } elsif ( $line =~ /^\s*$/ ) { # ignore empty line } else { @@ -82,14 +85,17 @@ sub read_data($$) close(DATA); } +################################## +# conditional lines + sub write_level_begin($$$) { my ($curLevel, $newLevel, $outp) = @_; if ($curLevel != $newLevel) { - ${$outp} .= "\n"; ${$outp} .= "%endif\n" if ($curLevel > 0); ${$outp} .= "%if %test_build_langs >= $newLevel\n" if ($newLevel > 0); + ${$outp} .= "\n" if ($curLevel > 0); } return $newLevel; @@ -106,119 +112,205 @@ sub write_level_end($$) return 0; } -sub write_help_package_section($$$) +############################## +# simple sections + +sub write_do_not_edit_section($) { - my ($datap, $curLang, $outp) = @_; + my $out = "###################################################################\n" . + "## DO NOT EDIT THIS SPEC FILE\n" . + "## Generated by:\n" . + "## perl lo-help-gen-spec $args\n" . + "###################################################################"; + return $out; +} + + +############################## +# all langs sections + +sub write_metadata_section($$) +{ + my ($pdata, $curLang) = @_; + my $pld = \% {$pdata->{'lang'}{$curLang}}; + my $out = ""; + + return $out if (defined $pld->{'poor-help'}); + my $oldPackage; - - return if (defined $datap->{'lang'}{$curLang}{'poor-help'}); - if ("$curLang" eq "en-US") { $oldPackage = "OpenOffice_org"; } else { $oldPackage = "OpenOffice_org-$curLang"; } - ${$outp} .= "\n"; - ${$outp} .= "\n"; - ${$outp} .= "%package -n libreoffice-help-$curLang\n"; - ${$outp} .= "License: LGPL-3.0\n"; - ${$outp} .= "Summary: $datap->{'lang'}{$curLang}{'long_name'} Help Localization for LibreOffice\n"; - ${$outp} .= "Group: Productivity/Office/Suite\n"; - ${$outp} .= "Provides: locale(libreoffice:$datap->{'lang'}{$curLang}{'locale'})\n"; - ${$outp} .= "PreReq: libreoffice = %version\n"; - ${$outp} .= "%if 0%{?suse_version}\n"; - ${$outp} .= "Supplements: libreoffice-l10n-$curLang\n"; - ${$outp} .= "%endif\n"; - ${$outp} .= "# compat stuff\n"; - ${$outp} .= "Provides: OpenOffice_org-help-$curLang = %version\n"; - ${$outp} .= "Obsoletes: OpenOffice_org-help-$curLang <= %version\n"; - ${$outp} .= "Provides: $oldPackage:%_prefix/ooo-2.0/help/$curLang/default.css\n"; - - foreach my $line (@{$datap->{'lang'}{$curLang}{'package-help'}}) { - ${$outp} .= "$line\n"; + $out .= "%package -n libreoffice-help-$curLang\n"; + $out .= "Summary: $pld->{'long_name'} Help Localization for LibreOffice\n"; + $out .= "Group: Productivity/Office/Suite\n"; + $out .= "Provides: locale(libreoffice:$pld->{'locale'})\n"; + $out .= "%if 0%{?suse_version} > 01120\n"; + $out .= "Requires(post): coreutils\n"; + $out .= "Requires(post): grep\n"; + $out .= "Requires(post): libreoffice >= 3.5\n"; + $out .= "Requires(postun): coreutils\n"; + $out .= "Requires(postun): grep\n"; + $out .= "Requires(postun): libreoffice >= 3.5\n"; + $out .= "%endif\n"; + $out .= "%if 0%{?suse_version} && 0%{?suse_version} <= 01120\n"; + $out .= "PreReq: coreutils\n"; + $out .= "PreReq: grep\n"; + $out .= "PreReq: libreoffice >= 3.5\n"; + $out .= "%endif\n"; + $out .= "Requires: libreoffice = %{version}\n"; + foreach my $line (@{$pld->{'package-help'}}) { + $out .= "$line\n"; } + $out .= "# compat stuff\n"; + $out .= "Provides: OpenOffice_org-help-$curLang = %version\n"; + $out .= "Obsoletes: OpenOffice_org-help-$curLang <= %version\n"; + $out .= "Provides: $oldPackage:%_prefix/ooo-2.0/help/$curLang/default.css\n"; - ${$outp} .= "\n"; - ${$outp} .= "\n"; - ${$outp} .= "%description -n libreoffice-help-$curLang\n"; - ${$outp} .= "$datap->{'lang'}{$curLang}{'long_name'} help localization for LibreOffice. The other localized stuff\n"; - ${$outp} .= "is in libreoffice-l10n-$curLang.\n"; - ${$outp} .= "\n"; + $out .= "\n"; + $out .= "%description -n libreoffice-help-$curLang\n"; + $out .= "$pld->{'long_name'} help localization for LibreOffice. The other localized stuff\n"; + $out .= "is in libreoffice-l10n-$curLang.\n"; + $out .= "\n"; + + return $out; } -sub write_help_scripts_section($$$) +sub write_install_scripts_section($$) { - my ($datap, $curLang, $outp) = @_; + my ($pdata, $curLang) = @_; + my $pld = \% {$pdata->{'lang'}{$curLang}}; + my $out = ""; - return if (defined $datap->{'lang'}{$curLang}{'poor-help'}); + return $out if (defined $pld->{'poor-help'}); - ${$outp} .= "# $curLang\n"; - ${$outp} .= "\n"; - ${$outp} .= "\n"; - ${$outp} .= "%posttrans -n libreoffice-help-$curLang\n"; - ${$outp} .= "%_datadir/%lo_home/link-to-ooo-home %_datadir/%lo_home/help_$datap->{'lang'}{$curLang}{'locale'}_list.txt || true\n"; - ${$outp} .= "\n"; - ${$outp} .= "\n"; - ${$outp} .= "%preun -n libreoffice-help-$curLang\n"; - ${$outp} .= "test \"\$1\" = \"0\" && cp %_datadir/%lo_home/help_$datap->{'lang'}{$curLang}{'locale'}_list.txt %_datadir/%lo_home/help_$datap->{'lang'}{$curLang}{'locale'}_list.txt.postun || true\n"; - ${$outp} .= "\n"; - ${$outp} .= "\n"; - ${$outp} .= "%postun -n libreoffice-help-$curLang\n"; - ${$outp} .= "test \"\$1\" = \"0\" && %_datadir/%lo_home/link-to-ooo-home --unlink %_datadir/%lo_home/help_$datap->{'lang'}{$curLang}{'locale'}_list.txt.postun || true\n"; - ${$outp} .= "rm -f %_datadir/%lo_home/help_$datap->{'lang'}{$curLang}{'locale'}_list.txt.postun 2>/dev/null\n"; + $out .= "# $curLang\n"; + $out .= "\n"; + $out .= "%posttrans -n libreoffice-help-$curLang\n"; + $out .= "%_datadir/%lo_home/link-to-ooo-home %_datadir/%lo_home/help_$pld->{'locale'}_list.txt || true\n"; + $out .= "\n"; + $out .= "%preun -n libreoffice-help-$curLang\n"; + $out .= "test \"\$1\" = \"0\" && cp %_datadir/%lo_home/help_$pld->{'locale'}_list.txt %_datadir/%lo_home/help_$pld->{'locale'}_list.txt.postun || true\n"; + $out .= "\n"; + $out .= "%postun -n libreoffice-help-$curLang\n"; + $out .= "test \"\$1\" = \"0\" && %_datadir/%lo_home/link-to-ooo-home --unlink %_datadir/%lo_home/help_$pld->{'locale'}_list.txt.postun || true\n"; + $out .= "rm -f %_datadir/%lo_home/help_$pld->{'locale'}_list.txt.postun 2>/dev/null\n"; + + return $out; } - -sub write_help_files_section($$$$) +sub write_files_section($$) { - my ($datap, $curLang, $outp) = @_; + my ($pdata, $curLang) = @_; + my $pld = \% {$pdata->{'lang'}{$curLang}}; + my $out = ""; - return if (defined $datap->{'lang'}{$curLang}{'poor-help'}); + return $out if (defined $pld->{'poor-help'}); - ${$outp} .= "\n"; - ${$outp} .= "\n"; - ${$outp} .= "%files -f file-lists/help_$datap->{'lang'}{$curLang}{'locale'}_list.txt -n libreoffice-help-$curLang\n"; - ${$outp} .= "%defattr(-,root,root)\n"; + $out .= "%files -f file-lists/help_$pld->{'locale'}_list.txt -n libreoffice-help-$curLang\n"; + $out .= "%defattr(-,root,root)\n"; + $out .= "\n"; - foreach my $line (@{$datap->{'lang'}{$curLang}{'files-help'}}) { - ${$outp} .= "$line\n"; - } + return $out; } -sub write_section($$$$) -{ - my ($datap, $group, $write_single_lang_section, $outp) = @_; - my $curLevel = 0; - - foreach my $curLang (sort keys %{$datap->{'lang'}}) { - if ($datap->{'lang'}{$curLang}{'group'} == $group) { - $curLevel = write_level_begin($curLevel, $datap->{'lang'}{$curLang}{'level'}, $outp); - & {$write_single_lang_section} ($datap, $curLang, $outp); - } - } - - $curLevel = write_level_end($curLevel, $outp); -} +######################################################## +# universal writing functions sub write_level_langs($$$) { - my ($datap, $group, $level) = @_; + my ($pdata, $group, $level) = @_; + my $out = ""; - my $level_langs = ""; - foreach my $curLang (sort keys %{$datap->{'lang'}}) { - if ( ($group == $datap->{'lang'}{$curLang}{'group'}) && - ($level >= $datap->{'lang'}{$curLang}{'level'}) ) { - $level_langs .= " $datap->{'lang'}{$curLang}{'locale'}"; + foreach my $curLang (sort keys %{$pdata->{'lang'}}) { + my $pld = \% {$pdata->{'lang'}{$curLang}}; + if ( ($group == $pld->{'group'}) && + ($level >= $pld->{'level'}) ) { + $out .= " $pld->{'locale'}"; } } - $level_langs =~ s/^ //; - $level_langs =~ s/_/-/g; + $out =~ s/^ //; + $out =~ s/_/-/g; - return $level_langs; + return $out; } +# the text is not repeated for each locale +sub write_simple_section($$) +{ + my ($pdata, $write_section) = @_; + + return & {$write_section} ($pdata); +} + + +# the text is repeated for each locale +# it is used on all distributions +sub write_locale_sections($$$) +{ + my ($pdata, $group, $write_single_lang_section) = @_; + my $curLevel = 0; + my $out = ""; + + foreach my $curLang (sort keys %{$pdata->{'lang'}}) { + my $pld = \% {$pdata->{'lang'}{$curLang}}; + if ($pld->{'group'} == $group) { + $curLevel = write_level_begin($curLevel, $pld->{'level'}, \$out); + $out .= & {$write_single_lang_section} ($pdata, $curLang); + } + } + + $curLevel = write_level_end($curLevel, \$out); + + return $out; +} + +######################################################## +# main write function + +sub write_specs($$) +{ + my ($pdata, $spec_template) = @_; + + my $do_not_edit = write_simple_section ($pdata, \&write_do_not_edit_section); + foreach my $group (0 .. $pdata->{'max_group'}) { + my $metadata = write_locale_sections ($pdata, $group, \&write_metadata_section); + my $install_scripts = write_locale_sections ($pdata, $group, \&write_install_scripts_section); + my $files = write_locale_sections ($pdata, $group, \&write_files_section); + + if ($metadata || $install_scripts || $files) { + my $spec = $spec_template; + $spec =~ s/.in$//; + $spec =~ s/groupX/group$group/; + + print "Generating $spec...\n"; + + open TEMPLATE , "< $spec_template" or die "Can't open '$spec_template'\n"; + open SPEC , "> $spec" or die "Can't open '$spec for writing'\n"; + + while( my $line =