diff options
43 files changed, 5848 insertions, 0 deletions
diff --git a/Makefile.fetch b/Makefile.fetch index 40a90a0654be..226244202354 100644 --- a/Makefile.fetch +++ b/Makefile.fetch @@ -74,6 +74,9 @@ $(WORKDIR)/download: $(BUILDDIR)/config_host.mk $(SRCDIR)/download.lst $(SRCDIR) @mkdir -p $(TARFILE_LOCATION)/tmp @date >> $(fetch_LOGFILE) $(foreach item, \ + $(call fetch_Optional,FIREBIRD,FIREBIRD_TARBALL) \ + ,$(call fetch_Download_item_special,http://people.igalia.com/agomez/files,$(item))) + $(foreach item, \ $(call fetch_Optional,CDR,CDR_TARBALL) \ $(call fetch_Optional,MSPUB,MSPUB_TARBALL) \ $(call fetch_Optional,MWAW,MWAW_TARBALL) \ diff --git a/Repository.mk b/Repository.mk index 0fc2a9271244..aa66703e9a84 100644 --- a/Repository.mk +++ b/Repository.mk @@ -251,6 +251,7 @@ $(eval $(call gb_Helper_register_libraries_for_install,OOOLIBS,ooo, \ flat \ file \ filterconfig \ + firebird-sdbc \ fpicker \ fps_office \ for \ diff --git a/RepositoryExternal.mk b/RepositoryExternal.mk index 826f51016465..6b11281aef82 100644 --- a/RepositoryExternal.mk +++ b/RepositoryExternal.mk @@ -2048,6 +2048,76 @@ gb_LinkTarget__use_openldap := endif # SYSTEM_OPENLDAP +ifeq ($(ENABLE_FIREBIRD_SDBC),TRUE) + +ifeq ($(SYSTEM_FIREBIRD),YES) + +define gb_LinkTarget__use_firebird +$(call gb_LinkTarget_set_include,$(1),\ + $(FIREBIRD_CFLAGS) \ + $$(INCLUDE) \ +) +$(call gb_LinkTarget_add_libs,$(1),$(FIREBIRD_LIBS)) + +endef + +# gb_LinkTarget__use_atomic_ops := +# gb_LinkTarget__use_tommath := + +else # !SYSTEM_FIREBIRD + +$(eval $(call gb_Helper_register_static_libraries,PLAINLIBS, \ + firebird \ +)) +define gb_LinkTarget__use_firebird +$(call gb_LinkTarget_use_unpacked,$(1),firebird) +$(call gb_LinkTarget_set_include,$(1),\ + -I$(OUTDIR)/inc/external/firebird \ + $$(INCLUDE) \ +) +$(call gb_LinkTarget_use_libraries,$(1),\ + firebird \ +) + +endef + +# $(eval $(call gb_Helper_register_static_libraries,PLAINLIBS, \ +# atomic_ops \ +# )) + +# define gb_LinkTarget__use_atomic_ops +# $(call gb_LinkTarget_use_static_libraries,$(1),\ +# atomic_ops \ +# ) + +# endef +# define gb_ExternalProject__use_atomic_ops +# $(call gb_ExternalProject_use_package,$(1),atomic_ops) +# $(call gb_ExternalProject_use_static_libraries,$(1),atomic_ops) + +# endef + +# define gb_LinkTarget__use_tommath +# $(call gb_LinkTarget_set_include,$(1),\ +# $(TOMMATH_CFLAGS) \ +# $$(INCLUDE) \ +# ) + +# $(call gb_LinkTarget_add_libs,$(1),$(TOMMATH_LIBS)) + +# endef + +endif # SYSTEM_FIREBIRD + +else # !ENABLE_FIREBIRD_SDBC + +gb_LinkTarget__use_firebird := +# gb_LinkTarget__use_atomic_ops := +# gb_LinkTarget__use_tommath := + +endif # ENABLE_FIREBIRD_SDBC + + ifeq ($(SYSTEM_POSTGRESQL),YES) define gb_LinkTarget__use_postgresql diff --git a/RepositoryModule_host.mk b/RepositoryModule_host.mk index c3834efdea4b..3d12e56941a9 100644 --- a/RepositoryModule_host.mk +++ b/RepositoryModule_host.mk @@ -62,6 +62,7 @@ $(eval $(call gb_Module_add_moduledirs,libreoffice,\ extras \ fileaccess \ filter \ + $(call gb_Helper_optional,FIREBIRD,firebird) \ $(call gb_Helper_optional,FONTCONFIG,fontconfig) \ $(call gb_Helper_optional,DBCONNECTIVITY,forms) \ formula \ diff --git a/config_host.mk.in b/config_host.mk.in index 8e14d7aa3fd9..9fbc6e2312d7 100644 --- a/config_host.mk.in +++ b/config_host.mk.in @@ -111,6 +111,7 @@ export ENABLE_DEBUG=@ENABLE_DEBUG@ export ENABLE_DEBUGINFO_FOR=@ENABLE_DEBUGINFO_FOR@ export ENABLE_DIRECTX=@ENABLE_DIRECTX@ export ENABLE_EVOAB2=@ENABLE_EVOAB2@ +export ENABLE_FIREBIRD_SDBC=@ENABLE_FIREBIRD_SDBC@ export ENABLE_GCONF=@ENABLE_GCONF@ export ENABLE_GIO=@ENABLE_GIO@ export ENABLE_GNOMEVFS=@ENABLE_GNOMEVFS@ @@ -162,6 +163,8 @@ export EPM_FLAGS=@EPM_FLAGS@ export EXTERNAL_WARNINGS_NOT_ERRORS=@EXTERNAL_WARNINGS_NOT_ERRORS@ export debug=@ENABLE_DEBUG@ @x_Cygwin@ export FIND=@WIN_FIND@ +export FIREBIRD_CFLAGS=$(gb_SPACE)@FIREBIRD_CFLAGS@ +export FIREBIRD_LIBS=$(gb_SPACE)@FIREBIRD_LIBS@ export FLEX=@FLEX@ export FLUTE_JAR=@FLUTE_JAR@ export FONTCONFIG_CFLAGS=$(gb_SPACE)@FONTCONFIG_CFLAGS@ @@ -462,6 +465,7 @@ export SYSTEM_DICTS=@SYSTEM_DICTS@ export SYSTEM_EXPAT=@SYSTEM_EXPAT@ export SYSTEM_FONTCONFIG=@SYSTEM_FONTCONFIG@ export SYSTEM_FREETYPE=@SYSTEM_FREETYPE@ +export SYSTEM_FIREBIRD=@SYSTEM_FIREBIRD@ export SYSTEM_GENBRK=@SYSTEM_GENBRK@ export SYSTEM_GENCCODE=@SYSTEM_GENCCODE@ export SYSTEM_GENCMN=@SYSTEM_GENCMN@ diff --git a/configure.ac b/configure.ac index 566b38ca16ac..dfe5b9c636b0 100644 --- a/configure.ac +++ b/configure.ac @@ -1169,6 +1169,12 @@ AC_ARG_ENABLE(lotuswordpro, [Disable the build of the Lotus Word Pro filter.]), ,enable_lotuswordpro=yes) +AC_ARG_ENABLE(firebird-sdbc, + AS_HELP_STRING([--enable-firebird-sdbc], + [Enable the build of the Firebird-SDBC driver. Work in progress, + use only if you are hacking on it.]), +,enable_firebird_sdbc=no) + AC_ARG_ENABLE(coretext, AS_HELP_STRING([--enable-coretext], [Use CoreText framework on Mac (instead of ATSU). @@ -1435,6 +1441,23 @@ AC_ARG_WITH(libpq-path, ], ,) +AC_ARG_WITH(system-firebird, + AS_HELP_STRING([--with-system-firebird], + [Use Firebird libraries already on system, for building the Firebird-SDBC + driver. If fb_config is not in PATH, use FBCONFIG to point to it.]),, + [with_system_firebird="$with_system_libs"]) + +# To be replaced with IBPP, in case we want ot use it +dnl AC_ARG_WITH(libibpp-path, +dnl AS_HELP_STRING([--with-libibpp-path], +dnl [Use this Firebird C++ API (libibpp) installation for building +dnl the Firebird-SDBC extension.]) +dnl [ +dnl Usage: --with-libibpp-path=<absolute path to +dnl your libibpp installation> +dnl ], +dnl ,) + AC_ARG_WITH(system-hsqldb, AS_HELP_STRING([--with-system-hsqldb], [Use hsqldb already on system.])) @@ -8070,6 +8093,74 @@ AC_SUBST(POSTGRESQL_INC) AC_SUBST(POSTGRESQL_LIB) dnl =================================================================== +dnl Check for Firebird stuff +dnl =================================================================== +ENABLE_FIREBIRD_SDBC="" +if test "x$enable_firebird_sdbc" != "xno"; then + + SCPDEFS="$SCPDEFS -DWITH_FIREBIRD_SDBC" + + dnl =================================================================== + dnl Check for system Firebird + dnl =================================================================== + AC_MSG_CHECKING([which Firebird to use]) + if test "$with_system_firebird" = "yes"; then + AC_MSG_RESULT([external]) + SYSTEM_FIREBIRD=YES + AC_PATH_PROG(FIREBIRDCONFIG, [fb_config]) + if test -z "$FIREBIRDCONFIG"; then + AC_MSG_ERROR([fb_config is missing. Install Firebird package.]) + fi + AC_MSG_CHECKING([Firebird version]) + FIREBIRD_VERSION=`$FIREBIRDCONFIG --version` + FIREBIRD_MAJOR=`$FIREBIRDCONFIG --version | cut -d"." -f1` + FIREBIRD_MINOR=`$FIREBIRDCONFIG --version | cut -d"." -f2` + if test "$FIREBIRD_MAJOR" -eq "2" -a "$FIREBIRD_MINOR" -eq "5"; then + AC_MSG_RESULT([OK]) + else + AC_MSG_ERROR([use 2.5.x]) + fi + AC_MSG_CHECKING([for Firebird Client library]) + FIREBIRD_CFLAGS=`$FIREBIRDCONFIG --cflags` + FIREBIRD_LIBS=`$FIREBIRDCONFIG --embedlibs` + dnl FIREBIRD_LIBS=`$FIREBIRDCONFIG --libs` + AC_MSG_RESULT([includes $FIREBIRD_CFLAGS, libraries $FIREBIRD_LIBS]) + else + AC_MSG_RESULT([internal]) + SYSTEM_FIREBIRD=NO + FIREBIRD_CFLAGS="-I${WORKDIR}/UnpackedTarball/firebird/include" + FIREBIRD_LIBS="-L${OUTDIR}/lib -lfbembed" + dnl FIREBIRD_LIBS="-L${OUTDIR}/lib -lfbclient" + + AC_CHECK_HEADERS(atomic_ops.h, [], + [AC_MSG_ERROR(atomic_ops.h not found. install Libatomic-ops)], []) + + dnl TODO: Checking to build IBPP in case we want to use it for the SDBC driver + + dnl dnl HP-UX atomic routines are in atomic library, not standard C library. + dnl dnl If we can't find atomic routines in vendor library, look for atomic_ops. + dnl AC_SEARCH_LIBS(atomic_inc, atomic,, + dnl AC_CHECK_LIB(atomic_ops, main)) + + dnl dnl check for tommath presence + dnl save_LIBS=$LIBS + dnl AC_CHECK_HEADER(tommath.h,,AC_MSG_ERROR(Include file for tommath not found - please install development tommath package)) + dnl AC_CHECK_LIB(tommath, mp_init, TOMMATH_LIBS=-ltommath, AC_MSG_ERROR(Library tommath not found - please install development tommath package)) + dnl LIBS=$save_LIBS + + BUILD_TYPE="$BUILD_TYPE FIREBIRD" + fi + + ENABLE_FIREBIRD_SDBC="TRUE" +fi +AC_SUBST(ENABLE_FIREBIRD_SDBC) +AC_SUBST(SYSTEM_FIREBIRD) +AC_SUBST(FIREBIRD_CFLAGS) +AC_SUBST(FIREBIRD_LIBS) +dnl AC_SUBST([TOMMATH_CFLAGS]) +dnl AC_SUBST([TOMMATH_LIBS]) + +dnl =================================================================== dnl Check for system curl dnl =================================================================== AC_MSG_CHECKING([which libcurl to use]) diff --git a/connectivity/Configuration_firebird.mk b/connectivity/Configuration_firebird.mk new file mode 100644 index 000000000000..49b95b591f3e --- /dev/null +++ b/connectivity/Configuration_firebird.mk @@ -0,0 +1,18 @@ +# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +$(eval $(call gb_Configuration_Configuration,driver_firebird)) + +$(eval $(call gb_Configuration_add_spool_modules,driver_firebird,connectivity/registry/firebird,\ + org/openoffice/Office/DataAccess/Drivers-firebird.xcu \ +)) + +$(eval $(call gb_Configuration_add_localized_datas,driver_firebird,connectivity/registry/firebird,\ + org/openoffice/Office/DataAccess/Drivers.xcu \ +)) diff --git a/connectivity/Library_firebird-sdbc.mk b/connectivity/Library_firebird-sdbc.mk new file mode 100644 index 000000000000..34d12e0c86a6 --- /dev/null +++ b/connectivity/Library_firebird-sdbc.mk @@ -0,0 +1,41 @@ +# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +$(eval $(call gb_Library_Library,firebird-sdbc)) + +$(eval $(call gb_Library_use_sdk_api,firebird-sdbc)) + +$(eval $(call gb_Library_use_externals,firebird-sdbc,\ + firebird \ +)) + +$(eval $(call gb_Library_use_libraries,firebird-sdbc, \ + comphelper \ + cppu \ + cppuhelper \ + sal \ + salhelper \ + $(gb_UWINAPI) \ +)) + +$(eval $(call gb_Library_set_componentfile,firebird-sdbc,connectivity/source/drivers/firebird/firebird-sdbc)) + +$(eval $(call gb_Library_add_exception_objects,firebird-sdbc,\ + connectivity/source/drivers/firebird/propertyids \ + connectivity/source/drivers/firebird/FConnection \ + connectivity/source/drivers/firebird/FDatabaseMetaData \ + connectivity/source/drivers/firebird/FDriver \ + connectivity/source/drivers/firebird/FPreparedStatement \ + connectivity/source/drivers/firebird/FResultSet \ + connectivity/source/drivers/firebird/FResultSetMetaData \ + connectivity/source/drivers/firebird/FServices \ + connectivity/source/drivers/firebird/FStatement \ +)) + +# vim: set noet sw=4 ts=4: diff --git a/connectivity/Module_connectivity.mk b/connectivity/Module_connectivity.mk index da4f5c91c1fe..3b6b0d97aaa6 100644 --- a/connectivity/Module_connectivity.mk +++ b/connectivity/Module_connectivity.mk @@ -84,6 +84,14 @@ $(eval $(call gb_Module_add_targets,connectivity,\ )) endif +ifeq ($(ENABLE_FIREBIRD_SDBC),TRUE) +$(eval $(call gb_Module_add_targets,connectivity,\ + Configuration_firebird \ + Library_firebird-sdbc \ + Rdb_firebird-sdbc \ +)) +endif + ifeq ($(BUILD_POSTGRESQL_SDBC),YES) $(eval $(call gb_Module_add_targets,connectivity,\ Configuration_postgresql \ diff --git a/connectivity/Rdb_firebird-sdbc.mk b/connectivity/Rdb_firebird-sdbc.mk new file mode 100644 index 000000000000..c3346cd36e46 --- /dev/null +++ b/connectivity/Rdb_firebird-sdbc.mk @@ -0,0 +1,14 @@ +# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +$(eval $(call gb_Rdb_Rdb,firebird-sdbc)) + +$(eval $(call gb_Rdb_add_components,firebird-sdbc,\ + connectivity/source/drivers/firebird/firebird-sdbc \ +)) diff --git a/connectivity/registry/firebird/org/openoffice/Office/DataAccess/Drivers.xcu b/connectivity/registry/firebird/org/openoffice/Office/DataAccess/Drivers.xcu new file mode 100644 index 000000000000..003cb03b3a81 --- /dev/null +++ b/connectivity/registry/firebird/org/openoffice/Office/DataAccess/Drivers.xcu @@ -0,0 +1,89 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!--*********************************************************************** + * + * Effective License of whole file: + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 3, 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 + * + * Parts "Copyright by Sun Microsystems, Inc" prior to August 2011: + * + * The Contents of this file are made available subject to the terms of + * the GNU Lesser General Public License Version 3 + * + * Copyright: 2008 by Sun Microsystems, Inc. + * + * All parts contributed on or after August 2011: + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + ************************************************************************ --> +<oor:component-data oor:name="Drivers" oor:package="org.openoffice.Office.DataAccess" xmlns:install="http://openoffice.org/2004/installation" xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema"> + <node oor:name="Installed" install:module="firebird"> + <node oor:name="sdbc:firebird:*" oor:op="replace"> + <prop oor:name="Driver"> + <value>com.sun.star.comp.sdbc.FirebirdDriver</value> + </prop> + <prop oor:name="DriverTypeDisplayName" oor:type="xs:string"> + <value xml:lang="en-US">Firebird</value> + </prop> + <node oor:name="Properties"> + <!-- Don't use ODBC syntax for date&time literals and (full) outer joins, + as PostgreSQL does not support it, + but supports the _interior_ of these escapes just fine. --> + <node oor:name="EscapeDateTime" oor:op="replace"> + <prop oor:name="Value" oor:type="xs:boolean"> + <value>false</value> + </prop> + </node> + <!-- Confusingly, this corresponds to "UseBracketedOuterJoinSyntax" in the Features --> + <node oor:name="EnableOuterJoinEscape" oor:op="replace"> + <prop oor:name="Value" oor:type="xs:boolean"> + <value>false</value> + </prop> + </node> + </node> + <node oor:name="Features"> + <!-- These entries enable the "Advanced Settings" UI to change the settings + whose default is set in node "Properties" above; + as this is guaranteed not to work with PostgreSQL, + we don't let people shoot themselves in the foot and don't enable the UI. --> + <!-- <node oor:name="EscapeDateTime" oor:op="replace"> --> + <!-- <prop oor:name="Value" oor:type="xs:boolean"> --> + <!-- <value>false</value> --> + <!-- </prop> --> + <!-- </node> --> + <!-- Confusingly, this corresponds to "EnableOuterJoinEscape" in the Properties --> + <!-- <node oor:name="UseBracketedOuterJoinSyntax" oor:op="replace"> --> + <!-- <prop oor:name="Value" oor:type="xs:boolean"> --> + <!-- <value>false</value> --> + <!-- </prop> --> + <!-- </node> --> + </node> + <node oor:name="MetaData"> + <node oor:name="Authentication" oor:op="replace"> + <prop oor:name="Value" oor:type="xs:string"> + <value>UserPassword</value> + </prop> + </node> + </node> + </node> + </node> +</oor:component-data> + +<!-- Local Variables: --> +<!-- indent-tabs-mode: nil --> +<!-- End: --> diff --git a/connectivity/source/drivers/firebird/FConnection.cxx b/connectivity/source/drivers/firebird/FConnection.cxx new file mode 100644 index 000000000000..671a2403d659 --- /dev/null +++ b/connectivity/source/drivers/firebird/FConnection.cxx @@ -0,0 +1,404 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * The Contents of this file are made available subject to the terms of + * the BSD license. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of Sun Microsystems, Inc. nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE + * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + *************************************************************************/ + +#include "FConnection.hxx" + +#include "FDatabaseMetaData.hxx" +#include "FDriver.hxx" +#include "FStatement.hxx" +#include "FPreparedStatement.hxx" +#include <com/sun/star/sdbc/ColumnValue.hpp> +#include <com/sun/star/sdbc/XRow.hpp> +#include <com/sun/star/sdbc/TransactionIsolation.hpp> +#include <com/sun/star/lang/DisposedException.hpp> + +using namespace connectivity::firebird; + +//------------------------------------------------------------------------------ +using namespace com::sun::star::uno; +using namespace com::sun::star::lang; +using namespace com::sun::star::beans; +using namespace com::sun::star::sdbc; +// -------------------------------------------------------------------------------- +OConnection::OConnection(FirebirdDriver* _pDriver) + : OSubComponent<OConnection, OConnection_BASE>((::cppu::OWeakObject*)_pDriver, this), + OMetaConnection_BASE(m_aMutex), + m_pDriver(_pDriver), + m_bClosed(sal_False), + m_xMetaData(NULL), + m_bUseCatalog(sal_False), + m_bUseOldDateFormat(sal_False) +{ + m_pDriver->acquire(); +} +//----------------------------------------------------------------------------- +OConnection::~OConnection() +{ + if(!isClosed()) + close(); + m_pDriver->release(); + m_pDriver = NULL; +} +//----------------------------------------------------------------------------- +void SAL_CALL OConnection::release() throw() +{ + relase_ChildImpl(); +} +// ----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +void OConnection::construct(const ::rtl::OUString& url,const Sequence< PropertyValue >& info) throw(SQLException) +{ + osl_atomic_increment( &m_refCount ); + + // some example code how to get the information out of the sequence + + sal_Int32 nLen = url.indexOf(':'); + nLen = url.indexOf(':',nLen+1); + ::rtl::OUString aDSN("DSN="), aUID, aPWD, aSysDrvSettings; + aDSN += url.copy(nLen+1); + + const char* pUser = "user"; + const char* pTimeout = "Timeout"; + const char* pSilent = "Silent"; + const char* pPwd = "password"; + const char* pUseCatalog = "UseCatalog"; + const char* pSysDrv = "SystemDriverSettings"; + + sal_Int32 nTimeout = 20; + sal_Bool bSilent = sal_True; + const PropertyValue *pBegin = info.getConstArray(); + const PropertyValue *pEnd = pBegin + info.getLength(); + for(;pBegin != pEnd;++pBegin) + { + if(!pBegin->Name.compareToAscii(pTimeout)) + pBegin->Value >>= nTimeout; + else if(!pBegin->Name.compareToAscii(pSilent)) + pBegin->Value >>= bSilent; + else if(!pBegin->Name.compareToAscii(pUser)) + { + pBegin->Value >>= aUID; + aDSN = aDSN + ::rtl::OUString(";UID=") + aUID; + } + else if(!pBegin->Name.compareToAscii(pPwd)) + { + pBegin->Value >>= aPWD; + aDSN = aDSN + ::rtl::OUString(";PWD=") + aPWD; + } + else if(!pBegin->Name.compareToAscii(pUseCatalog)) + { + pBegin->Value >>= m_bUseCatalog; + } + else if(!pBegin->Name.compareToAscii(pSysDrv)) + { + pBegin->Value >>= aSysDrvSettings; + aDSN += ::rtl::OUString(";"); + aDSN += aSysDrvSettings; + } + } + m_sUser = aUID; + + osl_atomic_decrement( &m_refCount ); +} +// XServiceInfo +// -------------------------------------------------------------------------------- +IMPLEMENT_SERVICE_INFO(OConnection, "com.sun.star.sdbc.drivers.firebird.OConnection", "com.sun.star.sdbc.Connection") + +// -------------------------------------------------------------------------------- +Reference< XStatement > SAL_CALL OConnection::createStatement( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(OConnection_BASE::rBHelper.bDisposed); + + // create a statement + // the statement can only be executed once + Reference< XStatement > xReturn = new OStatement(this); + m_aStatements.push_back(WeakReferenceHelper(xReturn)); + return xReturn; +} +// -------------------------------------------------------------------------------- +Reference< XPreparedStatement > SAL_CALL OConnection::prepareStatement( const ::rtl::OUString& _sSql ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(OConnection_BASE::rBHelper.bDisposed); + + // the pre + if(m_aTypeInfo.empty()) + buildTypeInfo(); + + // create a statement + // the statement can only be executed more than once + Reference< XPreparedStatement > xReturn = new OPreparedStatement(this,m_aTypeInfo,_sSql); + m_aStatements.push_back(WeakReferenceHelper(xReturn)); + return xReturn; +} +// -------------------------------------------------------------------------------- +Reference< XPreparedStatement > SAL_CALL OConnection::prepareCall( const ::rtl::OUString& _sSql ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(OConnection_BASE::rBHelper.bDisposed); + + // not implemented yet :-) a task to do + return NULL; +} +// -------------------------------------------------------------------------------- +::rtl::OUString SAL_CALL OConnection::nativeSQL( const ::rtl::OUString& _sSql ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + // when you need to transform SQL92 to you driver specific you can do it here + + return _sSql; +} +// -------------------------------------------------------------------------------- +void SAL_CALL OConnection::setAutoCommit( sal_Bool autoCommit ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(OConnection_BASE::rBHelper.bDisposed); + // here you have to set your commit mode please have a look at the jdbc documentation to get a clear explanation +} +// -------------------------------------------------------------------------------- +sal_Bool SAL_CALL OConnection::getAutoCommit( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(OConnection_BASE::rBHelper.bDisposed); + // you have to distinguish which if you are in autocommit mode or not + // at normal case true should be fine here + + return sal_True; +} +// -------------------------------------------------------------------------------- +void SAL_CALL OConnection::commit( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(OConnection_BASE::rBHelper.bDisposed); + + // when you database does support transactions you should commit here +} +// -------------------------------------------------------------------------------- +void SAL_CALL OConnection::rollback( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(OConnection_BASE::rBHelper.bDisposed); + + + // same as commit but for the other case +} +// -------------------------------------------------------------------------------- +sal_Bool SAL_CALL OConnection::isClosed( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + // just simple -> we are close when we are disposed taht means someone called dispose(); (XComponent) + return OConnection_BASE::rBHelper.bDisposed; +} +// -------------------------------------------------------------------------------- +Reference< XDatabaseMetaData > SAL_CALL OConnection::getMetaData( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(OConnection_BASE::rBHelper.bDisposed); + + // here we have to create the class with biggest interface + // The answer is 42 :-) + Reference< XDatabaseMetaData > xMetaData = m_xMetaData; + if(!xMetaData.is()) + { + xMetaData = new ODatabaseMetaData(this); // need the connection because it can return it + m_xMetaData = xMetaData; + } + + return xMetaData; +} +// -------------------------------------------------------------------------------- +void SAL_CALL OConnection::setReadOnly( sal_Bool readOnly ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(OConnection_BASE::rBHelper.bDisposed); + + // set you connection to readonly +} +// -------------------------------------------------------------------------------- +sal_Bool SAL_CALL OConnection::isReadOnly( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(OConnection_BASE::rBHelper.bDisposed); + + // return if your connection to readonly + return sal_False; +} +// -------------------------------------------------------------------------------- +void SAL_CALL OConnection::setCatalog( const ::rtl::OUString& catalog ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(OConnection_BASE::rBHelper.bDisposed); + + // if your database doesn't work with catalogs you go to next method otherwise you kjnow what to do +} +// -------------------------------------------------------------------------------- +::rtl::OUString SAL_CALL OConnection::getCatalog( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(OConnection_BASE::rBHelper.bDisposed); + + + // return your current catalog + return ::rtl::OUString(); +} +// -------------------------------------------------------------------------------- +void SAL_CALL OConnection::setTransactionIsolation( sal_Int32 level ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(OConnection_BASE::rBHelper.bDisposed); + + // set your isolation level + // please have a look at @see com.sun.star.sdbc.TransactionIsolation +} +// -------------------------------------------------------------------------------- +sal_Int32 SAL_CALL OConnection::getTransactionIsolation( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(OConnection_BASE::rBHelper.bDisposed); + + + // please have a look at @see com.sun.star.sdbc.TransactionIsolation + return TransactionIsolation::NONE; +} +// -------------------------------------------------------------------------------- +Reference< ::com::sun::star::container::XNameAccess > SAL_CALL OConnection::getTypeMap( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(OConnection_BASE::rBHelper.bDisposed); + + // if your driver has special database types you can return it here + + return NULL; +} +// -------------------------------------------------------------------------------- +void SAL_CALL OConnection::setTypeMap( const Reference< ::com::sun::star::container::XNameAccess >& typeMap ) throw(SQLException, RuntimeException) +{ + // the other way around +} +// -------------------------------------------------------------------------------- +// XCloseable +void SAL_CALL OConnection::close( ) throw(SQLException, RuntimeException) +{ + // we just dispose us + { + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(OConnection_BASE::rBHelper.bDisposed); + + } + dispose(); +} +// -------------------------------------------------------------------------------- +// XWarningsSupplier +Any SAL_CALL OConnection::getWarnings( ) throw(SQLException, RuntimeException) +{ + // when you collected some warnings -> return it + return Any(); +} +// -------------------------------------------------------------------------------- +void SAL_CALL OConnection::clearWarnings( ) throw(SQLException, RuntimeException) +{ + // you should clear your collected warnings here +} +//-------------------------------------------------------------------- +void OConnection::buildTypeInfo() throw( SQLException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + Reference< XResultSet> xRs = getMetaData ()->getTypeInfo (); + Reference< XRow> xRow(xRs,UNO_QUERY); + // Information for a single SQL type + + // Loop on the result set until we reach end of file + + while (xRs->next ()) + { + OTypeInfo aInfo; + aInfo.aTypeName = xRow->getString (1); + aInfo.nType = xRow->getShort (2); + aInfo.nPrecision = xRow->getInt (3); + aInfo.aLiteralPrefix = xRow->getString (4); + aInfo.aLiteralSuffix = xRow->getString (5); + aInfo.aCreateParams = xRow->getString (6); + aInfo.bNullable = xRow->getBoolean (7) == ColumnValue::NULLABLE; + aInfo.bCaseSensitive = xRow->getBoolean (8); + aInfo.nSearchType = xRow->getShort (9); + aInfo.bUnsigned = xRow->getBoolean (10); + aInfo.bCurrency = xRow->getBoolean (11); + aInfo.bAutoIncrement = xRow->getBoolean (12); + aInfo.aLocalTypeName = xRow->getString (13); + aInfo.nMinimumScale = xRow->getShort (14); + aInfo.nMaximumScale = xRow->getShort (15); + aInfo.nNumPrecRadix = (sal_Int16)xRow->getInt(18); + + + + // Now that we have the type info, save it + // in the Hashtable if we don't already have an + // entry for this SQL type. + + m_aTypeInfo.push_back(aInfo); + } + + // Close the result set/statement. + + Reference< XCloseable> xClose(xRs,UNO_QUERY); + xClose->close(); +} +//------------------------------------------------------------------------------ +void OConnection::disposing() +{ + // we noticed that we should be destroied in near future so we have to dispose our statements + ::osl::MutexGuard aGuard(m_aMutex); + + for (OWeakRefArray::iterator i = m_aStatements.begin(); m_aStatements.end() != i; ++i) + { + Reference< XComponent > xComp(i->get(), UNO_QUERY); + if (xComp.is()) + xComp->dispose(); + } + m_aStatements.clear(); + + m_bClosed = sal_True; + m_xMetaData = ::com::sun::star::uno::WeakReference< ::com::sun::star::sdbc::XDatabaseMetaData>(); + + dispose_ChildImpl(); + OConnection_BASE::disposing(); +} +// ----------------------------------------------------------------------------- + + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/drivers/firebird/FConnection.hxx b/connectivity/source/drivers/firebird/FConnection.hxx new file mode 100644 index 000000000000..2f3b96ace57c --- /dev/null +++ b/connectivity/source/drivers/firebird/FConnection.hxx @@ -0,0 +1,157 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * The Contents of this file are made available subject to the terms of + * the BSD license. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of Sun Microsystems, Inc. nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE + * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + *************************************************************************/ + +#ifndef CONNECTIVITY_SCONNECTION_HXX +#define CONNECTIVITY_SCONNECTION_HXX + +#include <com/sun/star/sdbc/SQLWarning.hpp> +#include <com/sun/star/beans/PropertyValue.hpp> +#include "OSubComponent.hxx" +#include "OTypeInfo.hxx" +#include <com/sun/star/lang/DisposedException.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/lang/XUnoTunnel.hpp> +#include <com/sun/star/sdbc/XWarningsSupplier.hpp> +#include <com/sun/star/sdbc/XConnection.hpp> +#include <cppuhelper/compbase3.hxx> +#include <cppuhelper/weakref.hxx> + +#include <map> + +namespace connectivity +{ + namespace firebird + { + + typedef ::cppu::WeakComponentImplHelper3< ::com::sun::star::sdbc::XConnection, + ::com::sun::star::sdbc::XWarningsSupplier, + ::com::sun::star::lang::XServiceInfo + > OMetaConnection_BASE; + + class OStatement_Base; + class FirebirdDriver; + class ODatabaseMetaData; + + typedef OMetaConnection_BASE OConnection_BASE; // implements basics and text encoding + typedef ::std::vector< ::connectivity::OTypeInfo> TTypeInfoVector; + typedef std::vector< ::com::sun::star::uno::WeakReferenceHelper > OWeakRefArray; + + class OConnection : public OBase_Mutex, + public OConnection_BASE, + public connectivity::firebird::OSubComponent<OConnection, OConnection_BASE> + { + friend class connectivity::firebird::OSubComponent<OConnection, OConnection_BASE>; + + protected: + + rtl_TextEncoding m_nTextEncoding; // the encoding which is used for all text conversions + //==================================================================== + // Data attributes + //==================================================================== + TTypeInfoVector m_aTypeInfo; // vector containing an entry + // for each row returned by + // DatabaseMetaData.getTypeInfo. + ::com::sun::star::uno::WeakReference< ::com::sun::star::sdbc::XDatabaseMetaData > m_xMetaData; + + OWeakRefArray m_aStatements; // vector containing a list + // of all the Statement objects + // for this Connection + + ::com::sun::star::sdbc::SQLWarning m_aLastWarning; // Last SQLWarning generated by + // an operation + ::rtl::OUString m_aURL; // URL of connection + ::rtl::OUString m_sUser; // the user name + FirebirdDriver* m_pDriver; // Pointer to the owning + // driver object + + sal_Bool m_bClosed; + sal_Bool m_bUseCatalog; // should we use the catalog on filebased databases + sal_Bool m_bUseOldDateFormat; + + + void buildTypeInfo() throw( ::com::sun::star::sdbc::SQLException); + + public: + virtual void construct( const ::rtl::OUString& url,const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& info) throw(::com::sun::star::sdbc::SQLException); + + OConnection(FirebirdDriver* _pDriver); + virtual ~OConnection(); + + void closeAllStatements () throw( ::com::sun::star::sdbc::SQLException); + + // OComponentHelper + virtual void SAL_CALL disposing(void); + // XInterface + virtual void SAL_CALL release() throw(); + + // XServiceInfo + DECLARE_SERVICE_INFO(); + // 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); + // XCloseable + virtual void SAL_CALL close( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // 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); + // + + // should we use the catalog on filebased databases + inline sal_Bool isCatalogUsed() const { return m_bUseCatalog; } + inline ::rtl::OUString getUserName() const { return m_sUser; } + inline FirebirdDriver* getDriver() const { return m_pDriver;} + inline rtl_TextEncoding getTextEncoding() const { return m_nTextEncoding; } + }; + } +} +#endif // CONNECTIVITY_SCONNECTION_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/drivers/firebird/FDatabaseMetaData.cxx b/connectivity/source/drivers/firebird/FDatabaseMetaData.cxx new file mode 100644 index 000000000000..64466febc588 --- /dev/null +++ b/connectivity/source/drivers/firebird/FDatabaseMetaData.cxx @@ -0,0 +1,889 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * The Contents of this file are made available subject to the terms of + * the BSD license. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of Sun Microsystems, Inc. nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE + * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + *************************************************************************/ + +#include "FDatabaseMetaData.hxx" +#include <com/sun/star/sdbc/DataType.hpp> +#include <com/sun/star/sdbc/ResultSetType.hpp> +#include <com/sun/star/sdbc/ResultSetConcurrency.hpp> +#include <com/sun/star/sdbc/TransactionIsolation.hpp> + +using namespace connectivity::firebird; +using namespace com::sun::star::uno; +using namespace com::sun::star::lang; +using namespace com::sun::star::beans; +using namespace com::sun::star::sdbc; + +ODatabaseMetaData::ODatabaseMetaData(OConnection* _pCon) +: m_pConnection(_pCon) +, m_bUseCatalog(sal_True) +{ + OSL_ENSURE(m_pConnection,"ODatabaseMetaData::ODatabaseMetaData: No connection set!"); + if(!m_pConnection->isCatalogUsed()) + { + osl_atomic_increment( &m_refCount ); + m_bUseCatalog = !(usesLocalFiles() || usesLocalFilePerTable()); + osl_atomic_decrement( &m_refCount ); + } +} +// ------------------------------------------------------------------------- +ODatabaseMetaData::~ODatabaseMetaData() +{ +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL ODatabaseMetaData::getCatalogSeparator( ) throw(SQLException, RuntimeException) +{ + ::rtl::OUString aVal; + if(m_bUseCatalog) + { // do some special here for you database + } + + return aVal; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL ODatabaseMetaData::getMaxBinaryLiteralLength( ) throw(SQLException, RuntimeException) +{ + sal_Int32 nValue = 0; // 0 means no limit + return nValue; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL ODatabaseMetaData::getMaxRowSize( ) throw(SQLException, RuntimeException) +{ + sal_Int32 nValue = 0; // 0 means no limit + return nValue; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL ODatabaseMetaData::getMaxCatalogNameLength( ) throw(SQLException, RuntimeException) +{ + sal_Int32 nValue = 0; // 0 means no limit + return nValue; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL ODatabaseMetaData::getMaxCharLiteralLength( ) throw(SQLException, RuntimeException) +{ + sal_Int32 nValue = 0; // 0 means no limit + return nValue; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnNameLength( ) throw(SQLException, RuntimeException) +{ + sal_Int32 nValue = 0; // 0 means no limit + return nValue; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInIndex( ) throw(SQLException, RuntimeException) +{ + sal_Int32 nValue = 0; // 0 means no limit + return nValue; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL ODatabaseMetaData::getMaxCursorNameLength( ) throw(SQLException, RuntimeException) +{ + sal_Int32 nValue = 0; // 0 means no limit + return nValue; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL ODatabaseMetaData::getMaxConnections( ) throw(SQLException, RuntimeException) +{ + sal_Int32 nValue = 0; // 0 means no limit + return nValue; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInTable( ) throw(SQLException, RuntimeException) +{ + sal_Int32 nValue = 0; // 0 means no limit + return nValue; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL ODatabaseMetaData::getMaxStatementLength( ) throw(SQLException, RuntimeException) +{ + sal_Int32 nValue = 0; // 0 means no limit + return nValue; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL ODatabaseMetaData::getMaxTableNameLength( ) throw(SQLException, RuntimeException) +{ + sal_Int32 nValue = 0; // 0 means no limit + return nValue; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL ODatabaseMetaData::getMaxTablesInSelect( ) throw(SQLException, RuntimeException) +{ + sal_Int32 nValue = 0; // 0 means no limit + return nValue; +} +// ------------------------------------------------------------------------- +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::doesMaxRowSizeIncludeBlobs( ) throw(SQLException, RuntimeException) +{ + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::storesLowerCaseQuotedIdentifiers( ) throw(SQLException, RuntimeException) +{ + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::storesLowerCaseIdentifiers( ) throw(SQLException, RuntimeException) +{ + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::storesMixedCaseQuotedIdentifiers( ) throw(SQLException, RuntimeException) +{ + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::storesMixedCaseIdentifiers( ) throw(SQLException, RuntimeException) +{ + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::storesUpperCaseQuotedIdentifiers( ) throw(SQLException, RuntimeException) +{ + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::storesUpperCaseIdentifiers( ) throw(SQLException, RuntimeException) +{ + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsAlterTableWithAddColumn( ) throw(SQLException, RuntimeException) +{ + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsAlterTableWithDropColumn( ) throw(SQLException, RuntimeException) +{ + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL ODatabaseMetaData::getMaxIndexLength( ) throw(SQLException, RuntimeException) +{ + sal_Int32 nValue = 0; // 0 means no limit + return nValue; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsNonNullableColumns( ) throw(SQLException, RuntimeException) +{ + return sal_False; +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL ODatabaseMetaData::getCatalogTerm( ) throw(SQLException, RuntimeException) +{ + ::rtl::OUString aVal; + if(m_bUseCatalog) + { + } + return aVal; +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL ODatabaseMetaData::getIdentifierQuoteString( ) throw(SQLException, RuntimeException) +{ + // normally this is " + ::rtl::OUString aVal("\""); + return aVal; +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL ODatabaseMetaData::getExtraNameCharacters( ) throw(SQLException, RuntimeException) +{ + ::rtl::OUString aVal; + return aVal; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsDifferentTableCorrelationNames( ) throw(SQLException, RuntimeException) +{ + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::isCatalogAtStart( ) throw(SQLException, RuntimeException) +{ + sal_Bool bValue = sal_False; + if(m_bUseCatalog) + { + } + return bValue; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::dataDefinitionIgnoredInTransactions( ) throw(SQLException, RuntimeException) +{ + return sal_True; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::dataDefinitionCausesTransactionCommit( ) throw(SQLException, RuntimeException) +{ + return sal_True; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsDataManipulationTransactionsOnly( ) throw(SQLException, RuntimeException) +{ + return sal_True; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsDataDefinitionAndDataManipulationTransactions( ) throw(SQLException, RuntimeException) +{ + return sal_True; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsPositionedDelete( ) throw(SQLException, RuntimeException) +{ + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsPositionedUpdate( ) throw(SQLException, RuntimeException) +{ + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsOpenStatementsAcrossRollback( ) throw(SQLException, RuntimeException) +{ + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsOpenStatementsAcrossCommit( ) throw(SQLException, RuntimeException) +{ + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsOpenCursorsAcrossCommit( ) throw(SQLException, RuntimeException) +{ + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsOpenCursorsAcrossRollback( ) throw(SQLException, RuntimeException) +{ + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsTransactionIsolationLevel( sal_Int32 level ) throw(SQLException, RuntimeException) +{ + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsSchemasInDataManipulation( ) throw(SQLException, RuntimeException) +{ + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsANSI92FullSQL( ) throw(SQLException, RuntimeException) +{ + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsANSI92EntryLevelSQL( ) throw(SQLException, RuntimeException) +{ + return sal_True; // should be supported at least +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsIntegrityEnhancementFacility( ) throw(SQLException, RuntimeException) +{ + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsSchemasInIndexDefinitions( ) throw(SQLException, RuntimeException) +{ + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsSchemasInTableDefinitions( ) throw(SQLException, RuntimeException) +{ + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsCatalogsInTableDefinitions( ) throw(SQLException, RuntimeException) +{ + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsCatalogsInIndexDefinitions( ) throw(SQLException, RuntimeException) +{ + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsCatalogsInDataManipulation( ) throw(SQLException, RuntimeException) +{ + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsOuterJoins( ) throw(SQLException, RuntimeException) +{ + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL ODatabaseMetaData::getMaxStatements( ) throw(SQLException, RuntimeException) +{ + sal_Int32 nValue = 0; // 0 means no limit + return nValue; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL ODatabaseMetaData::getMaxProcedureNameLength( ) throw(SQLException, RuntimeException) +{ + sal_Int32 nValue = 0; // 0 means no limit + return nValue; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL ODatabaseMetaData::getMaxSchemaNameLength( ) throw(SQLException, RuntimeException) +{ + sal_Int32 nValue = 0; // 0 means no limit + return nValue; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsTransactions( ) throw(SQLException, RuntimeException) +{ + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::allProceduresAreCallable( ) throw(SQLException, RuntimeException) +{ + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsStoredProcedures( ) throw(SQLException, RuntimeException) +{ + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsSelectForUpdate( ) throw(SQLException, RuntimeException) +{ + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::allTablesAreSelectable( ) throw(SQLException, RuntimeException) +{ + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::isReadOnly( ) throw(SQLException, RuntimeException) +{ + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::usesLocalFiles( ) throw(SQLException, RuntimeException) +{ + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::usesLocalFilePerTable( ) throw(SQLException, RuntimeException) +{ + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsTypeConversion( ) throw(SQLException, RuntimeException) +{ + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::nullPlusNonNullIsNull( ) throw(SQLException, RuntimeException) +{ + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsColumnAliasing( ) throw(SQLException, RuntimeException) +{ + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsTableCorrelationNames( ) throw(SQLException, RuntimeException) +{ + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsConvert( sal_Int32 fromType, sal_Int32 toType ) throw(SQLException, RuntimeException) +{ + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsExpressionsInOrderBy( ) throw(SQLException, RuntimeException) +{ + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsGroupBy( ) throw(SQLException, RuntimeException) +{ + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsGroupByBeyondSelect( ) throw(SQLException, RuntimeException) +{ + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsGroupByUnrelated( ) throw(SQLException, RuntimeException) +{ + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsMultipleTransactions( ) throw(SQLException, RuntimeException) +{ + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsMultipleResultSets( ) throw(SQLException, RuntimeException) +{ + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsLikeEscapeClause( ) throw(SQLException, RuntimeException) +{ + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsOrderByUnrelated( ) throw(SQLException, RuntimeException) +{ + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsUnion( ) throw(SQLException, RuntimeException) +{ + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsUnionAll( ) throw(SQLException, RuntimeException) +{ + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsMixedCaseIdentifiers( ) throw(SQLException, RuntimeException) +{ + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsMixedCaseQuotedIdentifiers( ) throw(SQLException, RuntimeException) +{ + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::nullsAreSortedAtEnd( ) throw(SQLException, RuntimeException) +{ + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::nullsAreSortedAtStart( ) throw(SQLException, RuntimeException) +{ + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::nullsAreSortedHigh( ) throw(SQLException, RuntimeException) +{ + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::nullsAreSortedLow( ) throw(SQLException, RuntimeException) +{ + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsSchemasInProcedureCalls( ) throw(SQLException, RuntimeException) +{ + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsSchemasInPrivilegeDefinitions( ) throw(SQLException, RuntimeException) +{ + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsCatalogsInProcedureCalls( ) throw(SQLException, RuntimeException) +{ + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsCatalogsInPrivilegeDefinitions( ) throw(SQLException, RuntimeException) +{ + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsCorrelatedSubqueries( ) throw(SQLException, RuntimeException) +{ + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsSubqueriesInComparisons( ) throw(SQLException, RuntimeException) +{ + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsSubqueriesInExists( ) throw(SQLException, RuntimeException) +{ + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsSubqueriesInIns( ) throw(SQLException, RuntimeException) +{ + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsSubqueriesInQuantifieds( ) throw(SQLException, RuntimeException) +{ + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsANSI92IntermediateSQL( ) throw(SQLException, RuntimeException) +{ + return sal_False; +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL ODatabaseMetaData::getURL( ) throw(SQLException, RuntimeException) +{ + ::rtl::OUString aValue("sdbc:firebird:"); + return aValue; +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL ODatabaseMetaData::getUserName( ) throw(SQLException, RuntimeException) +{ + ::rtl::OUString aValue; + return aValue; +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL ODatabaseMetaData::getDriverName( ) throw(SQLException, RuntimeException) +{ + ::rtl::OUString aValue; + return aValue; +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL ODatabaseMetaData::getDriverVersion() throw(SQLException, RuntimeException) +{ + ::rtl::OUString aValue; + return aValue; +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL ODatabaseMetaData::getDatabaseProductVersion( ) throw(SQLException, RuntimeException) +{ + ::rtl::OUString aValue; + return aValue; +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL ODatabaseMetaData::getDatabaseProductName( ) throw(SQLException, RuntimeException) +{ + ::rtl::OUString aValue; + return aValue; +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL ODatabaseMetaData::getProcedureTerm( ) throw(SQLException, RuntimeException) +{ + ::rtl::OUString aValue; + return aValue; +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL ODatabaseMetaData::getSchemaTerm( ) throw(SQLException, RuntimeException) +{ + ::rtl::OUString aValue; + return aValue; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL ODatabaseMetaData::getDriverMajorVersion( ) throw(RuntimeException) +{ + return 1; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL ODatabaseMetaData::getDefaultTransactionIsolation( ) throw(SQLException, RuntimeException) +{ + return TransactionIsolation::NONE; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL ODatabaseMetaData::getDriverMinorVersion( ) throw(RuntimeException) +{ + return 0; +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL ODatabaseMetaData::getSQLKeywords( ) throw(SQLException, RuntimeException) +{ + ::rtl::OUString aValue; + return aValue; +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL ODatabaseMetaData::getSearchStringEscape( ) throw(SQLException, RuntimeException) +{ + ::rtl::OUString aValue; + return aValue; +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL ODatabaseMetaData::getStringFunctions( ) throw(SQLException, RuntimeException) +{ + return ::rtl::OUString(); +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL ODatabaseMetaData::getTimeDateFunctions( ) throw(SQLException, RuntimeException) +{ + return ::rtl::OUString(); +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL ODatabaseMetaData::getSystemFunctions( ) throw(SQLException, RuntimeException) +{ + return ::rtl::OUString(); +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL ODatabaseMetaData::getNumericFunctions( ) throw(SQLException, RuntimeException) +{ + return ::rtl::OUString(); +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsExtendedSQLGrammar( ) throw(SQLException, RuntimeException) +{ + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsCoreSQLGrammar( ) throw(SQLException, RuntimeException) +{ + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsMinimumSQLGrammar( ) throw(SQLException, RuntimeException) +{ + return sal_True; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsFullOuterJoins( ) throw(SQLException, RuntimeException) +{ + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsLimitedOuterJoins( ) throw(SQLException, RuntimeException) +{ + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInGroupBy( ) throw(SQLException, RuntimeException) +{ + sal_Int32 nValue = 0; // 0 means no limit + return nValue; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInOrderBy( ) throw(SQLException, RuntimeException) +{ + sal_Int32 nValue = 0; // 0 means no limit + return nValue; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInSelect( ) throw(SQLException, RuntimeException) +{ + sal_Int32 nValue = 0; // 0 means no limit + return nValue; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL ODatabaseMetaData::getMaxUserNameLength( ) throw(SQLException, RuntimeException) +{ + sal_Int32 nValue = 0; // 0 means no limit + return nValue; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsResultSetType( sal_Int32 setType ) throw(SQLException, RuntimeException) +{ + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsResultSetConcurrency( sal_Int32 setType, sal_Int32 concurrency ) throw(SQLException, RuntimeException) +{ + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::ownUpdatesAreVisible( sal_Int32 setType ) throw(SQLException, RuntimeException) +{ + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::ownDeletesAreVisible( sal_Int32 setType ) throw(SQLException, RuntimeException) +{ + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::ownInsertsAreVisible( sal_Int32 setType ) throw(SQLException, RuntimeException) +{ + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::othersUpdatesAreVisible( sal_Int32 setType ) throw(SQLException, RuntimeException) +{ + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::othersDeletesAreVisible( sal_Int32 setType ) throw(SQLException, RuntimeException) +{ + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::othersInsertsAreVisible( sal_Int32 setType ) throw(SQLException, RuntimeException) +{ + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::updatesAreDetected( sal_Int32 setType ) throw(SQLException, RuntimeException) +{ + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::deletesAreDetected( sal_Int32 setType ) throw(SQLException, RuntimeException) +{ + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::insertsAreDetected( sal_Int32 setType ) throw(SQLException, RuntimeException) +{ + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsBatchUpdates( ) throw(SQLException, RuntimeException) +{ + return sal_False; +} +// ------------------------------------------------------------------------- +Reference< XConnection > SAL_CALL ODatabaseMetaData::getConnection( ) throw(SQLException, RuntimeException) +{ + return (Reference< XConnection >)m_pConnection;//new OConnection(m_aConnectionHandle); +} +// ------------------------------------------------------------------------- +// here follow all methods which return a resultset +// the first methods is an example implementation how to use this resultset +// of course you could implement it on your and you should do this because +// the general way is more memory expensive +// ------------------------------------------------------------------------- +Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTableTypes( ) throw(SQLException, RuntimeException) +{ + return NULL; +} +// ------------------------------------------------------------------------- +Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTypeInfo( ) throw(SQLException, RuntimeException) +{ + return NULL; +} +// ------------------------------------------------------------------------- +Reference< XResultSet > SAL_CALL ODatabaseMetaData::getCatalogs( ) throw(SQLException, RuntimeException) +{ + return NULL; +} +// ----------------------------------------------------------------------------- +Reference< XResultSet > SAL_CALL ODatabaseMetaData::getSchemas( ) throw(SQLException, RuntimeException) +{ + return NULL; +} +// ------------------------------------------------------------------------- +Reference< XResultSet > SAL_CALL ODatabaseMetaData::getColumnPrivileges( + const Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table, + const ::rtl::OUString& columnNamePattern ) throw(SQLException, RuntimeException) +{ + return NULL; +} +// ------------------------------------------------------------------------- +Reference< XResultSet > SAL_CALL ODatabaseMetaData::getColumns( + const Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& tableNamePattern, + const ::rtl::OUString& columnNamePattern ) throw(SQLException, RuntimeException) +{ + return NULL; +} +// ------------------------------------------------------------------------- +Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTables( + const Any& catalog, const ::rtl::OUString& schemaPattern, + const ::rtl::OUString& tableNamePattern, const Sequence< ::rtl::OUString >& types ) throw(SQLException, RuntimeException) +{ + return NULL; +} +// ------------------------------------------------------------------------- +Reference< XResultSet > SAL_CALL ODatabaseMetaData::getProcedureColumns( + const Any& catalog, const ::rtl::OUString& schemaPattern, + const ::rtl::OUString& procedureNamePattern, const ::rtl::OUString& columnNamePattern ) throw(SQLException, RuntimeException) +{ + return NULL; +} +// ------------------------------------------------------------------------- +Reference< XResultSet > SAL_CALL ODatabaseMetaData::getProcedures( + const Any& catalog, const ::rtl::OUString& schemaPattern, + const ::rtl::OUString& procedureNamePattern ) throw(SQLException, RuntimeException) +{ + return NULL; +} +// ------------------------------------------------------------------------- +Reference< XResultSet > SAL_CALL ODatabaseMetaData::getVersionColumns( + const Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table ) throw(SQLException, RuntimeException) +{ + return NULL; +} +// ------------------------------------------------------------------------- +Reference< XResultSet > SAL_CALL ODatabaseMetaData::getExportedKeys( + const Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table ) throw(SQLException, RuntimeException) +{ + return NULL; +} +// ------------------------------------------------------------------------- +Reference< XResultSet > SAL_CALL ODatabaseMetaData::getImportedKeys( + const Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table ) throw(SQLException, RuntimeException) +{ + return NULL; +} +// ------------------------------------------------------------------------- +Reference< XResultSet > SAL_CALL ODatabaseMetaData::getPrimaryKeys( + const Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table ) throw(SQLException, RuntimeException) +{ + return NULL; +} +// ------------------------------------------------------------------------- +Reference< XResultSet > SAL_CALL ODatabaseMetaData::getIndexInfo( + const Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table, + sal_Bool unique, sal_Bool approximate ) throw(SQLException, RuntimeException) +{ + return NULL; +} +// ------------------------------------------------------------------------- +Reference< XResultSet > SAL_CALL ODatabaseMetaData::getBestRowIdentifier( + const Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table, sal_Int32 scope, + sal_Bool nullable ) throw(SQLException, RuntimeException) +{ + return NULL; +} +// ------------------------------------------------------------------------- +Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTablePrivileges( + const Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& tableNamePattern ) throw(SQLException, RuntimeException) +{ + return NULL; +} +// ------------------------------------------------------------------------- +Reference< XResultSet > SAL_CALL ODatabaseMetaData::getCrossReference( + const Any& primaryCatalog, const ::rtl::OUString& primarySchema, + const ::rtl::OUString& primaryTable, const Any& foreignCatalog, + const ::rtl::OUString& foreignSchema, const ::rtl::OUString& foreignTable ) throw(SQLException, RuntimeException) +{ + return NULL; +} +// ------------------------------------------------------------------------- +Reference< XResultSet > SAL_CALL ODatabaseMetaData::getUDTs( const Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& typeNamePattern, const Sequence< sal_Int32 >& types ) throw(SQLException, RuntimeException) +{ + OSL_FAIL("Not implemented yet!"); + throw SQLException(); + return NULL; +} +// ----------------------------------------------------------------------------- + + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/drivers/firebird/FDatabaseMetaData.hxx b/connectivity/source/drivers/firebird/FDatabaseMetaData.hxx new file mode 100644 index 000000000000..a2852e0d6bd4 --- /dev/null +++ b/connectivity/source/drivers/firebird/FDatabaseMetaData.hxx @@ -0,0 +1,221 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * The Contents of this file are made available subject to the terms of + * the BSD license. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of Sun Microsystems, Inc. nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE + * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + *************************************************************************/ + +#ifndef CONNECTIVITY_SDATABASEMETADATA_HXX +#define CONNECTIVITY_SDATABASEMETADATA_HXX + +#include "FConnection.hxx" +#include <com/sun/star/sdbc/XDatabaseMetaData.hpp> +#include <cppuhelper/implbase1.hxx> + +namespace connectivity +{ + namespace firebird + { + //************************************************************** + //************ Class: ODatabaseMetaData + //************************************************************** + + typedef ::cppu::WeakImplHelper1< ::com::sun::star::sdbc::XDatabaseMetaData> ODatabaseMetaData_BASE; + + class ODatabaseMetaData : public ODatabaseMetaData_BASE + { + OConnection* m_pConnection; + sal_Bool m_bUseCatalog; + public: + + inline OConnection* getOwnConnection() const { return m_pConnection; } + + ODatabaseMetaData(OConnection* _pCon); + virtual ~ODatabaseMetaData(); + + // as I mentioned before this interface is really BIG + // XDatabaseMetaData + 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 // CONNECTIVITY_SDATABASEMETADATA_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/drivers/firebird/FDriver.cxx b/connectivity/source/drivers/firebird/FDriver.cxx new file mode 100644 index 000000000000..98be858a6704 --- /dev/null +++ b/connectivity/source/drivers/firebird/FDriver.cxx @@ -0,0 +1,212 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * The Contents of this file are made available subject to the terms of + * the BSD license. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of Sun Microsystems, Inc. nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE + * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + *************************************************************************/ + +#include "FDriver.hxx" +#include "FConnection.hxx" + +using namespace com::sun::star::uno; +using namespace com::sun::star::lang; +using namespace com::sun::star::beans; +using namespace com::sun::star::sdbc; +using namespace connectivity::firebird; + +namespace connectivity +{ + namespace firebird + { + //------------------------------------------------------------------ + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL FirebirdDriver_CreateInstance(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory) throw( ::com::sun::star::uno::Exception ) + { + return *(new FirebirdDriver()); + } + } +} +// -------------------------------------------------------------------------------- +FirebirdDriver::FirebirdDriver() + : ODriver_BASE(m_aMutex) +{ +} +// -------------------------------------------------------------------------------- +void FirebirdDriver::disposing() +{ + ::osl::MutexGuard aGuard(m_aMutex); + + // when driver will be destroied so all our connections have to be destroied as well + for (OWeakRefArray::iterator i = m_xConnections.begin(); m_xConnections.end() != i; ++i) + { + Reference< XComponent > xComp(i->get(), UNO_QUERY); + if (xComp.is()) + xComp->dispose(); + } + m_xConnections.clear(); + + ODriver_BASE::disposing(); +} + +// static ServiceInfo +//------------------------------------------------------------------------------ +rtl::OUString FirebirdDriver::getImplementationName_Static( ) throw(RuntimeException) +{ + return rtl::OUString("com.sun.star.comp.sdbc.FirebirdDriver"); + // this name is referenced in the configuration and in the firebird.xml + // Please take care when changing it. +} +//------------------------------------------------------------------------------ +Sequence< ::rtl::OUString > FirebirdDriver::getSupportedServiceNames_Static( ) throw (RuntimeException) +{ + // which service is supported + // for more information @see com.sun.star.sdbc.Driver + Sequence< ::rtl::OUString > aSNS( 1 ); + aSNS[0] = ::rtl::OUString("com.sun.star.sdbc.Driver"); + return aSNS; +} + +//------------------------------------------------------------------ +::rtl::OUString SAL_CALL FirebirdDriver::getImplementationName( ) throw(RuntimeException) +{ + return getImplementationName_Static(); +} + +//------------------------------------------------------------------ +sal_Bool SAL_CALL FirebirdDriver::supportsService( const ::rtl::OUString& _rServiceName ) throw(RuntimeException) +{ + Sequence< ::rtl::OUString > aSupported(getSupportedServiceNames()); + const ::rtl::OUString* pSupported = aSupported.getConstArray(); + const ::rtl::OUString* pEnd = pSupported + aSupported.getLength(); + for (;pSupported != pEnd && !pSupported->equals(_rServiceName); ++pSupported) + ; + + return pSupported != pEnd; +} + +//------------------------------------------------------------------ +Sequence< ::rtl::OUString > SAL_CALL FirebirdDriver::getSupportedServiceNames( ) throw(RuntimeException) +{ + return getSupportedServiceNames_Static(); +} + +// -------------------------------------------------------------------------------- +Reference< XConnection > SAL_CALL FirebirdDriver::connect( const ::rtl::OUString& url, const Sequence< PropertyValue >& info ) throw(SQLException, RuntimeException) +{ + // create a new connection with the given properties and append it to our vector + OConnection* pCon = new OConnection(this); + Reference< XConnection > xCon = pCon; // important here because otherwise the connection could be deleted inside (refcount goes -> 0) + pCon->construct(url,info); // late constructor call which can throw exception and allows a correct dtor call when so + m_xConnections.push_back(WeakReferenceHelper(*pCon)); + + return xCon; +} +// -------------------------------------------------------------------------------- +sal_Bool SAL_CALL FirebirdDriver::acceptsURL( const ::rtl::OUString& url ) + throw(SQLException, RuntimeException) +{ + // here we have to look if we support this url format + // change the URL format to your needs, but please aware that the first on who accepts the URl wins. + return (!url.compareTo(::rtl::OUString("sdbc:firebird:"),14)); +} +// -------------------------------------------------------------------------------- +Sequence< DriverPropertyInfo > SAL_CALL FirebirdDriver::getPropertyInfo( const ::rtl::OUString& url, const Sequence< PropertyValue >& info ) throw(SQLException, RuntimeException) +{ + // if you have somthing special to say, return it here :-) + return Sequence< DriverPropertyInfo >(); +} +// -------------------------------------------------------------------------------- +sal_Int32 SAL_CALL FirebirdDriver::getMajorVersion( ) throw(RuntimeException) +{ + return 0; // depends on you +} +// -------------------------------------------------------------------------------- +sal_Int32 SAL_CALL FirebirdDriver::getMinorVersion( ) throw(RuntimeException) +{ + return 1; // depends on you +} +// -------------------------------------------------------------------------------- + +//......................................................................... +namespace connectivity +{ + namespace firebird + { +//......................................................................... + + void release(oslInterlockedCount& _refCount, + ::cppu::OBroadcastHelper& rBHelper, + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _xInterface, + ::com::sun::star::lang::XComponent* _pObject) + { + if (osl_atomic_decrement( &_refCount ) == 0) + { + osl_atomic_increment( &_refCount ); + + if (!rBHelper.bDisposed && !rBHelper.bInDispose) + { + // remember the parent + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > xParent; + { + ::osl::MutexGuard aGuard( rBHelper.rMutex ); + xParent = _xInterface; + _xInterface = NULL; + } + + // First dispose + _pObject->dispose(); + + // only the alive ref holds the object + OSL_ASSERT( _refCount == 1 ); + + // release the parent in the ~ + if (xParent.is()) + { + ::osl::MutexGuard aGuard( rBHelper.rMutex ); + _xInterface = xParent; + } + } + } + else + osl_atomic_increment( &_refCount ); + } + + void checkDisposed(sal_Bool _bThrow) throw ( DisposedException ) + { + if (_bThrow) + throw DisposedException(); + + } +//......................................................................... + } +} // namespace connectivity +//......................................................................... + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/drivers/firebird/FDriver.hxx b/connectivity/source/drivers/firebird/FDriver.hxx new file mode 100644 index 000000000000..005ba0039697 --- /dev/null +++ b/connectivity/source/drivers/firebird/FDriver.hxx @@ -0,0 +1,88 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * The Contents of this file are made available subject to the terms of + * the BSD license. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of Sun Microsystems, Inc. nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE + * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + *************************************************************************/ + +#ifndef CONNECTIVITY_SDRIVER_HXX +#define CONNECTIVITY_SDRIVER_HXX + +#include <com/sun/star/sdbc/XDriver.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <cppuhelper/compbase2.hxx> +#include "FConnection.hxx" + +namespace connectivity +{ + namespace firebird + { + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL FirebirdDriver_CreateInstance(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory) throw( ::com::sun::star::uno::Exception ); + + typedef ::cppu::WeakComponentImplHelper2< ::com::sun::star::sdbc::XDriver, + ::com::sun::star::lang::XServiceInfo > ODriver_BASE; + + class FirebirdDriver : public ODriver_BASE + { + protected: + ::osl::Mutex m_aMutex; // mutex is need to control member access + OWeakRefArray m_xConnections; // vector containing a list + // of all the Connection objects + // for this Driver + public: + + FirebirdDriver(); + + // OComponentHelper + virtual void SAL_CALL disposing(void); + // XInterface + static ::rtl::OUString getImplementationName_Static( ) throw(::com::sun::star::uno::RuntimeException); + static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static( ) throw (::com::sun::star::uno::RuntimeException); + + // 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( ) throw(::com::sun::star::uno::RuntimeException); + + // 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); + }; + } + +} + +#endif // CONNECTIVITY_SDRIVER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/drivers/firebird/FPreparedStatement.cxx b/connectivity/source/drivers/firebird/FPreparedStatement.cxx new file mode 100644 index 000000000000..b597c65cd931 --- /dev/null +++ b/connectivity/source/drivers/firebird/FPreparedStatement.cxx @@ -0,0 +1,390 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * The Contents of this file are made available subject to the terms of + * the BSD license. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of Sun Microsystems, Inc. nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE + * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + *************************************************************************/ + +#include <stdio.h> +#include <osl/diagnose.h> +#include "FPreparedStatement.hxx" +#include <com/sun/star/sdbc/DataType.hpp> +#include "FResultSetMetaData.hxx" +#include <cppuhelper/typeprovider.hxx> +#include <com/sun/star/lang/DisposedException.hpp> +#include "propertyids.hxx" + +using namespace connectivity::firebird; +using namespace com::sun::star::uno; +using namespace com::sun::star::lang; +using namespace com::sun::star::beans; +using namespace com::sun::star::sdbc; +using namespace com::sun::star::container; +using namespace com::sun::star::io; +using namespace com::sun::star::util; + +IMPLEMENT_SERVICE_INFO(OPreparedStatement,"com.sun.star.sdbcx.firebird.PreparedStatement","com.sun.star.sdbc.PreparedStatement"); + + +OPreparedStatement::OPreparedStatement( OConnection* _pConnection,const TTypeInfoVector& _TypeInfo,const ::rtl::OUString& sql) + :OStatement_BASE2(_pConnection) + ,m_aTypeInfo(_TypeInfo) + ,m_bPrepared(sal_False) + ,m_sSqlStatement(sql) + ,m_nNumParams(0) +{ +} +// ----------------------------------------------------------------------------- +OPreparedStatement::~OPreparedStatement() +{ +} +// ----------------------------------------------------------------------------- +void SAL_CALL OPreparedStatement::acquire() throw() +{ + OStatement_BASE2::acquire(); +} +// ----------------------------------------------------------------------------- +void SAL_CALL OPreparedStatement::release() throw() +{ + OStatement_BASE2::release(); +} +// ----------------------------------------------------------------------------- +Any SAL_CALL OPreparedStatement::queryInterface( const Type & rType ) throw(RuntimeException) +{ + Any aRet = OStatement_BASE2::queryInterface(rType); + if(!aRet.hasValue()) + aRet = OPreparedStatement_BASE::queryInterface(rType); + return aRet; +} +// ------------------------------------------------------------------------- +::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL OPreparedStatement::getTypes( ) throw(::com::sun::star::uno::RuntimeException) +{ + return concatSequences(OPreparedStatement_BASE::getTypes(),OStatement_BASE2::getTypes()); +} +// ------------------------------------------------------------------------- + +Reference< XResultSetMetaData > SAL_CALL OPreparedStatement::getMetaData( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(OStatement_BASE::rBHelper.bDisposed); + + if(!m_xMetaData.is()) + m_xMetaData = new OResultSetMetaData(getOwnConnection()); + return m_xMetaData; +} +// ------------------------------------------------------------------------- + +void SAL_CALL OPreparedStatement::close( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(OStatement_BASE::rBHelper.bDisposed); + + + // Reset last warning message + + try { + clearWarnings (); + OStatement_BASE2::close(); + } + catch (SQLException &) { + // If we get an error, ignore + } + + // Remove this Statement object from the Connection object's + // list +} +// ------------------------------------------------------------------------- + +sal_Bool SAL_CALL OPreparedStatement::execute( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(OStatement_BASE::rBHelper.bDisposed); + + + // same as in statement with the difference that this statement also can contain parameter + return sal_False; +} +// ------------------------------------------------------------------------- + +sal_Int32 SAL_CALL OPreparedStatement::executeUpdate( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(OStatement_BASE::rBHelper.bDisposed); + + // same as in statement with the difference that this statement also can contain parameter + return 0; +} +// ------------------------------------------------------------------------- + +void SAL_CALL OPreparedStatement::setString( sal_Int32 parameterIndex, const ::rtl::OUString& x ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(OStatement_BASE::rBHelper.bDisposed); +} +// ------------------------------------------------------------------------- + +Reference< XConnection > SAL_CALL OPreparedStatement::getConnection( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(OStatement_BASE::rBHelper.bDisposed); + + return (Reference< XConnection >)m_pConnection; +} +// ------------------------------------------------------------------------- + +Reference< XResultSet > SAL_CALL OPreparedStatement::executeQuery( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(OStatement_BASE::rBHelper.bDisposed); + + Reference< XResultSet > rs = NULL; + + + return rs; +} +// ------------------------------------------------------------------------- + +void SAL_CALL OPreparedStatement::setBoolean( sal_Int32 parameterIndex, sal_Bool x ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(OStatement_BASE::rBHelper.bDisposed); + +} +// ------------------------------------------------------------------------- +void SAL_CALL OPreparedStatement::setByte( sal_Int32 parameterIndex, sal_Int8 x ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(OStatement_BASE::rBHelper.bDisposed); + + +} +// ------------------------------------------------------------------------- + +void SAL_CALL OPreparedStatement::setDate( sal_Int32 parameterIndex, const Date& aData ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(OStatement_BASE::rBHelper.bDisposed); + +} +// ------------------------------------------------------------------------- + + +void SAL_CALL OPreparedStatement::setTime( sal_Int32 parameterIndex, const Time& aVal ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(OStatement_BASE::rBHelper.bDisposed); + +} +// ------------------------------------------------------------------------- + +void SAL_CALL OPreparedStatement::setTimestamp( sal_Int32 parameterIndex, const DateTime& aVal ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(OStatement_BASE::rBHelper.bDisposed); + +} +// ------------------------------------------------------------------------- + +void SAL_CALL OPreparedStatement::setDouble( sal_Int32 parameterIndex, double x ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(OStatement_BASE::rBHelper.bDisposed); + +} + +// ------------------------------------------------------------------------- + +void SAL_CALL OPreparedStatement::setFloat( sal_Int32 parameterIndex, float x ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(OStatement_BASE::rBHelper.bDisposed); + +} +// ------------------------------------------------------------------------- + +void SAL_CALL OPreparedStatement::setInt( sal_Int32 parameterIndex, sal_Int32 x ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(OStatement_BASE::rBHelper.bDisposed); + +} +// ------------------------------------------------------------------------- + +void SAL_CALL OPreparedStatement::setLong( sal_Int32 parameterIndex, sal_Int64 aVal ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(OStatement_BASE::rBHelper.bDisposed); + +} +// ------------------------------------------------------------------------- + +void SAL_CALL OPreparedStatement::setNull( sal_Int32 parameterIndex, sal_Int32 sqlType ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(OStatement_BASE::rBHelper.bDisposed); + +} +// ------------------------------------------------------------------------- + +void SAL_CALL OPreparedStatement::setClob( sal_Int32 parameterIndex, const Reference< XClob >& x ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(OStatement_BASE::rBHelper.bDisposed); + +} +// ------------------------------------------------------------------------- + +void SAL_CALL OPreparedStatement::setBlob( sal_Int32 parameterIndex, const Reference< XBlob >& x ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(OStatement_BASE::rBHelper.bDisposed); + +} +// ------------------------------------------------------------------------- + +void SAL_CALL OPreparedStatement::setArray( sal_Int32 parameterIndex, const Reference< XArray >& x ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(OStatement_BASE::rBHelper.bDisposed); + +} +// ------------------------------------------------------------------------- + +void SAL_CALL OPreparedStatement::setRef( sal_Int32 parameterIndex, const Reference< XRef >& x ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(OStatement_BASE::rBHelper.bDisposed); + +} +// ------------------------------------------------------------------------- + +void SAL_CALL OPreparedStatement::setObjectWithInfo( sal_Int32 parameterIndex, const Any& x, sal_Int32 sqlType, sal_Int32 scale ) throw(SQLException, RuntimeException) +{ + checkDisposed(OStatement_BASE::rBHelper.bDisposed); + ::osl::MutexGuard aGuard( m_aMutex ); + +} +// ------------------------------------------------------------------------- + +void SAL_CALL OPreparedStatement::setObjectNull( sal_Int32 parameterIndex, sal_Int32 sqlType, const ::rtl::OUString& typeName ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(OStatement_BASE::rBHelper.bDisposed); + +} +// ------------------------------------------------------------------------- + +void SAL_CALL OPreparedStatement::setObject( sal_Int32 parameterIndex, const Any& x ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(OStatement_BASE::rBHelper.bDisposed); + +} +// ------------------------------------------------------------------------- + +void SAL_CALL OPreparedStatement::setShort( sal_Int32 parameterIndex, sal_Int16 x ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(OStatement_BASE::rBHelper.bDisposed); + +} +// ------------------------------------------------------------------------- + +void SAL_CALL OPreparedStatement::setBytes( sal_Int32 parameterIndex, const Sequence< sal_Int8 >& x ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(OStatement_BASE::rBHelper.bDisposed); + +} +// ------------------------------------------------------------------------- + + +void SAL_CALL OPreparedStatement::setCharacterStream( sal_Int32 parameterIndex, const Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(OStatement_BASE::rBHelper.bDisposed); + +} +// ------------------------------------------------------------------------- + +void SAL_CALL OPreparedStatement::setBinaryStream( sal_Int32 parameterIndex, const Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(OStatement_BASE::rBHelper.bDisposed); + +} +// ------------------------------------------------------------------------- + +void SAL_CALL OPreparedStatement::clearParameters( ) throw(SQLException, RuntimeException) +{ +} +// ------------------------------------------------------------------------- +void SAL_CALL OPreparedStatement::clearBatch( ) throw(SQLException, RuntimeException) +{ +} +// ------------------------------------------------------------------------- + +void SAL_CALL OPreparedStatement::addBatch( ) throw(SQLException, RuntimeException) +{ +} +// ------------------------------------------------------------------------- + +Sequence< sal_Int32 > SAL_CALL OPreparedStatement::executeBatch( ) throw(SQLException, RuntimeException) +{ + return Sequence< sal_Int32 > (); +} +// ------------------------------------------------------------------------- +void OPreparedStatement::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const Any& rValue) throw (Exception) +{ + switch(nHandle) + { + case PROPERTY_ID_RESULTSETCONCURRENCY: + break; + case PROPERTY_ID_RESULTSETTYPE: + break; + case PROPERTY_ID_FETCHDIRECTION: + break; + case PROPERTY_ID_USEBOOKMARKS: + break; + default: + OStatement_Base::setFastPropertyValue_NoBroadcast(nHandle,rValue); + } +} +// ----------------------------------------------------------------------------- +void OPreparedStatement::checkParameterIndex(sal_Int32 _parameterIndex) +{ + if( !_parameterIndex || _parameterIndex > m_nNumParams) + throw SQLException(); +} +// ----------------------------------------------------------------------------- + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/drivers/firebird/FPreparedStatement.hxx b/connectivity/source/drivers/firebird/FPreparedStatement.hxx new file mode 100644 index 000000000000..27195e378014 --- /dev/null +++ b/connectivity/source/drivers/firebird/FPreparedStatement.hxx @@ -0,0 +1,149 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * The Contents of this file are made available subject to the terms of + * the BSD license. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of Sun Microsystems, Inc. nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE + * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + *************************************************************************/ + +#ifndef CONNECTIVITY_SPREPAREDSTATEMENT_HXX +#define CONNECTIVITY_SPREPAREDSTATEMENT_HXX +#include "FStatement.hxx" +#include <com/sun/star/sdbc/XPreparedStatement.hpp> +#include <com/sun/star/sdbc/XParameters.hpp> +#include <com/sun/star/sdbc/XResultSetMetaDataSupplier.hpp> +#include <com/sun/star/sdbc/XPreparedBatchExecution.hpp> +#include <com/sun/star/io/XInputStream.hpp> + +namespace connectivity +{ + namespace firebird + { + + class OBoundParam; + typedef ::cppu::ImplHelper5< ::com::sun::star::sdbc::XPreparedStatement, + ::com::sun::star::sdbc::XParameters, + ::com::sun::star::sdbc::XPreparedBatchExecution, + ::com::sun::star::sdbc::XResultSetMetaDataSupplier, + ::com::sun::star::lang::XServiceInfo> OPreparedStatement_BASE; + + class OPreparedStatement : public OStatement_BASE2, + public OPreparedStatement_BASE + { + protected: + struct Parameter + { + ::com::sun::star::uno::Any aValue; + sal_Int32 nDataType; + + Parameter(const ::com::sun::star::uno::Any& rValue, + sal_Int32 rDataType) : aValue(rValue),nDataType(rDataType) + { + } + + }; + + ::std::vector< Parameter> m_aParameters; + //==================================================================== + // Data attributes + //==================================================================== + TTypeInfoVector m_aTypeInfo; // Hashtable containing an entry + // for each row returned by + // DatabaseMetaData.getTypeInfo. + + sal_Int32 m_nNumParams; // Number of parameter markers + // for the prepared statement + + ::rtl::OUString m_sSqlStatement; + ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData > m_xMetaData; + sal_Bool m_bPrepared; + + void checkParameterIndex(sal_Int32 _parameterIndex); + + protected: + virtual void SAL_CALL setFastPropertyValue_NoBroadcast(sal_Int32 nHandle, + const ::com::sun::star::uno::Any& rValue) + throw (::com::sun::star::uno::Exception); + virtual ~OPreparedStatement(); + public: + DECLARE_SERVICE_INFO(); + // a constructor, which is required for returning objects: + OPreparedStatement( OConnection* _pConnection,const TTypeInfoVector& _TypeInfo,const ::rtl::OUString& sql); + + //XInterface + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL acquire() throw(); + virtual void SAL_CALL release() throw(); + //XTypeProvider + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException); + + // 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); + // 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); + // XPreparedBatchExecution + virtual void SAL_CALL addBatch( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL clearBatch( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL executeBatch( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XCloseable + virtual void SAL_CALL close( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // 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); + }; + } +} +#endif // CONNECTIVITY_SPREPAREDSTATEMENT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/drivers/firebird/FResultSet.cxx b/connectivity/source/drivers/firebird/FResultSet.cxx new file mode 100644 index 000000000000..bd314e03d356 --- /dev/null +++ b/connectivity/source/drivers/firebird/FResultSet.cxx @@ -0,0 +1,875 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * The Contents of this file are made available subject to the terms of + * the BSD license. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of Sun Microsystems, Inc. nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE + * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + *************************************************************************/ + +#include "FResultSet.hxx" +#include "FResultSetMetaData.hxx" +#include <com/sun/star/sdbc/DataType.hpp> +#include <com/sun/star/beans/PropertyAttribute.hpp> +#include <com/sun/star/sdbcx/CompareBookmark.hpp> +#include <cppuhelper/typeprovider.hxx> +#include <com/sun/star/lang/DisposedException.hpp> +#include "propertyids.hxx" + +using namespace connectivity::firebird; +using namespace cppu; +using namespace com::sun::star::uno; +using namespace com::sun::star::lang; +using namespace com::sun::star::beans; +using namespace com::sun::star::sdbc; +using namespace com::sun::star::sdbcx; +using namespace com::sun::star::container; +using namespace com::sun::star::io; +using namespace com::sun::star::util; + +//------------------------------------------------------------------------------ +// IMPLEMENT_SERVICE_INFO(OResultSet,"com.sun.star.sdbcx.OResultSet","com.sun.star.sdbc.ResultSet"); +::rtl::OUString SAL_CALL OResultSet::getImplementationName( ) throw ( RuntimeException) \ +{ + return ::rtl::OUString("com.sun.star.sdbcx.firebird.ResultSet"); +} +// ------------------------------------------------------------------------- + Sequence< ::rtl::OUString > SAL_CALL OResultSet::getSupportedServiceNames( ) throw( RuntimeException) +{ + Sequence< ::rtl::OUString > aSupported(2); + aSupported[0] = ::rtl::OUString("com.sun.star.sdbc.ResultSet"); + aSupported[1] = ::rtl::OUString("com.sun.star.sdbcx.ResultSet"); + return aSupported; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL OResultSet::supportsService( const ::rtl::OUString& _rServiceName ) throw( RuntimeException) +{ + Sequence< ::rtl::OUString > aSupported(getSupportedServiceNames()); + const ::rtl::OUString* pSupported = aSupported.getConstArray(); + const ::rtl::OUString* pEnd = pSupported + aSupported.getLength(); + for (;pSupported != pEnd && !pSupported->equals(_rServiceName); ++pSupported) + ; + + return pSupported != pEnd; +} + +// ------------------------------------------------------------------------- +OResultSet::OResultSet(OStatement_Base* pStmt) + : OResultSet_BASE(m_aMutex) + ,OPropertySetHelper(OResultSet_BASE::rBHelper) + ,m_aStatement((OWeakObject*)pStmt) + ,m_xMetaData(NULL) + ,m_nTextEncoding(pStmt->getOwnConnection()->getTextEncoding()) + ,m_pStatement(pStmt) + ,m_bWasNull(sal_True) +{ +} +// ------------------------------------------------------------------------- +OResultSet::~OResultSet() +{ +} +// ------------------------------------------------------------------------- +void OResultSet::disposing(void) +{ + OPropertySetHelper::disposing(); + + ::osl::MutexGuard aGuard(m_aMutex); + + m_aStatement = NULL; + m_xMetaData = NULL; +} +// ------------------------------------------------------------------------- +Any SAL_CALL OResultSet::queryInterface( const Type & rType ) throw(RuntimeException) +{ + Any aRet = OPropertySetHelper::queryInterface(rType); + if(!aRet.hasValue()) + aRet = OResultSet_BASE::queryInterface(rType); + return aRet; +} +// ------------------------------------------------------------------------- + Sequence< Type > SAL_CALL OResultSet::getTypes( ) throw( RuntimeException) +{ + OTypeCollection aTypes( + ::cppu::UnoType< Reference< ::com::sun::star::beans::XMultiPropertySet > >::get(), + ::cppu::UnoType< Reference< ::com::sun::star::beans::XFastPropertySet > >::get(), + ::cppu::UnoType< Reference< ::com::sun::star::beans::XPropertySet > >::get()); + + return concatSequences(aTypes.getTypes(),OResultSet_BASE::getTypes()); +} +// ------------------------------------------------------------------------- + +sal_Int32 SAL_CALL OResultSet::findColumn( const ::rtl::OUString& columnName ) throw(SQLException, RuntimeException) +{ + + checkDisposed(OResultSet_BASE::rBHelper.bDisposed); + + // find the first column with the name columnName + + ::osl::MutexGuard aGuard( m_aMutex ); + + Reference< XResultSetMetaData > xMeta = getMetaData(); + sal_Int32 nLen = xMeta->getColumnCount(); + sal_Int32 i = 1; + for(;i<=nLen;++i) + if(xMeta->isCaseSensitive(i) ? columnName == xMeta->getColumnName(i) : + columnName.equalsIgnoreAsciiCase(xMeta->getColumnName(i))) + break; + return i; +} +// ------------------------------------------------------------------------- +Reference< XInputStream > SAL_CALL OResultSet::getBinaryStream( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(OResultSet_BASE::rBHelper.bDisposed); + + + return NULL; +} +// ------------------------------------------------------------------------- +Reference< XInputStream > SAL_CALL OResultSet::getCharacterStream( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(OResultSet_BASE::rBHelper.bDisposed); + + + return NULL; +} + +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL OResultSet::getBoolean( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(OResultSet_BASE::rBHelper.bDisposed); + + return sal_False; +} +// ------------------------------------------------------------------------- + +sal_Int8 SAL_CALL OResultSet::getByte( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(OResultSet_BASE::rBHelper.bDisposed); + + + sal_Int8 nRet = 0; + return nRet; +} +// ------------------------------------------------------------------------- + +Sequence< sal_Int8 > SAL_CALL OResultSet::getBytes( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + + checkDisposed(OResultSet_BASE::rBHelper.bDisposed); + ::osl::MutexGuard aGuard( m_aMutex ); + + return Sequence< sal_Int8 >(); +} +// ------------------------------------------------------------------------- + +Date SAL_CALL OResultSet::getDate( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(OResultSet_BASE::rBHelper.bDisposed); + + + Date nRet; + return nRet; +} +// ------------------------------------------------------------------------- + +double SAL_CALL OResultSet::getDouble( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(OResultSet_BASE::rBHelper.bDisposed); + + + double nRet = 0; + return nRet; +} +// ------------------------------------------------------------------------- + +float SAL_CALL OResultSet::getFloat( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(OResultSet_BASE::rBHelper.bDisposed); + + + float nVal(0); + return nVal; +} +// ------------------------------------------------------------------------- + +sal_Int32 SAL_CALL OResultSet::getInt( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(OResultSet_BASE::rBHelper.bDisposed); + + sal_Int32 nRet=0; + return nRet; +} +// ------------------------------------------------------------------------- + +sal_Int32 SAL_CALL OResultSet::getRow( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(OResultSet_BASE::rBHelper.bDisposed); + + sal_Int32 nValue = 0; + return nValue; +} +// ------------------------------------------------------------------------- + +sal_Int64 SAL_CALL OResultSet::getLong( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(OResultSet_BASE::rBHelper.bDisposed); + + return sal_Int64(); +} +// ------------------------------------------------------------------------- + +Reference< XResultSetMetaData > SAL_CALL OResultSet::getMetaData( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(OResultSet_BASE::rBHelper.bDisposed); + + + if(!m_xMetaData.is()) + m_xMetaData = new OResultSetMetaData(m_pStatement->getOwnConnection()); + return m_xMetaData; +} +// ------------------------------------------------------------------------- +Reference< XArray > SAL_CALL OResultSet::getArray( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(OResultSet_BASE::rBHelper.bDisposed); + + return NULL; +} + +// ------------------------------------------------------------------------- + +Reference< XClob > SAL_CALL OResultSet::getClob( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(OResultSet_BASE::rBHelper.bDisposed); + + return NULL; +} +// ------------------------------------------------------------------------- +Reference< XBlob > SAL_CALL OResultSet::getBlob( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(OResultSet_BASE::rBHelper.bDisposed); + + return NULL; +} +// ------------------------------------------------------------------------- + +Reference< XRef > SAL_CALL OResultSet::getRef( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(OResultSet_BASE::rBHelper.bDisposed); + + return NULL; +} +// ------------------------------------------------------------------------- + +Any SAL_CALL OResultSet::getObject( sal_Int32 columnIndex, const Reference< ::com::sun::star::container::XNameAccess >& typeMap ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(OResultSet_BASE::rBHelper.bDisposed); + + return Any(); +} +// ------------------------------------------------------------------------- + +sal_Int16 SAL_CALL OResultSet::getShort( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(OResultSet_BASE::rBHelper.bDisposed); + + + sal_Int16 nRet=0; + return nRet; +} +// ------------------------------------------------------------------------- + + +::rtl::OUString SAL_CALL OResultSet::getString( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(OResultSet_BASE::rBHelper.bDisposed); + + + ::rtl::OUString nRet; + return nRet; +} +// ------------------------------------------------------------------------- + +Time SAL_CALL OResultSet::getTime( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + checkDisposed(OResultSet_BASE::rBHelper.bDisposed); + + ::osl::MutexGuard aGuard( m_aMutex ); + + Time nRet; + return nRet; +} +// ------------------------------------------------------------------------- + + +DateTime SAL_CALL OResultSet::getTimestamp( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + checkDisposed(OResultSet_BASE::rBHelper.bDisposed); + + + ::osl::MutexGuard aGuard( m_aMutex ); + + DateTime nRet; + return nRet; +} +// ------------------------------------------------------------------------- + +sal_Bool SAL_CALL OResultSet::isBeforeFirst( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(OResultSet_BASE::rBHelper.bDisposed); + + + // here you have to implement your movements + // return true means there is no data + return sal_True; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL OResultSet::isAfterLast( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(OResultSet_BASE::rBHelper.bDisposed); + + return sal_True; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL OResultSet::isFirst( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(OResultSet_BASE::rBHelper.bDisposed); + + + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL OResultSet::isLast( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(OResultSet_BASE::rBHelper.bDisposed); + + + return sal_False; +} +// ------------------------------------------------------------------------- +void SAL_CALL OResultSet::beforeFirst( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(OResultSet_BASE::rBHelper.bDisposed); + + // move before the first row so that isBeforeFirst returns false + // the smae for other movement methods +} +// ------------------------------------------------------------------------- +void SAL_CALL OResultSet::afterLast( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(OResultSet_BASE::rBHelper.bDisposed); +} +// ------------------------------------------------------------------------- + +void SAL_CALL OResultSet::close( ) throw(SQLException, RuntimeException) +{ + { + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(OResultSet_BASE::rBHelper.bDisposed); + + } + dispose(); +} +// ------------------------------------------------------------------------- + +sal_Bool SAL_CALL OResultSet::first( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(OResultSet_BASE::rBHelper.bDisposed); + + return sal_False; +} +// ------------------------------------------------------------------------- + +sal_Bool SAL_CALL OResultSet::last( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(OResultSet_BASE::rBHelper.bDisposed); + + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL OResultSet::absolute( sal_Int32 row ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(OResultSet_BASE::rBHelper.bDisposed); + + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL OResultSet::relative( sal_Int32 row ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(OResultSet_BASE::rBHelper.bDisposed); + + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL OResultSet::previous( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(OResultSet_BASE::rBHelper.bDisposed); + + return sal_False; +} +// ------------------------------------------------------------------------- +Reference< XInterface > SAL_CALL OResultSet::getStatement( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(OResultSet_BASE::rBHelper.bDisposed); + + + return m_aStatement.get(); +} +// ------------------------------------------------------------------------- + +sal_Bool SAL_CALL OResultSet::rowDeleted( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(OResultSet_BASE::rBHelper.bDisposed); + + + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL OResultSet::rowInserted( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(OResultSet_BASE::rBHelper.bDisposed); + + + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL OResultSet::rowUpdated( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(OResultSet_BASE::rBHelper.bDisposed); + + + return sal_False; +} +// ------------------------------------------------------------------------- + +sal_Bool SAL_CALL OResultSet::next( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(OResultSet_BASE::rBHelper.bDisposed); + + + return sal_False; +} +// ------------------------------------------------------------------------- + +sal_Bool SAL_CALL OResultSet::wasNull( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(OResultSet_BASE::rBHelper.bDisposed); + + + return m_bWasNull; +} +// ------------------------------------------------------------------------- + +void SAL_CALL OResultSet::cancel( ) throw(RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(OResultSet_BASE::rBHelper.bDisposed); + +} +// ------------------------------------------------------------------------- +void SAL_CALL OResultSet::clearWarnings( ) throw(SQLException, RuntimeException) +{ +} +// ------------------------------------------------------------------------- +Any SAL_CALL OResultSet::getWarnings( ) throw(SQLException, RuntimeException) +{ + return Any(); +} +// ------------------------------------------------------------------------- +void SAL_CALL OResultSet::insertRow( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(OResultSet_BASE::rBHelper.bDisposed); + + // you only have to implement this if you want to insert new rows +} +// ------------------------------------------------------------------------- +void SAL_CALL OResultSet::updateRow( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(OResultSet_BASE::rBHelper.bDisposed); + + + // only when you allow updates +} +// ------------------------------------------------------------------------- +void SAL_CALL OResultSet::deleteRow( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(OResultSet_BASE::rBHelper.bDisposed); +} +// ------------------------------------------------------------------------- + +void SAL_CALL OResultSet::cancelRowUpdates( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(OResultSet_BASE::rBHelper.bDisposed); +} +// ------------------------------------------------------------------------- + +void SAL_CALL OResultSet::moveToInsertRow( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(OResultSet_BASE::rBHelper.bDisposed); + + + // only when you allow insert's +} +// ------------------------------------------------------------------------- + +void SAL_CALL OResultSet::moveToCurrentRow( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(OResultSet_BASE::rBHelper.bDisposed); +} +// ------------------------------------------------------------------------- + +void SAL_CALL OResultSet::updateNull( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(OResultSet_BASE::rBHelper.bDisposed); +} +// ------------------------------------------------------------------------- + +void SAL_CALL OResultSet::updateBoolean( sal_Int32 columnIndex, sal_Bool x ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(OResultSet_BASE::rBHelper.bDisposed); + +} +// ------------------------------------------------------------------------- +void SAL_CALL OResultSet::updateByte( sal_Int32 columnIndex, sal_Int8 x ) throw(SQLException, RuntimeException) +{ + checkDisposed(OResultSet_BASE::rBHelper.bDisposed); + ::osl::MutexGuard aGuard( m_aMutex ); + +} +// ------------------------------------------------------------------------- + +void SAL_CALL OResultSet::updateShort( sal_Int32 columnIndex, sal_Int16 x ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(OResultSet_BASE::rBHelper.bDisposed); + +} +// ------------------------------------------------------------------------- +void SAL_CALL OResultSet::updateInt( sal_Int32 columnIndex, sal_Int32 x ) throw(SQLException, RuntimeException) +{ + checkDisposed(OResultSet_BASE::rBHelper.bDisposed); + ::osl::MutexGuard aGuard( m_aMutex ); + +} +// ------------------------------------------------------------------------- +void SAL_CALL OResultSet::updateLong( sal_Int32 columnIndex, sal_Int64 x ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(OResultSet_BASE::rBHelper.bDisposed); + +} +// ----------------------------------------------------------------------- +void SAL_CALL OResultSet::updateFloat( sal_Int32 columnIndex, float x ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(OResultSet_BASE::rBHelper.bDisposed); + +} +// ------------------------------------------------------------------------- + +void SAL_CALL OResultSet::updateDouble( sal_Int32 columnIndex, double x ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(OResultSet_BASE::rBHelper.bDisposed); + +} +// ------------------------------------------------------------------------- +void SAL_CALL OResultSet::updateString( sal_Int32 columnIndex, const ::rtl::OUString& x ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(OResultSet_BASE::rBHelper.bDisposed); + +} +// ------------------------------------------------------------------------- +void SAL_CALL OResultSet::updateBytes( sal_Int32 columnIndex, const Sequence< sal_Int8 >& x ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(OResultSet_BASE::rBHelper.bDisposed); + +} +// ------------------------------------------------------------------------- +void SAL_CALL OResultSet::updateDate( sal_Int32 columnIndex, const Date& x ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(OResultSet_BASE::rBHelper.bDisposed); + +} +// ------------------------------------------------------------------------- + +void SAL_CALL OResultSet::updateTime( sal_Int32 columnIndex, const Time& x ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(OResultSet_BASE::rBHelper.bDisposed); + +} +// ------------------------------------------------------------------------- + +void SAL_CALL OResultSet::updateTimestamp( sal_Int32 columnIndex, const DateTime& x ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(OResultSet_BASE::rBHelper.bDisposed); + +} +// ------------------------------------------------------------------------- + +void SAL_CALL OResultSet::updateBinaryStream( sal_Int32 columnIndex, const Reference< XInputStream >& x, sal_Int32 length ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(OResultSet_BASE::rBHelper.bDisposed); + +} +// ------------------------------------------------------------------------- +void SAL_CALL OResultSet::updateCharacterStream( sal_Int32 columnIndex, const Reference< XInputStream >& x, sal_Int32 length ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(OResultSet_BASE::rBHelper.bDisposed); + +} +// ------------------------------------------------------------------------- +void SAL_CALL OResultSet::refreshRow( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(OResultSet_BASE::rBHelper.bDisposed); + +} +// ------------------------------------------------------------------------- +void SAL_CALL OResultSet::updateObject( sal_Int32 columnIndex, const Any& x ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(OResultSet_BASE::rBHelper.bDisposed); + +} +// ------------------------------------------------------------------------- + +void SAL_CALL OResultSet::updateNumericObject( sal_Int32 columnIndex, const Any& x, sal_Int32 scale ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(OResultSet_BASE::rBHelper.bDisposed); + +} +// ------------------------------------------------------------------------- +// XRowLocate +Any SAL_CALL OResultSet::getBookmark( ) throw( SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(OResultSet_BASE::rBHelper.bDisposed); + + // if you don't want to support bookmark you must remove the XRowLocate interface + + return Any(); +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL OResultSet::moveToBookmark( const Any& bookmark ) throw( SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(OResultSet_BASE::rBHelper.bDisposed); + + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL OResultSet::moveRelativeToBookmark( const Any& bookmark, sal_Int32 rows ) throw( SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(OResultSet_BASE::rBHelper.bDisposed); + + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL OResultSet::compareBookmarks( const Any& first, const Any& second ) throw( SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(OResultSet_BASE::rBHelper.bDisposed); + + + return CompareBookmark::NOT_EQUAL; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL OResultSet::hasOrderedBookmarks( ) throw( SQLException, RuntimeException) +{ + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL OResultSet::hashBookmark( const Any& bookmark ) throw( SQLException, RuntimeException) +{ + throw SQLException(); +} +// ------------------------------------------------------------------------- +// XDeleteRows +Sequence< sal_Int32 > SAL_CALL OResultSet::deleteRows( const Sequence< Any >& rows ) throw( SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(OResultSet_BASE::rBHelper.bDisposed); + + return Sequence< sal_Int32 >(); +} +// ------------------------------------------------------------------------- +IPropertyArrayHelper* OResultSet::createArrayHelper( ) const +{ + Sequence< Property > aProps(6); + Property* pProperties = aProps.getArray(); + sal_Int32 nPos = 0; + DECL_PROP1IMPL(CURSORNAME, ::rtl::OUString) PropertyAttribute::READONLY); + DECL_PROP0(FETCHDIRECTION, sal_Int32); + DECL_PROP0(FETCHSIZE, sal_Int32); + DECL_BOOL_PROP1IMPL(ISBOOKMARKABLE) PropertyAttribute::READONLY); + DECL_PROP1IMPL(RESULTSETCONCURRENCY,sal_Int32) PropertyAttribute::READONLY); + DECL_PROP1IMPL(RESULTSETTYPE, sal_Int32) PropertyAttribute::READONLY); + + return new OPropertyArrayHelper(aProps); +} +// ------------------------------------------------------------------------- +IPropertyArrayHelper & OResultSet::getInfoHelper() +{ + return *const_cast<OResultSet*>(this)->getArrayHelper(); +} +// ------------------------------------------------------------------------- +sal_Bool OResultSet::convertFastPropertyValue( + Any & rConvertedValue, + Any & rOldValue, + sal_Int32 nHandle, + const Any& rValue ) + throw (::com::sun::star::lang::IllegalArgumentException) +{ + switch(nHandle) + { + case PROPERTY_ID_ISBOOKMARKABLE: + case PROPERTY_ID_CURSORNAME: + case PROPERTY_ID_RESULTSETCONCURRENCY: + case PROPERTY_ID_RESULTSETTYPE: + throw ::com::sun::star::lang::IllegalArgumentException(); + break; + case PROPERTY_ID_FETCHDIRECTION: + case PROPERTY_ID_FETCHSIZE: + default: + ; + } + return sal_False; +} +// ------------------------------------------------------------------------- +void OResultSet::setFastPropertyValue_NoBroadcast( + sal_Int32 nHandle, + const Any& rValue + ) + throw (Exception) +{ + switch(nHandle) + { + case PROPERTY_ID_ISBOOKMARKABLE: + case PROPERTY_ID_CURSORNAME: + case PROPERTY_ID_RESULTSETCONCURRENCY: + case PROPERTY_ID_RESULTSETTYPE: + throw Exception(); + break; + case PROPERTY_ID_FETCHDIRECTION: + break; + case PROPERTY_ID_FETCHSIZE: + break; + default: + ; + } +} +// ------------------------------------------------------------------------- +void OResultSet::getFastPropertyValue( + Any& rValue, + sal_Int32 nHandle + ) const +{ + switch(nHandle) + { + case PROPERTY_ID_ISBOOKMARKABLE: + case PROPERTY_ID_CURSORNAME: + case PROPERTY_ID_RESULTSETCONCURRENCY: + case PROPERTY_ID_RESULTSETTYPE: + case PROPERTY_ID_FETCHDIRECTION: + case PROPERTY_ID_FETCHSIZE: + ; + } +} +// ----------------------------------------------------------------------------- +void SAL_CALL OResultSet::acquire() throw() +{ + OResultSet_BASE::acquire(); +} +// ----------------------------------------------------------------------------- +void SAL_CALL OResultSet::release() throw() +{ + OResultSet_BASE::release(); +} +// ----------------------------------------------------------------------------- +::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL OResultSet::getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException) +{ + return ::cppu::OPropertySetHelper::createPropertySetInfo(getInfoHelper()); +} +// ----------------------------------------------------------------------------- + + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/drivers/firebird/FResultSet.hxx b/connectivity/source/drivers/firebird/FResultSet.hxx new file mode 100644 index 000000000000..36ebe8894d71 --- /dev/null +++ b/connectivity/source/drivers/firebird/FResultSet.hxx @@ -0,0 +1,221 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * The Contents of this file are made available subject to the terms of + * the BSD license. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of Sun Microsystems, Inc. nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE + * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + *************************************************************************/ + +#ifndef CONNECTIVITY_SRESULTSET_HXX +#define CONNECTIVITY_SRESULTSET_HXX + +#include <com/sun/star/sdbc/XResultSet.hpp> +#include <com/sun/star/sdbc/XRow.hpp> +#include <com/sun/star/sdbc/XResultSetMetaDataSupplier.hpp> +#include <com/sun/star/sdbc/XCloseable.hpp> +#include <com/sun/star/sdbc/XColumnLocate.hpp> +#include <com/sun/star/util/XCancellable.hpp> +#include <com/sun/star/sdbc/XWarningsSupplier.hpp> +#include <com/sun/star/sdbc/XResultSetUpdate.hpp> +#include <com/sun/star/sdbc/XRowUpdate.hpp> +#include <com/sun/star/sdbcx/XRowLocate.hpp> +#include <com/sun/star/sdbcx/XDeleteRows.hpp> +#include <cppuhelper/compbase12.hxx> +#include "FStatement.hxx" +#include "OSubComponent.hxx" + +namespace connectivity +{ + namespace firebird + { + + /* + ** OResultSet + */ + typedef ::cppu::WeakComponentImplHelper12< ::com::sun::star::sdbc::XResultSet, + ::com::sun::star::sdbc::XRow, + ::com::sun::star::sdbc::XResultSetMetaDataSupplier, + ::com::sun::star::util::XCancellable, + ::com::sun::star::sdbc::XWarningsSupplier, + ::com::sun::star::sdbc::XResultSetUpdate, + ::com::sun::star::sdbc::XRowUpdate, + ::com::sun::star::sdbcx::XRowLocate, + ::com::sun::star::sdbcx::XDeleteRows, + ::com::sun::star::sdbc::XCloseable, + ::com::sun::star::sdbc::XColumnLocate, + ::com::sun::star::lang::XServiceInfo> OResultSet_BASE; + + class OResultSet : public OBase_Mutex, + public OResultSet_BASE, + public ::cppu::OPropertySetHelper, + public OPropertyArrayUsageHelper<OResultSet> + { + protected: + OStatement_Base* m_pStatement; + ::com::sun::star::uno::WeakReferenceHelper m_aStatement; + ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData> m_xMetaData; + rtl_TextEncoding m_nTextEncoding; + sal_Bool m_bWasNull; + + // OPropertyArrayUsageHelper + virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const; + // 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; + + // you can't delete objects of this type + virtual ~OResultSet(); + public: + DECLARE_SERVICE_INFO(); + + OResultSet( OStatement_Base* pStmt); + + + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > operator *() + { + return ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >(*(OResultSet_BASE*)this); + } + + // ::cppu::OComponentHelper + virtual void SAL_CALL disposing(void); + // XInterface + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL acquire() throw(); + virtual void SAL_CALL release() throw(); + //XTypeProvider + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException); + // XPropertySet + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException); + // XResultSet + 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); + // 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); + // 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); + // XCancellable + virtual void SAL_CALL cancel( ) throw(::com::sun::star::uno::RuntimeException); + // XCloseable + virtual void SAL_CALL close( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // 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); + // 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); + // 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); + // XColumnLocate + virtual sal_Int32 SAL_CALL findColumn( const ::rtl::OUString& columnName ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XRowLocate + virtual ::com::sun::star::uno::Any SAL_CALL getBookmark( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL moveToBookmark( const ::com::sun::star::uno::Any& bookmark ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL moveRelativeToBookmark( const ::com::sun::star::uno::Any& bookmark, sal_Int32 rows ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL compareBookmarks( const ::com::sun::star::uno::Any& first, const ::com::sun::star::uno::Any& second ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL hasOrderedBookmarks( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL hashBookmark( const ::com::sun::star::uno::Any& bookmark ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XDeleteRows + virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL deleteRows( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& rows ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + }; + } +} +#endif // CONNECTIVITY_SRESULTSET_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/drivers/firebird/FResultSetMetaData.cxx b/connectivity/source/drivers/firebird/FResultSetMetaData.cxx new file mode 100644 index 000000000000..3b02d095e124 --- /dev/null +++ b/connectivity/source/drivers/firebird/FResultSetMetaData.cxx @@ -0,0 +1,171 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * The Contents of this file are made available subject to the terms of + * the BSD license. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of Sun Microsystems, Inc. nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE + * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + *************************************************************************/ + +#include "FResultSetMetaData.hxx" + +using namespace connectivity::firebird; +using namespace com::sun::star::uno; +using namespace com::sun::star::lang; +using namespace com::sun::star::sdbc; + +// ------------------------------------------------------------------------- +OResultSetMetaData::~OResultSetMetaData() +{ +} +// ------------------------------------------------------------------------- +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL OResultSetMetaData::getColumnDisplaySize( sal_Int32 column ) throw(SQLException, RuntimeException) +{ + return 50; +} +// ------------------------------------------------------------------------- + +sal_Int32 SAL_CALL OResultSetMetaData::getColumnType( sal_Int32 column ) throw(SQLException, RuntimeException) +{ + sal_Int32 nType = 0; + return nType; +} +// ------------------------------------------------------------------------- + +sal_Int32 SAL_CALL OResultSetMetaData::getColumnCount( ) throw(SQLException, RuntimeException) +{ + // this make no sense here so you have to change this + return 0; +} +// ------------------------------------------------------------------------- + +sal_Bool SAL_CALL OResultSetMetaData::isCaseSensitive( sal_Int32 column ) throw(SQLException, RuntimeException) +{ + return sal_True; +} +// ------------------------------------------------------------------------- + +::rtl::OUString SAL_CALL OResultSetMetaData::getSchemaName( sal_Int32 column ) throw(SQLException, RuntimeException) +{ + return ::rtl::OUString(); +} +// ------------------------------------------------------------------------- + +::rtl::OUString SAL_CALL OResultSetMetaData::getColumnName( sal_Int32 column ) throw(SQLException, RuntimeException) +{ + return ::rtl::OUString("Column") + ::rtl::OUString::valueOf(column); +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL OResultSetMetaData::getTableName( sal_Int32 column ) throw(SQLException, RuntimeException) +{ + return ::rtl::OUString(); +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL OResultSetMetaData::getCatalogName( sal_Int32 column ) throw(SQLException, RuntimeException) +{ + return ::rtl::OUString(); +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL OResultSetMetaData::getColumnTypeName( sal_Int32 column ) throw(SQLException, RuntimeException) +{ + return ::rtl::OUString(); +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL OResultSetMetaData::getColumnLabel( sal_Int32 column ) throw(SQLException, RuntimeException) +{ + return ::rtl::OUString(); +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL OResultSetMetaData::getColumnServiceName( sal_Int32 column ) throw(SQLException, RuntimeException) +{ + return ::rtl::OUString(); +} +// ------------------------------------------------------------------------- + +sal_Bool SAL_CALL OResultSetMetaData::isCurrency( sal_Int32 column ) throw(SQLException, RuntimeException) +{ + return sal_False; +} +// ------------------------------------------------------------------------- + +sal_Bool SAL_CALL OResultSetMetaData::isAutoIncrement( sal_Int32 column ) throw(SQLException, RuntimeException) +{ + return sal_False; +} +// ------------------------------------------------------------------------- + + +sal_Bool SAL_CALL OResultSetMetaData::isSigned( sal_Int32 column ) throw(SQLException, RuntimeException) +{ + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL OResultSetMetaData::getPrecision( sal_Int32 column ) throw(SQLException, RuntimeException) +{ + return 0; +} +// ----------------------------------------------------------------------------- +sal_Int32 SAL_CALL OResultSetMetaData::getScale( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + return 0; +} +// ------------------------------------------------------------------------- + +sal_Int32 SAL_CALL OResultSetMetaData::isNullable( sal_Int32 column ) throw(SQLException, RuntimeException) +{ + return 0; +} +// ------------------------------------------------------------------------- + +sal_Bool SAL_CALL OResultSetMetaData::isSearchable( sal_Int32 column ) throw(SQLException, RuntimeException) +{ + return sal_True; +} +// ------------------------------------------------------------------------- + +sal_Bool SAL_CALL OResultSetMetaData::isReadOnly( sal_Int32 column ) throw(SQLException, RuntimeException) +{ + return sal_True; +} +// ------------------------------------------------------------------------- + +sal_Bool SAL_CALL OResultSetMetaData::isDefinitelyWritable( sal_Int32 column ) throw(SQLException, RuntimeException) +{ + return sal_False; +; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL OResultSetMetaData::isWritable( sal_Int32 column ) throw(SQLException, RuntimeException) +{ + return sal_False; +} +// ------------------------------------------------------------------------- + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/drivers/firebird/FResultSetMetaData.hxx b/connectivity/source/drivers/firebird/FResultSetMetaData.hxx new file mode 100644 index 000000000000..78e11d21b518 --- /dev/null +++ b/connectivity/source/drivers/firebird/FResultSetMetaData.hxx @@ -0,0 +1,93 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * The Contents of this file are made available subject to the terms of + * the BSD license. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of Sun Microsystems, Inc. nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE + * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + *************************************************************************/ + +#ifndef CONNECTIVITY_SRESULSETMETADATA_HXX +#define CONNECTIVITY_SRESULSETMETADATA_HXX + +#include <com/sun/star/sdbc/XResultSetMetaData.hpp> +#include <cppuhelper/implbase1.hxx> +#include "FConnection.hxx" + +namespace connectivity +{ + namespace firebird + { + //************************************************************** + //************ Class: ResultSetMetaData + //************************************************************** + typedef ::cppu::WeakImplHelper1< ::com::sun::star::sdbc::XResultSetMetaData> OResultSetMetaData_BASE; + + class OResultSetMetaData : public OResultSetMetaData_BASE + { + OConnection* m_pConnection; + + protected: + virtual ~OResultSetMetaData(); + public: + // a constructor, which is required for returning objects: + OResultSetMetaData(OConnection* _pConnection) : m_pConnection(_pConnection){} + + /// Avoid ambigous cast error from the compiler. + inline operator ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData > () throw() + { return this; } + + 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 // CONNECTIVITY_SRESULSETMETADATA_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/drivers/firebird/FServices.cxx b/connectivity/source/drivers/firebird/FServices.cxx new file mode 100644 index 000000000000..9cc8197e84c0 --- /dev/null +++ b/connectivity/source/drivers/firebird/FServices.cxx @@ -0,0 +1,147 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * The Contents of this file are made available subject to the terms of + * the BSD license. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of Sun Microsystems, Inc. nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE + * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + *************************************************************************/ + +#include <sal/types.h> +#include "FDriver.hxx" +#include <cppuhelper/factory.hxx> +#include <osl/diagnose.h> + +using namespace connectivity::firebird; +using ::rtl::OUString; +using ::com::sun::star::uno::Reference; +using ::com::sun::star::uno::Sequence; +using ::com::sun::star::registry::XRegistryKey; +using ::com::sun::star::lang::XSingleServiceFactory; +using ::com::sun::star::lang::XMultiServiceFactory; + +typedef Reference< XSingleServiceFactory > (SAL_CALL *createFactoryFunc) + ( + const Reference< XMultiServiceFactory > & rServiceManager, + const OUString & rComponentName, + ::cppu::ComponentInstantiation pCreateFunction, + const Sequence< OUString > & rServiceNames, + rtl_ModuleCount* _pTemp + ); + +//*************************************************************************************** +// +// The required C-Api must be provided! +// It contains of 3 special functions that have to be exported. +// + +//--------------------------------------------------------------------------------------- +void REGISTER_PROVIDER( + const OUString& aServiceImplName, + const Sequence< OUString>& Services, + const Reference< ::com::sun::star::registry::XRegistryKey > & xKey) +{ + OUString aMainKeyName("/"); + aMainKeyName += aServiceImplName; + aMainKeyName += OUString("/UNO/SERVICES"); + + Reference< ::com::sun::star::registry::XRegistryKey > xNewKey( xKey->createKey(aMainKeyName) ); + OSL_ENSURE(xNewKey.is(), "FIREBIRD::component_writeInfo : could not create a registry key !"); + + for (sal_uInt32 i=0; i<Services.getLength(); ++i) + xNewKey->createKey(Services[i]); +} + + +//--------------------------------------------------------------------------------------- +struct ProviderRequest +{ + Reference< XSingleServiceFactory > xRet; + Reference< XMultiServiceFactory > const xServiceManager; + OUString const sImplementationName; + + ProviderRequest( + void* pServiceManager, + sal_Char const* pImplementationName + ) + : xServiceManager(reinterpret_cast<XMultiServiceFactory*>(pServiceManager)) + , sImplementationName(OUString::createFromAscii(pImplementationName)) + { + } + + inline + sal_Bool CREATE_PROVIDER( + const OUString& Implname, + const Sequence< OUString > & Services, + ::cppu::ComponentInstantiation Factory, + createFactoryFunc creator + ) + { + if (!xRet.is() && (Implname == sImplementationName)) + try + { + xRet = creator( xServiceManager, sImplementationName,Factory, Services,0); + } + catch(...) + { + } + return xRet.is(); + } + + void* getProvider() const { return xRet.get(); } +}; + +//--------------------------------------------------------------------------------------- +extern "C" SAL_DLLPUBLIC_EXPORT void* SAL_CALL firebird_component_getFactory( + const sal_Char* pImplementationName, + void* pServiceManager, + void* pRegistryKey) +{ + void* pRet = 0; + if (pServiceManager) + { + ProviderRequest aReq(pServiceManager,pImplementationName); + + aReq.CREATE_PROVIDER( + FirebirdDriver::getImplementationName_Static(), + FirebirdDriver::getSupportedServiceNames_Static(), + FirebirdDriver_CreateInstance, ::cppu::createSingleFactory) + ; + + if(aReq.xRet.is()) + aReq.xRet->acquire(); + + pRet = aReq.getProvider(); + } + + return pRet; +}; + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/drivers/firebird/FStatement.cxx b/connectivity/source/drivers/firebird/FStatement.cxx new file mode 100644 index 000000000000..153b99352818 --- /dev/null +++ b/connectivity/source/drivers/firebird/FStatement.cxx @@ -0,0 +1,370 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * The Contents of this file are made available subject to the terms of + * the BSD license. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of Sun Microsystems, Inc. nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE + * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + *************************************************************************/ + +#include <stdio.h> +#include <osl/diagnose.h> +#include "FStatement.hxx" +#include "FConnection.hxx" +#include "FResultSet.hxx" +#include <osl/thread.h> +#include <com/sun/star/sdbc/ResultSetConcurrency.hpp> +#include <com/sun/star/sdbc/ResultSetType.hpp> +#include <com/sun/star/sdbc/FetchDirection.hpp> +#include <com/sun/star/lang/DisposedException.hpp> +#include <cppuhelper/typeprovider.hxx> +#include "propertyids.hxx" + +using namespace connectivity::firebird; +//------------------------------------------------------------------------------ +using namespace com::sun::star::uno; +using namespace com::sun::star::lang; +using namespace com::sun::star::beans; +using namespace com::sun::star::sdbc; +using namespace com::sun::star::sdbcx; +using namespace com::sun::star::container; +using namespace com::sun::star::io; +using namespace com::sun::star::util; +//------------------------------------------------------------------------------ +OStatement_Base::OStatement_Base(OConnection* _pConnection ) + : OStatement_BASE(m_aMutex), + OPropertySetHelper(OStatement_BASE::rBHelper), + rBHelper(OStatement_BASE::rBHelper), + m_pConnection(_pConnection) +{ + m_pConnection->acquire(); +} +// ----------------------------------------------------------------------------- +OStatement_Base::~OStatement_Base() +{ +} +//------------------------------------------------------------------------------ +void OStatement_Base::disposeResultSet() +{ + // free the cursor if alive + Reference< XComponent > xComp(m_xResultSet.get(), UNO_QUERY); + if (xComp.is()) + xComp->dispose(); + m_xResultSet = Reference< XResultSet>(); +} +//------------------------------------------------------------------------------ +void OStatement_BASE2::disposing() +{ + ::osl::MutexGuard aGuard(m_aMutex); + + disposeResultSet(); + + if (m_pConnection) + m_pConnection->release(); + m_pConnection = NULL; + + dispose_ChildImpl(); + OStatement_Base::disposing(); +} +//----------------------------------------------------------------------------- +void SAL_CALL OStatement_BASE2::release() throw() +{ + relase_ChildImpl(); +} +//----------------------------------------------------------------------------- +Any SAL_CALL OStatement_Base::queryInterface( const Type & rType ) throw(RuntimeException) +{ + Any aRet = OStatement_BASE::queryInterface(rType); + if(!aRet.hasValue()) + aRet = OPropertySetHelper::queryInterface(rType); + return aRet; +} +// ------------------------------------------------------------------------- +Sequence< Type > SAL_CALL OStatement_Base::getTypes( ) throw(RuntimeException) +{ + ::cppu::OTypeCollection aTypes( + ::cppu::UnoType< Reference< XMultiPropertySet > >::get(), + ::cppu::UnoType< Reference< XFastPropertySet > >::get(), + ::cppu::UnoType< Reference< XPropertySet > >::get()); + + return concatSequences(aTypes.getTypes(),OStatement_BASE::getTypes()); +} +// ------------------------------------------------------------------------- + +void SAL_CALL OStatement_Base::cancel( ) throw(RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(OStatement_BASE::rBHelper.bDisposed); + // cancel the current sql statement +} +// ------------------------------------------------------------------------- + +void SAL_CALL OStatement_Base::close( ) throw(SQLException, RuntimeException) +{ + { + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(OStatement_BASE::rBHelper.bDisposed); + + } + dispose(); +} +// ------------------------------------------------------------------------- + +void SAL_CALL OStatement::clearBatch( ) throw(SQLException, RuntimeException) +{ + // if you support batches clear it here +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL OStatement_Base::execute( const ::rtl::OUString& sql ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(OStatement_BASE::rBHelper.bDisposed); + + // returns true when a resultset is available + return sal_False; +} +// ------------------------------------------------------------------------- + +Reference< XResultSet > SAL_CALL OStatement_Base::executeQuery( const ::rtl::OUString& sql ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(OStatement_BASE::rBHelper.bDisposed); + + + Reference< XResultSet > xRS = NULL; + // create a resultset as result of executing the sql statement + // you have to here something :-) + m_xResultSet = xRS; // we nedd a reference to it for later use + return xRS; +} +// ------------------------------------------------------------------------- + +Reference< XConnection > SAL_CALL OStatement_Base::getConnection( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(OStatement_BASE::rBHelper.bDisposed); + + // just return our connection here + return (Reference< XConnection >)m_pConnection; +} +// ----------------------------------------------------------------------------- +sal_Int32 SAL_CALL OStatement_Base::getUpdateCount( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + return 0; +} +// ------------------------------------------------------------------------- + +Any SAL_CALL OStatement::queryInterface( const Type & rType ) throw(RuntimeException) +{ + Any aRet = ::cppu::queryInterface(rType,static_cast< XBatchExecution*> (this)); + if(!aRet.hasValue()) + aRet = OStatement_Base::queryInterface(rType); + return aRet; +} +// ------------------------------------------------------------------------- + +void SAL_CALL OStatement::addBatch( const ::rtl::OUString& sql ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(OStatement_BASE::rBHelper.bDisposed); + + + m_aBatchList.push_back(sql); +} +// ------------------------------------------------------------------------- +Sequence< sal_Int32 > SAL_CALL OStatement::executeBatch( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(OStatement_BASE::rBHelper.bDisposed); + + return Sequence< sal_Int32 >(); +} +// ------------------------------------------------------------------------- + + +sal_Int32 SAL_CALL OStatement_Base::executeUpdate( const ::rtl::OUString& sql ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(OStatement_BASE::rBHelper.bDisposed); + + // the return values gives information about how many rows are affected by executing the sql statement + return 0; + +} +// ------------------------------------------------------------------------- + +Reference< XResultSet > SAL_CALL OStatement_Base::getResultSet( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(OStatement_BASE::rBHelper.bDisposed); + +// return our save resultset here + return m_xResultSet; +} +// ------------------------------------------------------------------------- + +sal_Bool SAL_CALL OStatement_Base::getMoreResults( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(OStatement_BASE::rBHelper.bDisposed); + + // if your driver supports more than only one resultset + // and has one more at this moment return true + return sal_False; +} +// ------------------------------------------------------------------------- + +// ------------------------------------------------------------------------- +Any SAL_CALL OStatement_Base::getWarnings( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(OStatement_BASE::rBHelper.bDisposed); + + + return makeAny(m_aLastWarning); +} +// ------------------------------------------------------------------------- + +// ------------------------------------------------------------------------- +void SAL_CALL OStatement_Base::clearWarnings( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(OStatement_BASE::rBHelper.bDisposed); + + + m_aLastWarning = SQLWarning(); +} +// ------------------------------------------------------------------------- +::cppu::IPropertyArrayHelper* OStatement_Base::createArrayHelper( ) const +{ + // this properties are define by the service statement + // they must in alphabetic order + Sequence< Property > aProps(10); + Property* pProperties = aProps.getArray(); + sal_Int32 nPos = 0; + DECL_PROP0(CURSORNAME, ::rtl::OUString); + DECL_BOOL_PROP0(ESCAPEPROCESSING); + DECL_PROP0(FETCHDIRECTION,sal_Int32); + DECL_PROP0(FETCHSIZE, sal_Int32); + DECL_PROP0(MAXFIELDSIZE,sal_Int32); + DECL_PROP0(MAXROWS, sal_Int32); + DECL_PROP0(QUERYTIMEOUT,sal_Int32); + DECL_PROP0(RESULTSETCONCURRENCY,sal_Int32); + DECL_PROP0(RESULTSETTYPE,sal_Int32); + DECL_BOOL_PROP0(USEBOOKMARKS); + + return new ::cppu::OPropertyArrayHelper(aProps); +} + +// ------------------------------------------------------------------------- +::cppu::IPropertyArrayHelper & OStatement_Base::getInfoHelper() +{ + return *const_cast<OStatement_Base*>(this)->getArrayHelper(); +} +// ------------------------------------------------------------------------- +sal_Bool OStatement_Base::convertFastPropertyValue( + Any & rConvertedValue, + Any & rOldValue, + sal_Int32 nHandle, + const Any& rValue ) + throw (::com::sun::star::lang::IllegalArgumentException) +{ + sal_Bool bConverted = sal_False; + // here we have to try to convert + return bConverted; +} +// ------------------------------------------------------------------------- +void OStatement_Base::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const Any& rValue) throw (Exception) +{ + // set the value to what ever is necessary + switch(nHandle) + { + case PROPERTY_ID_QUERYTIMEOUT: + case PROPERTY_ID_MAXFIELDSIZE: + case PROPERTY_ID_MAXROWS: + case PROPERTY_ID_CURSORNAME: + case PROPERTY_ID_RESULTSETCONCURRENCY: + case PROPERTY_ID_RESULTSETTYPE: + case PROPERTY_ID_FETCHDIRECTION: + case PROPERTY_ID_FETCHSIZE: + case PROPERTY_ID_ESCAPEPROCESSING: + case PROPERTY_ID_USEBOOKMARKS: + default: + ; + } +} +// ------------------------------------------------------------------------- +void OStatement_Base::getFastPropertyValue(Any& rValue,sal_Int32 nHandle) const +{ + switch(nHandle) + { + case PROPERTY_ID_QUERYTIMEOUT: + case PROPERTY_ID_MAXFIELDSIZE: + case PROPERTY_ID_MAXROWS: + case PROPERTY_ID_CURSORNAME: + case PROPERTY_ID_RESULTSETCONCURRENCY: + case PROPERTY_ID_RESULTSETTYPE: + case PROPERTY_ID_FETCHDIRECTION: + case PROPERTY_ID_FETCHSIZE: + case PROPERTY_ID_ESCAPEPROCESSING: + case PROPERTY_ID_USEBOOKMARKS: + default: + ; + } +} +// ------------------------------------------------------------------------- +IMPLEMENT_SERVICE_INFO(OStatement,"com.sun.star.sdbcx.OStatement","com.sun.star.sdbc.Statement"); +// ----------------------------------------------------------------------------- +void SAL_CALL OStatement_Base::acquire() throw() +{ + OStatement_BASE::acquire(); +} +// ----------------------------------------------------------------------------- +void SAL_CALL OStatement_Base::release() throw() +{ + OStatement_BASE::release(); +} +// ----------------------------------------------------------------------------- +void SAL_CALL OStatement::acquire() throw() +{ + OStatement_BASE2::acquire(); +} +// ----------------------------------------------------------------------------- +void SAL_CALL OStatement::release() throw() +{ + OStatement_BASE2::release(); +} +// ----------------------------------------------------------------------------- +Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL OStatement_Base::getPropertySetInfo( ) throw(RuntimeException) +{ + return ::cppu::OPropertySetHelper::createPropertySetInfo(getInfoHelper()); +} +// ----------------------------------------------------------------------------- + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/drivers/firebird/FStatement.hxx b/connectivity/source/drivers/firebird/FStatement.hxx new file mode 100644 index 000000000000..b5ed868a6c0c --- /dev/null +++ b/connectivity/source/drivers/firebird/FStatement.hxx @@ -0,0 +1,178 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * The Contents of this file are made available subject to the terms of + * the BSD license. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of Sun Microsystems, Inc. nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE + * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + *************************************************************************/ + +#ifndef CONNECTIVITY_SSTATEMENT_HXX +#define CONNECTIVITY_SSTATEMENT_HXX + +#include <com/sun/star/sdbc/XStatement.hpp> +#include <com/sun/star/sdbc/XWarningsSupplier.hpp> +#include <com/sun/star/sdbc/XMultipleResults.hpp> +#include <com/sun/star/sdbc/XBatchExecution.hpp> +#include <com/sun/star/sdbc/XCloseable.hpp> +#include <com/sun/star/sdbc/SQLWarning.hpp> +#include <com/sun/star/util/XCancellable.hpp> +#include <cppuhelper/compbase5.hxx> +#include "FConnection.hxx" +#include <list> +#include "OSubComponent.hxx" +#include <com/sun/star/lang/XServiceInfo.hpp> + +namespace connectivity +{ + namespace firebird + { + + typedef ::cppu::WeakComponentImplHelper5< ::com::sun::star::sdbc::XStatement, + ::com::sun::star::sdbc::XWarningsSupplier, + ::com::sun::star::util::XCancellable, + ::com::sun::star::sdbc::XCloseable, + ::com::sun::star::sdbc::XMultipleResults> OStatement_BASE; + + //************************************************************** + //************ Class: OStatement_Base + // is a base class for the normal statement and for the prepared statement + //************************************************************** + class OStatement_Base : public OBase_Mutex, + public OStatement_BASE, + public ::cppu::OPropertySetHelper, + public OPropertyArrayUsageHelper<OStatement_Base> + + { + ::com::sun::star::sdbc::SQLWarning m_aLastWarning; + protected: + ::com::sun::star::uno::WeakReference< ::com::sun::star::sdbc::XResultSet> m_xResultSet; // The last ResultSet created + // for this Statement + + ::std::list< ::rtl::OUString> m_aBatchList; + + OConnection* m_pConnection; // The owning Connection object + protected: + + void disposeResultSet(); + + // OPropertyArrayUsageHelper + virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const; + // 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; + virtual ~OStatement_Base(); + + public: + ::cppu::OBroadcastHelper& rBHelper; + OStatement_Base(OConnection* _pConnection ); + using OStatement_BASE::operator ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >; + + // OComponentHelper + virtual void SAL_CALL disposing(void){OStatement_BASE::disposing();} + // XInterface + virtual void SAL_CALL release() throw(); + virtual void SAL_CALL acquire() throw(); + // XInterface + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); + //XTypeProvider + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException); + + // XPropertySet + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException); + // 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) ; + // 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); + // XCancellable + virtual void SAL_CALL cancel( ) throw(::com::sun::star::uno::RuntimeException); + // XCloseable + virtual void SAL_CALL close( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // 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); + + // other methods + OConnection* getOwnConnection() const { return m_pConnection;} + }; + + class OStatement_BASE2 :public OStatement_Base + ,public OSubComponent<OStatement_BASE2, OStatement_BASE> + + { + friend class OSubComponent<OStatement_BASE2, OStatement_BASE>; + public: + OStatement_BASE2(OConnection* _pConnection ) : OStatement_Base(_pConnection ), + OSubComponent<OStatement_BASE2, OStatement_BASE>((::cppu::OWeakObject*)_pConnection, this){} + // OComponentHelper + virtual void SAL_CALL disposing(void); + // XInterface + virtual void SAL_CALL release() throw(); + }; + + class OStatement : public OStatement_BASE2, + public ::com::sun::star::sdbc::XBatchExecution, + public ::com::sun::star::lang::XServiceInfo + { + protected: + virtual ~OStatement(){} + public: + // a constructor, which is required for returning objects: + OStatement( OConnection* _pConnection) : OStatement_BASE2( _pConnection){} + DECLARE_SERVICE_INFO(); + + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL acquire() throw(); + virtual void SAL_CALL release() throw(); + // XBatchExecution + virtual void SAL_CALL addBatch( const ::rtl::OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL clearBatch( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL executeBatch( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + }; + } +} +#endif // CONNECTIVITY_SSTATEMENT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/drivers/firebird/OSubComponent.hxx b/connectivity/source/drivers/firebird/OSubComponent.hxx new file mode 100644 index 000000000000..99bda5368bc4 --- /dev/null +++ b/connectivity/source/drivers/firebird/OSubComponent.hxx @@ -0,0 +1,254 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * The Contents of this file are made available subject to the terms of + * the BSD license. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of Sun Microsystems, Inc. nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE + * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + *************************************************************************/ + +#ifndef _CONNECTIVITY_OSUBCOMPONENT_HXX_ +#define _CONNECTIVITY_OSUBCOMPONENT_HXX_ + +#include <cppuhelper/weak.hxx> +#include <cppuhelper/interfacecontainer.h> +#include <com/sun/star/lang/DisposedException.hpp> +#include <cppuhelper/propshlp.hxx> +#include <osl/mutex.hxx> +#include <osl/diagnose.h> + +namespace cppu { + class IPropertyArrayHelper; +} + +namespace com +{ + namespace sun + { + namespace star + { + namespace lang + { + class XComponent; + } + } + } +} +namespace connectivity +{ + + namespace firebird + { + void release(oslInterlockedCount& _refCount, + ::cppu::OBroadcastHelper& rBHelper, + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _xInterface, + ::com::sun::star::lang::XComponent* _pObject); + + void checkDisposed(sal_Bool _bThrow) throw ( ::com::sun::star::lang::DisposedException ); + //************************************************************ + // OSubComponent + //************************************************************ + template <class SELF, class WEAK> class OSubComponent + { + protected: + // the parent must support the tunnel implementation + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > m_xParent; + SELF* m_pDerivedImplementation; + + public: + OSubComponent( + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _xParent, + SELF* _pDerivedImplementation) + :m_xParent(_xParent) + ,m_pDerivedImplementation(_pDerivedImplementation) + { + } + + protected: + void dispose_ChildImpl() + { + ::osl::MutexGuard aGuard( m_pDerivedImplementation->rBHelper.rMutex ); + m_xParent = NULL; + } + void relase_ChildImpl() + { + release(m_pDerivedImplementation->m_refCount, + m_pDerivedImplementation->rBHelper, + m_xParent, + m_pDerivedImplementation); + + m_pDerivedImplementation->WEAK::release(); + } + }; + + + template <class TYPE> + class OPropertyArrayUsageHelper + { + protected: + static sal_Int32 s_nRefCount; + static ::cppu::IPropertyArrayHelper* s_pProps; + static ::osl::Mutex s_aMutex; + + public: + OPropertyArrayUsageHelper(); + virtual ~OPropertyArrayUsageHelper() + { // ARGHHHHHHH ..... would like to implement this in proparrhlp_impl.hxx (as we do with all other methods) + // but SUNPRO 5 compiler (linker) doesn't like this + ::osl::MutexGuard aGuard(s_aMutex); + OSL_ENSURE(s_nRefCount > 0, "OPropertyArrayUsageHelper::~OPropertyArrayUsageHelper : suspicious call : have a refcount of 0 !"); + if (!--s_nRefCount) + { + delete s_pProps; + s_pProps = NULL; + } + } + + /** call this in the getInfoHelper method of your derived class. The method returns the array helper of the + class, which is created if neccessary. + */ + ::cppu::IPropertyArrayHelper* getArrayHelper(); + + protected: + /** used to implement the creation of the array helper which is shared amongst all instances of the class. + This method needs to be implemented in derived classes. + <BR> + The method gets called with s_aMutex acquired. + <BR> + as long as IPropertyArrayHelper has no virtual destructor, the implementation of ~OPropertyArrayUsageHelper + assumes that you created an ::cppu::OPropertyArrayHelper when deleting s_pProps. + @return an pointer to the newly created array helper. Must not be NULL. + */ + virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const = 0; + }; + + template<class TYPE> + sal_Int32 OPropertyArrayUsageHelper< TYPE >::s_nRefCount = 0; + + template<class TYPE> + ::cppu::IPropertyArrayHelper* OPropertyArrayUsageHelper< TYPE >::s_pProps = NULL; + + template<class TYPE> + ::osl::Mutex OPropertyArrayUsageHelper< TYPE >::s_aMutex; + + //------------------------------------------------------------------ + template <class TYPE> + OPropertyArrayUsageHelper<TYPE>::OPropertyArrayUsageHelper() + { + ::osl::MutexGuard aGuard(s_aMutex); + ++s_nRefCount; + } + + //------------------------------------------------------------------ + template <class TYPE> + ::cppu::IPropertyArrayHelper* OPropertyArrayUsageHelper<TYPE>::getArrayHelper() + { + OSL_ENSURE(s_nRefCount, "OPropertyArrayUsageHelper::getArrayHelper : suspicious call : have a refcount of 0 !"); + if (!s_pProps) + { + ::osl::MutexGuard aGuard(s_aMutex); + if (!s_pProps) + { + s_pProps = createArrayHelper(); + OSL_ENSURE(s_pProps, "OPropertyArrayUsageHelper::getArrayHelper : createArrayHelper returned nonsense !"); + } + } + return s_pProps; + } + + + + class OBase_Mutex + { + public: + ::osl::Mutex m_aMutex; + }; + + namespace internal + { + template <class T> + void implCopySequence(const T* _pSource, T*& _pDest, sal_Int32 _nSourceLen) + { + for (sal_Int32 i=0; i<_nSourceLen; ++i, ++_pSource, ++_pDest) + *_pDest = *_pSource; + } + } + //------------------------------------------------------------------------- + /// concat two sequences + template <class T> + ::com::sun::star::uno::Sequence<T> concatSequences(const ::com::sun::star::uno::Sequence<T>& _rLeft, const ::com::sun::star::uno::Sequence<T>& _rRight) + { + sal_Int32 nLeft(_rLeft.getLength()), nRight(_rRight.getLength()); + const T* pLeft = _rLeft.getConstArray(); + const T* pRight = _rRight.getConstArray(); + + sal_Int32 nReturnLen(nLeft + nRight); + ::com::sun::star::uno::Sequence<T> aReturn(nReturnLen); + T* pReturn = aReturn.getArray(); + + internal::implCopySequence(pLeft, pReturn, nLeft); + internal::implCopySequence(pRight, pReturn, nRight); + + return aReturn; + } + + +#define DECLARE_SERVICE_INFO() \ + 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( ) throw(::com::sun::star::uno::RuntimeException) \ + +#define IMPLEMENT_SERVICE_INFO(classname, implasciiname, serviceasciiname) \ + ::rtl::OUString SAL_CALL classname::getImplementationName( ) throw (::com::sun::star::uno::RuntimeException) \ + { \ + return ::rtl::OUString::createFromAscii(implasciiname); \ + } \ + ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL classname::getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException) \ + { \ + ::com::sun::star::uno::Sequence< ::rtl::OUString > aSupported(1); \ + aSupported[0] = ::rtl::OUString::createFromAscii(serviceasciiname); \ + return aSupported; \ + } \ + sal_Bool SAL_CALL classname::supportsService( const ::rtl::OUString& _rServiceName ) throw(::com::sun::star::uno::RuntimeException) \ + { \ + Sequence< ::rtl::OUString > aSupported(getSupportedServiceNames()); \ + const ::rtl::OUString* pSupported = aSupported.getConstArray(); \ + const ::rtl::OUString* pEnd = pSupported + aSupported.getLength(); \ + for (;pSupported != pEnd && !pSupported->equals(_rServiceName); ++pSupported) \ + ; \ + \ + return pSupported != pEnd; \ + } \ + + + } +} +#endif // _CONNECTIVITY_OSUBCOMPONENT_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/drivers/firebird/OTypeInfo.hxx b/connectivity/source/drivers/firebird/OTypeInfo.hxx new file mode 100644 index 000000000000..dffe3e68976c --- /dev/null +++ b/connectivity/source/drivers/firebird/OTypeInfo.hxx @@ -0,0 +1,100 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * The Contents of this file are made available subject to the terms of + * the BSD license. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of Sun Microsystems, Inc. nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE + * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + *************************************************************************/ + +#ifndef _CONNECTIVITY_OTYPEINFO_HXX_ +#define _CONNECTIVITY_OTYPEINFO_HXX_ + +#include <com/sun/star/sdbc/ColumnSearch.hpp> +#include <com/sun/star/sdbc/DataType.hpp> + +namespace connectivity +{ + struct OTypeInfo + { + ::rtl::OUString aTypeName; // Name of the the type in the database + ::rtl::OUString aLiteralPrefix; // Prefix for literals + ::rtl::OUString aLiteralSuffix; // Suffix for literals + ::rtl::OUString aCreateParams; // Parameters to create + ::rtl::OUString aLocalTypeName; + + sal_Int32 nPrecision; // Length of the types + + sal_Int16 nMaximumScale; // Decimal places (precision) + sal_Int16 nMinimumScale; // Min decimal places (precision) + + sal_Int16 nType; // Database type + sal_Int16 nSearchType; // Can search for the type + sal_Int16 nNumPrecRadix; // indicating the radix, which is usually 2 or 10 + + sal_Bool bCurrency : 1, // Currency + bAutoIncrement : 1, // Is this field auto incrementing? + bNullable : 1, // Can this field assume a NULL value? + bCaseSensitive : 1, // Is this type case-sensitive? + bUnsigned : 1, // Is this type unsigned? + bEmpty_1 : 1, // for later use + bEmpty_2 : 1; + + OTypeInfo() + :bCurrency(sal_False) + ,bAutoIncrement(sal_False) + ,bNullable(sal_True) + ,bCaseSensitive(sal_False) + ,bUnsigned(sal_False) + ,nMaximumScale(0) + ,nMinimumScale(0) + ,nType( ::com::sun::star::sdbc::DataType::OTHER) + ,nPrecision(0) + ,nSearchType( ::com::sun::star::sdbc::ColumnSearch::FULL) + {} + + inline static void * SAL_CALL operator new( size_t nSize ) SAL_THROW(()) + { return ::rtl_allocateMemory( nSize ); } + inline static void * SAL_CALL operator new( size_t nSize,void* _pHint ) SAL_THROW(()) + { return _pHint; } + inline static void SAL_CALL operator delete( void * pMem ) SAL_THROW(()) + { ::rtl_freeMemory( pMem ); } + inline static void SAL_CALL operator delete( void * pMem,void* _pHint ) SAL_THROW(()) + { } + + sal_Bool operator == (const OTypeInfo& lh) const { return lh.nType == nType; } + sal_Bool operator != (const OTypeInfo& lh) const { return lh.nType != nType; } + + inline ::rtl::OUString getDBName() const { return aTypeName; } + }; +} +#endif // _CONNECTIVITY_OTYPEINFO_HXX_ + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/drivers/firebird/firebird-sdbc.component b/connectivity/source/drivers/firebird/firebird-sdbc.component new file mode 100644 index 000000000000..2624f2e7b00b --- /dev/null +++ b/connectivity/source/drivers/firebird/firebird-sdbc.component @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * +--> + +<component loader="com.sun.star.loader.SharedLibrary" prefix="firebird" + xmlns="http://openoffice.org/2010/uno-components"> + <implementation name="com.sun.star.comp.sdbc.FirebirdDriver"> + <service name="com.sun.star.sdbc.Driver"/> + </implementation> +</component> diff --git a/connectivity/source/drivers/firebird/propertyids.cxx b/connectivity/source/drivers/firebird/propertyids.cxx new file mode 100644 index 000000000000..a20aa45a44b1 --- /dev/null +++ b/connectivity/source/drivers/firebird/propertyids.cxx @@ -0,0 +1,185 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * The Contents of this file are made available subject to the terms of + * the BSD license. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of Sun Microsystems, Inc. nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE + * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + *************************************************************************/ + +#include <osl/diagnose.h> +#include "propertyids.hxx" +namespace connectivity +{ +namespace firebird +{ + const sal_Char* getPROPERTY_QUERYTIMEOUT() { return "QueryTimeOut"; } + const sal_Char* getPROPERTY_MAXFIELDSIZE() { return "MaxFieldSize"; } + const sal_Char* getPROPERTY_MAXROWS() { return "MaxRows"; } + const sal_Char* getPROPERTY_CURSORNAME() { return "CursorName"; } + const sal_Char* getPROPERTY_RESULTSETCONCURRENCY() { return "ResultSetConcurrency"; } + const sal_Char* getPROPERTY_RESULTSETTYPE() { return "ResultSetType"; } + const sal_Char* getPROPERTY_FETCHDIRECTION() { return "FetchDirection"; } + const sal_Char* getPROPERTY_FETCHSIZE() { return "FetchSize"; } + const sal_Char* getPROPERTY_ESCAPEPROCESSING() { return "EscapeProcessing"; } + const sal_Char* getPROPERTY_USEBOOKMARKS() { return "UseBookmarks"; } + + const sal_Char* getPROPERTY_NAME() { return "Name"; } + const sal_Char* getPROPERTY_TYPE() { return "Type"; } + const sal_Char* getPROPERTY_TYPENAME() { return "TypeName"; } + const sal_Char* getPROPERTY_PRECISION() { return "Precision"; } + const sal_Char* getPROPERTY_SCALE() { return "Scale"; } + const sal_Char* getPROPERTY_ISNULLABLE() { return "IsNullable"; } + const sal_Char* getPROPERTY_ISAUTOINCREMENT() { return "IsAutoIncrement"; } + const sal_Char* getPROPERTY_ISROWVERSION() { return "IsRowVersion"; } + const sal_Char* getPROPERTY_DESCRIPTION() { return "Description"; } + const sal_Char* getPROPERTY_DEFAULTVALUE() { return "DefaultValue"; } + + const sal_Char* getPROPERTY_REFERENCEDTABLE() { return "ReferencedTable"; } + const sal_Char* getPROPERTY_UPDATERULE() { return "UpdateRule"; } + const sal_Char* getPROPERTY_DELETERULE() { return "DeleteRule"; } + const sal_Char* getPROPERTY_CATALOG() { return "Catalog"; } + const sal_Char* getPROPERTY_ISUNIQUE() { return "IsUnique"; } + const sal_Char* getPROPERTY_ISPRIMARYKEYINDEX() { return "IsPrimaryKeyIndex"; } + const sal_Char* getPROPERTY_ISCLUSTERED() { return "IsClustered"; } + const sal_Char* getPROPERTY_ISASCENDING() { return "IsAscending"; } + const sal_Char* getPROPERTY_SCHEMANAME() { return "SchemaName"; } + const sal_Char* getPROPERTY_CATALOGNAME() { return "CatalogName"; } + const sal_Char* getPROPERTY_COMMAND() { return "Command"; } + const sal_Char* getPROPERTY_CHECKOPTION() { return "CheckOption"; } + const sal_Char* getPROPERTY_PASSWORD() { return "Password"; } + const sal_Char* getPROPERTY_RELATEDCOLUMN() { return "RelatedColumn"; } + + const sal_Char* getSTAT_INVALID_INDEX() { return "Invalid descriptor index"; } + + const sal_Char* getPROPERTY_FUNCTION() { return "Function"; } + const sal_Char* getPROPERTY_TABLENAME() { return "TableName"; } + const sal_Char* getPROPERTY_REALNAME() { return "RealName"; } + const sal_Char* getPROPERTY_DBASEPRECISIONCHANGED() { return "DbasePrecisionChanged"; } + const sal_Char* getPROPERTY_ISCURRENCY() { return "IsCurrency"; } + const sal_Char* getPROPERTY_ISBOOKMARKABLE() { return "IsBookmarkable"; } + + const sal_Char* getPROPERTY_FORMATKEY() { return "FormatKey"; } + const sal_Char* getPROPERTY_LOCALE() { return "Locale"; } + + const sal_Char* getPROPERTY_AUTOINCREMENTCREATION() { return "AutoIncrementCreation"; } + const sal_Char* getPROPERTY_PRIVILEGES() { return "Privileges"; } + //============================================================ + //= error messages + //============================================================ + const sal_Char* getERRORMSG_SEQUENCE() { return "Function sequence error"; } + const sal_Char* getSQLSTATE_SEQUENCE() { return "HY010"; } + const sal_Char* getSQLSTATE_GENERAL() { return "HY0000"; } + const sal_Char* getSTR_DELIMITER() { return "/"; } + + OPropertyMap::~OPropertyMap() + { + ::std::map<sal_Int32 , rtl_uString*>::iterator aIter = m_aPropertyMap.begin(); + for(;aIter != m_aPropertyMap.end();++aIter) + if(aIter->second) + rtl_uString_release(aIter->second); + } + // ------------------------------------------------------------------------------ + ::rtl::OUString OPropertyMap::getNameByIndex(sal_Int32 _nIndex) const + { + ::rtl::OUString sRet; + ::std::map<sal_Int32 , rtl_uString*>::const_iterator aIter = m_aPropertyMap.find(_nIndex); + if(aIter == m_aPropertyMap.end()) + sRet = const_cast<OPropertyMap*>(this)->fillValue(_nIndex); + else + sRet = aIter->second; + return sRet; + } + // ------------------------------------------------------------------------------ + ::rtl::OUString OPropertyMap::fillValue(sal_Int32 _nIndex) + { + rtl_uString* pStr = NULL; + switch(_nIndex) + { + case PROPERTY_ID_QUERYTIMEOUT: { rtl_uString_newFromAscii(&pStr,getPROPERTY_QUERYTIMEOUT() ); break; } + case PROPERTY_ID_MAXFIELDSIZE: { rtl_uString_newFromAscii(&pStr,getPROPERTY_MAXFIELDSIZE() ); break; } + case PROPERTY_ID_MAXROWS: { rtl_uString_newFromAscii(&pStr,getPROPERTY_MAXROWS() ); break; } + case PROPERTY_ID_CURSORNAME: { rtl_uString_newFromAscii(&pStr,getPROPERTY_CURSORNAME() ); break; } + case PROPERTY_ID_RESULTSETCONCURRENCY: { rtl_uString_newFromAscii(&pStr,getPROPERTY_RESULTSETCONCURRENCY() ); break; } + case PROPERTY_ID_RESULTSETTYPE: { rtl_uString_newFromAscii(&pStr,getPROPERTY_RESULTSETTYPE() ); break; } + case PROPERTY_ID_FETCHDIRECTION: { rtl_uString_newFromAscii(&pStr,getPROPERTY_FETCHDIRECTION() ); break; } + case PROPERTY_ID_FETCHSIZE: { rtl_uString_newFromAscii(&pStr,getPROPERTY_FETCHSIZE() ); break; } + case PROPERTY_ID_ESCAPEPROCESSING: { rtl_uString_newFromAscii(&pStr,getPROPERTY_ESCAPEPROCESSING() ); break; } + case PROPERTY_ID_USEBOOKMARKS: { rtl_uString_newFromAscii(&pStr,getPROPERTY_USEBOOKMARKS() ); break; } + // Column + case PROPERTY_ID_NAME: { rtl_uString_newFromAscii(&pStr,getPROPERTY_NAME() ); break; } + case PROPERTY_ID_TYPE: { rtl_uString_newFromAscii(&pStr,getPROPERTY_TYPE() ); break; } + case PROPERTY_ID_TYPENAME: { rtl_uString_newFromAscii(&pStr,getPROPERTY_TYPENAME() ); break; } + case PROPERTY_ID_PRECISION: { rtl_uString_newFromAscii(&pStr,getPROPERTY_PRECISION() ); break; } + case PROPERTY_ID_SCALE: { rtl_uString_newFromAscii(&pStr,getPROPERTY_SCALE() ); break; } + case PROPERTY_ID_ISNULLABLE: { rtl_uString_newFromAscii(&pStr,getPROPERTY_ISNULLABLE() ); break; } + case PROPERTY_ID_ISAUTOINCREMENT: { rtl_uString_newFromAscii(&pStr,getPROPERTY_ISAUTOINCREMENT() ); break; } + case PROPERTY_ID_ISROWVERSION: { rtl_uString_newFromAscii(&pStr,getPROPERTY_ISROWVERSION() ); break; } + case PROPERTY_ID_DESCRIPTION: { rtl_uString_newFromAscii(&pStr,getPROPERTY_DESCRIPTION() ); break; } + case PROPERTY_ID_DEFAULTVALUE: { rtl_uString_newFromAscii(&pStr,getPROPERTY_DEFAULTVALUE() ); break; } + + case PROPERTY_ID_REFERENCEDTABLE: { rtl_uString_newFromAscii(&pStr,getPROPERTY_REFERENCEDTABLE() ); break; } + case PROPERTY_ID_UPDATERULE: { rtl_uString_newFromAscii(&pStr,getPROPERTY_UPDATERULE() ); break; } + case PROPERTY_ID_DELETERULE: { rtl_uString_newFromAscii(&pStr,getPROPERTY_DELETERULE() ); break; } + case PROPERTY_ID_CATALOG: { rtl_uString_newFromAscii(&pStr,getPROPERTY_CATALOG() ); break; } + case PROPERTY_ID_ISUNIQUE: { rtl_uString_newFromAscii(&pStr,getPROPERTY_ISUNIQUE() ); break; } + case PROPERTY_ID_ISPRIMARYKEYINDEX: { rtl_uString_newFromAscii(&pStr,getPROPERTY_ISPRIMARYKEYINDEX() ); break; } + case PROPERTY_ID_ISCLUSTERED: { rtl_uString_newFromAscii(&pStr,getPROPERTY_ISCLUSTERED() ); break; } + case PROPERTY_ID_ISASCENDING: { rtl_uString_newFromAscii(&pStr,getPROPERTY_ISASCENDING() ); break; } + case PROPERTY_ID_SCHEMANAME: { rtl_uString_newFromAscii(&pStr,getPROPERTY_SCHEMANAME() ); break; } + case PROPERTY_ID_CATALOGNAME: { rtl_uString_newFromAscii(&pStr,getPROPERTY_CATALOGNAME() ); break; } + + case PROPERTY_ID_COMMAND: { rtl_uString_newFromAscii(&pStr,getPROPERTY_COMMAND() ); break; } + case PROPERTY_ID_CHECKOPTION: { rtl_uString_newFromAscii(&pStr,getPROPERTY_CHECKOPTION() ); break; } + case PROPERTY_ID_PASSWORD: { rtl_uString_newFromAscii(&pStr,getPROPERTY_PASSWORD() ); break; } + case PROPERTY_ID_RELATEDCOLUMN: { rtl_uString_newFromAscii(&pStr,getPROPERTY_RELATEDCOLUMN() ); break; } + + case PROPERTY_ID_FUNCTION: { rtl_uString_newFromAscii(&pStr,getPROPERTY_FUNCTION() ); break; } + case PROPERTY_ID_TABLENAME: { rtl_uString_newFromAscii(&pStr,getPROPERTY_TABLENAME() ); break; } + case PROPERTY_ID_REALNAME: { rtl_uString_newFromAscii(&pStr,getPROPERTY_REALNAME() ); break; } + case PROPERTY_ID_DBASEPRECISIONCHANGED: { rtl_uString_newFromAscii(&pStr,getPROPERTY_DBASEPRECISIONCHANGED() ); break; } + case PROPERTY_ID_ISCURRENCY: { rtl_uString_newFromAscii(&pStr,getPROPERTY_ISCURRENCY() ); break; } + case PROPERTY_ID_ISBOOKMARKABLE: { rtl_uString_newFromAscii(&pStr,getPROPERTY_ISBOOKMARKABLE() ); break; } + case PROPERTY_ID_INVALID_INDEX: { rtl_uString_newFromAscii(&pStr,getSTAT_INVALID_INDEX() ); break; } + case PROPERTY_ID_ERRORMSG_SEQUENCE: { rtl_uString_newFromAscii(&pStr,getERRORMSG_SEQUENCE() ); break; } + case PROPERTY_ID_HY010: { rtl_uString_newFromAscii(&pStr,getSQLSTATE_SEQUENCE() ); break; } + case PROPERTY_ID_HY0000: { rtl_uString_newFromAscii(&pStr,getSQLSTATE_GENERAL() ); break; } + case PROPERTY_ID_DELIMITER: { rtl_uString_newFromAscii(&pStr,getSTR_DELIMITER() ); break; } + case PROPERTY_ID_FORMATKEY: { rtl_uString_newFromAscii(&pStr,getPROPERTY_FORMATKEY() ); break; } + case PROPERTY_ID_LOCALE: { rtl_uString_newFromAscii(&pStr,getPROPERTY_LOCALE() ); break; } + case PROPERTY_ID_AUTOINCREMENTCREATION: { rtl_uString_newFromAscii(&pStr,getPROPERTY_AUTOINCREMENTCREATION() ); break; } + case PROPERTY_ID_PRIVILEGES: { rtl_uString_newFromAscii(&pStr,getPROPERTY_PRIVILEGES() ); break; } + } + m_aPropertyMap[_nIndex] = pStr; + return pStr; + } + } +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/drivers/firebird/propertyids.hxx b/connectivity/source/drivers/firebird/propertyids.hxx new file mode 100644 index 000000000000..4e8dcc1d6c8e --- /dev/null +++ b/connectivity/source/drivers/firebird/propertyids.hxx @@ -0,0 +1,163 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * The Contents of this file are made available subject to the terms of + * the BSD license. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of Sun Microsystems, Inc. nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE + * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + *************************************************************************/ + +#ifndef _CONNECTIVITY_PROPERTYIDS_HXX_ +#define _CONNECTIVITY_PROPERTYIDS_HXX_ + +// this define has to be set to split the names into different dll's or so's +// every dll has his own set of property names +#include <rtl/ustring.hxx> +#ifndef _MAP_ +#include <map> +#endif + +namespace connectivity +{ +namespace firebird +{ + class OPropertyMap + { + ::std::map<sal_Int32 , rtl_uString*> m_aPropertyMap; + + ::rtl::OUString fillValue(sal_Int32 _nIndex); + public: + OPropertyMap() + { + } + ~OPropertyMap(); + ::rtl::OUString getNameByIndex(sal_Int32 _nIndex) const; + + static OPropertyMap& getPropMap() + { + static OPropertyMap s_aPropMap; + return s_aPropMap; + } + }; + + + + typedef const sal_Char* (*PVFN)(); + + struct UStringDescription + { + const sal_Char* pZeroTerminatedName; + sal_Int32 nLength; + + UStringDescription(PVFN _fCharFkt); + operator ::rtl::OUString() const { return ::rtl::OUString(pZeroTerminatedName,nLength,RTL_TEXTENCODING_ASCII_US); } + ~UStringDescription(); + private: + UStringDescription(); + }; + } +} + + +//------------------------------------------------------------------------------ +#define DECL_PROP1IMPL(varname, type) \ +pProperties[nPos++] = ::com::sun::star::beans::Property(OPropertyMap::getPropMap().getNameByIndex(PROPERTY_ID_##varname), PROPERTY_ID_##varname, ::cppu::UnoType< type >::get(), +//------------------------------------------------------------------------------ +#define DECL_PROP0(varname, type) \ + DECL_PROP1IMPL(varname, type) 0) +//------------------------------------------------------------------------------ +#define DECL_BOOL_PROP1IMPL(varname) \ + pProperties[nPos++] = ::com::sun::star::beans::Property(OPropertyMap::getPropMap().getNameByIndex(PROPERTY_ID_##varname), PROPERTY_ID_##varname, ::getBooleanCppuType(), +//------------------------------------------------------------------------------ +#define DECL_BOOL_PROP0(varname) \ + DECL_BOOL_PROP1IMPL(varname) 0) + + +#define PROPERTY_ID_QUERYTIMEOUT 1 +#define PROPERTY_ID_MAXFIELDSIZE 2 +#define PROPERTY_ID_MAXROWS 3 +#define PROPERTY_ID_CURSORNAME 4 +#define PROPERTY_ID_RESULTSETCONCURRENCY 5 +#define PROPERTY_ID_RESULTSETTYPE 6 +#define PROPERTY_ID_FETCHDIRECTION 7 +#define PROPERTY_ID_FETCHSIZE 8 +#define PROPERTY_ID_ESCAPEPROCESSING 9 +#define PROPERTY_ID_USEBOOKMARKS 10 +// Column +#define PROPERTY_ID_NAME 11 +#define PROPERTY_ID_TYPE 12 +#define PROPERTY_ID_TYPENAME 13 +#define PROPERTY_ID_PRECISION 14 +#define PROPERTY_ID_SCALE 15 +#define PROPERTY_ID_ISNULLABLE 16 +#define PROPERTY_ID_ISAUTOINCREMENT 17 +#define PROPERTY_ID_ISROWVERSION 18 +#define PROPERTY_ID_DESCRIPTION 19 +#define PROPERTY_ID_DEFAULTVALUE 20 + +#define PROPERTY_ID_REFERENCEDTABLE 21 +#define PROPERTY_ID_UPDATERULE 22 +#define PROPERTY_ID_DELETERULE 23 +#define PROPERTY_ID_CATALOG 24 +#define PROPERTY_ID_ISUNIQUE 25 +#define PROPERTY_ID_ISPRIMARYKEYINDEX 26 +#define PROPERTY_ID_ISCLUSTERED 27 +#define PROPERTY_ID_ISASCENDING 28 +#define PROPERTY_ID_SCHEMANAME 29 +#define PROPERTY_ID_CATALOGNAME 30 + +#define PROPERTY_ID_COMMAND 31 +#define PROPERTY_ID_CHECKOPTION 32 +#define PROPERTY_ID_PASSWORD 33 +#define PROPERTY_ID_RELATEDCOLUMN 34 + +#define PROPERTY_ID_FUNCTION 35 +#define PROPERTY_ID_TABLENAME 36 +#define PROPERTY_ID_REALNAME 37 +#define PROPERTY_ID_DBASEPRECISIONCHANGED 38 +#define PROPERTY_ID_ISCURRENCY 39 +#define PROPERTY_ID_ISBOOKMARKABLE 40 + +#define PROPERTY_ID_INVALID_INDEX 41 +#define PROPERTY_ID_ERRORMSG_SEQUENCE 42 +#define PROPERTY_ID_HY010 43 +#define PROPERTY_ID_HY0000 44 +#define PROPERTY_ID_DELIMITER 45 +#define PROPERTY_ID_FORMATKEY 46 +#define PROPERTY_ID_LOCALE 47 +#define PROPERTY_ID_IM001 48 + +#define PROPERTY_ID_AUTOINCREMENTCREATION 49 + +#define PROPERTY_ID_PRIVILEGES 50 + +#endif // _CONNECTIVITY_PROPERTYIDS_HXX_ + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cppunit/unxlngx6/bin/DllPlugInTester b/cppunit/unxlngx6/bin/DllPlugInTester Binary files differnew file mode 100755 index 000000000000..e6446f3f0482 --- /dev/null +++ b/cppunit/unxlngx6/bin/DllPlugInTester diff --git a/download.lst b/download.lst index 976e02b1eccb..a3ce8b5545e3 100644 --- a/download.lst +++ b/download.lst @@ -6,6 +6,10 @@ MWAW_MD5SUM := 2289bb137bbba9b473ce60168895c036 export MWAW_TARBALL := libmwaw-0.1.10.tar.bz2 VISIO_MD5SUM := 9d9eb3ae6bee763c161228b2b12e25f8 export VISIO_TARBALL := libvisio-0.0.30.tar.bz2 +FIREBIRD_MD5SUM := 21154d2004e025c8a3666625b0357bb5 +export FIREBIRD_TARBALL := Firebird-2.5.2.26540-0.tar.bz2 +# FIREBIRD_MD5SUM := b259c2d1c60a03bd104108405ae990a7 +# export FIREBIRD_TARBALL := Firebird-3.0-alpha1-20130302.tar.gz export AFMS_TARBALL := 1756c4fa6c616ae15973c104cd8cb256-Adobe-Core35_AFMs-314.tar.gz export APACHE_COMMONS_CODEC_TARBALL := 2e482c7567908d334785ce7d69ddfff7-commons-codec-1.6-src.tar.gz diff --git a/firebird/ExternalPackage_firebird.mk b/firebird/ExternalPackage_firebird.mk new file mode 100644 index 000000000000..d02037d46183 --- /dev/null +++ b/firebird/ExternalPackage_firebird.mk @@ -0,0 +1,46 @@ +# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +$(eval $(call gb_ExternalPackage_ExternalPackage,firebird,firebird)) + +$(eval $(call gb_ExternalPackage_use_external_project,firebird,firebird)) + +$(eval $(call gb_ExternalPackage_add_unpacked_files,firebird,inc/external/firebird,\ + gen/firebird/include/ib_util.h \ + gen/firebird/include/ibase.h \ + gen/firebird/include/iberror.h \ + gen/firebird/include/perf.h \ +)) + +# Need to be added? +# $(eval $(call gb_ExternalPackage_add_unpacked_files,firebird,share/firebird,\ +# gen/install/misc/firebird.conf \ +# )) +# $(eval $(call gb_ExternalPackage_add_unpacked_files,firebird,share/firebird,\ +# gen/firebird/firebird.msg \ +# )) +# $(eval $(call gb_ExternalPackage_add_unpacked_files,firebird,bin/firebird,\ +# gen/firebird/bin/isql \ +# gen/firebird/bin/isql_static \ +# )) +# $(eval $(call gb_ExternalPackage_add_unpacked_files,firebird,share/firebird,\ +# gen/install/misc/fbintl.conf \ +# )) +# $(eval $(call gb_ExternalPackage_add_unpacked_files,firebird,share/firebird,\ +# gen/firebird/intl/libfbintl.so \ +# )) +# $(eval $(call gb_ExternalPackage_add_unpacked_files,firebird,share/firebird,\ +# gen/firebird/security2.fdb \ +# )) + +$(eval $(call gb_ExternalPackage_add_library_for_install,firebird,lib/libfbembed.so.2.5.2,gen/firebird/lib/libfbembed.so.2.5.2)) + +$(eval $(call gb_ExternalPackage_add_file,firebird,lib/libfbembed.so.2.5.2,gen/firebird/lib/libfbembed.so.2.5.2)) + +# vim: set noet sw=4 ts=4: diff --git a/firebird/ExternalProject_firebird.mk b/firebird/ExternalProject_firebird.mk new file mode 100644 index 000000000000..231759b81dbd --- /dev/null +++ b/firebird/ExternalProject_firebird.mk @@ -0,0 +1,61 @@ +# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +$(eval $(call gb_ExternalProject_ExternalProject,firebird)) + +$(eval $(call gb_ExternalProject_use_unpacked,firebird,firebird)) + +$(eval $(call gb_ExternalProject_use_autoconf,firebird,build)) + +$(eval $(call gb_ExternalProject_use_externals,firebird,\ + boost_headers \ + icu \ +)) + +# Dependency in 2.5 +# $(eval $(call gb_ExternalProject_use_packages,firebird, \ +# atomic_op \ +# )) + +# Dependency in 3.0 +# $(eval $(call gb_ExternalProject_use_packages,firebird, \ +# tommath \ +# )) + +$(eval $(call gb_ExternalProject_register_targets,firebird,\ + build \ +)) + +# note: this can intentionally only build against internal atomic_op +# note: this can intentionally only build against internal tommath + +$(call gb_ExternalProject_get_state_target,firebird,build): + $(call gb_ExternalProject_run,build,\ + export CFLAGS="$(if $(filter TRUE,$(DISABLE_DYNLOADING)),-fvisibility=hidden)" \ + && export LDFLAGS="-L$(OUTDIR)/lib \ + $(if $(filter LINUX FREEBSD,$(OS)),-Wl$(COMMA)-z$(COMMA)origin -Wl$(COMMA)-rpath$(COMMA)\\"\$$\$$ORIGIN:'\'\$$\$$ORIGIN/../ure-link/lib") \ + $(if $(SYSBASE),$(if $(filter LINUX SOLARIS,$(OS)),-L$(SYSBASE)/lib -L$(SYSBASE)/usr/lib -lpthread -ldl))" \ + && CPPFLAGS="-I$(OUTDIR)/inc/external $(if $(SYSBASE),-I$(SYSBASE)/usr/include)" \ + && export ICU_LIBS=" " \ + && export ICU_CFLAGS="$(if $(filter NO,$(SYSTEM_ICU)),\ + -I$(call gb_UnpackedTarball_get_dir,icu)/source/i18n \ + -I$(call gb_UnpackedTarball_get_dir,icu)/source/common, )" \ + && export PKG_CONFIG="" \ + && ./configure \ + --with-system-icu \ + --without-editline \ + --disable-superserver \ + $(if $(filter NO,$(SYSTEM_BOOST)),CXXFLAGS=-I$(call gb_UnpackedTarball_get_dir,boost),CXXFLAGS=$(BOOST_CPPFLAGS)) \ + $(if $(filter YES,$(CROSS_COMPILING)),--build=$(BUILD_PLATFORM) --host=$(HOST_PLATFORM)) \ + $(if $(filter MACOSX,$(OS)),--prefix=/@.__________________________________________________OOO) \ + $(if $(filter IOS ANDROID,$(OS)),--disable-shared,--disable-static) \ + && $(MAKE) firebird_embedded \ + ) + +# vim: set noet sw=4 ts=4: diff --git a/firebird/Makefile b/firebird/Makefile new file mode 100644 index 000000000000..ccb1c85a04da --- /dev/null +++ b/firebird/Makefile @@ -0,0 +1,7 @@ +# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- + +module_directory:=$(dir $(realpath $(firstword $(MAKEFILE_LIST)))) + +include $(module_directory)/../solenv/gbuild/partial_build.mk + +# vim: set noet sw=4 ts=4: diff --git a/firebird/Module_firebird.mk b/firebird/Module_firebird.mk new file mode 100644 index 000000000000..7c8fca0b02ee --- /dev/null +++ b/firebird/Module_firebird.mk @@ -0,0 +1,23 @@ +# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +$(eval $(call gb_Module_Module,firebird)) + +ifeq ($(SYSTEM_FIREBIRD),NO) +$(eval $(call gb_Module_add_targets,firebird,\ + UnpackedTarball_firebird \ +)) + +$(eval $(call gb_Module_add_targets,firebird,\ + ExternalPackage_firebird \ + ExternalProject_firebird \ +)) +endif + +# vim: set noet sw=4 ts=4: diff --git a/firebird/UnpackedTarball_firebird.mk b/firebird/UnpackedTarball_firebird.mk new file mode 100644 index 000000000000..ebdfab808c78 --- /dev/null +++ b/firebird/UnpackedTarball_firebird.mk @@ -0,0 +1,14 @@ +# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +$(eval $(call gb_UnpackedTarball_UnpackedTarball,firebird)) + +$(eval $(call gb_UnpackedTarball_set_tarball,firebird,$(FIREBIRD_TARBALL))) + +# vim: set noet sw=4 ts=4: diff --git a/postprocess/CustomTarget_registry.mk b/postprocess/CustomTarget_registry.mk index 38758b26f9f5..6963c9759490 100644 --- a/postprocess/CustomTarget_registry.mk +++ b/postprocess/CustomTarget_registry.mk @@ -426,6 +426,13 @@ postprocess_FILES_postgresqlsdbc := $(postprocess_MOD)/org/openoffice/Office/Dat postprocess_DRIVERS += postgresql endif +ifeq ($(ENABLE_FIREBIRD_SDBC),TRUE) +postprocess_XCDS += firebirdsdbc.xcd +postprocess_DEPS_firebirdsdbc := main +postprocess_FILES_firebirdsdbc := $(postprocess_MOD)/org/openoffice/Office/DataAccess/Drivers-firebird.xcu +postprocess_DRIVERS += firebird +endif + ifeq (unx,$(GUIBASE)) ifneq (,$(or $(filter TRUEYES,$(ENABLE_GCONF)$(ENABLE_LOCKDOWN))$(filter TRUE,$(ENABLE_GIO)))) postprocess_XCDS += gnome.xcd diff --git a/scp2/InstallModule_base.mk b/scp2/InstallModule_base.mk index d9561421fd45..afa234670f69 100644 --- a/scp2/InstallModule_base.mk +++ b/scp2/InstallModule_base.mk @@ -27,6 +27,7 @@ $(eval $(call gb_InstallModule_add_scpfiles,scp2/base,\ $(eval $(call gb_InstallModule_add_localized_scpfiles,scp2/base,\ scp2/source/base/module_base \ scp2/source/base/postgresqlsdbc \ + scp2/source/base/firebirdsdbc \ )) # vim: set shiftwidth=4 tabstop=4 noexpandtab: diff --git a/scp2/source/base/firebirdsdbc.scp b/scp2/source/base/firebirdsdbc.scp new file mode 100644 index 000000000000..8ef1bdf4bfd7 --- /dev/null +++ b/scp2/source/base/firebirdsdbc.scp @@ -0,0 +1,33 @@ +#include "macros.inc" + +#if defined WITH_FIREBIRD_SDBC + +Module gid_Module_Optional_FirebirdSdbc + PackageInfo = "packinfo_office.txt"; + MOD_NAME_DESC(MODULE_OPTIONAL_FIREBIRDSDBC); + ParentID = gid_Module_Prg_Base_Bin; + Files = (gid_File_Lib_FirebirdSdbc, + gid_File_FirebirdSdbc_Rdb, + gid_File_FirebirdSdbc_Xcd); + Minimal = NO; + Default = YES; + Styles = (); +End + +STD_LIB_FILE(gid_File_Lib_FirebirdSdbc, postgresql-sdbc) + +File gid_File_FirebirdSdbc_Rdb + TXT_FILE_BODY; + Dir = gid_Brand_Dir_Program_Services; + Name = "firebird-sdbc.rdb"; + Styles = (PACKED); +End + +File gid_File_FirebirdSdbc_Xcd + TXT_FILE_BODY; + Dir = gid_Brand_Dir_Share_Registry; + Name = "firebirdsdbc.xcd"; + Styles = (PACKED); +End + +#endif diff --git a/scp2/source/base/firebirdsdbc.ulf b/scp2/source/base/firebirdsdbc.ulf new file mode 100644 index 000000000000..477db352eed3 --- /dev/null +++ b/scp2/source/base/firebirdsdbc.ulf @@ -0,0 +1,14 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +[STR_NAME_MODULE_OPTIONAL_EXTENSIONS_FIREBIRDSDBC] +en-US = "Firebird Connector" + +[STR_DESC_MODULE_OPTIONAL_EXTENSIONS_FIREBIRDSDBC] +en-US = "Firebird Connector" diff --git a/setup_native/source/packinfo/packinfo_office.txt b/setup_native/source/packinfo/packinfo_office.txt index 4fbad6351d05..6982a213858e 100644 --- a/setup_native/source/packinfo/packinfo_office.txt +++ b/setup_native/source/packinfo/packinfo_office.txt @@ -1200,6 +1200,21 @@ packageversion = "%PACKAGEVERSION" End Start +module = "gid_Module_Optional_FirebirdSdbc" +solarispackagename = "%BASISPACKAGEPREFIX%WITHOUTDOTPRODUCTVERSION-firebird-sdbc" +solarisrequires = "%BASISPACKAGEPREFIX%WITHOUTDOTPRODUCTVERSION-base" +packagename = "%BASISPACKAGEPREFIX%PRODUCTVERSION-postgresql-sdbc" +freebsdrequires = "%BASISPACKAGEPREFIX%PRODUCTVERSION-base" +requires = "%BASISPACKAGEPREFIX%PRODUCTVERSION-base" +copyright = "2012 The Document Foundation" +solariscopyright = "solariscopyrightfile" +vendor = "The Document Foundation" +description = "Firebird Connector driver for %PRODUCTNAME %PRODUCTVERSION" +destpath = "/opt" +packageversion = "%PACKAGEVERSION" +End + +Start module = "gid_Module_Pdfimport" solarispackagename = "%BASISPACKAGEPREFIX%WITHOUTDOTPRODUCTVERSION-extension-pdf-import" solarisrequires = "%BASISPACKAGEPREFIX%WITHOUTDOTPRODUCTVERSION-core01 (Name="Core module for %PRODUCTNAME %PRODUCTVERSION"), %BASISPACKAGEPREFIX%WITHOUTDOTPRODUCTVERSION-core02 (Name="Core module for %PRODUCTNAME %PRODUCTVERSION"), %BASISPACKAGEPREFIX%WITHOUTDOTPRODUCTVERSION-core03 (Name="Core module for %PRODUCTNAME %PRODUCTVERSION"), %BASISPACKAGEPREFIX%WITHOUTDOTPRODUCTVERSION-core04 (Name="Core module for %PRODUCTNAME %PRODUCTVERSION"), %BASISPACKAGEPREFIX%WITHOUTDOTPRODUCTVERSION-core05 (Name="Core module for %PRODUCTNAME %PRODUCTVERSION"), %BASISPACKAGEPREFIX%WITHOUTDOTPRODUCTVERSION-core06 (Name="Core module for %PRODUCTNAME %PRODUCTVERSION"), %BASISPACKAGEPREFIX%WITHOUTDOTPRODUCTVERSION-core07 (Name="Core module for %PRODUCTNAME %PRODUCTVERSION")" |