summaryrefslogtreecommitdiff
path: root/connectivity/inc
diff options
context:
space:
mode:
Diffstat (limited to 'connectivity/inc')
-rw-r--r--connectivity/inc/connectivity/BlobHelper.hxx51
-rw-r--r--connectivity/inc/connectivity/CommonTools.hxx216
-rw-r--r--connectivity/inc/connectivity/ConnectionWrapper.hxx98
-rw-r--r--connectivity/inc/connectivity/DateConversion.hxx94
-rwxr-xr-xconnectivity/inc/connectivity/DriversConfig.hxx87
-rw-r--r--connectivity/inc/connectivity/FValue.hxx467
-rw-r--r--connectivity/inc/connectivity/IParseContext.hxx108
-rw-r--r--connectivity/inc/connectivity/PColumn.hxx148
-rw-r--r--connectivity/inc/connectivity/ParameterCont.hxx59
-rw-r--r--connectivity/inc/connectivity/SQLStatementHelper.hxx54
-rw-r--r--connectivity/inc/connectivity/StdTypeDefs.hxx48
-rw-r--r--connectivity/inc/connectivity/TColumnsHelper.hxx70
-rw-r--r--connectivity/inc/connectivity/TIndex.hxx56
-rw-r--r--connectivity/inc/connectivity/TIndexColumns.hxx50
-rw-r--r--connectivity/inc/connectivity/TIndexes.hxx57
-rw-r--r--connectivity/inc/connectivity/TKey.hxx54
-rw-r--r--connectivity/inc/connectivity/TKeyColumns.hxx50
-rw-r--r--connectivity/inc/connectivity/TKeys.hxx66
-rw-r--r--connectivity/inc/connectivity/TTableHelper.hxx173
-rw-r--r--connectivity/inc/connectivity/conncleanup.hxx97
-rw-r--r--connectivity/inc/connectivity/dbcharset.hxx168
-rw-r--r--connectivity/inc/connectivity/dbconversion.hxx224
-rw-r--r--connectivity/inc/connectivity/dbexception.hxx377
-rw-r--r--connectivity/inc/connectivity/dbmetadata.hxx200
-rw-r--r--connectivity/inc/connectivity/dbtools.hxx825
-rw-r--r--connectivity/inc/connectivity/dbtoolsdllapi.hxx40
-rw-r--r--connectivity/inc/connectivity/filtermanager.hxx131
-rw-r--r--connectivity/inc/connectivity/formattedcolumnvalue.hxx119
-rw-r--r--connectivity/inc/connectivity/parameters.hxx426
-rw-r--r--connectivity/inc/connectivity/paramwrapper.hxx208
-rw-r--r--connectivity/inc/connectivity/predicateinput.hxx126
-rw-r--r--connectivity/inc/connectivity/sdbcx/IRefreshable.hxx57
-rw-r--r--connectivity/inc/connectivity/sdbcx/VCatalog.hxx132
-rw-r--r--connectivity/inc/connectivity/sdbcx/VCollection.hxx243
-rw-r--r--connectivity/inc/connectivity/sdbcx/VColumn.hxx118
-rw-r--r--connectivity/inc/connectivity/sdbcx/VDescriptor.hxx102
-rw-r--r--connectivity/inc/connectivity/sdbcx/VGroup.hxx113
-rw-r--r--connectivity/inc/connectivity/sdbcx/VIndex.hxx117
-rw-r--r--connectivity/inc/connectivity/sdbcx/VIndexColumn.hxx69
-rw-r--r--connectivity/inc/connectivity/sdbcx/VKey.hxx128
-rw-r--r--connectivity/inc/connectivity/sdbcx/VKeyColumn.hxx71
-rw-r--r--connectivity/inc/connectivity/sdbcx/VTable.hxx148
-rw-r--r--connectivity/inc/connectivity/sdbcx/VTypeDef.hxx47
-rw-r--r--connectivity/inc/connectivity/sdbcx/VUser.hxx107
-rw-r--r--connectivity/inc/connectivity/sdbcx/VView.hxx108
-rw-r--r--connectivity/inc/connectivity/sqlerror.hxx340
-rw-r--r--connectivity/inc/connectivity/sqliterator.hxx366
-rw-r--r--connectivity/inc/connectivity/sqlnode.hxx473
-rw-r--r--connectivity/inc/connectivity/sqlparse.hxx261
-rw-r--r--connectivity/inc/connectivity/standardsqlstate.hxx73
-rw-r--r--connectivity/inc/connectivity/statementcomposer.hxx111
-rw-r--r--connectivity/inc/connectivity/virtualdbtools.hxx358
-rw-r--r--connectivity/inc/connectivity/warningscontainer.hxx107
-rw-r--r--connectivity/inc/makefile.mk47
-rw-r--r--connectivity/inc/pch/precompiled_connectivity.cxx29
-rw-r--r--connectivity/inc/pch/precompiled_connectivity.hxx334
56 files changed, 9006 insertions, 0 deletions
diff --git a/connectivity/inc/connectivity/BlobHelper.hxx b/connectivity/inc/connectivity/BlobHelper.hxx
new file mode 100644
index 000000000000..3a16911524ab
--- /dev/null
+++ b/connectivity/inc/connectivity/BlobHelper.hxx
@@ -0,0 +1,51 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CONNECTIVITY_BLOBHELPER_HXX_
+#define _CONNECTIVITY_BLOBHELPER_HXX_
+
+#include "connectivity/dbtoolsdllapi.hxx"
+#include <com/sun/star/sdbc/XBlob.hpp>
+#include <cppuhelper/implbase1.hxx>
+
+namespace connectivity
+{
+ class OOO_DLLPUBLIC_DBTOOLS BlobHelper : public ::cppu::WeakImplHelper1< com::sun::star::sdbc::XBlob >
+ {
+ ::com::sun::star::uno::Sequence< sal_Int8 > m_aValue;
+ public:
+ BlobHelper(const ::com::sun::star::uno::Sequence< sal_Int8 >& _val);
+ private:
+ virtual ::sal_Int64 SAL_CALL length( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::sal_Int8 > SAL_CALL getBytes( ::sal_Int64 pos, ::sal_Int32 length ) 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( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int64 SAL_CALL position( const ::com::sun::star::uno::Sequence< ::sal_Int8 >& pattern, ::sal_Int64 start ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int64 SAL_CALL positionOfBlob( const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XBlob >& pattern, ::sal_Int64 start ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ };
+}
+
+#endif //_CONNECTIVITY_BLOBHELPER_HXX_
+
diff --git a/connectivity/inc/connectivity/CommonTools.hxx b/connectivity/inc/connectivity/CommonTools.hxx
new file mode 100644
index 000000000000..c3409678f274
--- /dev/null
+++ b/connectivity/inc/connectivity/CommonTools.hxx
@@ -0,0 +1,216 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CONNECTIVITY_COMMONTOOLS_HXX_
+#define _CONNECTIVITY_COMMONTOOLS_HXX_
+
+#include <rtl/ustring.hxx>
+#include <com/sun/star/lang/DisposedException.hpp>
+#include <com/sun/star/uno/Any.hxx>
+#ifndef _VECTOR_
+#include <vector>
+#endif
+#include <cppuhelper/weakref.hxx>
+#include <comphelper/stl_types.hxx>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
+#include <osl/interlck.h>
+#include <jvmaccess/virtualmachine.hxx>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include "connectivity/dbtoolsdllapi.hxx"
+
+namespace com { namespace sun { namespace star { namespace util {
+ struct Date;
+ struct DateTime;
+ struct Time;
+}
+}}}
+
+namespace connectivity
+{
+ //------------------------------------------------------------------------------
+ OOO_DLLPUBLIC_DBTOOLS sal_Bool match(const sal_Unicode* pWild, const sal_Unicode* pStr, const sal_Unicode cEscape);
+ //------------------------------------------------------------------------------
+ OOO_DLLPUBLIC_DBTOOLS rtl::OUString toString(const ::com::sun::star::uno::Any& rValue);
+ OOO_DLLPUBLIC_DBTOOLS rtl::OUString toDateString(const ::com::sun::star::util::Date& rDate);
+ OOO_DLLPUBLIC_DBTOOLS rtl::OUString toTimeString(const ::com::sun::star::util::Time& rTime);
+ OOO_DLLPUBLIC_DBTOOLS rtl::OUString toDateTimeString(const ::com::sun::star::util::DateTime& rDateTime);
+
+ // typedefs
+ typedef std::vector< ::com::sun::star::uno::WeakReferenceHelper > OWeakRefArray;
+ typedef ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XColumnsSupplier> OSQLTable;
+
+ DECLARE_STL_MAP(::rtl::OUString,OSQLTable,comphelper::UStringMixLess, OSQLTables);
+
+ // -------------------------------------------------------------------------
+ // class ORefVector allows reference counting on a std::vector
+ // -------------------------------------------------------------------------
+ template< class VectorVal > class ORefVector
+ {
+ std::vector< VectorVal > m_vector;
+ oslInterlockedCount m_refCount;
+ // ORefVector(const ORefVector&);
+ // ORefVector& operator=(const ORefVector&);
+
+ protected:
+ virtual ~ORefVector(){}
+ public:
+ typedef std::vector< VectorVal > Vector;
+
+ ORefVector() : m_refCount(0) {}
+ ORefVector(size_t _st) : m_vector(_st) , m_refCount(0) {}
+ ORefVector(const ORefVector& _rRH) : m_vector(_rRH.m_vector),m_refCount(0)
+ {
+ }
+ ORefVector& operator=(const ORefVector& _rRH)
+ {
+ if ( &_rRH != this )
+ {
+ m_vector = _rRH.m_vector;
+ }
+ return *this;
+ }
+
+ std::vector< VectorVal > & get() { return m_vector; }
+ std::vector< VectorVal > const & get() const { return m_vector; }
+
+ inline static void * SAL_CALL operator new( size_t nSize ) SAL_THROW( () )
+ { return ::rtl_allocateMemory( nSize ); }
+ inline static void SAL_CALL operator delete( void * pMem ) SAL_THROW( () )
+ { ::rtl_freeMemory( pMem ); }
+ inline static void * SAL_CALL operator new( size_t, void * pMem ) SAL_THROW( () )
+ { return pMem; }
+ inline static void SAL_CALL operator delete( void *, void * ) SAL_THROW( () )
+ {}
+
+ void acquire()
+ {
+ osl_incrementInterlockedCount( &m_refCount );
+ }
+ void release()
+ {
+ if (! osl_decrementInterlockedCount( &m_refCount ))
+ delete this;
+ }
+
+ };
+ // -------------------------------------------------------------------------
+ // class ORowVector incudes refcounting and initialze himself
+ // with at least one element. This first element is reserved for
+ // the bookmark
+ // -------------------------------------------------------------------------
+ template< class VectorVal > class ORowVector : public ORefVector< VectorVal >
+ {
+ public:
+ ORowVector() : ORefVector< VectorVal >(1){}
+ ORowVector(size_t _st) : ORefVector< VectorVal >(_st+1)
+ {}
+ };
+
+ typedef ORefVector< ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet> > OSQLColumns;
+
+ // =======================================================================================
+ // search from __first to __last the column with the name _rVal
+ // when no such column exist __last is returned
+ OOO_DLLPUBLIC_DBTOOLS
+ OSQLColumns::Vector::const_iterator find( OSQLColumns::Vector::const_iterator __first,
+ OSQLColumns::Vector::const_iterator __last,
+ const ::rtl::OUString& _rVal,
+ const ::comphelper::UStringMixEqual& _rCase);
+ // =======================================================================================
+ // search from __first to __last the column with the realname _rVal
+ // when no such column exist __last is returned
+ OOO_DLLPUBLIC_DBTOOLS
+ OSQLColumns::Vector::const_iterator findRealName( OSQLColumns::Vector::const_iterator __first,
+ OSQLColumns::Vector::const_iterator __last,
+ const ::rtl::OUString& _rVal,
+ const ::comphelper::UStringMixEqual& _rCase);
+
+ // =======================================================================================
+ // the first two find methods are much faster than the one below
+ // =======================================================================================
+ // search from __first to __last the column with the property _rProp equals the value _rVal
+ // when no such column exist __last is returned
+ OOO_DLLPUBLIC_DBTOOLS
+ OSQLColumns::Vector::const_iterator find( OSQLColumns::Vector::const_iterator __first,
+ OSQLColumns::Vector::const_iterator __last,
+ const ::rtl::OUString& _rProp,
+ const ::rtl::OUString& _rVal,
+ const ::comphelper::UStringMixEqual& _rCase);
+
+ OOO_DLLPUBLIC_DBTOOLS void checkDisposed(sal_Bool _bThrow) throw ( ::com::sun::star::lang::DisposedException );
+
+
+ /** creates a java virtual machine
+ @param _rxFactory
+ The ORB.
+ @return
+ The JavaVM.
+ */
+ OOO_DLLPUBLIC_DBTOOLS ::rtl::Reference< jvmaccess::VirtualMachine > getJavaVM(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory);
+
+ /** return <TRUE/> if the java class exists, otherwise <FALSE/>.
+ @param _pJVM
+ The JavaVM.
+ @param _sClassName
+ The class name to look for.
+ */
+ OOO_DLLPUBLIC_DBTOOLS sal_Bool existsJavaClassByName( const ::rtl::Reference< jvmaccess::VirtualMachine >& _pJVM,const ::rtl::OUString& _sClassName );
+}
+
+//==================================================================================
+
+#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_COMMONTOOLS_HXX_
+
diff --git a/connectivity/inc/connectivity/ConnectionWrapper.hxx b/connectivity/inc/connectivity/ConnectionWrapper.hxx
new file mode 100644
index 000000000000..56c61cb827f2
--- /dev/null
+++ b/connectivity/inc/connectivity/ConnectionWrapper.hxx
@@ -0,0 +1,98 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _CONNECTIVITY_ZCONNECTIONWRAPPER_HXX_
+#define _CONNECTIVITY_ZCONNECTIONWRAPPER_HXX_
+
+#include <cppuhelper/implbase2.hxx>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+#include <com/sun/star/sdbc/XConnection.hpp>
+#include <comphelper/broadcasthelper.hxx>
+#include "connectivity/CommonTools.hxx"
+#include "connectivity/dbtoolsdllapi.hxx"
+
+namespace connectivity
+{
+
+ //==========================================================================
+ //= OConnectionWrapper - wraps all methods to the real connection from the driver
+ //= but when disposed it doesn't dispose the real connection
+ //==========================================================================
+ typedef ::cppu::ImplHelper2< ::com::sun::star::lang::XServiceInfo,
+ ::com::sun::star::lang::XUnoTunnel
+ > OConnection_BASE;
+
+ class OOO_DLLPUBLIC_DBTOOLS OConnectionWrapper : public OConnection_BASE
+ {
+ protected:
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XAggregation > m_xProxyConnection;
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > m_xConnection;
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XTypeProvider > m_xTypeProvider;
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XUnoTunnel > m_xUnoTunnel;
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XServiceInfo > m_xServiceInfo;
+
+ virtual ~OConnectionWrapper();
+ void setDelegation(::com::sun::star::uno::Reference< ::com::sun::star::uno::XAggregation >& _rxProxyConnection,oslInterlockedCount& _rRefCount);
+ void setDelegation(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _xConnection
+ ,const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _xORB
+ ,oslInterlockedCount& _rRefCount);
+ // must be called from derived classes
+ void disposing();
+ public:
+ OConnectionWrapper( );
+
+ // XServiceInfo
+ 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 ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw (::com::sun::star::uno::RuntimeException);
+
+ // com::sun::star::lang::XUnoTunnel
+ virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException);
+ static ::com::sun::star::uno::Sequence< sal_Int8 > getUnoTunnelImplementationId();
+ /** method to create unique ids
+ @param _rURL
+ The URL.
+ @param _rInfo
+ The info property of the datasource. It will be resorted if needed.
+ @param _pBuffer
+ Here we store the digest. Must not NULL.
+ @param _rUserName
+ The user name.
+ @param _rPassword
+ The password.
+ */
+ static void createUniqueId( const ::rtl::OUString& _rURL
+ ,::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& _rInfo
+ ,sal_uInt8* _pBuffer
+ ,const ::rtl::OUString& _rUserName = ::rtl::OUString()
+ ,const ::rtl::OUString& _rPassword = ::rtl::OUString());
+ };
+}
+#endif // _CONNECTIVITY_ZCONNECTIONWRAPPER_HXX_
+
diff --git a/connectivity/inc/connectivity/DateConversion.hxx b/connectivity/inc/connectivity/DateConversion.hxx
new file mode 100644
index 000000000000..4c1f668fa107
--- /dev/null
+++ b/connectivity/inc/connectivity/DateConversion.hxx
@@ -0,0 +1,94 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _CONNECTIVITY_DATECONVERSION_HXX_
+#define _CONNECTIVITY_DATECONVERSION_HXX_
+
+#include <com/sun/star/util/Date.hpp>
+#include <com/sun/star/util/Time.hpp>
+#include <com/sun/star/util/DateTime.hpp>
+#include "connectivity/dbtoolsdllapi.hxx"
+
+namespace connectivity
+{
+ class OOO_DLLPUBLIC_DBTOOLS DateConversion
+ {
+ public:
+ static sal_Int32 toINT32(const ::com::sun::star::util::Date&)
+ {
+ OSL_ENSURE(0,"Please use DBConversion instead!");
+ return 0;
+ }
+ static sal_Int32 toINT32(const ::com::sun::star::util::Time&)
+ {
+ OSL_ENSURE(0,"Please use DBConversion instead!");
+ return 0;
+ }
+ static sal_Int64 toINT64(const ::com::sun::star::util::DateTime&)
+ {
+ OSL_ENSURE(0,"Please use DBConversion instead!");
+ return 0;
+ }
+ static sal_Int32 getMsFromTime(const ::com::sun::star::util::Time&)
+ {
+ OSL_ENSURE(0,"Please use DBConversion instead!");
+ return 0;
+ }
+ static double toDouble(const ::com::sun::star::util::Date&)
+ {
+ OSL_ENSURE(0,"Please use DBConversion instead!");
+ return 0;
+ }
+ static double toDouble(const ::com::sun::star::util::Time&)
+ {
+ OSL_ENSURE(0,"Please use DBConversion instead!");
+ return 0;
+ }
+ static double toDouble(const ::com::sun::star::util::DateTime&)
+ {
+ OSL_ENSURE(0,"Please use DBConversion instead!");
+ return 0;
+ }
+ static ::com::sun::star::util::Date toDate(double,const ::com::sun::star::util::Date& =::com::sun::star::util::Date(01,01,1900))
+ {
+ OSL_ENSURE(0,"Please use DBConversion instead!");
+ return ::com::sun::star::util::Date();
+ }
+ static ::com::sun::star::util::Time toTime(double)
+ {
+ OSL_ENSURE(0,"Please use DBConversion instead!");
+ return ::com::sun::star::util::Time();
+ }
+ static ::com::sun::star::util::DateTime toDateTime(double,const ::com::sun::star::util::Date& =::com::sun::star::util::Date(01,01,1900))
+ {
+ OSL_ENSURE(0,"Please use DBConversion instead!");
+ return ::com::sun::star::util::DateTime();
+ }
+ };
+}
+#endif // _CONNECTIVITY_DATECONVERSION_HXX_
+
diff --git a/connectivity/inc/connectivity/DriversConfig.hxx b/connectivity/inc/connectivity/DriversConfig.hxx
new file mode 100755
index 000000000000..94ca201e5ad5
--- /dev/null
+++ b/connectivity/inc/connectivity/DriversConfig.hxx
@@ -0,0 +1,87 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CONNECTIVITY_DRIVERSCONFIG_HXX_INCLUDED
+#define CONNECTIVITY_DRIVERSCONFIG_HXX_INCLUDED
+
+#include <comphelper/stl_types.hxx>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/beans/NamedValue.hpp>
+#include <com/sun/star/uno/Sequence.h>
+#include "connectivity/dbtoolsdllapi.hxx"
+#include <salhelper/singletonref.hxx>
+#include <comphelper/namedvaluecollection.hxx>
+#include <unotools/confignode.hxx>
+
+namespace connectivity
+{
+ typedef struct
+ {
+ ::comphelper::NamedValueCollection aProperties;
+ ::comphelper::NamedValueCollection aFeatures;
+ ::comphelper::NamedValueCollection aMetaData;
+ ::rtl::OUString sDriverFactory;
+ ::rtl::OUString sDriverTypeDisplayName;
+ } TInstalledDriver;
+ DECLARE_STL_USTRINGACCESS_MAP( TInstalledDriver, TInstalledDrivers);
+
+ class DriversConfigImpl
+ {
+ mutable ::utl::OConfigurationTreeRoot m_aInstalled;
+ mutable TInstalledDrivers m_aDrivers;
+ void Load(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB) const;
+ public:
+ DriversConfigImpl();
+
+ const TInstalledDrivers& getInstalledDrivers(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB) const { Load(_rxORB); return m_aDrivers; }
+ };
+ //
+ // Allows to access all driver which are located in the configuration
+ //
+ class OOO_DLLPUBLIC_DBTOOLS DriversConfig
+ {
+ typedef salhelper::SingletonRef<DriversConfigImpl> OSharedConfigNode;
+
+ const ::comphelper::NamedValueCollection& impl_get(const ::rtl::OUString& _sURL,sal_Int32 _nProps) const;
+ public:
+ DriversConfig(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB);
+ ~DriversConfig();
+
+ DriversConfig( const DriversConfig& );
+ DriversConfig& operator=( const DriversConfig& );
+
+ ::rtl::OUString getDriverFactoryName(const ::rtl::OUString& _sUrl) const;
+ ::rtl::OUString getDriverTypeDisplayName(const ::rtl::OUString& _sUrl) const;
+ const ::comphelper::NamedValueCollection& getProperties(const ::rtl::OUString& _sURL) const;
+ const ::comphelper::NamedValueCollection& getFeatures(const ::rtl::OUString& _sURL) const;
+ const ::comphelper::NamedValueCollection& getMetaData(const ::rtl::OUString& _sURL) const;
+ ::com::sun::star::uno::Sequence< ::rtl::OUString > getURLs() const;
+ private:
+ OSharedConfigNode m_aNode;
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xORB;
+ };
+}
+#endif // CONNECTIVITY_DRIVERSCONFIG_HXX_INCLUDED
diff --git a/connectivity/inc/connectivity/FValue.hxx b/connectivity/inc/connectivity/FValue.hxx
new file mode 100644
index 000000000000..e4fe1b64e626
--- /dev/null
+++ b/connectivity/inc/connectivity/FValue.hxx
@@ -0,0 +1,467 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _CONNECTIVITY_FILE_VALUE_HXX_
+#define _CONNECTIVITY_FILE_VALUE_HXX_
+
+#include <com/sun/star/sdbc/DataType.hpp>
+#include <com/sun/star/uno/Any.hxx>
+#include <rtl/ustring.hxx>
+#include <osl/diagnose.h>
+#include <comphelper/stl_types.hxx>
+#include <vos/ref.hxx>
+#include "connectivity/dbtoolsdllapi.hxx"
+#include "connectivity/CommonTools.hxx"
+#include <com/sun/star/util/DateTime.hpp>
+#include <com/sun/star/util/Date.hpp>
+#include <com/sun/star/util/Time.hpp>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/sdbc/XRow.hpp>
+#include <com/sun/star/sdb/XColumn.hpp>
+
+namespace connectivity
+{
+ namespace detail
+ {
+ class IValueSource;
+ }
+
+ class OOO_DLLPUBLIC_DBTOOLS ORowSetValue
+ {
+ union
+ {
+ sal_Bool m_bBool;
+ sal_Int8 m_nInt8;
+ sal_Int16 m_nInt16;
+ sal_Int32 m_nInt32;
+ rtl_uString* m_pString;
+
+ void* m_pValue; // can contains double, etc
+ } m_aValue;
+
+ sal_Int32 m_eTypeKind; // the database type
+ sal_Bool m_bNull : 1; // value is null
+ sal_Bool m_bBound : 1; // is bound
+ sal_Bool m_bModified : 1; // value was changed
+ sal_Bool m_bSigned : 1; // value is signed
+
+ void free();
+
+ public:
+ ORowSetValue()
+ :m_eTypeKind(::com::sun::star::sdbc::DataType::VARCHAR)
+ ,m_bNull(sal_True)
+ ,m_bBound(sal_True)
+ ,m_bModified(sal_False)
+ ,m_bSigned(sal_True)
+ {
+ m_aValue.m_pString = NULL;
+ }
+
+ ORowSetValue(const ORowSetValue& _rRH)
+ :m_eTypeKind(::com::sun::star::sdbc::DataType::VARCHAR)
+ ,m_bNull(sal_True)
+ ,m_bBound(sal_True)
+ ,m_bModified(sal_False)
+ ,m_bSigned(sal_True)
+ {
+ m_aValue.m_pString = NULL;
+ operator=(_rRH);
+ }
+
+ ORowSetValue(const ::rtl::OUString& _rRH)
+ :m_eTypeKind(::com::sun::star::sdbc::DataType::VARCHAR)
+ ,m_bNull(sal_True)
+ ,m_bBound(sal_True)
+ ,m_bModified(sal_False)
+ ,m_bSigned(sal_True)
+ {
+ m_aValue.m_pString = NULL;
+ operator=(_rRH);
+ }
+
+ ORowSetValue(const double& _rRH)
+ :m_eTypeKind(::com::sun::star::sdbc::DataType::DOUBLE)
+ ,m_bNull(sal_True)
+ ,m_bBound(sal_True)
+ ,m_bModified(sal_False)
+ ,m_bSigned(sal_True)
+ {
+ m_aValue.m_pString = NULL;
+ operator=(_rRH);
+ }
+
+ ORowSetValue(const float& _rRH)
+ :m_eTypeKind(::com::sun::star::sdbc::DataType::FLOAT)
+ ,m_bNull(sal_True)
+ ,m_bBound(sal_True)
+ ,m_bModified(sal_False)
+ ,m_bSigned(sal_True)
+ {
+ m_aValue.m_pString = NULL;
+ operator=(_rRH);
+ }
+
+ ORowSetValue(const sal_Int8& _rRH)
+ :m_eTypeKind(::com::sun::star::sdbc::DataType::TINYINT)
+ ,m_bNull(sal_True)
+ ,m_bBound(sal_True)
+ ,m_bModified(sal_False)
+ ,m_bSigned(sal_True)
+ {
+ m_aValue.m_pString = NULL;
+ operator=(_rRH);
+ }
+ ORowSetValue(const sal_Int16& _rRH)
+ :m_eTypeKind(::com::sun::star::sdbc::DataType::SMALLINT)
+ ,m_bNull(sal_True)
+ ,m_bBound(sal_True)
+ ,m_bModified(sal_False)
+ ,m_bSigned(sal_True)
+ {
+ m_aValue.m_pString = NULL;
+ operator=(_rRH);
+ }
+ ORowSetValue(const sal_Int32& _rRH)
+ :m_eTypeKind(::com::sun::star::sdbc::DataType::INTEGER)
+ ,m_bNull(sal_True)
+ ,m_bBound(sal_True)
+ ,m_bModified(sal_False)
+ ,m_bSigned(sal_True)
+ {
+ m_aValue.m_pString = NULL;
+ operator=(_rRH);
+ }
+ ORowSetValue(const sal_Int64& _rRH)
+ :m_eTypeKind(::com::sun::star::sdbc::DataType::BIGINT)
+ ,m_bNull(sal_True)
+ ,m_bBound(sal_True)
+ ,m_bModified(sal_False)
+ ,m_bSigned(sal_True)
+ {
+ m_aValue.m_pString = NULL;
+ operator=(_rRH);
+ }
+
+ ORowSetValue(const sal_Bool& _rRH)
+ :m_eTypeKind(::com::sun::star::sdbc::DataType::BIT)
+ ,m_bNull(sal_True)
+ ,m_bBound(sal_True)
+ ,m_bModified(sal_False)
+ ,m_bSigned(sal_True)
+ {
+ m_aValue.m_pString = NULL;
+ operator=(_rRH);
+ }
+
+ ORowSetValue(const ::com::sun::star::util::Date& _rRH)
+ :m_eTypeKind(::com::sun::star::sdbc::DataType::DATE)
+ ,m_bNull(sal_True)
+ ,m_bBound(sal_True)
+ ,m_bModified(sal_False)
+ ,m_bSigned(sal_True)
+ {
+ m_aValue.m_pString = NULL;
+ operator=(_rRH);
+ }
+
+ ORowSetValue(const ::com::sun::star::util::Time& _rRH)
+ :m_eTypeKind(::com::sun::star::sdbc::DataType::TIME)
+ ,m_bNull(sal_True)
+ ,m_bBound(sal_True)
+ ,m_bModified(sal_False)
+ ,m_bSigned(sal_True)
+ {
+ m_aValue.m_pString = NULL;
+ operator=(_rRH);
+ }
+
+ ORowSetValue(const ::com::sun::star::util::DateTime& _rRH)
+ :m_eTypeKind(::com::sun::star::sdbc::DataType::TIMESTAMP)
+ ,m_bNull(sal_True)
+ ,m_bBound(sal_True)
+ ,m_bModified(sal_False)
+ ,m_bSigned(sal_True)
+ {
+ m_aValue.m_pString = NULL;
+ operator=(_rRH);
+ }
+
+ ORowSetValue(const ::com::sun::star::uno::Sequence<sal_Int8>& _rRH)
+ :m_eTypeKind(::com::sun::star::sdbc::DataType::LONGVARBINARY)
+ ,m_bNull(sal_True)
+ ,m_bBound(sal_True)
+ ,m_bModified(sal_False)
+ ,m_bSigned(sal_True)
+ {
+ m_aValue.m_pString = NULL;
+ operator=(_rRH);
+ }
+
+ ~ORowSetValue()
+ {
+ free();
+ }
+
+ 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,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 *,void* ) SAL_THROW( () )
+ { }
+
+ ORowSetValue& operator=(const ORowSetValue& _rRH);
+
+ // simple types
+ ORowSetValue& operator=(const sal_Bool _rRH);
+ ORowSetValue& operator=(const sal_Int8& _rRH);
+ ORowSetValue& operator=(const sal_Int16& _rRH);
+ ORowSetValue& operator=(const sal_Int32& _rRH);
+ ORowSetValue& operator=(const sal_Int64& _rRH);
+ ORowSetValue& operator=(const double& _rRH);
+ ORowSetValue& operator=(const float& _rRH);
+
+ // ADT's
+ ORowSetValue& operator=(const ::com::sun::star::util::Date& _rRH);
+ ORowSetValue& operator=(const ::com::sun::star::util::Time& _rRH);
+ ORowSetValue& operator=(const ::com::sun::star::util::DateTime& _rRH);
+
+ ORowSetValue& operator=(const ::rtl::OUString& _rRH);
+ // the type isn't set it will be set to VARCHAR if the type is different change it
+ ORowSetValue& operator=(const ::com::sun::star::uno::Sequence<sal_Int8>& _rRH);
+ // we the possiblity to save a any for bookmarks
+ ORowSetValue& operator=(const ::com::sun::star::uno::Any& _rAny);
+
+ operator sal_Bool() const { return isNull() ? sal_False : getBool(); }
+ operator sal_Int8() const { return isNull() ? static_cast<sal_Int8>(0) : getInt8(); }
+ operator sal_Int16() const { return isNull() ? static_cast<sal_Int16>(0) : getInt16(); }
+ operator sal_Int32() const { return isNull() ? 0 : getInt32(); }
+ operator sal_Int64() const { return isNull() ? 0 : getLong(); }
+ operator float() const { return isNull() ? (float)0.0: getFloat(); }
+ operator double() const { return isNull() ? 0.0 : getDouble(); }
+
+ operator ::rtl::OUString() const
+ {
+ return isNull() ? ::rtl::OUString() : getString();
+ }
+
+ operator ::com::sun::star::util::Date() const
+ {
+ return isNull() ? ::com::sun::star::util::Date() : getDate();
+ }
+
+ operator ::com::sun::star::util::Time() const
+ {
+ return isNull() ? ::com::sun::star::util::Time() : getTime();
+ }
+
+ operator ::com::sun::star::util::DateTime() const
+ {
+ return isNull() ? ::com::sun::star::util::DateTime() : getDateTime();
+ }
+
+ operator ::com::sun::star::uno::Sequence<sal_Int8>() const
+ {
+ return isNull() ? ::com::sun::star::uno::Sequence<sal_Int8>() : getSequence();
+ }
+
+ bool operator==(const ORowSetValue& _rRH) const;
+ bool operator!=(const ORowSetValue& _rRH) const
+ {
+ return !( *this == _rRH );
+ }
+
+ sal_Bool isNull() const
+ {
+ return m_bNull;
+ }
+ void setNull()
+ {
+ free();
+ m_bNull = sal_True;
+ m_aValue.m_pString = NULL;
+ }
+
+ sal_Bool isBound() const { return m_bBound; }
+ void setBound(sal_Bool _bBound) { m_bBound = _bBound ? true : false; }
+
+ sal_Bool isModified() const { return m_bModified; }
+ void setModified(sal_Bool _bMod=sal_True){ m_bModified = _bMod ? true : false; }
+
+ sal_Bool isSigned() const { return m_bSigned; }
+ void setSigned(sal_Bool _bMod=sal_True);
+
+ sal_Int32 getTypeKind() const { return m_eTypeKind; }
+ void setTypeKind(sal_Int32 _eType);
+
+ // before calling one of this methods, be sure that the value is not null
+ void* getValue() const { OSL_ENSURE(m_bBound,"Value is not bound!");return m_aValue.m_pValue; }
+ sal_Bool getBool() const;
+ sal_Int8 getInt8() const;
+ sal_Int16 getInt16() const;
+ sal_Int32 getInt32() const;
+ sal_Int64 getLong() const;
+ double getDouble() const;
+ float getFloat() const;
+ // convert the double to the type _nDataType
+ void setFromDouble(const double& _rVal,sal_Int32 _nDatatype);
+
+ ::rtl::OUString getString() const; // makes a automatic conversion if type isn't a string
+ ::com::sun::star::util::Date getDate() const;
+ ::com::sun::star::util::Time getTime() const;
+ ::com::sun::star::util::DateTime getDateTime() const;
+ ::com::sun::star::uno::Sequence<sal_Int8> getSequence() const;
+ // only use for anys
+ ::com::sun::star::uno::Any getAny() const { return *(::com::sun::star::uno::Any*)m_aValue.m_pValue; }
+ ::com::sun::star::uno::Any makeAny() const;
+
+ /**
+ fetches a single value out of the row
+ @param _nPos the current column position
+ @param _nType the type of the current column
+ @param _xRow the row where to fetch the data from
+ */
+ void fill(sal_Int32 _nPos,
+ sal_Int32 _nType,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRow>& _xRow);
+
+ /**
+ fetches a single value out of the row
+ @param _nPos the current column position
+ @param _nType the type of the current column
+ @param _bNullable if true then it will be checked if the result could be NULL, otherwise not.
+ @param _xRow the row where to fetch the data from
+ */
+ void fill(sal_Int32 _nPos,
+ sal_Int32 _nType,
+ sal_Bool _bNullable,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRow>& _xRow);
+
+ void fill(const ::com::sun::star::uno::Any& _rValue);
+
+ void fill( const sal_Int32 _nType,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumn >& _rxColumn );
+
+ private:
+ void impl_fill( const sal_Int32 _nType, sal_Bool _bNullable, const detail::IValueSource& _rValueSource );
+ };
+
+ /// ORowSetValueDecorator decorates a ORowSetValue so the value is "refcounted"
+ class OOO_DLLPUBLIC_DBTOOLS ORowSetValueDecorator : public ::vos::OReference
+ {
+ ORowSetValue m_aValue; // my own value
+ public:
+ ORowSetValueDecorator(){m_aValue.setBound(sal_True);}
+ ORowSetValueDecorator(const ORowSetValue& _aValue) : m_aValue(_aValue){m_aValue.setBound(sal_True);}
+ ORowSetValueDecorator& operator=(const ORowSetValue& _aValue);
+
+ inline operator const ORowSetValue&() const { return m_aValue; }
+ inline bool operator ==( const ORowSetValue & _rRH ) { return m_aValue == _rRH; }
+ inline const ORowSetValue& getValue() const { return m_aValue; }
+ inline ORowSetValue& get() { return m_aValue; }
+ inline void setValue(const ORowSetValue& _aValue) { m_aValue = _aValue; }
+ inline void setNull() { m_aValue.setNull(); }
+ inline void setBound(sal_Bool _bBound ) { m_aValue.setBound(_bBound);}
+ inline sal_Bool isBound( ) const { return m_aValue.isBound();}
+ inline void setTypeKind(sal_Int32 _nType) { m_aValue.setTypeKind(_nType); }
+ inline void setModified(sal_Bool _bModified) { m_aValue.setModified(_bModified); }
+
+ };
+ typedef ::vos::ORef<ORowSetValueDecorator> ORowSetValueDecoratorRef;
+
+ // -------------------------------------------------------------------------
+ /// TSetBound is a unary_function to set the bound value with e.q. for_each call
+ struct OOO_DLLPUBLIC_DBTOOLS TSetBound : ::std::unary_function<ORowSetValue,void>
+ {
+ sal_Bool m_bBound;
+ TSetBound(sal_Bool _bBound) : m_bBound(_bBound){}
+ void operator()(ORowSetValue& _rValue) const { _rValue.setBound(m_bBound); }
+
+ };
+
+ // -------------------------------------------------------------------------
+ /// TSetBound is a unary_function to set the bound value with e.q. for_each call
+ struct OOO_DLLPUBLIC_DBTOOLS TSetRefBound : ::std::unary_function<ORowSetValueDecoratorRef,void>
+ {
+ sal_Bool m_bBound;
+ TSetRefBound(sal_Bool _bBound) : m_bBound(_bBound){}
+ void operator()(ORowSetValueDecoratorRef& _rValue) const { _rValue->setBound(m_bBound); }
+
+ };
+
+ // ----------------------------------------------------------------------------
+ // Vector for file based rows
+ // ----------------------------------------------------------------------------
+ template< class VectorVal > class ODeleteVector : public connectivity::ORowVector< VectorVal >
+ {
+ sal_Bool m_bDeleted;
+ public:
+ ODeleteVector() : connectivity::ORowVector< VectorVal >() ,m_bDeleted(sal_False) {}
+ ODeleteVector(size_t _st) : connectivity::ORowVector< VectorVal >(_st) ,m_bDeleted(sal_False) {}
+
+ sal_Bool isDeleted() const { return m_bDeleted; }
+ void setDeleted(sal_Bool _bDeleted) { m_bDeleted = _bDeleted; }
+ };
+
+ typedef ODeleteVector< ORowSetValue > OValueVector;
+
+ class OOO_DLLPUBLIC_DBTOOLS OValueRefVector : public ODeleteVector< ORowSetValueDecoratorRef >
+ {
+ public:
+ OValueRefVector(){}
+ OValueRefVector(size_t _st) : ODeleteVector< ORowSetValueDecoratorRef >(_st)
+ {
+ for(OValueRefVector::Vector::iterator aIter = get().begin() ; aIter != get().end() ;++aIter)
+ *aIter = new ORowSetValueDecorator;
+ }
+ };
+
+#define SQL_NO_PARAMETER (SAL_MAX_UINT32)
+ class OAssignValues : public OValueRefVector
+ {
+ ::std::vector<sal_Int32> m_nParameterIndexes;
+ public:
+ OAssignValues() : m_nParameterIndexes(1,SQL_NO_PARAMETER){}
+ OAssignValues(Vector::size_type n) : OValueRefVector(n),m_nParameterIndexes(n+1,SQL_NO_PARAMETER){}
+
+ void setParameterIndex(sal_Int32 _nId,sal_Int32 _nParameterIndex) { m_nParameterIndexes[_nId] = _nParameterIndex;}
+ sal_Int32 getParameterIndex(sal_Int32 _nId) const { return m_nParameterIndexes[_nId]; }
+ };
+
+ typedef ::vos::ORef< OAssignValues > ORefAssignValues;
+
+
+
+ typedef ::vos::ORef< OValueVector > OValueRow;
+ typedef ::vos::ORef< OValueRefVector > OValueRefRow;
+}
+
+#endif // #ifndef _CONNECTIVITY_FILE_VALUE_HXX_
+
+
diff --git a/connectivity/inc/connectivity/IParseContext.hxx b/connectivity/inc/connectivity/IParseContext.hxx
new file mode 100644
index 000000000000..03de6e924154
--- /dev/null
+++ b/connectivity/inc/connectivity/IParseContext.hxx
@@ -0,0 +1,108 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CONNECTIVITY_IPARSECONTEXT_HXX
+#define CONNECTIVITY_IPARSECONTEXT_HXX
+
+namespace connectivity { class OSQLParseNode; }
+
+#include <rtl/ustring.hxx>
+#include <com/sun/star/lang/Locale.hpp>
+#include "connectivity/dbtoolsdllapi.hxx"
+
+namespace connectivity
+{
+ //==========================================================================
+ //= IParseContext
+ //==========================================================================
+ class IParseContext
+ {
+ public:
+ enum ErrorCode
+ {
+ ERROR_NONE = 0,
+ ERROR_GENERAL, // "Syntax error in SQL expression"
+ ERROR_VALUE_NO_LIKE, // "The value #1 can not be used with LIKE."
+ ERROR_FIELD_NO_LIKE, // "LIKE can not be used with this field."
+ ERROR_INVALID_COMPARE, // "The entered criterion can not be compared with this field."
+ ERROR_INVALID_INT_COMPARE, // "The field can not be compared with a number."
+ ERROR_INVALID_DATE_COMPARE, // "The field can not be compared with a date."
+ ERROR_INVALID_REAL_COMPARE, // "The field can not be compared with a floating point number."
+ ERROR_INVALID_TABLE, // "The database does not contain a table named \"#\"."
+ ERROR_INVALID_TABLE_OR_QUERY, // "The database does contain neither a table nor a query named \"#\"."
+ ERROR_INVALID_COLUMN, // "The column \"#1\" is unknown in the table \"#2\"."
+ ERROR_INVALID_TABLE_EXIST, // "The database already contains a table or view with name \"#\"."
+ ERROR_INVALID_QUERY_EXIST // "The database already contains a query with name \"#\".";
+ };
+
+ enum InternationalKeyCode
+ {
+ KEY_NONE = 0,
+ KEY_LIKE,
+ KEY_NOT,
+ KEY_NULL,
+ KEY_TRUE,
+ KEY_FALSE,
+ KEY_IS,
+ KEY_BETWEEN,
+ KEY_OR,
+ KEY_AND,
+ KEY_AVG,
+ KEY_COUNT,
+ KEY_MAX,
+ KEY_MIN,
+ KEY_SUM,
+ KEY_EVERY,
+ KEY_ANY,
+ KEY_SOME,
+ KEY_STDDEV_POP,
+ KEY_STDDEV_SAMP,
+ KEY_VAR_SAMP,
+ KEY_VAR_POP,
+ KEY_COLLECT,
+ KEY_FUSION,
+ KEY_INTERSECTION
+ };
+
+ public:
+ // retrieves language specific error messages
+ virtual ::rtl::OUString getErrorMessage(ErrorCode _eCodes) const = 0;
+
+ // retrieves language specific keyword strings (only ASCII allowed)
+ virtual ::rtl::OString getIntlKeywordAscii(InternationalKeyCode _eKey) const = 0;
+
+ // finds out, if we have an international keyword (only ASCII allowed)
+ virtual InternationalKeyCode getIntlKeyCode(const ::rtl::OString& rToken) const = 0;
+
+ /** get's a locale instance which should be used when parsing in the context specified by this instance
+ <p>if this is not overridden by derived classes, it returns the static default locale.</p>
+ */
+ virtual ::com::sun::star::lang::Locale getPreferredLocale( ) const = 0;
+ };
+}
+
+#endif // CONNECTIVITY_IPARSECONTEXT_HXX
+
diff --git a/connectivity/inc/connectivity/PColumn.hxx b/connectivity/inc/connectivity/PColumn.hxx
new file mode 100644
index 000000000000..547cc8fb9970
--- /dev/null
+++ b/connectivity/inc/connectivity/PColumn.hxx
@@ -0,0 +1,148 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CONNECTIVITY_PCOLUMN_HXX_
+#define _CONNECTIVITY_PCOLUMN_HXX_
+
+#include "connectivity/dbtoolsdllapi.hxx"
+#include "connectivity/sdbcx/VColumn.hxx"
+#include "connectivity/CommonTools.hxx"
+#include <vos/ref.hxx>
+#include <com/sun/star/sdbc/XResultSetMetaData.hpp>
+#include <com/sun/star/sdbc/XDatabaseMetaData.hpp>
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <comphelper/proparrhlp.hxx>
+
+namespace connectivity
+{
+ namespace parse
+ {
+ class OParseColumn;
+
+ typedef sdbcx::OColumn OParseColumn_BASE;
+ typedef ::comphelper::OPropertyArrayUsageHelper<OParseColumn> OParseColumn_PROP;
+
+ class OOO_DLLPUBLIC_DBTOOLS OParseColumn :
+ public OParseColumn_BASE, public OParseColumn_PROP
+ {
+ ::rtl::OUString m_aRealName;
+ ::rtl::OUString m_aTableName;
+ ::rtl::OUString m_sLabel;
+ sal_Bool m_bFunction;
+ sal_Bool m_bDbasePrecisionChanged;
+ sal_Bool m_bAggregateFunction;
+ sal_Bool m_bIsSearchable;
+
+ protected:
+ virtual ::cppu::IPropertyArrayHelper* createArrayHelper() const;
+ virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper();
+
+ virtual ~OParseColumn();
+ public:
+ OParseColumn(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _xColumn,sal_Bool _bCase);
+ OParseColumn(const ::rtl::OUString& _Name,
+ const ::rtl::OUString& _TypeName,
+ const ::rtl::OUString& _DefaultValue,
+ const ::rtl::OUString& _Description,
+ sal_Int32 _IsNullable,
+ sal_Int32 _Precision,
+ sal_Int32 _Scale,
+ sal_Int32 _Type,
+ sal_Bool _IsAutoIncrement,
+ sal_Bool _IsCurrency,
+ sal_Bool _bCase);
+
+ virtual void construct();
+
+ void setRealName(const ::rtl::OUString& _rName) { m_aRealName = _rName; }
+ void setLabel(const ::rtl::OUString& i_sLabel) { m_sLabel = i_sLabel; }
+ void setTableName(const ::rtl::OUString& _rName) { m_aTableName = _rName; }
+ void setFunction(sal_Bool _bFunction) { m_bFunction = _bFunction; }
+ void setAggregateFunction(sal_Bool _bFunction) { m_bAggregateFunction = _bFunction; }
+ void setIsSearchable( sal_Bool _bIsSearchable ) { m_bIsSearchable = _bIsSearchable; }
+ void setDbasePrecisionChanged(sal_Bool _bDbasePrecisionChanged) { m_bDbasePrecisionChanged = _bDbasePrecisionChanged; }
+
+ ::rtl::OUString getRealName() const { return m_aRealName; }
+ ::rtl::OUString getLabel() const { return m_sLabel; }
+ ::rtl::OUString getTableName() const { return m_aTableName; }
+ sal_Bool getFunction() const { return m_bFunction; }
+ sal_Bool getDbasePrecisionChanged() const { return m_bDbasePrecisionChanged; }
+
+ public:
+ /** creates a collection of OParseColumn, as described by a result set meta data instance.
+ */
+ static ::vos::ORef< OSQLColumns >
+ createColumnsForResultSet(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData >& _rxResMetaData,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData >& _rxDBMetaData,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess>& i_xQueryColumns
+ );
+
+ DECLARE_STL_USTRINGACCESS_MAP(int,StringMap);
+ /** creates a single OParseColumn, as described by a result set meta data instance.
+ The column names are unique.
+ */
+ static OParseColumn*
+ createColumnForResultSet(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData >& _rxResMetaData,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData >& _rxDBMetaData,
+ sal_Int32 _nColumnPos,
+ StringMap& _rColumns
+ );
+
+ private:
+ using OParseColumn_BASE::createArrayHelper;
+ };
+
+ class OOrderColumn;
+
+ typedef sdbcx::OColumn OOrderColumn_BASE;
+ typedef ::comphelper::OPropertyArrayUsageHelper<OOrderColumn> OOrderColumn_PROP;
+
+ class OOO_DLLPUBLIC_DBTOOLS OOrderColumn :
+ public OOrderColumn_BASE, public OOrderColumn_PROP
+ {
+ sal_Bool m_bAscending;
+ sal_Bool m_bOrder;
+ protected:
+ virtual ::cppu::IPropertyArrayHelper* createArrayHelper() const;
+ virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper();
+
+ virtual ~OOrderColumn();
+ public:
+ OOrderColumn(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _xColumn,sal_Bool _bCase,sal_Bool _bAscending);
+
+ virtual void construct();
+
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException);
+ private:
+ using OOrderColumn_BASE::createArrayHelper;
+ };
+ }
+}
+
+#endif //_CONNECTIVITY_PCOLUMN_HXX_
+
diff --git a/connectivity/inc/connectivity/ParameterCont.hxx b/connectivity/inc/connectivity/ParameterCont.hxx
new file mode 100644
index 000000000000..f096a9a1a747
--- /dev/null
+++ b/connectivity/inc/connectivity/ParameterCont.hxx
@@ -0,0 +1,59 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CONNECTIVITY_PARAMETERCONTINUATION_HXX_INCLUDED
+#define CONNECTIVITY_PARAMETERCONTINUATION_HXX_INCLUDED
+
+#include <com/sun/star/sdb/XInteractionSupplyParameters.hpp>
+#include <comphelper/interaction.hxx>
+#include "connectivity/dbtoolsdllapi.hxx"
+
+namespace dbtools
+{
+//====================================================================
+ //= OParameterContinuation
+ //====================================================================
+ class OOO_DLLPUBLIC_DBTOOLS OParameterContinuation : public comphelper::OInteraction< ::com::sun::star::sdb::XInteractionSupplyParameters >
+ {
+ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > m_aValues;
+
+ public:
+ OParameterContinuation() { }
+
+ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > getValues() const { return m_aValues; }
+
+ // XInteractionSupplyParameters
+ virtual void SAL_CALL setParameters( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& _rValues ) throw(::com::sun::star::uno::RuntimeException);
+
+ protected:
+ virtual ~OParameterContinuation() { }
+ private:
+ OParameterContinuation(const OParameterContinuation&);
+ void operator =(const OParameterContinuation&);
+ };
+} // dbtools
+#endif //CONNECTIVITY_PARAMETERCONTINUATION_HXX_INCLUDED
+
diff --git a/connectivity/inc/connectivity/SQLStatementHelper.hxx b/connectivity/inc/connectivity/SQLStatementHelper.hxx
new file mode 100644
index 000000000000..0d1bb97c7b7f
--- /dev/null
+++ b/connectivity/inc/connectivity/SQLStatementHelper.hxx
@@ -0,0 +1,54 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: dbtools.hxx,v $
+ * $Revision: 1.37 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _CONNECTIVITY_SQLSTATEMENTHELPER_HXX_
+#define _CONNECTIVITY_SQLSTATEMENTHELPER_HXX_
+
+#include "connectivity/dbtoolsdllapi.hxx"
+#include <com/sun/star/beans/XPropertySet.hpp>
+namespace rtl
+{
+ class OUStringBuffer;
+}
+//.........................................................................
+namespace dbtools
+{
+ class OOO_DLLPUBLIC_DBTOOLS ISQLStatementHelper
+ {
+ public:
+ virtual void addComment(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor,::rtl::OUStringBuffer& _rOut) = 0;
+ };
+
+//.........................................................................
+} // namespace dbtools
+//.........................................................................
+
+#endif // _CONNECTIVITY_SQLSTATEMENTHELPER_HXX_
+
diff --git a/connectivity/inc/connectivity/StdTypeDefs.hxx b/connectivity/inc/connectivity/StdTypeDefs.hxx
new file mode 100644
index 000000000000..7b3afaab70d7
--- /dev/null
+++ b/connectivity/inc/connectivity/StdTypeDefs.hxx
@@ -0,0 +1,48 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CONNECTIVITY_STDTYPEDEFS_HXX
+#define CONNECTIVITY_STDTYPEDEFS_HXX
+
+#include "sal/config.h"
+
+#include <map>
+#include <vector>
+#include "sal/types.h"
+
+namespace rtl { class OUString; }
+
+namespace connectivity
+{
+ typedef ::std::vector< ::rtl::OUString> TStringVector;
+ typedef ::std::vector< sal_Int32> TIntVector;
+ typedef ::std::map<sal_Int32,sal_Int32> TInt2IntMap;
+ typedef ::std::map< ::rtl::OUString,sal_Int32> TString2IntMap;
+ typedef ::std::map< sal_Int32,::rtl::OUString> TInt2StringMap;
+}
+
+#endif // CONNECTIVITY_STDTYPEDEFS_HXX
+
diff --git a/connectivity/inc/connectivity/TColumnsHelper.hxx b/connectivity/inc/connectivity/TColumnsHelper.hxx
new file mode 100644
index 000000000000..1343ff633fd2
--- /dev/null
+++ b/connectivity/inc/connectivity/TColumnsHelper.hxx
@@ -0,0 +1,70 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef CONNECTIVITY_COLUMNSHELPER_HXX
+#define CONNECTIVITY_COLUMNSHELPER_HXX
+
+#include "connectivity/sdbcx/VCollection.hxx"
+#include <com/sun/star/sdbc/XDatabaseMetaData.hpp>
+#include "connectivity/sdbcx/IRefreshable.hxx"
+#include "connectivity/dbtoolsdllapi.hxx"
+
+namespace connectivity
+{
+ class OTableHelper;
+ class OColumnsHelperImpl;
+ /** contains generell column handling to creat default columns and default sql statements.
+ */
+ class OOO_DLLPUBLIC_DBTOOLS OColumnsHelper : public sdbcx::OCollection
+ {
+ OColumnsHelperImpl* m_pImpl;
+ protected:
+ OTableHelper* m_pTable;
+
+ virtual sdbcx::ObjectType createObject(const ::rtl::OUString& _rName);
+ virtual void impl_refresh() throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > createDescriptor();
+ virtual sdbcx::ObjectType appendObject( const ::rtl::OUString& _rForName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor );
+ virtual void dropObject(sal_Int32 _nPos,const ::rtl::OUString _sElementName);
+ public:
+ OColumnsHelper( ::cppu::OWeakObject& _rParent
+ ,sal_Bool _bCase
+ ,::osl::Mutex& _rMutex
+ ,const TStringVector &_rVector
+ ,sal_Bool _bUseHardRef = sal_True
+ );
+ virtual ~OColumnsHelper();
+
+ /** set the parent of the columns. Can also be <NULL/>.
+ @param _pTable
+ The parent.
+ */
+ inline void setParent(OTableHelper* _pTable) { m_pTable = _pTable;}
+ };
+}
+#endif // CONNECTIVITY_COLUMNSHELPER_HXX
+
diff --git a/connectivity/inc/connectivity/TIndex.hxx b/connectivity/inc/connectivity/TIndex.hxx
new file mode 100644
index 000000000000..c6537d2855fd
--- /dev/null
+++ b/connectivity/inc/connectivity/TIndex.hxx
@@ -0,0 +1,56 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef CONNECTIVITY_INDEXHELPER_HXX_
+#define CONNECTIVITY_INDEXHELPER_HXX_
+
+#include "connectivity/dbtoolsdllapi.hxx"
+#include "connectivity/sdbcx/VIndex.hxx"
+#include <com/sun/star/sdbc/XDatabaseMetaData.hpp>
+
+namespace connectivity
+{
+ class OTableHelper;
+ class OOO_DLLPUBLIC_DBTOOLS OIndexHelper : public connectivity::sdbcx::OIndex
+ {
+ OTableHelper* m_pTable;
+ public:
+ virtual void refreshColumns();
+ public:
+ OIndexHelper( OTableHelper* _pTable);
+ OIndexHelper( OTableHelper* _pTable,
+ const ::rtl::OUString& _Name,
+ const ::rtl::OUString& _Catalog,
+ sal_Bool _isUnique,
+ sal_Bool _isPrimaryKeyIndex,
+ sal_Bool _isClustered
+ );
+ inline OTableHelper* getTable() const { return m_pTable; }
+ };
+}
+#endif // CONNECTIVITY_INDEXHELPER_HXX_
+
diff --git a/connectivity/inc/connectivity/TIndexColumns.hxx b/connectivity/inc/connectivity/TIndexColumns.hxx
new file mode 100644
index 000000000000..466363d61e02
--- /dev/null
+++ b/connectivity/inc/connectivity/TIndexColumns.hxx
@@ -0,0 +1,50 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef CONNECTIVITY_INDEXCOLUMNSHELPER_HXX
+#define CONNECTIVITY_INDEXCOLUMNSHELPER_HXX
+
+#include "connectivity/sdbcx/VCollection.hxx"
+#include "connectivity/dbtoolsdllapi.hxx"
+
+namespace connectivity
+{
+ class OIndexHelper;
+ class OOO_DLLPUBLIC_DBTOOLS OIndexColumns : public sdbcx::OCollection
+ {
+ OIndexHelper* m_pIndex;
+ protected:
+ virtual sdbcx::ObjectType createObject(const ::rtl::OUString& _rName);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > createDescriptor();
+ virtual void impl_refresh() throw(::com::sun::star::uno::RuntimeException);
+ public:
+ OIndexColumns( OIndexHelper* _pIndex,
+ ::osl::Mutex& _rMutex,
+ const ::std::vector< ::rtl::OUString> &_rVector);
+ };
+}
+#endif // CONNECTIVITY_INDEXCOLUMNSHELPER_HXX
diff --git a/connectivity/inc/connectivity/TIndexes.hxx b/connectivity/inc/connectivity/TIndexes.hxx
new file mode 100644
index 000000000000..d0a2eec83741
--- /dev/null
+++ b/connectivity/inc/connectivity/TIndexes.hxx
@@ -0,0 +1,57 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef CONNECTIVITY_INDEXESHELPER_HXX
+#define CONNECTIVITY_INDEXESHELPER_HXX
+
+#include "connectivity/dbtoolsdllapi.hxx"
+#include "connectivity/sdbcx/VCollection.hxx"
+#include <com/sun/star/sdbc/XDatabaseMetaData.hpp>
+
+namespace connectivity
+{
+ class OTableHelper;
+ class OOO_DLLPUBLIC_DBTOOLS OIndexesHelper : public sdbcx::OCollection
+ {
+ OTableHelper* m_pTable;
+ protected:
+ virtual sdbcx::ObjectType createObject(const ::rtl::OUString& _rName);
+ virtual void impl_refresh() throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > createDescriptor();
+ virtual sdbcx::ObjectType appendObject( const ::rtl::OUString& _rForName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor );
+ virtual void dropObject(sal_Int32 _nPos,const ::rtl::OUString _sElementName);
+ public:
+ OIndexesHelper(OTableHelper* _pTable,
+ ::osl::Mutex& _rMutex,
+ const ::std::vector< ::rtl::OUString> &_rVector
+ );
+
+ };
+}
+
+#endif // CONNECTIVITY_INDEXESHELPER_HXX
+
diff --git a/connectivity/inc/connectivity/TKey.hxx b/connectivity/inc/connectivity/TKey.hxx
new file mode 100644
index 000000000000..e586524dcca0
--- /dev/null
+++ b/connectivity/inc/connectivity/TKey.hxx
@@ -0,0 +1,54 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef CONNECTIVITY_TKEY_HXX
+#define CONNECTIVITY_TKEY_HXX
+
+#include "connectivity/dbtoolsdllapi.hxx"
+#include <connectivity/sdbcx/VKey.hxx>
+#include <com/sun/star/sdbc/XDatabaseMetaData.hpp>
+
+namespace connectivity
+{
+ class OTableHelper;
+ class OOO_DLLPUBLIC_DBTOOLS OTableKeyHelper : public connectivity::sdbcx::OKey
+ {
+ OTableHelper* m_pTable;
+ public:
+ virtual void refreshColumns();
+ public:
+ OTableKeyHelper( OTableHelper* _pTable);
+ OTableKeyHelper( OTableHelper* _pTable
+ ,const ::rtl::OUString& _Name
+ ,const sdbcx::TKeyProperties& _rProps
+ );
+ inline OTableHelper* getTable() const { return m_pTable; }
+ };
+}
+#endif // CONNECTIVITY_TKEY_HXX
+
+
diff --git a/connectivity/inc/connectivity/TKeyColumns.hxx b/connectivity/inc/connectivity/TKeyColumns.hxx
new file mode 100644
index 000000000000..9328fd5af04e
--- /dev/null
+++ b/connectivity/inc/connectivity/TKeyColumns.hxx
@@ -0,0 +1,50 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef CONNECTIVITY_TKEYCOLUMNS_HXX
+#define CONNECTIVITY_TKEYCOLUMNS_HXX
+
+#include "connectivity/sdbcx/VCollection.hxx"
+#include "connectivity/TKey.hxx"
+#include "connectivity/dbtoolsdllapi.hxx"
+
+namespace connectivity
+{
+ class OOO_DLLPUBLIC_DBTOOLS OKeyColumnsHelper : public connectivity::sdbcx::OCollection
+ {
+ OTableKeyHelper* m_pKey;
+ protected:
+ virtual sdbcx::ObjectType createObject(const ::rtl::OUString& _rName);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > createDescriptor();
+ virtual void impl_refresh() throw(::com::sun::star::uno::RuntimeException);
+ public:
+ OKeyColumnsHelper( OTableKeyHelper* _pKey,
+ ::osl::Mutex& _rMutex,
+ const ::std::vector< ::rtl::OUString> &_rVector);
+ };
+}
+#endif // CONNECTIVITY_TKEYCOLUMNS_HXX
diff --git a/connectivity/inc/connectivity/TKeys.hxx b/connectivity/inc/connectivity/TKeys.hxx
new file mode 100644
index 000000000000..8142dbcbe9df
--- /dev/null
+++ b/connectivity/inc/connectivity/TKeys.hxx
@@ -0,0 +1,66 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef CONNECTIVITY_TKEYS_HXX
+#define CONNECTIVITY_TKEYS_HXX
+
+#include "connectivity/sdbcx/VCollection.hxx"
+#include <com/sun/star/sdbc/XDatabaseMetaData.hpp>
+#include "connectivity/TTableHelper.hxx"
+#include "connectivity/dbtoolsdllapi.hxx"
+
+namespace connectivity
+{
+ typedef sdbcx::OCollection OKeys_BASE;
+ class OOO_DLLPUBLIC_DBTOOLS OKeysHelper : public OKeys_BASE
+ {
+ OTableHelper* m_pTable;
+ protected:
+ virtual sdbcx::ObjectType createObject(const ::rtl::OUString& _rName);
+ virtual void impl_refresh() throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > createDescriptor();
+ virtual sdbcx::ObjectType appendObject( const ::rtl::OUString& _rForName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor );
+ virtual void dropObject(sal_Int32 _nPos,const ::rtl::OUString _sElementName);
+
+ virtual ::rtl::OUString getDropForeignKey() const;
+
+ public:
+ OKeysHelper( OTableHelper* _pTable,
+ ::osl::Mutex& _rMutex,
+ const TStringVector& _rVector
+ );
+ inline OTableHelper* getTable() const { return m_pTable; }
+
+ static void cloneDescriptorColumns(
+ const sdbcx::ObjectType& _rSourceDescriptor,
+ const sdbcx::ObjectType& _rDestDescriptor
+ );
+ };
+}
+
+#endif // CONNECTIVITY_TKEYS_HXX
+
diff --git a/connectivity/inc/connectivity/TTableHelper.hxx b/connectivity/inc/connectivity/TTableHelper.hxx
new file mode 100644
index 000000000000..f99a106bce37
--- /dev/null
+++ b/connectivity/inc/connectivity/TTableHelper.hxx
@@ -0,0 +1,173 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef CONNECTIVITY_TABLEHELPER_HXX
+#define CONNECTIVITY_TABLEHELPER_HXX
+
+#include "connectivity/dbtoolsdllapi.hxx"
+#include "connectivity/sdbcx/VTable.hxx"
+#include "connectivity/sdbcx/VKey.hxx"
+#include "connectivity/StdTypeDefs.hxx"
+#include <comphelper/stl_types.hxx>
+#include <com/sun/star/sdb/tools/XTableRename.hpp>
+#include <com/sun/star/sdb/tools/XTableAlteration.hpp>
+#include <com/sun/star/sdb/tools/XKeyAlteration.hpp>
+#include <com/sun/star/sdb/tools/XIndexAlteration.hpp>
+
+namespace connectivity
+{
+ typedef sal_Int32 OrdinalPosition;
+ struct ColumnDesc
+ {
+ ::rtl::OUString sName;
+ ::rtl::OUString aField6;
+ ::rtl::OUString sField12; // REMARKS
+ ::rtl::OUString sField13;
+ sal_Int32 nField5
+ , nField7
+ , nField9
+ , nField11;
+
+ OrdinalPosition nOrdinalPosition;
+
+ ColumnDesc() {}
+ ColumnDesc( const ::rtl::OUString& _rName
+ , sal_Int32 _nField5
+ , const ::rtl::OUString& _aField6
+ , sal_Int32 _nField7
+ , sal_Int32 _nField9
+ , sal_Int32 _nField11
+ , const ::rtl::OUString& _sField12
+ , const ::rtl::OUString& _sField13
+ ,OrdinalPosition _nPosition )
+ :sName( _rName )
+ ,aField6(_aField6)
+ ,sField12(_sField12)
+ ,sField13(_sField13)
+ ,nField5(_nField5)
+ ,nField7(_nField7)
+ ,nField9(_nField9)
+ ,nField11(_nField11)
+ ,nOrdinalPosition( _nPosition )
+ {
+ }
+ };
+ typedef connectivity::sdbcx::OTable OTable_TYPEDEF;
+
+ OOO_DLLPUBLIC_DBTOOLS ::rtl::OUString getTypeString(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xColProp);
+
+ DECLARE_STL_USTRINGACCESS_MAP( sdbcx::TKeyProperties , TKeyMap);
+
+ struct OTableHelperImpl;
+
+ class OOO_DLLPUBLIC_DBTOOLS OTableHelper : public OTable_TYPEDEF
+ {
+ ::std::auto_ptr<OTableHelperImpl> m_pImpl;
+
+ void refreshPrimaryKeys(TStringVector& _rKeys);
+ void refreshForgeinKeys(TStringVector& _rKeys);
+
+ protected:
+ /** creates the column collection for the table
+ @param _rNames
+ The column names.
+ */
+ virtual sdbcx::OCollection* createColumns(const TStringVector& _rNames) = 0;
+
+ /** creates the key collection for the table
+ @param _rNames
+ The key names.
+ */
+ virtual sdbcx::OCollection* createKeys(const TStringVector& _rNames) = 0;
+
+ /** creates the index collection for the table
+ @param _rNames
+ The index names.
+ */
+ virtual sdbcx::OCollection* createIndexes(const TStringVector& _rNames) = 0;
+
+ /** this function is called upon disposing the component
+ */
+ virtual void SAL_CALL disposing();
+
+ /** The default returns "RENAME TABLE " or "RENAME VIEW " depending on the type.
+ *
+ * \return The start of the rename statement.
+ */
+ virtual ::rtl::OUString getRenameStart() const;
+
+ virtual ~OTableHelper();
+
+ public:
+ virtual void refreshColumns();
+ virtual void refreshKeys();
+ virtual void refreshIndexes();
+
+ const ColumnDesc* getColumnDescription(const ::rtl::OUString& _sName) const;
+
+ public:
+ OTableHelper( sdbcx::OCollection* _pTables,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _xConnection,
+ sal_Bool _bCase);
+ OTableHelper( sdbcx::OCollection* _pTables,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _xConnection,
+ sal_Bool _bCase,
+ const ::rtl::OUString& _Name,
+ const ::rtl::OUString& _Type,
+ const ::rtl::OUString& _Description = ::rtl::OUString(),
+ const ::rtl::OUString& _SchemaName = ::rtl::OUString(),
+ const ::rtl::OUString& _CatalogName = ::rtl::OUString()
+ );
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData> getMetaData() const;
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection> getConnection() const;
+
+ virtual void SAL_CALL acquire() throw();
+ virtual void SAL_CALL release() throw();
+
+ // XRename
+ virtual void SAL_CALL rename( const ::rtl::OUString& newName ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::container::ElementExistException, ::com::sun::star::uno::RuntimeException);
+
+ // XAlterTable
+ virtual void SAL_CALL alterColumnByIndex( sal_Int32 index, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ // XNamed
+ virtual ::rtl::OUString SAL_CALL getName() throw(::com::sun::star::uno::RuntimeException);
+
+ // helper method to get key properties
+ sdbcx::TKeyProperties getKeyProperties(const ::rtl::OUString& _sName) const;
+ void addKey(const ::rtl::OUString& _sName,const sdbcx::TKeyProperties& _aKeyProperties);
+
+ virtual ::rtl::OUString getTypeCreatePattern() const;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdb::tools::XTableRename> getRenameService() const;
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdb::tools::XTableAlteration> getAlterService() const;
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdb::tools::XKeyAlteration> getKeyService() const;
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdb::tools::XIndexAlteration> getIndexService() const;
+ };
+}
+#endif // CONNECTIVITY_TABLEHELPER_HXX
+
diff --git a/connectivity/inc/connectivity/conncleanup.hxx b/connectivity/inc/connectivity/conncleanup.hxx
new file mode 100644
index 000000000000..ee940f02e66d
--- /dev/null
+++ b/connectivity/inc/connectivity/conncleanup.hxx
@@ -0,0 +1,97 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _CONNECTIVITY_CONNCLEANUP_HXX_
+#define _CONNECTIVITY_CONNCLEANUP_HXX_
+
+#include <cppuhelper/implbase2.hxx>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/sdbc/XRowSet.hpp>
+#include <com/sun/star/sdbc/XConnection.hpp>
+#include "connectivity/dbtoolsdllapi.hxx"
+
+//.........................................................................
+namespace dbtools
+{
+//.........................................................................
+
+ //=====================================================================
+ //= OAutoConnectionDisposer
+ //=====================================================================
+ typedef ::cppu::WeakImplHelper2 < ::com::sun::star::beans::XPropertyChangeListener,
+ ::com::sun::star::sdbc::XRowSetListener
+ > OAutoConnectionDisposer_Base;
+
+ class OOO_DLLPUBLIC_DBTOOLS OAutoConnectionDisposer : public OAutoConnectionDisposer_Base
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >
+ m_xOriginalConnection;
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet > m_xRowSet; // needed to add as listener
+ sal_Bool m_bRSListening : 1; // true when we're listening on rowset
+ sal_Bool m_bPropertyListening : 1; // true when we're listening for property changes
+
+ public:
+ /** constructs an object
+ <p>The connection given will be set on the rowset (as ActiveConnection), and the object adds itself as property
+ change listener for the connection. Once somebody sets a new ActiveConnection, the old one (the one given
+ here) will be disposed.</p>
+ */
+ OAutoConnectionDisposer(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet >& _rxRowSet,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection
+ );
+
+ protected:
+ // XPropertyChangeListener
+ virtual void SAL_CALL propertyChange( const ::com::sun::star::beans::PropertyChangeEvent& _rEvent ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XEventListener
+ virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& _rSource ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XRowSetListener
+ virtual void SAL_CALL cursorMoved( const ::com::sun::star::lang::EventObject& event ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL rowChanged( const ::com::sun::star::lang::EventObject& event ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL rowSetChanged( const ::com::sun::star::lang::EventObject& event ) throw (::com::sun::star::uno::RuntimeException);
+
+ private:
+ void clearConnection();
+
+ void startRowSetListening();
+ void stopRowSetListening();
+ sal_Bool isRowSetListening() const { return m_bRSListening; }
+
+ void startPropertyListening( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxProps );
+ void stopPropertyListening( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxEventSource );
+ sal_Bool isPropertyListening() const { return m_bPropertyListening; }
+ };
+
+//.........................................................................
+} // namespace dbtools
+//.........................................................................
+
+#endif // _CONNECTIVITY_CONNCLEANUP_HXX_
+
diff --git a/connectivity/inc/connectivity/dbcharset.hxx b/connectivity/inc/connectivity/dbcharset.hxx
new file mode 100644
index 000000000000..427cdcf1cf88
--- /dev/null
+++ b/connectivity/inc/connectivity/dbcharset.hxx
@@ -0,0 +1,168 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _DBHELPER_DBCHARSET_HXX_
+#define _DBHELPER_DBCHARSET_HXX_
+
+#include <comphelper/stl_types.hxx>
+#include <rtl/textenc.h>
+#include <rtl/tencinfo.h>
+#include <rtl/ustring.hxx>
+#include "connectivity/dbtoolsdllapi.hxx"
+
+//.........................................................................
+namespace dbtools
+{
+//.........................................................................
+
+ //=========================================================================
+ //= OCharsetMap
+ //=========================================================================
+ /** is a class which translates between different charset representations.
+
+ <p>The set of recognized charsets is very limited: only the ones which are database relevant are
+ implemented at the moment</p>
+
+ <p>Possible representations are:
+ <ul>
+ <li><b>IANA names.</b>
+ Have a look at <A href="http://www.iana.org/assignments/character-sets">this document</A> for
+ more details</li>
+ <li><b>rtl_TextEncoding</b></li>
+ </ul>
+ </p>
+ */
+ class OOO_DLLPUBLIC_DBTOOLS OCharsetMap
+ {
+ protected:
+ DECLARE_STL_STDKEY_SET( rtl_TextEncoding, TextEncBag );
+
+ TextEncBag m_aEncodings;
+
+ public:
+ class CharsetIterator;
+ friend class OCharsetMap::CharsetIterator;
+ typedef CharsetIterator iterator;
+ typedef CharsetIterator const_iterator;
+
+ OCharsetMap();
+ virtual ~OCharsetMap();
+
+ struct IANA { };
+
+ /** find the given text encoding in the map.
+ @return the <em>end</em> iterator if the encoding could not be found.
+ */
+ CharsetIterator find(const rtl_TextEncoding _eEncoding) const;
+ /** find the given IANA name in the map.
+ @return the <em>end</em> iterator if the IANA name could not be found.
+ */
+ CharsetIterator find(const ::rtl::OUString& _rIanaName, const IANA&) const;
+
+ sal_Int32 size() const { ensureConstructed( ); return m_aEncodings.size(); }
+
+ /// get access to the first element of the charset collection
+ CharsetIterator begin() const;
+ /// get access to the (last + 1st) element of the charset collection
+ CharsetIterator end() const;
+
+ protected:
+ // needed because we want to call a virtual method during construction
+ void lateConstruct();
+ inline void ensureConstructed( ) const { if ( m_aEncodings.empty() ) const_cast< OCharsetMap* >( this )->lateConstruct(); }
+
+ virtual sal_Bool approveEncoding( const rtl_TextEncoding _eEncoding, const rtl_TextEncodingInfo& _rInfo ) const;
+ };
+
+ //-------------------------------------------------------------------------
+ //- CharsetIteratorDerefHelper
+ //-------------------------------------------------------------------------
+ class OOO_DLLPUBLIC_DBTOOLS CharsetIteratorDerefHelper
+ {
+ friend class OCharsetMap::CharsetIterator;
+
+ rtl_TextEncoding m_eEncoding;
+ ::rtl::OUString m_aIanaName;
+
+ public:
+ CharsetIteratorDerefHelper(const CharsetIteratorDerefHelper& _rSource);
+
+ rtl_TextEncoding getEncoding() const { return m_eEncoding; }
+ ::rtl::OUString getIanaName() const { return m_aIanaName; }
+
+ protected:
+ CharsetIteratorDerefHelper();
+ CharsetIteratorDerefHelper( const rtl_TextEncoding _eEncoding, const ::rtl::OUString& _rIanaName );
+
+ };
+
+
+ //-------------------------------------------------------------------------
+ //- OCharsetMap::CharsetIterator
+ //-------------------------------------------------------------------------
+ class OOO_DLLPUBLIC_DBTOOLS OCharsetMap::CharsetIterator
+ {
+ friend class OCharsetMap;
+
+ friend OOO_DLLPUBLIC_DBTOOLS bool operator==(const CharsetIterator& lhs, const CharsetIterator& rhs);
+ friend bool operator!=(const CharsetIterator& lhs, const CharsetIterator& rhs) { return !(lhs == rhs); }
+
+// friend sal_Int32 operator-(const CharsetIterator& lhs, const CharsetIterator& rhs);
+
+ protected:
+ const OCharsetMap* m_pContainer;
+ OCharsetMap::TextEncBag::const_iterator m_aPos;
+
+ public:
+ CharsetIterator(const CharsetIterator& _rSource);
+ ~CharsetIterator();
+
+ CharsetIteratorDerefHelper operator*() const;
+ // no -> operator
+ // this would require us to a) store CharsetIteratorDerefHelper instances ourself so that we
+ // can return a pointer or b) introduce a -> operator on the CharsetIteratorDerefHelper, too.
+
+ /// prefix increment
+ const CharsetIterator& operator++();
+ /// postfix increment
+ const CharsetIterator operator++(int) { CharsetIterator hold(*this); ++*this; return hold; }
+
+ /// prefix decrement
+ const CharsetIterator& operator--();
+ /// postfix decrement
+ const CharsetIterator operator--(int) { CharsetIterator hold(*this); --*this; return hold; }
+
+ protected:
+ CharsetIterator(const OCharsetMap* _pContainer, OCharsetMap::TextEncBag::const_iterator _aPos );
+ };
+
+//.........................................................................
+} // namespace dbtools
+//.........................................................................
+
+#endif // _DBHELPER_DBCHARSET_HXX_
+
diff --git a/connectivity/inc/connectivity/dbconversion.hxx b/connectivity/inc/connectivity/dbconversion.hxx
new file mode 100644
index 000000000000..6a54a3e92d2d
--- /dev/null
+++ b/connectivity/inc/connectivity/dbconversion.hxx
@@ -0,0 +1,224 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _DBHELPER_DBCONVERSION_HXX_
+#define _DBHELPER_DBCONVERSION_HXX_
+
+#include <com/sun/star/lang/IllegalArgumentException.hpp>
+#include <com/sun/star/util/Date.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+#include "connectivity/dbtoolsdllapi.hxx"
+
+// forward declarations
+namespace rtl
+{
+ class OUString;
+}
+namespace com
+{
+ namespace sun
+ {
+ namespace star
+ {
+ namespace lang
+ {
+ struct Locale;
+ }
+ namespace sdb
+ {
+ class XColumn;
+ class XColumnUpdate;
+ }
+ namespace sdbc
+ {
+ class SQLException;
+ }
+ namespace beans
+ {
+ class XPropertySet;
+ }
+ namespace util
+ {
+ class XNumberFormatter;
+ class XNumberFormatsSupplier;
+ struct Time;
+ struct DateTime;
+ }
+ namespace script
+ {
+ class XTypeConverter;
+ }
+ }
+ }
+}
+
+//.........................................................................
+namespace dbtools
+{
+//.........................................................................
+
+ class OOO_DLLPUBLIC_DBTOOLS DBTypeConversion
+ {
+ public:
+ static ::com::sun::star::util::Date getStandardDate();
+ static void setValue(const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumnUpdate>& xVariant,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter>& xFormatter,
+ const ::com::sun::star::util::Date& rNullDate,
+ const ::rtl::OUString& rString,
+ sal_Int32 nKey,
+ sal_Int16 nFieldType,
+ sal_Int16 nKeyType) throw(::com::sun::star::lang::IllegalArgumentException);
+
+ static void setValue(const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumnUpdate>& xVariant,
+ const ::com::sun::star::util::Date& rNullDate,
+ const double& rValue,
+ sal_Int16 nKeyType) throw(::com::sun::star::lang::IllegalArgumentException);
+
+ static double getValue(const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumn>& xVariant, const ::com::sun::star::util::Date& rNullDate,
+ sal_Int16 nKeyType);
+
+ // get the columnvalue as string with a default format given by the column or a default format
+ // for the type
+ static ::rtl::OUString getValue(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _xColumn,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter>& xFormatter,
+ const ::com::sun::star::lang::Locale& _rLocale,
+ const ::com::sun::star::util::Date& rNullDate);
+
+ static ::rtl::OUString getValue(const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumn>& _xColumn,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter>& xFormatter,
+ const ::com::sun::star::util::Date& rNullDate,
+ sal_Int32 nKey,
+ sal_Int16 nKeyType);
+
+ static ::com::sun::star::util::Date toDate(double dVal, const ::com::sun::star::util::Date& _rNullDate = getStandardDate());
+ static ::com::sun::star::util::Date toDate(const ::rtl::OUString& _sSQLDate);
+ static ::com::sun::star::util::Time toTime(double dVal);
+ static ::com::sun::star::util::Time toTime(const ::rtl::OUString& _sSQLDate);
+ static ::com::sun::star::util::DateTime toDateTime(double dVal, const ::com::sun::star::util::Date& _rNullDate = getStandardDate());
+ static ::com::sun::star::util::DateTime toDateTime(const ::rtl::OUString& _sSQLDate);
+
+
+ /** return the given DateTime as JDBC compliant 64 bit value
+ */
+ static sal_Int64 toINT64(const ::com::sun::star::util::DateTime& rVal);
+ static sal_Int32 getMsFromTime(const ::com::sun::star::util::Time& rVal);
+
+ static sal_Int32 toDays(const ::com::sun::star::util::Date& _rVal, const ::com::sun::star::util::Date& _rNullDate = getStandardDate());
+
+ static double toDouble(const ::com::sun::star::util::Date& rVal, const ::com::sun::star::util::Date& _rNullDate = getStandardDate());
+ static double toDouble(const ::com::sun::star::util::Time& rVal);
+ static double toDouble(const ::com::sun::star::util::DateTime& rVal, const ::com::sun::star::util::Date& _rNullDate = getStandardDate());
+
+ static sal_Int32 toINT32(const ::com::sun::star::util::Date& rVal);
+ static sal_Int32 toINT32(const ::com::sun::star::util::Time& rVal);
+
+ static ::com::sun::star::util::Date toDate(sal_Int32 _nVal);
+ static ::com::sun::star::util::Time toTime(sal_Int32 _nVal);
+
+ /** convert a double which is a date value relative to a given fixed date into a date value relative
+ to the standard db null date.
+ */
+ static double toStandardDbDate(const ::com::sun::star::util::Date& _rNullDate, double _rVal) { return _rVal + toDays(_rNullDate); }
+ /** convert a double which is a date value relative to the standard db null date into a date value relative
+ to a given fixed date.
+ */
+ static double toNullDate(const ::com::sun::star::util::Date& _rNullDate, double _rVal) { return _rVal - toDays(_rNullDate); }
+
+ // return the date from the numberformatsupplier or the STANDARD_DATE (1900,1,1)
+ static ::com::sun::star::util::Date getNULLDate(const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier > &xSupplier);
+
+ // return the date in the format %04d-%02d-%02d
+ static ::rtl::OUString toDateString(const ::com::sun::star::util::Date& rDate);
+ // return the time in the format %02d:%02d:%02d
+ static ::rtl::OUString toTimeString(const ::com::sun::star::util::Time& rTime);
+ // return the DateTime in the format %04d-%02d-%02d %02d:%02d:%02d
+ static ::rtl::OUString toDateTimeString(const ::com::sun::star::util::DateTime& _rDateTime);
+ // return the any in an sql standard format
+ static ::rtl::OUString toSQLString(sal_Int32 eType, const ::com::sun::star::uno::Any& _rVal, sal_Bool bQuote,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::script::XTypeConverter >& _rxTypeConverter);
+
+ /** converts a Unicode string into a 8-bit string, using the given encoding
+
+ @param _rSource
+ the source string to convert
+ @param _rDest
+ the destination string
+ @param _eEncoding
+ the encoding to use for the conversion
+
+ @throws com::sun::star::sdbc::SQLException
+ if the given string contains characters which are not convertible using the given encoding
+ The SQLState of the exception will be set to 22018 ("Invalid character value for cast specification")
+
+ @return
+ the length of the converted string
+ */
+ static sal_Int32 convertUnicodeString(
+ const ::rtl::OUString& _rSource,
+ ::rtl::OString& _rDest,
+ rtl_TextEncoding _eEncoding
+ )
+ SAL_THROW((::com::sun::star::sdbc::SQLException));
+
+ /** converts a Unicode string into a 8-bit string, using the given encoding
+
+ @param _rSource
+ the source string to convert
+
+ @param _rDest
+ the destination string
+
+ @param _nMaxLen
+ the maximum length of the destination string
+
+ @param _eEncoding
+ the encoding to use for the conversion
+
+ @throws com::sun::star::sdbc::SQLException
+ if convertUnicodeString, which is called internally, throws such an exception
+
+ @throws com::sun::star::sdbc::SQLException
+ if the conversion results in a string which is longer than _nMaxLen
+
+ @return
+ the length of the converted string
+ */
+ static sal_Int32 convertUnicodeStringToLength(
+ const ::rtl::OUString& _rSource,
+ ::rtl::OString& _rDest,
+ sal_Int32 _nMaxLen,
+ rtl_TextEncoding _eEncoding
+ )
+ SAL_THROW((::com::sun::star::sdbc::SQLException));
+ };
+
+//.........................................................................
+} // namespace dbtools
+//.........................................................................
+
+#endif // _DBHELPER_DBCONVERSION_HXX_
+
diff --git a/connectivity/inc/connectivity/dbexception.hxx b/connectivity/inc/connectivity/dbexception.hxx
new file mode 100644
index 000000000000..bd4077ccb9e2
--- /dev/null
+++ b/connectivity/inc/connectivity/dbexception.hxx
@@ -0,0 +1,377 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _DBHELPER_DBEXCEPTION_HXX_
+#define _DBHELPER_DBEXCEPTION_HXX_
+
+#include <com/sun/star/sdbc/SQLException.hpp>
+#include "connectivity/standardsqlstate.hxx"
+#include "connectivity/dbtoolsdllapi.hxx"
+
+namespace com
+{
+ namespace sun
+ {
+ namespace star
+ {
+ namespace sdb
+ {
+ class SQLContext;
+ struct SQLErrorEvent;
+ }
+ namespace sdbc
+ {
+ class SQLWarning;
+ }
+ }
+ }
+}
+//.........................................................................
+namespace dbtools
+{
+//.........................................................................
+
+//==============================================================================
+//= Special exception if cancel is pressed in DBA UI
+//==============================================================================
+enum OOoBaseErrorCode
+{
+ ParameterInteractionCancelled = 1
+};
+
+//==============================================================================
+//= SQLExceptionInfo - encapsulating the type info of an SQLException-derived class
+//==============================================================================
+
+class OOO_DLLPUBLIC_DBTOOLS SQLExceptionInfo
+{
+public:
+ enum TYPE { SQL_EXCEPTION, SQL_WARNING, SQL_CONTEXT, UNDEFINED };
+
+private:
+ ::com::sun::star::uno::Any m_aContent;
+ TYPE m_eType; // redundant (could be derived from m_aContent.getValueType())
+
+public:
+ SQLExceptionInfo();
+ SQLExceptionInfo(const ::com::sun::star::sdbc::SQLException& _rError);
+ SQLExceptionInfo(const ::com::sun::star::sdbc::SQLWarning& _rError);
+ SQLExceptionInfo(const ::com::sun::star::sdb::SQLContext& _rError);
+
+ /** convenience constructor
+
+ If your error processing relies on SQLExceptions, and SQLExceptionInfos, you still may
+ need to display an error which consists of a simple message string only.
+ In those cases, you can use this constructor, which behaves as if you would have used
+ an SQLException containing exactly the given error message.
+ */
+ SQLExceptionInfo( const ::rtl::OUString& _rSimpleErrorMessage );
+
+ SQLExceptionInfo(const SQLExceptionInfo& _rCopySource);
+
+ SQLExceptionInfo(const ::com::sun::star::sdb::SQLErrorEvent& _rError);
+ // use for events got via XSQLErrorListener::errorOccured
+ SQLExceptionInfo(const ::com::sun::star::uno::Any& _rError);
+ // use with the Reason member of an SQLErrorEvent or with NextElement of an SQLException
+
+ /** prepends a plain error message to the chain of exceptions
+ @param _rSimpleErrorMessage
+ the error message to prepend
+ @param _pAsciiSQLState
+ the SQLState of the to-be-constructed SQLException, or NULL if this should be defaulted to HY000
+ @param _nErrorCode
+ the ErrorCode of the to-be-constructed SQLException
+ */
+ void prepend( const ::rtl::OUString& _rErrorMessage, const sal_Char* _pAsciiSQLState = NULL, const sal_Int32 _nErrorCode = 0 );
+
+ /** appends a plain message to the chain of exceptions
+ @param _eType
+ the type of exception to append. Must be SQL_EXCEPTION, SQL_WARNING, SQL_CONTEXT, for all other
+ values, the behavior is undefined.
+ @param _rErrorMessage
+ the message to append
+ @param _pAsciiSQLState
+ the SQLState of the exception to append
+ @param _nErrorCode
+ the error code of the exception to append
+ */
+ void append( TYPE _eType, const ::rtl::OUString& _rErrorMessage, const sal_Char* _pAsciiSQLState = NULL, const sal_Int32 _nErrorCode = 0 );
+
+ /** throws (properly typed) the exception contained in the object
+ @precond
+ isValid() returns <TRUE/>
+ @throws SQLException
+ @throws RuntimeException
+ if the instance does not contain an SQLException
+ */
+ void doThrow();
+
+ const SQLExceptionInfo& operator=(const ::com::sun::star::sdbc::SQLException& _rError);
+ const SQLExceptionInfo& operator=(const ::com::sun::star::sdbc::SQLWarning& _rError);
+ const SQLExceptionInfo& operator=(const ::com::sun::star::sdb::SQLContext& _rError);
+ const SQLExceptionInfo& operator=(const ::com::sun::star::sdb::SQLErrorEvent& _rErrorEvent);
+ const SQLExceptionInfo& operator=(const ::com::sun::star::uno::Any& _rCaughtSQLException);
+
+ sal_Bool isKindOf(TYPE _eType) const;
+ // not just a simple comparisation ! e.g. getType() == SQL_CONTEXT implies isKindOf(SQL_EXCEPTION) == sal_True !
+ sal_Bool isValid() const { return m_eType != UNDEFINED; }
+ TYPE getType() const { return m_eType; }
+
+ operator const ::com::sun::star::sdbc::SQLException* () const;
+ operator const ::com::sun::star::sdbc::SQLWarning* () const;
+ operator const ::com::sun::star::sdb::SQLContext* () const;
+
+ const ::com::sun::star::uno::Any& get() const { return m_aContent; }
+
+ void clear()
+ {
+ m_aContent.clear();
+ m_eType = UNDEFINED;
+ }
+
+protected:
+ void implDetermineType();
+};
+
+//==============================================================================
+//= SQLExceptionIteratorHelper - iterating through an SQLException chain
+//==============================================================================
+
+class OOO_DLLPUBLIC_DBTOOLS SQLExceptionIteratorHelper
+{
+protected:
+ const ::com::sun::star::sdbc::SQLException* m_pCurrent;
+ SQLExceptionInfo::TYPE m_eCurrentType;
+
+public:
+ /** constructs an iterator instance from an SQLException
+
+ @param _rChainStart
+ the start of the exception chain to iterate. Must live as long as the iterator
+ instances lives, at least.
+ */
+ SQLExceptionIteratorHelper( const ::com::sun::star::sdbc::SQLException& _rChainStart );
+
+ /** constructs an iterator instance from an SQLWarning
+
+ @param _rChainStart
+ the start of the exception chain to iterate. Must live as long as the iterator
+ instances lives, at least.
+ */
+ SQLExceptionIteratorHelper( const ::com::sun::star::sdbc::SQLWarning& _rChainStart );
+
+ /** constructs an iterator instance from an SQLContext
+
+ @param _rChainStart
+ the start of the exception chain to iterate. Must live as long as the iterator
+ instances lives, at least.
+ */
+ SQLExceptionIteratorHelper( const ::com::sun::star::sdb::SQLContext& _rChainStart );
+
+ /** constructs an iterator instance from an SQLExceptionInfo
+
+ @param _rErrorInfo
+ the start of the exception chain to iterate. Must live as long as the iterator
+ instances lives, at least.
+ */
+ SQLExceptionIteratorHelper( const SQLExceptionInfo& _rErrorInfo );
+
+ /** determines whether there are more elements in the exception chain
+ */
+ sal_Bool hasMoreElements() const { return ( m_pCurrent != NULL ); }
+
+ /** returns the type of the current element in the exception chain
+ */
+ SQLExceptionInfo::TYPE currentType() const { return m_eCurrentType; }
+
+ /** retrieves the current element in the chain, or <NULL/> if the chain has been completely
+ traveled.
+ */
+ const ::com::sun::star::sdbc::SQLException* current() const { return m_pCurrent; }
+
+ /** retrieves the current element in the chain, or <NULL/> if the chain has been completely
+ traveled.
+
+ In opposite to the second <member>current</member>, this version allows typed access to
+ the respective SQLException.
+ */
+ void current( SQLExceptionInfo& _out_rInfo ) const;
+
+ /** proceeds to the next element in the chain
+
+ @return the current element in the chain, as <b>before</em> the chain move.
+ */
+ const ::com::sun::star::sdbc::SQLException* next();
+
+ /** proceeds to the next element in the chain
+
+ In opposite to the second <member>current</member>, this version allows typed access to
+ the respective SQLException.
+ */
+ void next( SQLExceptionInfo& _out_rInfo );
+};
+
+//==================================================================================
+//= StandardExceptions
+//==================================================================================
+//----------------------------------------------------------------------------------
+/** returns a standard error string for a given SQLState
+
+ @param _eState
+ describes the state whose description is to retrieve. Must not be SQL_ERROR_UNSPECIFIED.
+ @raises RuntimeException
+ in case of an internal error
+*/
+OOO_DLLPUBLIC_DBTOOLS ::rtl::OUString getStandardSQLState( StandardSQLState _eState );
+
+//----------------------------------------------------------------------------------
+/** returns a standard ASCII string for a given SQLState
+
+ @param _eState
+ describes the state whose description is to retrieve. Must not be SQL_ERROR_UNSPECIFIED.
+ @return
+ a non-<NULL/> pointer to an ASCII character string denoting the requested SQLState
+ @raises RuntimeException
+ in case of an internal error
+*/
+OOO_DLLPUBLIC_DBTOOLS const sal_Char* getStandardSQLStateAscii( StandardSQLState _eState );
+
+//----------------------------------------------------------------------------------
+OOO_DLLPUBLIC_DBTOOLS void throwFunctionNotSupportedException(
+ const ::rtl::OUString& _rMsg,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _Context,
+ const ::com::sun::star::uno::Any& _Next = ::com::sun::star::uno::Any()
+ )
+ throw ( ::com::sun::star::sdbc::SQLException );
+
+//----------------------------------------------------------------------------------
+/** throws an exception with SQL state IM001, saying that a certain function is not supported
+*/
+OOO_DLLPUBLIC_DBTOOLS void throwFunctionNotSupportedException(
+ const sal_Char* _pAsciiFunctionName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxContext,
+ const ::com::sun::star::uno::Any* _pNextException = NULL
+ )
+ throw ( ::com::sun::star::sdbc::SQLException );
+
+//----------------------------------------------------------------------------------
+/** throws a function sequence (HY010) exception
+*/
+OOO_DLLPUBLIC_DBTOOLS void throwFunctionSequenceException(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _Context,
+ const ::com::sun::star::uno::Any& _Next = ::com::sun::star::uno::Any()
+ )
+ throw ( ::com::sun::star::sdbc::SQLException );
+
+//----------------------------------------------------------------------------------
+/** throw a invalid index sqlexception
+*/
+OOO_DLLPUBLIC_DBTOOLS void throwInvalidIndexException(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _Context,
+ const ::com::sun::star::uno::Any& _Next = ::com::sun::star::uno::Any()
+ )
+ throw ( ::com::sun::star::sdbc::SQLException );
+
+//----------------------------------------------------------------------------------
+/** throw a generic SQLException, i.e. one with an SQLState of HY000, an ErrorCode of 0 and no NextException
+*/
+OOO_DLLPUBLIC_DBTOOLS void throwGenericSQLException(
+ const ::rtl::OUString& _rMsg,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxSource
+ )
+ throw (::com::sun::star::sdbc::SQLException);
+
+//----------------------------------------------------------------------------------
+/** throw a generic SQLException, i.e. one with an SQLState of HY000, an ErrorCode of 0 and no NextException
+*/
+OOO_DLLPUBLIC_DBTOOLS void throwGenericSQLException(
+ const ::rtl::OUString& _rMsg,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxSource,
+ const ::com::sun::star::uno::Any& _rNextException
+ )
+ throw (::com::sun::star::sdbc::SQLException);
+
+//----------------------------------------------------------------------------------
+/** throw a SQLException with SQLState HYC00 (Optional feature not implemented)
+ @param _pAsciiFeatureName
+ an ASCII description of the feature which is not implemented. It's recommended that the feature
+ name is built from the name of the interface plus its method, for instance "XParameters::updateBinaryStream"
+ @param _rxContext
+ the context of the exception
+ @param _pNextException
+ the next exception to chain into the thrown exception, if any
+*/
+OOO_DLLPUBLIC_DBTOOLS void throwFeatureNotImplementedException(
+ const sal_Char* _pAsciiFeatureName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxContext,
+ const ::com::sun::star::uno::Any* _pNextException = NULL
+ )
+ throw (::com::sun::star::sdbc::SQLException);
+
+//----------------------------------------------------------------------------------
+/** throws an SQLException
+*/
+OOO_DLLPUBLIC_DBTOOLS void throwSQLException(
+ const sal_Char* _pAsciiMessage,
+ const sal_Char* _pAsciiState,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxContext,
+ const sal_Int32 _nErrorCode = 0,
+ const ::com::sun::star::uno::Any* _pNextException = NULL
+ )
+ throw (::com::sun::star::sdbc::SQLException);
+
+//----------------------------------------------------------------------------------
+/** throws an SQLException
+*/
+OOO_DLLPUBLIC_DBTOOLS void throwSQLException(
+ const sal_Char* _pAsciiMessage,
+ StandardSQLState _eSQLState,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxContext,
+ const sal_Int32 _nErrorCode = 0,
+ const ::com::sun::star::uno::Any* _pNextException = NULL
+ )
+ throw (::com::sun::star::sdbc::SQLException);
+
+//----------------------------------------------------------------------------------
+/** throws an SQLException
+*/
+OOO_DLLPUBLIC_DBTOOLS void throwSQLException(
+ const ::rtl::OUString& _rMessage,
+ StandardSQLState _eSQLState,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxContext,
+ const sal_Int32 _nErrorCode = 0,
+ const ::com::sun::star::uno::Any* _pNextException = NULL
+ )
+ throw (::com::sun::star::sdbc::SQLException);
+
+//.........................................................................
+} // namespace dbtools
+//.........................................................................
+
+#endif // _DBHELPER_DBEXCEPTION_HXX_
+
+
diff --git a/connectivity/inc/connectivity/dbmetadata.hxx b/connectivity/inc/connectivity/dbmetadata.hxx
new file mode 100644
index 000000000000..7ed7967bf4c5
--- /dev/null
+++ b/connectivity/inc/connectivity/dbmetadata.hxx
@@ -0,0 +1,200 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef CONNECTIVITY_INC_CONNECTIVITY_DBMETADATA_HXX
+#define CONNECTIVITY_INC_CONNECTIVITY_DBMETADATA_HXX
+
+/** === begin UNO includes === **/
+#include <com/sun/star/sdbc/XConnection.hpp>
+/** === end UNO includes === **/
+
+#include <memory>
+#include "connectivity/dbtoolsdllapi.hxx"
+
+namespace comphelper
+{
+ class ComponentContext;
+}
+
+//........................................................................
+namespace dbtools
+{
+//........................................................................
+
+ //====================================================================
+ //= DatabaseMetaData
+ //====================================================================
+ struct DatabaseMetaData_Impl;
+ /** encapsulates meta data about a database/connection which cannot be obtained
+ from the usual XDatabaseMetaData result set.
+
+ Meta data perhaps isn't really the right term ... Some of the methods
+ in this class involved heuristics, some are just a convenient wrapper
+ around more complex ways to obtain the same information.
+
+ @todo
+ Once CWS dba30 is integrated, we could easily add all the meta data
+ which is part of the "Info" property of a data source.
+ */
+ class OOO_DLLPUBLIC_DBTOOLS DatabaseMetaData
+ {
+ private:
+ ::std::auto_ptr< DatabaseMetaData_Impl > m_pImpl;
+
+ public:
+ DatabaseMetaData();
+ /** constructs a DatabaseMetaData instance
+ @param _rxConnection
+ is the connection whose meta data you're interested in.
+ Note that some of the information provided by this class can only be obtained
+ if this connection denotes an application-level connection, i.e. supports
+ the com.sun.star.sdb.Connection service.
+
+ @throws ::com::sun::star::lang::IllegalArgumentException
+ if the given connection is not <NULL/>, but the XDatabaseMetaData provided by it
+ are <NULL/>
+ @throws ::com::sun::star::sdbc::SQLException
+ if obtaining the meta data from the connection throws an SQLException
+ @throws ::com::sun::star::uno::RuntimeException
+ if obtaining the meta data from the connection throws an RuntimeException
+ */
+ DatabaseMetaData(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _connection );
+ DatabaseMetaData( const DatabaseMetaData& _copyFrom );
+ DatabaseMetaData& operator=( const DatabaseMetaData& _copyFrom );
+
+ ~DatabaseMetaData();
+
+ public:
+ /** determines whether or not the instances is based on a valid connection
+
+ As long as this method returns true<TRUE/>, you should expect all other
+ methods throwing an SQLException when called.
+ */
+ bool isConnected() const;
+
+ /** resets the instance so that it's based on a new connection
+ */
+ inline void reset( const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _connection )
+ {
+ *this = DatabaseMetaData( _connection );
+ }
+
+ /// wraps XDatabaseMetaData::getIdentifierQuoteString
+ const ::rtl::OUString& getIdentifierQuoteString() const;
+
+ /// wraps XDatabaseMetaData::getCatalogSeparator
+ const ::rtl::OUString& getCatalogSeparator() const;
+
+ /** determines whether the database supports sub queries in the FROM part
+ of a SELECT clause are supported.
+ @throws ::com::sun::star::sdbc::SQLException
+ with SQLState 08003 (connection does not exist) if the instances was
+ default-constructed and does not have a connection, yet.
+ */
+ bool supportsSubqueriesInFrom() const;
+
+ /** checks whether the database supports primary keys
+
+ Since there's no dedicated API to ask a database for this, a heuristics needs to be applied.
+ First, the <code>PrimaryKeySupport<code> settings of the data source is examined. If it is <TRUE/>
+ or <FALSE/>, then value is returned. If it is <NULL/>, then the database meta data are examined
+ for support of core SQL grammar, and the result is returned. The assumption is that a database/driver
+ which supports core SQL grammar usually also supports primary keys, and vice versa. At least, experience
+ shows this is true most of the time.
+ */
+ bool supportsPrimaryKeys() const;
+
+ /** determines whether names in the database should be restricted to SQL-92 identifiers
+
+ Effectively, this method checks the EnableSQL92Check property of the data source settings,
+ if present.
+ */
+ bool restrictIdentifiersToSQL92() const;
+
+ /** determines whether when generating SQL statements, an AS keyword should be generated
+ before a correlation name.
+
+ E.g., it determines whether <code>SELECT * FROM table AS correlation_name</code> or
+ <code>SELECT * FROM table correlation_name</code> is generated.
+ */
+ bool generateASBeforeCorrelationName() const;
+
+ /** should date time be escaped like '2001-01-01' => #2001-01-01#
+ */
+ bool shouldEscapeDateTime() const;
+
+ /** auto increment columns should be automaticly used as primary key.
+ */
+ bool isAutoIncrementPrimaryKey() const;
+
+ /** determines the syntax to use for boolean comparison predicates
+
+ @see ::com::sun::star::sdb::BooleanComparisonMode
+ */
+ sal_Int32
+ getBooleanComparisonMode() const;
+
+ /** determines in relations are supported.
+ *
+ * \return <TRUE/> when relations are supported, otherwise <FALSE/>
+ */
+ bool supportsRelations() const;
+
+ /** determines if column alias names can be used in the order by clause.
+ *
+ * \return <TRUE/> when relations are supported, otherwise <FALSE/>
+ */
+ bool supportsColumnAliasInOrderBy() const;
+
+ /** determines whether user administration is supported for the database
+
+ User administration support is controlled by the availability of the XUsersSupplier
+ interface, and it returning a non-NULL users container.
+
+ @param _rContext
+ the component context we operate in. Might be needed to create the
+ css.sdbc.DriverManager instance.
+ */
+ bool supportsUserAdministration( const ::comphelper::ComponentContext& _rContext ) const;
+
+ /** determines whether in the application UI, empty table folders (aka catalogs/schemas) should be displayed
+ */
+ bool displayEmptyTableFolders() const;
+
+ /** determines that threads are supported.
+ *
+ * \return <TRUE/> when threads are supported, otherwise <FALSE/>
+ */
+ bool supportsThreads() const;
+ };
+
+//........................................................................
+} // namespace dbtools
+//........................................................................
+
+#endif // CONNECTIVITY_INC_CONNECTIVITY_DBMETADATA_HXX
diff --git a/connectivity/inc/connectivity/dbtools.hxx b/connectivity/inc/connectivity/dbtools.hxx
new file mode 100644
index 000000000000..9b93830aeefe
--- /dev/null
+++ b/connectivity/inc/connectivity/dbtools.hxx
@@ -0,0 +1,825 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _CONNECTIVITY_DBTOOLS_HXX_
+#define _CONNECTIVITY_DBTOOLS_HXX_
+
+#include <connectivity/dbexception.hxx>
+#include <comphelper/types.hxx>
+#include <com/sun/star/sdbc/DataType.hpp>
+#include <comphelper/stl_types.hxx>
+#include <unotools/sharedunocomponent.hxx>
+#include "connectivity/dbtoolsdllapi.hxx"
+#include "connectivity/FValue.hxx"
+
+namespace com { namespace sun { namespace star {
+
+namespace sdb {
+ class XSingleSelectQueryComposer;
+ class SQLContext;
+}
+namespace sdbcx {
+ class XTablesSupplier;
+}
+namespace sdbc {
+ class XConnection;
+ class XDatabaseMetaData;
+ class XRowSet;
+ class XDataSource;
+ class SQLException;
+ class XParameters;
+ class XRowUpdate;
+}
+namespace beans {
+ class XPropertySet;
+}
+namespace awt {
+ class XWindow;
+}
+namespace lang {
+ struct Locale;
+ class XMultiServiceFactory;
+ class WrappedTargetException;
+}
+namespace container {
+ class XNameAccess;
+}
+
+namespace util {
+ class XNumberFormatTypes;
+ class XNumberFormatsSupplier;
+}
+namespace task {
+ class XInteractionHandler;
+}
+
+} } }
+
+namespace rtl
+{
+ class OUStringBuffer;
+}
+
+//.........................................................................
+namespace dbtools
+{
+ class ISQLStatementHelper;
+ typedef ::utl::SharedUNOComponent< ::com::sun::star::sdbc::XConnection > SharedConnection;
+
+ enum EComposeRule
+ {
+ eInTableDefinitions,
+ eInIndexDefinitions,
+ eInDataManipulation,
+ eInProcedureCalls,
+ eInPrivilegeDefinitions,
+ eComplete
+ };
+//=========================================================================
+ // date conversion
+
+ // calculates the default numberformat for a given datatype and a give language
+ OOO_DLLPUBLIC_DBTOOLS
+ sal_Int32 getDefaultNumberFormat(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _xColumn,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatTypes >& _xTypes,
+ const ::com::sun::star::lang::Locale& _rLocale);
+
+ // calculates the default numberformat for a given datatype and a give language
+ // @param _nDataType @see com.sun.star.sdbc.DataType
+ // @param _nScale can be zero
+ OOO_DLLPUBLIC_DBTOOLS
+ sal_Int32 getDefaultNumberFormat(sal_Int32 _nDataType,
+ sal_Int32 _nScale,
+ sal_Bool _bIsCurrency,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatTypes >& _xTypes,
+ const ::com::sun::star::lang::Locale& _rLocale);
+
+//=========================================================================
+
+ /** creates a connection which can be used for the rowset given
+
+ The function tries to obtain a connection for the row set with the following
+ steps (in this order):
+ <nl>
+ <li>If the rowset already has an ActiveConnection (means a non-<NULL/> value vor this property),
+ this one is used.</li>
+ <li>If row set is part of a database form document (see ->isEmbeddedInDatabase),
+ a connection for the respective database is used.</li>
+ <li>If in the parent hierarchy of the row set, there is an object supporting
+ the XConnection interface, this one is returned.</li>
+ <li>If the DataSourceName property of the row set is not empty, a connection for this
+ data source is retrieved.</li>
+ <li>If the URL property of the row set is not empty, an connection for this URL is
+ retrieved from the driver manager.
+ </nl>
+
+ @param _rxRowSet
+ the row set
+
+ @param _rxFactory
+ a service factory, which can be used to create data sources, interaction handler etc (the usual stuff)
+
+ @param _bSetAsActiveConnection
+ If <TRUE/>, the calculated connection is set as ActiveConnection property on the rowset.
+
+ If the connection was newly created by the method, and this parameter is <TRUE/>, then
+ the ownership of the connection is delivered to a temporary object, which observes the
+ row set: As soon as a connection-relevant property of the row set changes, or as soon
+ as somebody else sets another ActiveConnection at the row set, the original
+ connection (the one which this function calculated) is disposed and discarded. At this
+ very moment, also the temporary observer object dies. This way, it is ensured that
+ there's no resource leak from an un-owned connection object.
+ */
+ OOO_DLLPUBLIC_DBTOOLS
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection> connectRowset(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet>& _rxRowSet,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rxFactory,
+ sal_Bool _bSetAsActiveConnection
+ ) SAL_THROW ( ( ::com::sun::star::sdbc::SQLException
+ , ::com::sun::star::lang::WrappedTargetException
+ , ::com::sun::star::uno::RuntimeException ) );
+
+ /** ensures that a row set has a valid ActiveConnection, if possible
+
+ This function does nearly the same as ->connectRowset. In fact, it is to be preferred over
+ ->connectRowset, if possible.
+
+ There are a few differences:
+ <ul><li>If a connection could be determined for the given RowSet, it is always
+ set as ActiveConnection.</li>
+ <li>Definition of the ownership of the created connection allows for more scenarios:
+ <ul><li>If the connection was not newly created, the returned ->SharedConnection
+ instance will not have the ownership, since in this case it's assumed
+ that there already is an instance which has the ownership.</li>
+ <li>If the connection was newly created, and ->_bUseAutoConnectionDisposer
+ is <TRUE/>, then the returned SharedConnection instance will <em>not</em>
+ be the owner of the connection. Instead, the ownership will be delivered
+ to a temporary object as described for connectRowset.</li>
+ <li>If the connection was newly created, and ->_bUseAutoConnectionDisposer
+ is <FALSE/>, then the returned SharedConnection instance will have the
+ ownership of the XConnection.</li>
+ </ul>
+ </li>
+ </ul>
+ */
+ OOO_DLLPUBLIC_DBTOOLS SharedConnection ensureRowSetConnection(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet>& _rxRowSet,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rxFactory,
+ bool _bUseAutoConnectionDisposer
+ ) SAL_THROW ( ( ::com::sun::star::sdbc::SQLException
+ , ::com::sun::star::lang::WrappedTargetException
+ , ::com::sun::star::uno::RuntimeException ) );
+
+ /** returns the connection the RowSet is currently working with (which is the ActiveConnection property)
+ */
+ OOO_DLLPUBLIC_DBTOOLS ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection> getConnection(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet>& _rxRowSet) throw (::com::sun::star::uno::RuntimeException);
+ OOO_DLLPUBLIC_DBTOOLS ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection> getConnection(
+ const ::rtl::OUString& _rsTitleOrPath,
+ const ::rtl::OUString& _rsUser,
+ const ::rtl::OUString& _rsPwd,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rxFactory);
+
+ OOO_DLLPUBLIC_DBTOOLS ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection> getConnection_withFeedback(
+ const ::rtl::OUString& _rDataSourceName,
+ const ::rtl::OUString& _rUser,
+ const ::rtl::OUString& _rPwd,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rxFactory)
+ SAL_THROW ( (::com::sun::star::sdbc::SQLException) );
+
+
+ /** determines whether the given component is part of a document which is an embedded database
+ document (such as a form)
+ */
+ OOO_DLLPUBLIC_DBTOOLS bool isEmbeddedInDatabase(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxComponent,
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxActualConnection
+ );
+
+ /** returns the columns of the named table of the given connection
+ */
+ OOO_DLLPUBLIC_DBTOOLS ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess> getTableFields(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection>& _rxConn,
+ const ::rtl::OUString& _rName
+ );
+
+ /** returns the primary key columns of the table
+ */
+ OOO_DLLPUBLIC_DBTOOLS ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess> getPrimaryKeyColumns_throw(
+ const ::com::sun::star::uno::Any& i_aTable
+ );
+ OOO_DLLPUBLIC_DBTOOLS ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess> getPrimaryKeyColumns_throw(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& i_xTable
+ );
+
+ /** get fields for a result set given by a "command descriptor"
+
+ <p>A command descriptor here means:
+ <ul><li>a SDB-level connection (<type scope="com.sun.star.sdb">Connection</type></li>
+ <li>a string specifying the name of an object relative to the connection</li>
+ <li>a <type scope="com.sun.star.sdb">CommandType</type> value specifying the type
+ of the object</type></li>
+ </ul>
+ </p>
+
+ @param _rxConnection
+ the connection relative to which the to-be-examined object exists
+
+ @param _nCommandType
+ the type of the object
+
+ @param _rCommand
+ the object. This may be a table name, a query name, or an SQL statement, depending on the value
+ of <arg>_nCommandType</arg>
+
+ @param _rxCollectionOner
+ If (and only if) <arg>CommandType</arg> is CommandType.COMMAND, the fields collection which is returned
+ by this function here is a temporary object. It is kept alive by another object, which is to be
+ created temporarily, too. To ensure that the fields you get are valid as long as you need them,
+ the owner which controls their life time is transfered to this parameter upon return.<br/>
+
+ Your fields live as long as this component lives.<br/>
+
+ Additionally, you are encouraged to dispose this component as soon as you don't need the fields anymore.
+ It depends on the connection's implementation if this is necessary, but the is no guarantee, so to
+ be on the safe side with respect to resource leaks, you should dispose the component.
+
+ @param _pErrorInfo
+ If not <NULL/>, then upon return from the function the instance pointed to by this argument will
+ contain any available error information in case something went wrong.
+
+ @return
+ the container of the columns (aka fields) of the object
+ */
+ OOO_DLLPUBLIC_DBTOOLS
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >
+ getFieldsByCommandDescriptor(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection,
+ const sal_Int32 _nCommandType,
+ const ::rtl::OUString& _rCommand,
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& _rxKeepFieldsAlive,
+ SQLExceptionInfo* _pErrorInfo = NULL
+ ) SAL_THROW( ( ) );
+
+
+ /** get fields for a result set given by a "command descriptor"
+
+ <p>A command descriptor here means:
+ <ul><li>a SDB-level connection (<type scope="com.sun.star.sdb">Connection</type></li>
+ <li>a string specifying the name of an object relative to the connection</li>
+ <li>a <type scope="com.sun.star.sdb">CommandType</type> value specifying the type
+ of the object</type></li>
+ </ul>
+ </p>
+
+ @param _rxConnection
+ the connection relative to which the to-be-examined object exists
+
+ @param _nCommandType
+ the type of the object
+
+ @param _rCommand
+ the object. This may be a table name, a query name, or an SQL statement, depending on the value
+ of <arg>_nCommandType</arg>
+
+ @param _pErrorInfo
+ If not <NULL/>, then upon return from the function the instance pointed to by this argument will
+ contain any available error information in case something went wrong.
+
+ @return
+ an array of strings containing the names of the columns (aka fields) of the object
+ */
+ OOO_DLLPUBLIC_DBTOOLS ::com::sun::star::uno::Sequence< ::rtl::OUString >
+ getFieldNamesByCommandDescriptor(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection,
+ const sal_Int32 _nCommandType,
+ const ::rtl::OUString& _rCommand,
+ SQLExceptionInfo* _pErrorInfo = NULL
+ ) SAL_THROW( ( ) );
+
+
+ /** create a new ::com::sun::star::sdbc::SQLContext, fill it with the given descriptions and the given source,
+ and <i>append</i> _rException (i.e. put it into the NextException member of the SQLContext).
+ */
+ OOO_DLLPUBLIC_DBTOOLS ::com::sun::star::sdb::SQLContext prependContextInfo(const ::com::sun::star::sdbc::SQLException& _rException, const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxContext, const ::rtl::OUString& _rContextDescription, const ::rtl::OUString& _rContextDetails );
+
+ OOO_DLLPUBLIC_DBTOOLS
+ ::com::sun::star::sdbc::SQLException prependErrorInfo(
+ const ::com::sun::star::sdbc::SQLException& _rChainedException,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxContext,
+ const ::rtl::OUString& _rAdditionalError,
+ const StandardSQLState _eSQLState = SQL_ERROR_UNSPECIFIED,
+ const sal_Int32 _nErrorCode = 0);
+
+ /** search the parent hierachy for a data source.
+ */
+ OOO_DLLPUBLIC_DBTOOLS ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDataSource> findDataSource(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _xParent);
+
+ /** determines the value of a booolean data source setting, given by ASCII name
+
+ @param _rxConnection
+ the connection belonging to the data source whose setting is to be retrieved
+ @param _pAsciiSettingName
+ the ASCII name of the setting
+ */
+ OOO_DLLPUBLIC_DBTOOLS bool getBooleanDataSourceSetting(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection,
+ const sal_Char* _pAsciiSettingName
+ );
+
+ /** check if a specific property is enabled in the info sequence
+ @deprecated
+ Use getBooleanDataSourceSetting instead, which cares for the default of the property itself,
+ instead of spreading this knowledge through all callers.
+ */
+ OOO_DLLPUBLIC_DBTOOLS
+ sal_Bool isDataSourcePropertyEnabled(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>& _xProp
+ ,const ::rtl::OUString& _sProperty,
+ sal_Bool _bDefault = sal_False);
+
+ /** retrieves a particular indirect data source setting
+
+ @param _rxDataSource
+ a data source component
+ @param _pAsciiSettingsName
+ the ASCII name of the setting to obtain
+ @param _rSettingsValue
+ the value of the setting, upon successfull return
+
+ @return
+ <FALSE/> if the setting is not present in the <member scope="com::sun::star::sdb">DataSource::Info</member>
+ member of the data source
+ <TRUE/> otherwise
+ */
+ OOO_DLLPUBLIC_DBTOOLS
+ bool getDataSourceSetting(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxDataSource,
+ const sal_Char* _pAsciiSettingsName,
+ ::com::sun::star::uno::Any& /* [out] */ _rSettingsValue
+ );
+ OOO_DLLPUBLIC_DBTOOLS
+ bool getDataSourceSetting(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxDataSource,
+ const ::rtl::OUString& _sSettingsName,
+ ::com::sun::star::uno::Any& /* [out] */ _rSettingsValue
+ );
+
+ OOO_DLLPUBLIC_DBTOOLS ::rtl::OUString getDefaultReportEngineServiceName(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rxFactory);
+
+ /** quote the given name with the given quote string.
+ */
+ OOO_DLLPUBLIC_DBTOOLS ::rtl::OUString quoteName(const ::rtl::OUString& _rQuote, const ::rtl::OUString& _rName);
+
+ /** quote the given table name (which may contain a catalog and a schema) according to the rules provided by the meta data
+ */
+ OOO_DLLPUBLIC_DBTOOLS
+ ::rtl::OUString quoteTableName(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData>& _rxMeta
+ , const ::rtl::OUString& _rName
+ ,EComposeRule _eComposeRule);
+
+ /** split a fully qualified table name (including catalog and schema, if appliable) into it's component parts.
+ @param _rxConnMetaData meta data describing the connection where you got the table name from
+ @param _rQualifiedName fully qualified table name
+ @param _rCatalog (out parameter) upon return, contains the catalog name
+ @param _rSchema (out parameter) upon return, contains the schema name
+ @param _rName (out parameter) upon return, contains the table name
+ @param _eComposeRule where do you need the name for
+ */
+ OOO_DLLPUBLIC_DBTOOLS void qualifiedNameComponents(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData >& _rxConnMetaData,
+ const ::rtl::OUString& _rQualifiedName, ::rtl::OUString& _rCatalog, ::rtl::OUString& _rSchema, ::rtl::OUString& _rName,EComposeRule _eComposeRule);
+
+ /** calculate a NumberFormatsSupplier for use with an given connection
+ @param _rxConn the connection for which the formatter is requested
+ @param _bAllowDefault if the connection (and related components, such as it's parent) cannot supply
+ a formatter, we can ask the DatabaseEnvironment for a default one. This parameter
+ states if this is allowed.
+ @param _rxFactory required (only of _bAllowDefault is sal_True) for creating the DatabaseEnvironment.
+ @return the formatter all object related to the given connection should work with.
+ */
+ OOO_DLLPUBLIC_DBTOOLS ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier> getNumberFormats(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection>& _rxConn,
+ sal_Bool _bAllowDefault = sal_False,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rxFactory = ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>()
+ );
+
+ /** returns the statement which is composed from the current settings of a row set
+
+ If the row set is currently not connected, it is attempted to do so with it's current settings.
+ (TODO: isn't this a resource leak? Do we really need this behaviour?).
+
+ @param _rxRowSet
+ the row set whose settings should be examined. Must not be <NULL/>
+ @param _rxFactory
+ a service factory which may be needed to connect the row set
+ @param _bUseRowSetFilter
+ If <TRUE/>, the <b>Filter</b> property of the row set will also be examined. In case it is
+ not empty, and <b>ApplyFilter</b> is <TRUE/>, it will also be added to the composed statement.
+ @param _bUseRowSetOrder
+ If <TRUE/>, the <b>Order</b> property of the row set will also be examined. In case it is
+ not empty, it will also be added to the composed statement.
+ */
+ OOO_DLLPUBLIC_DBTOOLS ::rtl::OUString getComposedRowSetStatement(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxRowSet,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rxFactory,
+ sal_Bool _bUseRowSetFilter = sal_True,
+ sal_Bool _bUseRowSetOrder = sal_True
+ ) SAL_THROW( ( ::com::sun::star::sdbc::SQLException ) );
+
+ /** create an <type scope="com::sun::star::sdb">XSingleSelectQueryComposer</type> which represents
+ the current settings (Command/CommandType/Filter/Order) of the given rowset.
+
+ As such an instance can be obtained from a <type scope="com::sun::star::sdb">Connection</type>
+ only the function searches for the connection the RowSet is using via connectRowset.
+ This implies that a connection will be set on the RowSet if needed.
+ (need to changes this sometimes ...)
+ */
+ OOO_DLLPUBLIC_DBTOOLS ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XSingleSelectQueryComposer > getCurrentSettingsComposer(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _rxRowSetProps,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rxFactory
+ );
+
+ /** transfer and translate properties between two FormComponents
+ @param _rxOld the source property set
+ @param _rxNew the destination property set
+ @param _rLocale the locale for converting number related properties
+ */
+ OOO_DLLPUBLIC_DBTOOLS void TransferFormComponentProperties(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _rxOld,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _rxNew,
+ const ::com::sun::star::lang::Locale& _rLocale
+ );
+
+ /** check if the property "Privileges" supports ::com::sun::star::sdbcx::Privilege::INSERT
+ @param _rxCursorSet the property set
+ */
+ OOO_DLLPUBLIC_DBTOOLS sal_Bool canInsert(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _rxCursorSet);
+ /** check if the property "Privileges" supports ::com::sun::star::sdbcx::Privilege::UPDATE
+ @param _rxCursorSet the property set
+ */
+ OOO_DLLPUBLIC_DBTOOLS sal_Bool canUpdate(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _rxCursorSet);
+ /** check if the property "Privileges" supports ::com::sun::star::sdbcx::Privilege::DELETE
+ @param _rxCursorSet the property set
+ */
+ OOO_DLLPUBLIC_DBTOOLS sal_Bool canDelete(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _rxCursorSet);
+
+ //----------------------------------------------------------------------------------
+ /** compose a complete table name from it's up to three parts, regarding to the database meta data composing rules
+ */
+ OOO_DLLPUBLIC_DBTOOLS ::rtl::OUString composeTableName( const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData >& _rxMetaData,
+ const ::rtl::OUString& _rCatalog,
+ const ::rtl::OUString& _rSchema,
+ const ::rtl::OUString& _rName,
+ sal_Bool _bQuote,
+ EComposeRule _eComposeRule);
+
+ /** composes a table name for usage in a SELECT statement
+
+ This includes quoting of the table as indicated by the connection's meta data, plus respecting
+ the settings "UseCatalogInSelect" and "UseSchemaInSelect", which might be present
+ in the data source which the connection belongs to.
+ */
+ OOO_DLLPUBLIC_DBTOOLS ::rtl::OUString composeTableNameForSelect(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection,
+ const ::rtl::OUString& _rCatalog,
+ const ::rtl::OUString& _rSchema,
+ const ::rtl::OUString& _rName );
+
+ /** composes a table name for usage in a SELECT statement
+
+ This includes quoting of the table as indicated by the connection's meta data, plus respecting
+ the settings "UseCatalogInSelect" and "UseSchemaInSelect", which might be present
+ in the data source which the connection belongs to.
+ */
+ OOO_DLLPUBLIC_DBTOOLS ::rtl::OUString composeTableNameForSelect(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _xTable );
+ //----------------------------------------------------------------------------------
+ /** compose the table name out of the property set which must support the properties from the service <member scope= "com::sun::star::sdbcx">table</member>
+ @param _xMetaData
+ The metadata from the connection.
+ @param _xTable
+ The table.
+ */
+ OOO_DLLPUBLIC_DBTOOLS ::rtl::OUString composeTableName(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData>& _xMetaData,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _xTable,
+ EComposeRule _eComposeRule,
+ bool _bSuppressCatalogName,
+ bool _bSuppressSchemaName,
+ bool _bQuote);
+
+ //----------------------------------------------------------------------------------
+ OOO_DLLPUBLIC_DBTOOLS sal_Int32 getSearchColumnFlag( const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection>& _rxConn,
+ sal_Int32 _nDataType);
+ // return the datasource for the given datasource name
+ OOO_DLLPUBLIC_DBTOOLS ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDataSource> getDataSource(const ::rtl::OUString& _rsDataSourceName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rxFactory);
+
+ /** search for a name that is NOT in the NameAcces
+ @param _rxContainer
+ the NameAccess container to search in
+ @param _rBaseName
+ the base name that should be used to create the new name
+ @param _bStartWithNumber
+ When <TRUE/> the name ends with number even when the name itself doesn't occur in the collection.
+ @return
+ A name which doesn't exist in the collection.
+ */
+ OOO_DLLPUBLIC_DBTOOLS
+ ::rtl::OUString createUniqueName(const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess>& _rxContainer,
+ const ::rtl::OUString& _rBaseName,
+ sal_Bool _bStartWithNumber = sal_True);
+
+ /** creates a unique name which is not already used in the given name array
+ */
+ OOO_DLLPUBLIC_DBTOOLS ::rtl::OUString createUniqueName(
+ const ::com::sun::star::uno::Sequence< ::rtl::OUString >& _rNames,
+ const ::rtl::OUString& _rBaseName,
+ sal_Bool _bStartWithNumber = sal_True
+ );
+
+ /** create a name which is a valid SQL 92 identifier name
+ @param _rName the string which should be converted
+ @param _rSpecials @see com.sun.star.sdbc.XDatabaseMetaData.getExtraNameCharacters
+
+ @see isValidSQLName
+ */
+ OOO_DLLPUBLIC_DBTOOLS ::rtl::OUString convertName2SQLName(const ::rtl::OUString& _rName,const ::rtl::OUString& _rSpecials);
+
+ /** checks whether the given name is a valid SQL name
+
+ @param _rName the string which should be converted
+ @param _rSpecials @see com.sun.star.sdbc.XDatabaseMetaData.getExtraNameCharacters
+
+ @see convertName2SQLName
+ */
+ OOO_DLLPUBLIC_DBTOOLS sal_Bool isValidSQLName( const ::rtl::OUString& _rName, const ::rtl::OUString& _rSpecials );
+
+ OOO_DLLPUBLIC_DBTOOLS
+ void showError( const SQLExceptionInfo& _rInfo,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow>& _pParent,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rxFactory);
+
+ /** implements <method scope="com.sun.star.sdb">XRowUpdate::updateObject</method>
+ <p>The object which is to be set is analyzed, and in case it is a simlpe scalar type for which there
+ is another updateXXX method, this other method is used.</p>
+ @param _rxUpdatedObject
+ the interface to forward all updateXXX calls to (except updateObject)
+ @param _nColumnIndex
+ the column index to update
+ @param _rValue
+ the value to update
+ @return
+ <TRUE/> if the update request was successfully re-routed to one of the other updateXXX methods
+ */
+ OOO_DLLPUBLIC_DBTOOLS
+ sal_Bool implUpdateObject( const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowUpdate >& _rxUpdatedObject,
+ const sal_Int32 _nColumnIndex,
+ const ::com::sun::star::uno::Any& _rValue) SAL_THROW ( ( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) );
+
+
+
+ /** ask the user for parameters if the prepared statement needs some and sets them in the prepared statement
+ @param _xConnection the connection must be able to create <type scope="com::sun::star::sdb">SingleSelectQueryComposer</type>s
+ @param _xPreparedStmt the prepared statement where the parameters could be set when needed
+ @param _aParametersSet contains which parameters have to asked for and which already have set.
+ */
+ OOO_DLLPUBLIC_DBTOOLS
+ void askForParameters( const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XSingleSelectQueryComposer >& _xComposer,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XParameters>& _xParameters,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection>& _xConnection,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& _rxHandler,
+ const ::std::bit_vector& _aParametersSet = ::std::bit_vector());
+
+ /** call the appropiate set method for the specific sql type @see com::sun::star::sdbc::DataType
+ @param _xParams the parameters where to set the value
+ @param parameterIndex the index of the parameter, 1 based
+ @param x the value to set
+ @param sqlType the corresponding sql type @see com::sun::star::sdbc::DataType
+ @param scale the scale of the sql type can be 0
+ */
+ OOO_DLLPUBLIC_DBTOOLS
+ void setObjectWithInfo( const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XParameters>& _xParameters,
+ sal_Int32 parameterIndex,
+ const ::com::sun::star::uno::Any& x,
+ sal_Int32 sqlType,
+ sal_Int32 scale=0) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+
+ /** call the appropiate set method for the specific sql type @see com::sun::star::sdbc::DataType
+ @param _xParams the parameters where to set the value
+ @param parameterIndex the index of the parameter, 1 based
+ @param x the value to set
+ @param sqlType the corresponding sql type @see com::sun::star::sdbc::DataType
+ @param scale the scale of the sql type can be 0
+ */
+ OOO_DLLPUBLIC_DBTOOLS
+ void setObjectWithInfo( const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XParameters>& _xParameters,
+ sal_Int32 parameterIndex,
+ const ::connectivity::ORowSetValue& x,
+ sal_Int32 sqlType,
+ sal_Int32 scale=0) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+
+
+ /** implements <method scope="com.sun.star.sdb">XParameters::setObject</method>
+ <p>The object which is to be set is analyzed, and in case it is a simlpe scalar type for which there
+ is another setXXX method, this other method is used.</p>
+ @param _rxParameters
+ the interface to forward all setXXX calls to (except setObject)
+ @param _nColumnIndex
+ the column index to update
+ @param _rValue
+ the value to update
+ @return
+ <TRUE/> if the update request was successfully re-routed to one of the other updateXXX methods
+ */
+ OOO_DLLPUBLIC_DBTOOLS
+ sal_Bool implSetObject( const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XParameters>& _rxParameters,
+ const sal_Int32 _nColumnIndex,
+ const ::com::sun::star::uno::Any& _rValue) SAL_THROW ( ( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException ) );
+
+ /** creates the standard sql create table statement without the key part.
+ @param descriptor
+ The descriptor of the new table.
+ @param _xConnection
+ The connection.
+ @param _bAddScale
+ The scale will also be added when the value is 0.
+ */
+ OOO_DLLPUBLIC_DBTOOLS
+ ::rtl::OUString createStandardCreateStatement( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection>& _xConnection,
+ ISQLStatementHelper* _pHelper,
+ const ::rtl::OUString& _sCreatePattern = ::rtl::OUString());
+
+ /** creates the standard sql statement for the key part of a create table statement.
+ @param descriptor
+ The descriptor of the new table.
+ @param _xConnection
+ The connection.
+ */
+ OOO_DLLPUBLIC_DBTOOLS
+ ::rtl::OUString createStandardKeyStatement( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection>& _xConnection);
+
+ /** creates the standard sql statement for the column part of a create table statement.
+ @param _pHelper
+ Allow to add special SQL constructs.
+ @param descriptor
+ The descriptor of the column.
+ @param _xConnection
+ The connection.
+ @param _pHelper
+ Allow to add special SQL constructs.
+ */
+ OOO_DLLPUBLIC_DBTOOLS
+ ::rtl::OUString createStandardColumnPart( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor
+ ,const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection>& _xConnection
+ ,ISQLStatementHelper* _pHelper = NULL
+ ,const ::rtl::OUString& _sCreatePattern = ::rtl::OUString());
+
+ /** creates a SQL CREATE TABLE statement
+
+ @param descriptor
+ The descriptor of the new table.
+ @param _xConnection
+ The connection.
+ @param _pHelper
+ Allow to add special SQL constructs.
+ @param _sCreatePattern
+
+ @return
+ The CREATE TABLE statement.
+ */
+ OOO_DLLPUBLIC_DBTOOLS
+ ::rtl::OUString createSqlCreateTableStatement( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor
+ ,const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection>& _xConnection
+ ,ISQLStatementHelper* _pHelper = NULL
+ ,const ::rtl::OUString& _sCreatePattern = ::rtl::OUString());
+
+ /** creates a SDBC column with the help of getColumns.
+ @param _xTable
+ The table.
+ @param _rName
+ The name of the column.
+ @param _bCase
+ Is the column case sensitive.
+ @param _bQueryForInfo
+ If <TRUE/> the autoincrement and currency field will be read from the meta data, otherwise the following parameters will be used instead
+ @param _bIsAutoIncrement
+ <TRUE/> if the column is an autoincrement.
+ @param _bIsCurrency
+ <TRUE/> if the column is a currency field.
+ @param _nDataType
+ The data type of the column.
+ */
+ OOO_DLLPUBLIC_DBTOOLS
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>
+ createSDBCXColumn( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _xTable,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection>& _xConnection,
+ const ::rtl::OUString& _rName,
+ sal_Bool _bCase,
+ sal_Bool _bQueryForInfo = sal_True,
+ sal_Bool _bIsAutoIncrement = sal_False,
+ sal_Bool _bIsCurrency = sal_False,
+ sal_Int32 _nDataType = com::sun::star::sdbc::DataType::OTHER);
+
+ /** tries to locate the corresponding DataDefinitionSupplier for the given url and connection
+ @param _rsUrl
+ The URL used to connect to the database.
+ @param _xConnection
+ The connection used to find the correct driver.
+ @param _rxFactory
+ Used to create the drivermanager.
+ @return
+ The datadefintion object.
+ */
+ OOO_DLLPUBLIC_DBTOOLS ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XTablesSupplier> getDataDefinitionByURLAndConnection(
+ const ::rtl::OUString& _rsUrl,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection>& _xConnection,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rxFactory);
+
+ /** returns the table privileges to the given parameters
+ @param _xMetaData
+ The meta data.
+ @param _sCatalog
+ contains the catalog name
+ @param _sSchema
+ contains the schema name
+ @param _sTable
+ contains the table name
+ */
+ OOO_DLLPUBLIC_DBTOOLS
+ sal_Int32 getTablePrivileges(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData>& _xMetaData,
+ const ::rtl::OUString& _sCatalog,
+ const ::rtl::OUString& _sSchema,
+ const ::rtl::OUString& _sTable);
+
+ typedef ::std::pair<sal_Bool,sal_Bool> TBoolPair;
+ typedef ::std::pair< TBoolPair,sal_Int32 > ColumnInformation;
+ typedef ::std::multimap< ::rtl::OUString, ColumnInformation, ::comphelper::UStringMixLess> ColumnInformationMap;
+ /** collects the information about auto increment, currency and data type for the given column name.
+ The column must be quoted, * is also valid.
+ @param _xConnection
+ The connection.
+ @param _sComposedTableName
+ The quoted table name. ccc.sss.ttt
+ @param _sName
+ The name of the column, or *
+ @param _rInfo
+ The information about the column(s).
+ */
+ OOO_DLLPUBLIC_DBTOOLS
+ void collectColumnInformation( const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection>& _xConnection,
+ const ::rtl::OUString& _sComposedTableName,
+ const ::rtl::OUString& _rName,
+ ColumnInformationMap& _rInfo);
+
+
+ /** adds a boolean comparison clause to the given SQL predicate
+
+ @param _rExpression
+ the expression which is to be compared with a boolean value
+ @param _bValue
+ the boolean value which the expression is to be compared with
+ @param _nBooleanComparisonMode
+ the boolean comparison mode to be used. Usually obtained from
+ a css.sdb.DataSource's Settings member.
+ @param _out_rSQLPredicate
+ the buffer to which the comparison predicate will be appended
+ */
+ OOO_DLLPUBLIC_DBTOOLS void getBoleanComparisonPredicate(
+ const ::rtl::OUString& _rExpression,
+ const sal_Bool _bValue,
+ const sal_Int32 _nBooleanComparisonMode,
+ ::rtl::OUStringBuffer& _out_rSQLPredicate
+ );
+
+//.........................................................................
+} // namespace dbtools
+//.........................................................................
+
+#endif // _CONNECTIVITY_DBTOOLS_HXX_
+
diff --git a/connectivity/inc/connectivity/dbtoolsdllapi.hxx b/connectivity/inc/connectivity/dbtoolsdllapi.hxx
new file mode 100644
index 000000000000..6044a53e3328
--- /dev/null
+++ b/connectivity/inc/connectivity/dbtoolsdllapi.hxx
@@ -0,0 +1,40 @@
+/*************************************************************************
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+************************************************************************/
+
+#ifndef INCLUDED_CONNECTIVITY_DBTOOLSDLLAPI_HXX
+#define INCLUDED_CONNECTIVITY_DBTOOLSDLLAPI_HXX
+
+#include "sal/config.h"
+
+#include "sal/types.h"
+
+#if defined OOO_DLLIMPLEMENTATION_DBTOOLS
+#define OOO_DLLPUBLIC_DBTOOLS SAL_DLLPUBLIC_EXPORT
+#else
+#define OOO_DLLPUBLIC_DBTOOLS SAL_DLLPUBLIC_IMPORT
+#endif
+
+#endif
diff --git a/connectivity/inc/connectivity/filtermanager.hxx b/connectivity/inc/connectivity/filtermanager.hxx
new file mode 100644
index 000000000000..71494de67b38
--- /dev/null
+++ b/connectivity/inc/connectivity/filtermanager.hxx
@@ -0,0 +1,131 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CONNECTIVITY_FILTERMANAGER_HXX
+#define CONNECTIVITY_FILTERMANAGER_HXX
+
+/** === begin UNO includes === **/
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/sdb/XSQLQueryComposer.hpp>
+#include <com/sun/star/sdbc/XConnection.hpp>
+/** === end UNO includes === **/
+#include <rtl/ustring.hxx>
+
+#include <vector>
+#include "connectivity/dbtoolsdllapi.hxx"
+
+//........................................................................
+namespace dbtools
+{
+//........................................................................
+
+ //====================================================================
+ //= FilterManager
+ //====================================================================
+ /** manages the filter of a database component with filter properties
+
+ The idea is that the filter which a database component actually really uses is composed of several single
+ filter components (which all are conjunctive).
+
+ First, there is a component which is visible to the clients of the database component itself - if they ask
+ the database component for the Filter property, they will get this public filter.
+
+ Second, there is an implicit filter, which is (to be) created from the MasterFields and DetailFields
+ property of the database component, if the latter denote columns.<br/>
+ For instance, if there is a link-pair CustomerID->cid, where |CustomerID| is a column of the master
+ database component, and |cid| is a column of the detail database component (the database component we're responsible for), then there will
+ be an implicit filter "cid = :param_cid_link" (or something like this), which is never visible
+ to the clients of the database component, but nevertheless needs to be propagated to the aggregated RowSet.<br/>
+ Actually, this implicit filter is maintained by the FormParameterManager.
+
+ Potentially, there could be more filter components (for instance, you could imagine database component
+ controls which act as live filter, which could be implemented with a third component), but
+ at the moment there are only these two.
+ */
+ class OOO_DLLPUBLIC_DBTOOLS FilterManager
+ {
+ public:
+ enum FilterComponent
+ {
+ fcPublicFilter = 0, // the filter which is to be published as "Filter" property of the database component
+ fcLinkFilter, // the filter part which is implicitly created for a database component when connecting
+ // master and detail database components via column names
+
+ FC_COMPONENT_COUNT // boundary delimiter, not to be used from outside
+ };
+
+ private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >
+ m_xORB;
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >
+ m_xComponentAggregate;
+ ::std::vector< ::rtl::OUString > m_aFilterComponents;
+ sal_Bool m_bApplyPublicFilter;
+
+ public:
+ /// ctor
+ explicit FilterManager(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB
+ );
+
+ /// late ctor
+ void initialize(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxComponentAggregate );
+
+ /// makes the object forgetting the references to the database component
+ void dispose( );
+
+ const ::rtl::OUString& getFilterComponent( FilterComponent _eWhich ) const;
+ void setFilterComponent( FilterComponent _eWhich, const ::rtl::OUString& _rComponent );
+
+ inline sal_Bool isApplyPublicFilter( ) const { return m_bApplyPublicFilter; }
+ void setApplyPublicFilter( sal_Bool _bApply );
+
+ private:
+ /** retrieves a filter which is a conjunction of all single filter components
+ */
+ ::rtl::OUString getComposedFilter( ) const;
+
+ /** appends one filter component to the statement in our composer
+ */
+ void appendFilterComponent( ::rtl::OUString& /* [inout] */ _rAppendTo, const ::rtl::OUString& _rComponent ) const;
+
+ /// checks whether there is only one (or even no) non-empty filter component
+ bool isThereAtMostOneComponent( ::rtl::OUString& _rOnlyComponent ) const;
+
+ /// returns the index of the first filter component which should be considered when building the composed filter
+ inline sal_Int32 getFirstApplicableFilterIndex() const
+ {
+ return m_bApplyPublicFilter ? fcPublicFilter : fcPublicFilter + 1;
+ }
+ };
+
+//........................................................................
+} // namespacefrm
+//........................................................................
+
+#endif // CONNECTIVITY_FORMFILTERMANAGER_HXX
+
diff --git a/connectivity/inc/connectivity/formattedcolumnvalue.hxx b/connectivity/inc/connectivity/formattedcolumnvalue.hxx
new file mode 100644
index 000000000000..d9bb8b49973f
--- /dev/null
+++ b/connectivity/inc/connectivity/formattedcolumnvalue.hxx
@@ -0,0 +1,119 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef CONNECTIVITY_FORMATTEDCOLUMNVALUE_HXX
+#define CONNECTIVITY_FORMATTEDCOLUMNVALUE_HXX
+
+/** === begin UNO includes === **/
+#include <com/sun/star/sdbc/XRowSet.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/sdb/XColumn.hpp>
+#include <com/sun/star/sdb/XColumnUpdate.hpp>
+#include <com/sun/star/util/XNumberFormatter.hpp>
+/** === end UNO includes === **/
+
+#include <boost/noncopyable.hpp>
+
+#include <memory>
+#include "connectivity/dbtoolsdllapi.hxx"
+
+namespace comphelper { class ComponentContext; }
+
+//........................................................................
+namespace dbtools
+{
+//........................................................................
+
+ struct FormattedColumnValue_Data;
+ //====================================================================
+ //= FormattedColumnValue
+ //====================================================================
+ /** a class which helps retrieving and setting the value of a database column
+ as formatted string.
+ */
+ class OOO_DLLPUBLIC_DBTOOLS FormattedColumnValue : public ::boost::noncopyable
+ {
+ public:
+ /** constructs an instance
+
+ The format key for the string value exchange is taken from the given column object.
+ If it has a non-<NULL/> property value <code>FormatKey</code>, this key is taken.
+ Otherwise, a default format matching the column type is determined.
+
+ The locale of this fallback format is the current system locale.
+
+ The number formats supplier is determined from the given <code>RowSet</code>, by
+ examining its <code>ActiveConnection</code>.
+ */
+ FormattedColumnValue(
+ const ::comphelper::ComponentContext& _rContext,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet >& _rxRowSet,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxColumn
+ );
+
+ /** constructs an instance
+
+ The format key for the string value exchange is taken from the given column object.
+ If it has a non-<NULL/> property value <code>FormatKey</code>, this key is taken.
+ Otherwise, a default format matching the column type is determined.
+
+ The locale of this fallback format is the current system locale.
+ */
+ FormattedColumnValue(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& i_rNumberFormatter,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& i_rColumn
+ );
+
+ // note that all methods of this class need to be virtual, since it's
+ // used in a load-on-demand context in module SVX
+
+ virtual ~FormattedColumnValue();
+
+ virtual void clear();
+
+ // access to the details of the formatting we determined
+ virtual sal_Int32 getFormatKey() const;
+ virtual sal_Int32 getFieldType() const;
+ virtual sal_Int16 getKeyType() const;
+ virtual bool isNumericField() const;
+ virtual const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumn >&
+ getColumn() const;
+ virtual const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumnUpdate >&
+ getColumnUpdate() const;
+
+ virtual bool setFormattedValue( const ::rtl::OUString& _rFormattedStringValue ) const;
+ virtual ::rtl::OUString getFormattedValue() const;
+
+ private:
+ ::std::auto_ptr< FormattedColumnValue_Data > m_pData;
+ };
+
+//........................................................................
+} // namespace dbtools
+//........................................................................
+
+#endif // CONNECTIVITY_FORMATTEDCOLUMNVALUE_HXX
diff --git a/connectivity/inc/connectivity/parameters.hxx b/connectivity/inc/connectivity/parameters.hxx
new file mode 100644
index 000000000000..75b314e770f3
--- /dev/null
+++ b/connectivity/inc/connectivity/parameters.hxx
@@ -0,0 +1,426 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CONNECTIVITY_PARAMETERS_HXX
+#define CONNECTIVITY_PARAMETERS_HXX
+
+#include <map>
+#include <vector>
+
+/** === begin UNO includes === **/
+#include <com/sun/star/uno/XAggregation.hpp>
+#include <com/sun/star/form/XDatabaseParameterListener.hpp>
+#include <com/sun/star/sdbc/XConnection.hpp>
+#include <com/sun/star/task/XInteractionHandler.hpp>
+#include <com/sun/star/sdbc/XParameters.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/container/XIndexAccess.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/sdb/XSingleSelectQueryComposer.hpp>
+/** === end UNO includes === **/
+
+#include "connectivity/dbtoolsdllapi.hxx"
+#include "connectivity/paramwrapper.hxx"
+#include <unotools/sharedunocomponent.hxx>
+#include <comphelper/implementationreference.hxx>
+#include <cppuhelper/interfacecontainer.hxx>
+
+//........................................................................
+namespace dbtools
+{
+//........................................................................
+
+ typedef ::utl::SharedUNOComponent< ::com::sun::star::sdb::XSingleSelectQueryComposer, ::utl::DisposableComponent >
+ SharedQueryComposer;
+
+ //====================================================================
+ //= ParameterManager
+ //====================================================================
+ class FilterManager;
+ class OOO_DLLPUBLIC_DBTOOLS ParameterManager
+ {
+ public:
+ /// classifies the origin of the data to fill a parameter
+ enum ParameterClassification
+ {
+ /** parameters which are filled from the master-detail relationship, where the detail
+ name is an explicit parameter name
+ */
+ eLinkedByParamName,
+ /** parameters which are filled from the master-detail relationship, where the detail
+ name is a column name, so an implicit parameter had to be generated for it
+ */
+ eLinkedByColumnName,
+ /** parameters which are filled externally (i.e. by XParamaters::setXXX, or by the parameter listeners)
+ */
+ eFilledExternally
+ };
+ /** meta data about an inner parameter
+ */
+ private:
+ struct ParameterMetaData
+ {
+ /// the type of the parameter
+ ParameterClassification eType;
+ /// the column object for this parameter, as returned by the query composer
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >
+ xComposerColumn;
+ /// the indicies of inner parameters which need to be filled when this concrete parameter is set
+ ::std::vector< sal_Int32 > aInnerIndexes;
+
+ /// default ctor
+ ParameterMetaData()
+ :eType( eFilledExternally )
+ {
+ }
+
+ /// ctor with composer column
+ ParameterMetaData( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxColumn )
+ :eType ( eFilledExternally )
+ ,xComposerColumn ( _rxColumn )
+ {
+ }
+ };
+
+ typedef ::std::map< ::rtl::OUString, ParameterMetaData > ParameterInformation;
+
+ private:
+ ::osl::Mutex& m_rMutex;
+ ::cppu::OInterfaceContainerHelper m_aParameterListeners;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >
+ m_xORB;
+
+ ::com::sun::star::uno::WeakReference< ::com::sun::star::beans::XPropertySet >
+ m_xComponent; // the database component whose parameters we're handling
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XAggregation >
+ m_xAggregatedRowSet; // the aggregated row set - necessary for unwrapped access to some interfaces
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XParameters >
+ m_xInnerParamUpdate; // write access to the inner parameters
+ SharedQueryComposer m_xComposer; // query composer wrapping the statement which the *aggregate* is based on
+ SharedQueryComposer m_xParentComposer; // query composer wrapping the statement of our parent database component
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess >
+ m_xInnerParamColumns; // index access to the parameter columns, as got from the query composer
+
+ ::dbtools::param::ParametersContainerRef
+ m_pOuterParameters; // the container of parameters which still need to be filled in by
+ // external instances
+ sal_Int32 m_nInnerCount; // overall number of parameters as required by the database component's aggregate
+
+ ParameterInformation m_aParameterInformation;
+
+ ::com::sun::star::uno::Sequence< ::rtl::OUString > m_aMasterFields;
+ ::com::sun::star::uno::Sequence< ::rtl::OUString > m_aDetailFields;
+
+ ::rtl::OUString m_sIdentifierQuoteString;
+ ::rtl::OUString m_sSpecialCharacters;
+
+ ::std::vector< bool > m_aParametersVisited;
+
+ bool m_bUpToDate;
+
+ public:
+ /** ctor
+ */
+ explicit ParameterManager(
+ ::osl::Mutex& _rMutex,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB
+ );
+
+ /// late ctor
+ void initialize(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxComponent,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XAggregation >& _rxComponentAggregate
+ );
+
+ /// makes the object forgetting the references to the database component
+ void dispose( );
+
+ /// clears the instance data
+ void clearAllParameterInformation();
+
+ /// checks whether the parameter information are up-to-date
+ inline bool isUpToDate() const { return m_bUpToDate; }
+
+ /** updates all parameter information represented by the instance
+ */
+ void updateParameterInfo( FilterManager& _rFilterManager );
+
+ /** fills parameter values, as extensive as possible
+
+ <p>In particular, all values which can be filled from the master-detail relationship of
+ between our database component and it's parent are filled in.</p>
+
+ @param _rxCompletionHandler
+ an interaction handler which should be used to fill all parameters which
+ cannot be filled by other means. May be <NULL/>
+ @param _rClearForNotifies
+ the mutex guard to be (temporarily) cleared for notifications
+
+ @precond
+ the instance is alive, i.e. <member>isAlive</member> returns <TRUE/>
+
+ @return
+ <TRUE/> if and only if the parameter filling has <em>not</em> been cancelled by the user
+ */
+ bool fillParameterValues(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& _rxCompletionHandler,
+ ::osl::ResettableMutexGuard& _rClearForNotifies
+ );
+
+ /** sets all parameter values to null (via <member>XParameters::setNull</member>)
+
+ @precond
+ the instance is alive, i.e. <member>isAlive</member> returns <TRUE/>
+ */
+ void setAllParametersNull() SAL_THROW( ( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException ) );
+
+ /** resets all detail columns which are, via a parameter, linked to a master column, to
+ the value of this master column.
+
+ For instance, if the database component is bound to a statement <code>SELECT * from invoice where inv_id = :cid</code>,
+ and there is <em>one</em> master-detail link from
+
+ @precond
+ the instance is alive, i.e. <member>isAlive</member> returns <TRUE/>
+ */
+ void resetParameterValues() SAL_THROW(());
+
+ /** tells the object that it's database component is being disposed
+
+ The object then fires the <member>XEventListener::disposing</member> notification to
+ the parameter listeners
+ */
+ void disposing( const ::com::sun::star::lang::EventObject& _rDisposingEvent );
+
+ /** adds the given listener to the list of parameter listeners
+ */
+ void addParameterListener(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::form::XDatabaseParameterListener >& _rxListener
+ );
+
+ /** removes the given listener from the list of parameter listeners
+ */
+ void removeParameterListener(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::form::XDatabaseParameterListener >& _rxListener
+ );
+
+ // XParameters equivalents
+ void setNull ( sal_Int32 _nIndex, sal_Int32 sqlType);
+ void setObjectNull ( sal_Int32 _nIndex, sal_Int32 sqlType, const ::rtl::OUString& typeName);
+ void setBoolean ( sal_Int32 _nIndex, sal_Bool x);
+ void setByte ( sal_Int32 _nIndex, sal_Int8 x);
+ void setShort ( sal_Int32 _nIndex, sal_Int16 x);
+ void setInt ( sal_Int32 _nIndex, sal_Int32 x);
+ void setLong ( sal_Int32 _nIndex, sal_Int64 x);
+ void setFloat ( sal_Int32 _nIndex, float x);
+ void setDouble ( sal_Int32 _nIndex, double x);
+ void setString ( sal_Int32 _nIndex, const ::rtl::OUString& x);
+ void setBytes ( sal_Int32 _nIndex, const ::com::sun::star::uno::Sequence< sal_Int8 >& x);
+ void setDate ( sal_Int32 _nIndex, const ::com::sun::star::util::Date& x);
+ void setTime ( sal_Int32 _nIndex, const ::com::sun::star::util::Time& x);
+ void setTimestamp ( sal_Int32 _nIndex, const ::com::sun::star::util::DateTime& x);
+ void setBinaryStream ( sal_Int32 _nIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream>& x, sal_Int32 length);
+ void setCharacterStream ( sal_Int32 _nIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream>& x, sal_Int32 length);
+ void setObject ( sal_Int32 _nIndex, const ::com::sun::star::uno::Any& x);
+ void setObjectWithInfo ( sal_Int32 _nIndex, const ::com::sun::star::uno::Any& x, sal_Int32 targetSqlType, sal_Int32 scale);
+ void setRef ( sal_Int32 _nIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRef>& x);
+ void setBlob ( sal_Int32 _nIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XBlob>& x);
+ void setClob ( sal_Int32 _nIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XClob>& x);
+ void setArray ( sal_Int32 _nIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XArray>& x);
+ void clearParameters();
+
+ private:
+ /// checkes whether the object is already initialized, and not yet disposed
+ inline bool isAlive() const { return m_xComponent.get().is() && m_xInnerParamUpdate.is(); }
+
+ /** creates a filter expression from a master-detail link where the detail denotes a column name
+ */
+ ::rtl::OUString
+ createFilterConditionFromColumnLink(
+ const ::rtl::OUString& /* [in] */ _rMasterColumn,
+ const ::rtl::OUString& /* [in] */ _rDetailColumn,
+ ::rtl::OUString& /* [out] */ _rNewParamName
+ );
+
+ /** initializes our query composer, and the collection of inner parameter columns
+
+ @param _rxComponent
+ the database component to initialize from. Must not be <NULL/>
+ @return
+ <TRUE/> if and only if the initialization was successfull
+
+ @postcond
+ if and only if <TRUE/> is returned, then <member>m_xInnerParamColumns</member> contains the collection of
+ inner parameters
+ */
+ bool initializeComposerByComponent(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxComponent
+ );
+
+ /** collects initial meta information about inner paramaters (i.e. it initially fills
+ <member>m_aParameterInformation</member>).
+
+ @param _bSecondRun
+ if <TRUE/>, this is the second run, because we ourself previously extended the filter of
+ the RowSet
+
+ @precond
+ <member>m_xInnerParamColumns</member> is not <NULL/>
+ */
+ void collectInnerParameters( bool _bSecondRun );
+
+ /** analyzes the master-detail links for our database component, and initializes m_aMasterFields and m_aDetailFields
+
+ @param _rFilterManager
+ the filter manager of the database component
+ @param _rColumnsInLinkDetails
+ will be set to <TRUE/> if and only if there were link pairs where the detail field denoted
+ a column name of our database component
+
+ @precond
+ the instance is alive, i.e. <member>isAlive</member> returns <TRUE/>
+ */
+ void analyzeFieldLinks( FilterManager& _rFilterManager, bool& /* [out] */ _rColumnsInLinkDetails );
+
+ /** classifies the link pairs
+
+ @param _rxParentColumns
+ the columns of the parent database component
+
+ @param _rxColumns
+ the columns of our own database component
+
+ @param _out_rAdditionalFilterComponents
+ the additional filter components which are required for master-detail relationships where
+ the detail part denotes a column name. In such a case, an additional filter needs to be created,
+ containing a new parameter.
+
+ @precond
+ <member>m_aMasterFields</member> and <member>m_aDetailFields</member> have the same length
+ */
+ void classifyLinks(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& _rxParentColumns,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& _rxColumns,
+ ::std::vector< ::rtl::OUString >& _out_rAdditionalFilterComponents
+ ) SAL_THROW(( ::com::sun::star::uno::Exception ));
+
+ /** finalizes our <member>m_pOuterParameters</member> so that it can be used for
+ external parameter listeners
+
+ @precond
+ <member>m_pOuterParameters</member> is <NULL/>
+ @precond
+ <member>m_xInnerParamUpdate</member> is not <NULL/>
+ */
+ void createOuterParameters();
+
+ /** fills in the parameters values which result from the master-detail relationship
+ between the database component and it's parent
+
+ @param _rxParentColumns
+ the columns of the parameter database component. Must not be <NULL/>
+ @precond
+ the instance is alive, i.e. <member>isAlive</member> returns <TRUE/>
+ */
+ void fillLinkedParameters(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& _rxParentColumns
+ );
+
+ /** completes all missing parameters via an interaction handler
+
+ @precond
+ the instance is alive, i.e. <member>isAlive</member> returns <TRUE/>
+
+ @return
+ <TRUE/> if and only if the parameter filling has <em>not</em> been cancelled by the user
+ */
+ bool completeParameters(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& _rxCompletionHandler,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > _rxConnection
+ );
+
+ /** asks the parameter listeners to fill in final values
+
+ @precond
+ the instance is alive, i.e. <member>isAlive</member> returns <TRUE/>
+
+ @return
+ <TRUE/> if and only if the parameter filling has <em>not</em> been cancelled by the user
+ */
+ bool consultParameterListeners( ::osl::ResettableMutexGuard& _rClearForNotifies );
+
+ /** mark an externally filled parameter asvisited
+ */
+ void externalParameterVisited( sal_Int32 _nIndex );
+
+ private:
+ /** retrieves the columns of the parent database component
+
+ @precond
+ the instance is alive, i.e. <member>isAlive</member> returns <TRUE/>
+ @return
+ <TRUE/> if and only if the columns could be successfully retrieved
+ */
+ bool getParentColumns(
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& /* [out] */ _out_rxParentColumns,
+ bool _bFromComposer
+ );
+
+ /** retrieves the columns of our database component
+
+ @param _bFromComposer
+ if <TRUE/>, the columns are obtained from the composer, else from the living database component itself
+ @return
+ <TRUE/> if and only if the columns could be successfully retrieved
+ */
+ bool getColumns(
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& /* [out] */ _rxColumns,
+ bool _bFromComposer
+ ) SAL_THROW(( ::com::sun::star::uno::Exception ));
+
+ /** retrieves the active connection of the database component
+ */
+ bool getConnection(
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& /* [out] */ _rxConnection
+ );
+
+ /** caches some info about the connection of our database component
+ */
+ void cacheConnectionInfo() SAL_THROW(( ));
+
+ private:
+ ParameterManager(); // never implemented
+ ParameterManager( const ParameterManager& ); // never implemented
+ ParameterManager& operator=( const ParameterManager& ); // never implemented
+ };
+
+//........................................................................
+} // namespacefrm
+//........................................................................
+
+#endif // CONNECTIVITY_PARAMETERS_HXX
+
diff --git a/connectivity/inc/connectivity/paramwrapper.hxx b/connectivity/inc/connectivity/paramwrapper.hxx
new file mode 100644
index 000000000000..34e2fef67bbc
--- /dev/null
+++ b/connectivity/inc/connectivity/paramwrapper.hxx
@@ -0,0 +1,208 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef CONNECTIVITY_PARAMWRAPPER_HXX
+#define CONNECTIVITY_PARAMWRAPPER_HXX
+
+#include "connectivity/dbtoolsdllapi.hxx"
+#include <connectivity/FValue.hxx>
+
+/** === begin UNO includes === **/
+#include <com/sun/star/sdbc/XParameters.hpp>
+#include <com/sun/star/container/XIndexAccess.hpp>
+#include <com/sun/star/container/XEnumerationAccess.hpp>
+#include <com/sun/star/sdb/XSingleSelectQueryAnalyzer.hpp>
+/** === end UNO includes === **/
+
+#include <comphelper/uno3.hxx>
+#include <comphelper/broadcasthelper.hxx>
+#include <cppuhelper/weak.hxx>
+#include <cppuhelper/propshlp.hxx>
+#include <cppuhelper/compbase2.hxx>
+
+#include <memory>
+#include <vector>
+
+//........................................................................
+namespace dbtools
+{
+namespace param
+{
+//........................................................................
+
+ //====================================================================
+ //= ParameterWrapper
+ //====================================================================
+ /** wraps a parameter column as got from an SQLQueryComposer, so that it has an additional
+ property "Value", which is forwarded to an XParameters interface
+ */
+ class OOO_DLLPUBLIC_DBTOOLS ParameterWrapper :public ::cppu::OWeakObject
+ ,public ::comphelper::OMutexAndBroadcastHelper
+ ,public ::cppu::OPropertySetHelper
+ {
+ private:
+ typedef ::cppu::OWeakObject UnoBase;
+ typedef ::cppu::OPropertySetHelper PropertyBase;
+
+ private:
+ /// the most recently set value of the parameter
+ ::connectivity::ORowSetValue m_aValue;
+ /// the positions (in our m_xValueDestination) at which the value should be set (0-based!)
+ ::std::vector< sal_Int32 > m_aIndexes;
+
+ /// the "delegator" column to which standard property requests are forwarded
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > m_xDelegator;
+ /// the property set info for our delegator
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > m_xDelegatorPSI;
+ /// the component taking the value
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XParameters > m_xValueDestination;
+ /// helper for implementing XPropertySetInfo
+ ::std::auto_ptr< ::cppu::OPropertyArrayHelper > m_pInfoHelper;
+
+
+ public:
+ const ::connectivity::ORowSetValue& Value() const { return m_aValue; }
+ ::connectivity::ORowSetValue& Value() { return m_aValue; }
+
+ public:
+ ParameterWrapper(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxColumn
+ );
+
+ ParameterWrapper(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxColumn,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XParameters >& _rxAllParameters,
+ const ::std::vector< sal_Int32 >& _rIndexes
+ );
+
+ DECLARE_XINTERFACE()
+ DECLARE_XTYPEPROVIDER()
+
+ // XPropertySet
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
+
+ // OPropertySetHelper
+ 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;
+
+ // pseudo-XComponent
+ virtual void SAL_CALL dispose();
+
+ protected:
+ virtual ~ParameterWrapper();
+
+ // disambiguations
+ using ::cppu::OPropertySetHelper::getFastPropertyValue;
+
+ private:
+ ::rtl::OUString impl_getPseudoAggregatePropertyName( sal_Int32 _nHandle ) const;
+
+ private:
+ ParameterWrapper(); // not implemented
+ };
+
+ //====================================================================
+ //= ParameterWrapperContainer
+ //====================================================================
+ typedef ::std::vector< ::rtl::Reference< ParameterWrapper > > Parameters;
+
+ //====================================================================
+ //= ParameterWrapperContainer
+ //====================================================================
+ typedef ::cppu::WeakComponentImplHelper2 < ::com::sun::star::container::XIndexAccess
+ , ::com::sun::star::container::XEnumerationAccess
+ > ParameterWrapperContainer_Base;
+
+ /// class for the parameter event @see approveParameter
+ class OOO_DLLPUBLIC_DBTOOLS ParameterWrapperContainer :
+ public ParameterWrapperContainer_Base
+ {
+ private:
+ ::osl::Mutex m_aMutex;
+ Parameters m_aParameters;
+
+ protected:
+ virtual ~ParameterWrapperContainer();
+
+ public:
+ /** creates an empty container
+ */
+ ParameterWrapperContainer();
+
+ /** creates a container from a SingleSelectQuerAnalyzer's parameter columns
+
+ Note that here, the simple constructor of the ParameterWrapper will be used, which does not
+ use a XParameters instance to forward values to, but only remembers the values itself.
+ */
+ ParameterWrapperContainer( const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XSingleSelectQueryAnalyzer >& _rxComposer );
+
+ // ::com::sun::star::container::XElementAccess
+ virtual ::com::sun::star::uno::Type SAL_CALL getElementType() throw( ::com::sun::star::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL hasElements() throw( ::com::sun::star::uno::RuntimeException );
+
+ // ::com::sun::star::container::XEnumerationAccess
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration > SAL_CALL createEnumeration() throw( ::com::sun::star::uno::RuntimeException );
+
+ // ::com::sun::star::container::XIndexAccess
+ virtual sal_Int32 SAL_CALL getCount() throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Any SAL_CALL getByIndex(sal_Int32 _rIndex) throw( ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException );
+
+ public:
+ const Parameters& getParameters() { return m_aParameters; }
+
+ const ::connectivity::ORowSetValue& operator[]( size_t _index ) const { return m_aParameters[ _index ]->Value(); }
+ ::connectivity::ORowSetValue& operator[]( size_t _index ) { return m_aParameters[ _index ]->Value(); }
+
+ /** adds an ParameterWrapper to the end of the array
+ */
+ void push_back( ParameterWrapper* _pParameter )
+ {
+ m_aParameters.push_back( _pParameter );
+ }
+
+ size_t size() const { return m_aParameters.size(); }
+
+ protected:
+ // XComponent
+ virtual void SAL_CALL disposing();
+
+ private:
+ void impl_checkDisposed_throw();
+ };
+
+ //====================================================================
+ //= ParamatersContainer
+ //====================================================================
+ typedef ::rtl::Reference< ParameterWrapperContainer > ParametersContainerRef;
+
+//........................................................................
+} } // namespace dbtools::param
+//........................................................................
+
+#endif // CONNECTIVITY_PARAMWRAPPER_HXX
diff --git a/connectivity/inc/connectivity/predicateinput.hxx b/connectivity/inc/connectivity/predicateinput.hxx
new file mode 100644
index 000000000000..5041fd30c060
--- /dev/null
+++ b/connectivity/inc/connectivity/predicateinput.hxx
@@ -0,0 +1,126 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef CONNECTIVITY_PREDICATEINPUT_HXX
+#define CONNECTIVITY_PREDICATEINPUT_HXX
+
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/sdbc/XConnection.hpp>
+#include <com/sun/star/util/XNumberFormatter.hpp>
+#include <com/sun/star/i18n/XLocaleData.hpp>
+#include <connectivity/sqlparse.hxx>
+#include "connectivity/dbtoolsdllapi.hxx"
+
+//.........................................................................
+namespace dbtools
+{
+//.........................................................................
+
+ //=====================================================================
+ //= OPredicateInputController
+ //=====================================================================
+ /** A class which allows input of an SQL predicate for a row set column
+ into a edit field.
+ */
+ class OOO_DLLPUBLIC_DBTOOLS OPredicateInputController
+ {
+ private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >
+ m_xORB;
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >
+ m_xConnection;
+ ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >
+ m_xFormatter;
+ ::com::sun::star::uno::Reference< ::com::sun::star::i18n::XLocaleData >
+ m_xLocaleData;
+
+ ::connectivity::OSQLParser
+ m_aParser;
+
+ public:
+ OPredicateInputController(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection,
+ const ::connectivity::IParseContext* _pParseContext = NULL
+ );
+
+ /** transforms a "raw" predicate value (usually obtained from a user input) into a valid predicate for the given column
+ @param _rPredicateValue
+ The text to normalize.
+ @param _rxField
+ The field for which the text should be a predicate value.
+ @param _pErrorMessage
+ If not <NULL/>, and a parsing error occurs, the error message will be copied to the string the argument
+ points to.
+ */
+ sal_Bool normalizePredicateString(
+ ::rtl::OUString& _rPredicateValue,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxField,
+ ::rtl::OUString* _pErrorMessage = NULL
+ ) const;
+
+ /** get's a value of the predicate which can be used in a WHERE clause.
+ @param _rPredicateValue
+ the value which has been normalized using normalizePredicateString
+ @param _rxField
+ is the field for which a predicate is to be entered
+ @param _bForStatementUse
+ If <TRUE/>, the returned value can be used in an SQL statement. If <FALSE/>, it can be used
+ for instance for setting parameter values.
+ @param _pErrorMessage
+ If not <NULL/>, and a parsing error occurs, the error message will be copied to the string the argument
+ points to.
+ @see normalizePredicateString
+ */
+ ::rtl::OUString getPredicateValue(
+ const ::rtl::OUString& _rPredicateValue,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & _rxField,
+ sal_Bool _bForStatementUse,
+ ::rtl::OUString* _pErrorMessage = NULL
+ ) const;
+
+ private:
+ ::connectivity::OSQLParseNode* implPredicateTree(
+ ::rtl::OUString& _rErrorMessage,
+ const ::rtl::OUString& _rStatement,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & _rxField
+ ) const;
+
+ sal_Bool getSeparatorChars(
+ const ::com::sun::star::lang::Locale& _rLocale,
+ sal_Unicode& _rDecSep,
+ sal_Unicode& _rThdSep
+ ) const;
+ };
+
+//.........................................................................
+} // namespace dbtools
+//.........................................................................
+
+#endif // CONNECTIVITY_PREDICATEINPUT_HXX
+
diff --git a/connectivity/inc/connectivity/sdbcx/IRefreshable.hxx b/connectivity/inc/connectivity/sdbcx/IRefreshable.hxx
new file mode 100644
index 000000000000..de3a2b28670c
--- /dev/null
+++ b/connectivity/inc/connectivity/sdbcx/IRefreshable.hxx
@@ -0,0 +1,57 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CONNECTIVITY_SDBCX_IREFRESHABLE_HXX_
+#define _CONNECTIVITY_SDBCX_IREFRESHABLE_HXX_
+
+#include "connectivity/CommonTools.hxx"
+#include "connectivity/dbtoolsdllapi.hxx"
+
+namespace connectivity
+{
+ namespace sdbcx
+ {
+ class OOO_DLLPUBLIC_DBTOOLS SAL_NO_VTABLE IRefreshableGroups
+ {
+ public:
+ virtual void refreshGroups() = 0;
+ };
+
+ class OOO_DLLPUBLIC_DBTOOLS SAL_NO_VTABLE IRefreshableUsers
+ {
+ public:
+ virtual void refreshUsers() = 0;
+ };
+
+ class OOO_DLLPUBLIC_DBTOOLS SAL_NO_VTABLE IRefreshableColumns
+ {
+ public:
+ virtual void refreshColumns() = 0;
+ };
+ }
+}
+#endif //_CONNECTIVITY_SDBCX_IREFRESHABLE_HXX_
+
diff --git a/connectivity/inc/connectivity/sdbcx/VCatalog.hxx b/connectivity/inc/connectivity/sdbcx/VCatalog.hxx
new file mode 100644
index 000000000000..672b9f4cfea6
--- /dev/null
+++ b/connectivity/inc/connectivity/sdbcx/VCatalog.hxx
@@ -0,0 +1,132 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _CONNECTIVITY_SDBCX_CATALOG_HXX_
+#define _CONNECTIVITY_SDBCX_CATALOG_HXX_
+
+#include <osl/diagnose.h>
+#include <com/sun/star/sdbcx/XTablesSupplier.hpp>
+#include <com/sun/star/sdbcx/XViewsSupplier.hpp>
+#include <com/sun/star/sdbcx/XUsersSupplier.hpp>
+#include <com/sun/star/sdbcx/XGroupsSupplier.hpp>
+#include <com/sun/star/sdbc/XConnection.hpp>
+#include <com/sun/star/sdbc/XRow.hpp>
+#include <cppuhelper/compbase5.hxx>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include "connectivity/CommonTools.hxx"
+#include "OSubComponent.hxx"
+#include "connectivity/sdbcx/IRefreshable.hxx"
+#include "connectivity/StdTypeDefs.hxx"
+#include "connectivity/dbtoolsdllapi.hxx"
+
+namespace connectivity
+{
+ namespace sdbcx
+ {
+
+ class OCollection;
+ // OCatalog is a general catalog class
+ // other drivers can be derived their catalog from this class when they want to support sdbcx
+ // it holds already tables, views, groups and users
+
+ typedef ::cppu::WeakComponentImplHelper5< ::com::sun::star::sdbcx::XTablesSupplier,
+ ::com::sun::star::sdbcx::XViewsSupplier,
+ ::com::sun::star::sdbcx::XUsersSupplier,
+ ::com::sun::star::sdbcx::XGroupsSupplier,
+ ::com::sun::star::lang::XServiceInfo> OCatalog_BASE;
+
+
+ class OOO_DLLPUBLIC_DBTOOLS SAL_NO_VTABLE OCatalog :
+ public OCatalog_BASE,
+ public IRefreshableGroups,
+ public IRefreshableUsers,
+ public connectivity::OSubComponent<OCatalog, OCatalog_BASE>
+ {
+ friend class connectivity::OSubComponent<OCatalog, OCatalog_BASE>;
+ protected:
+
+ ::osl::Mutex m_aMutex;
+
+ // this members are deleted when the dtor is called
+ // they are hold weak
+ OCollection* m_pTables;
+ OCollection* m_pViews;
+ OCollection* m_pGroups;
+ OCollection* m_pUsers;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData > m_xMetaData; // just to make things easier
+
+ /** builds the name which should be used to access the object later on in the collection.
+ Will only be called in fillNames.
+ @param _xRow
+ The current row from the resultset given to fillNames.
+ */
+ virtual ::rtl::OUString buildName( const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRow >& _xRow);
+
+ /** fills a vector with the nescessary names which can be used in combination with the collections.
+ For each row buildName will be called.
+ @param _xResult
+ The resultset which should be used to fill the names. Will be disposed after return and set to NULL.
+ @param _rNames
+ The vector who will be filled.
+ */
+ void fillNames(::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet >& _xResult,TStringVector& _rNames);
+
+ public:
+ OCatalog(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection> &_xConnection);
+ virtual ~OCatalog();
+
+ DECLARE_SERVICE_INFO();
+
+ // refreshTables is called when the method getTables had been called
+ // the member m_pTables has to be created
+ virtual void refreshTables() = 0;
+ // refreshViews is called when the method getViews had been called
+ virtual void refreshViews() = 0;
+
+ // the other refresh methods come from base classes IRefreshableGroups and IRefreshableUsers
+
+ // ::cppu::OComponentHelper
+ virtual void SAL_CALL disposing(void);
+ // XInterface
+ void SAL_CALL acquire() throw();
+ void SAL_CALL release() throw();
+ // XTablesSupplier
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL getTables( ) throw(::com::sun::star::uno::RuntimeException);
+ // XViewsSupplier
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL getViews( ) throw(::com::sun::star::uno::RuntimeException);
+ // XUsersSupplier
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL getUsers( ) throw(::com::sun::star::uno::RuntimeException);
+ // XGroupsSupplier
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL getGroups( ) throw(::com::sun::star::uno::RuntimeException);
+
+ };
+ }
+}
+
+#endif // _CONNECTIVITY_SDBCX_CATALOG_HXX_
+
diff --git a/connectivity/inc/connectivity/sdbcx/VCollection.hxx b/connectivity/inc/connectivity/sdbcx/VCollection.hxx
new file mode 100644
index 000000000000..58fd6f8d0e2c
--- /dev/null
+++ b/connectivity/inc/connectivity/sdbcx/VCollection.hxx
@@ -0,0 +1,243 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _CONNECTIVITY_SDBCX_COLLECTION_HXX_
+#define _CONNECTIVITY_SDBCX_COLLECTION_HXX_
+
+#include <cppuhelper/implbase10.hxx>
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/container/XIndexAccess.hpp>
+#include <com/sun/star/container/XEnumerationAccess.hpp>
+#include <com/sun/star/container/XEnumeration.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/util/XRefreshable.hpp>
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/sdbcx/XDataDescriptorFactory.hpp>
+#include <com/sun/star/sdbcx/XAppend.hpp>
+#include <com/sun/star/sdbcx/XDrop.hpp>
+#include <com/sun/star/sdbc/XColumnLocate.hpp>
+#include <comphelper/stl_types.hxx>
+#include <cppuhelper/interfacecontainer.h>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include "connectivity/CommonTools.hxx"
+#include <com/sun/star/container/XContainer.hpp>
+#include "connectivity/StdTypeDefs.hxx"
+#include "connectivity/dbtoolsdllapi.hxx"
+#include <memory>
+
+
+namespace connectivity
+{
+ namespace sdbcx
+ {
+
+ // the class OCollection is base class for collections :-)
+ typedef ::cppu::ImplHelper10< ::com::sun::star::container::XNameAccess,
+ ::com::sun::star::container::XIndexAccess,
+ ::com::sun::star::container::XEnumerationAccess,
+ ::com::sun::star::container::XContainer,
+ ::com::sun::star::sdbc::XColumnLocate,
+ ::com::sun::star::util::XRefreshable,
+ ::com::sun::star::sdbcx::XDataDescriptorFactory,
+ ::com::sun::star::sdbcx::XAppend,
+ ::com::sun::star::sdbcx::XDrop,
+ ::com::sun::star::lang::XServiceInfo> OCollectionBase;
+
+ typedef ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > ObjectType;
+
+ class OOO_DLLPUBLIC_DBTOOLS SAL_NO_VTABLE IObjectCollection
+ {
+ public:
+ virtual void reserve(size_t nLength) = 0;
+ virtual bool exists(const ::rtl::OUString& _sName ) = 0;
+ virtual bool empty() = 0;
+ virtual void swapAll() = 0;
+ virtual void swap() = 0;
+ virtual void clear() = 0;
+ virtual void reFill(const TStringVector &_rVector) = 0;
+ virtual void insert(const ::rtl::OUString& _sName,const ObjectType& _xObject) = 0;
+ virtual bool rename(const ::rtl::OUString _sOldName,const ::rtl::OUString _sNewName) = 0;
+ virtual sal_Int32 size() = 0;
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > getElementNames() = 0;
+ virtual ::rtl::OUString getName(sal_Int32 _nIndex) = 0;
+ virtual void disposeAndErase(sal_Int32 _nIndex) = 0;
+ virtual void disposeElements() = 0;
+ virtual sal_Int32 findColumn( const ::rtl::OUString& columnName ) = 0;
+ virtual ::rtl::OUString findColumnAtIndex( sal_Int32 _nIndex) = 0;
+ virtual ObjectType getObject(sal_Int32 _nIndex) = 0;
+ virtual ObjectType getObject(const ::rtl::OUString& columnName) = 0;
+ virtual void setObject(sal_Int32 _nIndex,const ObjectType& _xObject) = 0;
+ virtual sal_Bool isCaseSensitive() const = 0;
+ };
+ //************************************************************
+ // OCollection
+ //************************************************************
+ class OOO_DLLPUBLIC_DBTOOLS SAL_NO_VTABLE OCollection :
+ public OCollectionBase
+ {
+ protected:
+ ::std::auto_ptr<IObjectCollection> m_pElements;
+
+ ::cppu::OInterfaceContainerHelper m_aContainerListeners;
+ ::cppu::OInterfaceContainerHelper m_aRefreshListeners;
+
+ protected:
+ ::cppu::OWeakObject& m_rParent; // parent of the collection
+ ::osl::Mutex& m_rMutex; // mutex of the parent
+ sal_Bool m_bUseIndexOnly; // is only TRUE when only an indexaccess is needed
+
+ // the implementing class should refresh their elements
+ virtual void impl_refresh() throw(::com::sun::star::uno::RuntimeException) = 0;
+
+ // will be called when a object was requested by one of the accessing methods like getByIndex
+ virtual ObjectType createObject(const ::rtl::OUString& _rName) = 0;
+
+ // will be called when a new object should be generated by a call of createDataDescriptor
+ // the returned object is empty will be filled outside and added to the collection
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > createDescriptor();
+
+ /** appends an object described by a descriptor, under a given name
+ @param _rForName
+ is the name under which the object should be appended. Guaranteed to not be empty.
+ This is passed for convenience only, since it's the result of a call of
+ getNameForObject for the given descriptor
+ @param descriptor
+ describes the object to append
+ @return
+ the new object which is to be inserted into the collection. This might be the result
+ of a call of <code>createObject( _rForName )</code>, or a clone of the descriptor.
+ */
+ virtual ObjectType appendObject( const ::rtl::OUString& _rForName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor );
+
+ // called when XDrop was called
+ virtual void dropObject(sal_Int32 _nPos,const ::rtl::OUString _sElementName);
+
+ /** returns the name for the object. The default implementation ask for the property NAME. If this doesn't satisfy, it has to be overloaded.
+ @param _xObject The object where the name should be extracted.
+ @return The name of the object.
+ */
+ virtual ::rtl::OUString getNameForObject(const ObjectType& _xObject);
+
+ /** clones the given descriptor
+
+ The method calls createDescriptor to create a new, empty descriptor, and then copies all properties from
+ _descriptor to the new object, which is returned.
+
+ This method might come handy in derived classes for implementing appendObject, when the object
+ is not actually appended to any backend (e.g. for the columns collection of a descriptor object itself,
+ where there is not yet a database backend to append the column to).
+ */
+ ObjectType cloneDescriptor( const ObjectType& _descriptor );
+
+ OCollection(::cppu::OWeakObject& _rParent,
+ sal_Bool _bCase,
+ ::osl::Mutex& _rMutex,
+ const TStringVector &_rVector,
+ sal_Bool _bUseIndexOnly = sal_False,
+ sal_Bool _bUseHardRef = sal_True);
+
+ /** clear the name map
+ <p>Does <em>not</em> dispose the objects hold by the collection.</p>
+ */
+ void clear_NoDispose();
+
+ /** insert a new element into the collection
+ */
+ void insertElement(const ::rtl::OUString& _sElementName,const ObjectType& _xElement);
+
+ /** return the name of element at index _nIndex
+ */
+ inline ::rtl::OUString getElementName(sal_Int32 _nIndex)
+ {
+ return m_pElements->findColumnAtIndex(_nIndex);
+ }
+
+
+ /** return the object, if not existent it creates it.
+ @param _nIndex
+ The index of the object to create.
+ @return ObjectType
+ */
+ ObjectType getObject(sal_Int32 _nIndex);
+
+ public:
+ virtual ~OCollection();
+ DECLARE_SERVICE_INFO();
+
+ void reFill(const TStringVector &_rVector);
+ inline sal_Bool isCaseSensitive() const { return m_pElements->isCaseSensitive(); }
+ void renameObject(const ::rtl::OUString _sOldName,const ::rtl::OUString _sNewName);
+
+ // only the name is identical to ::cppu::OComponentHelper
+ virtual void SAL_CALL disposing(void);
+ // dispatch the refcounting to the parent
+ virtual void SAL_CALL acquire() throw();
+ virtual void SAL_CALL release() throw();
+
+ // XInterface
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw (::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::container::XElementAccess
+ virtual ::com::sun::star::uno::Type SAL_CALL getElementType( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL hasElements( ) throw(::com::sun::star::uno::RuntimeException);
+ // ::com::sun::star::container::XIndexAccess
+ virtual sal_Int32 SAL_CALL getCount( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) throw(::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::container::XNameAccess
+ virtual ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) throw(::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw(::com::sun::star::uno::RuntimeException);
+ // XEnumerationAccess
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration > SAL_CALL createEnumeration( ) throw(::com::sun::star::uno::RuntimeException);
+ // ::com::sun::star::util::XRefreshable
+ virtual void SAL_CALL refresh( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addRefreshListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XRefreshListener >& l ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeRefreshListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XRefreshListener >& l ) throw(::com::sun::star::uno::RuntimeException);
+ // XDataDescriptorFactory
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL createDataDescriptor( ) throw(::com::sun::star::uno::RuntimeException);
+ // XAppend
+ virtual void SAL_CALL appendByDescriptor( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::container::ElementExistException, ::com::sun::star::uno::RuntimeException);
+ // XDrop
+ virtual void SAL_CALL dropByName( const ::rtl::OUString& elementName ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL dropByIndex( sal_Int32 index ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ // XColumnLocate
+ virtual sal_Int32 SAL_CALL findColumn( const ::rtl::OUString& columnName ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ // ::com::sun::star::container::XContainer
+ virtual void SAL_CALL addContainerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerListener >& xListener ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeContainerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerListener >& xListener ) throw(::com::sun::star::uno::RuntimeException);
+ private:
+ void notifyElementRemoved(const ::rtl::OUString& _sName);
+ void disposeElements();
+ void dropImpl(sal_Int32 _nIndex,sal_Bool _bReallyDrop = sal_True);
+ };
+ }
+}
+#endif // _CONNECTIVITY_SDBCX_COLLECTION_HXX_
+
+
diff --git a/connectivity/inc/connectivity/sdbcx/VColumn.hxx b/connectivity/inc/connectivity/sdbcx/VColumn.hxx
new file mode 100644
index 000000000000..0a8c5498cf60
--- /dev/null
+++ b/connectivity/inc/connectivity/sdbcx/VColumn.hxx
@@ -0,0 +1,118 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CONNECTIVITY_SDBCX_COLUMN_HXX_
+#define _CONNECTIVITY_SDBCX_COLUMN_HXX_
+
+#include <com/sun/star/sdbcx/XDataDescriptorFactory.hpp>
+#include <com/sun/star/container/XNamed.hpp>
+#include <comphelper/IdPropArrayHelper.hxx>
+#include <cppuhelper/compbase2.hxx>
+#include <cppuhelper/implbase1.hxx>
+#include "connectivity/CommonTools.hxx"
+#include <comphelper/broadcasthelper.hxx>
+#include "connectivity/sdbcx/VDescriptor.hxx"
+#include "connectivity/dbtoolsdllapi.hxx"
+#include <com/sun/star/lang/XServiceInfo.hpp>
+
+namespace connectivity
+{
+ namespace sdbcx
+ {
+ class OColumn;
+ typedef ::comphelper::OIdPropertyArrayUsageHelper<OColumn> OColumn_PROP;
+
+ typedef ::cppu::WeakComponentImplHelper2< ::com::sun::star::container::XNamed,
+ ::com::sun::star::lang::XServiceInfo> OColumnDescriptor_BASE;
+ typedef ::cppu::ImplHelper1< ::com::sun::star::sdbcx::XDataDescriptorFactory > OColumn_BASE;
+
+
+ class OOO_DLLPUBLIC_DBTOOLS OColumn :
+ public comphelper::OBaseMutex,
+ public OColumn_BASE,
+ public OColumnDescriptor_BASE,
+ public OColumn_PROP,
+ public ODescriptor
+ {
+ protected:
+ ::rtl::OUString m_TypeName;
+ ::rtl::OUString m_Description;
+ ::rtl::OUString m_DefaultValue;
+
+ sal_Int32 m_IsNullable;
+ sal_Int32 m_Precision;
+ sal_Int32 m_Scale;
+ sal_Int32 m_Type;
+
+ sal_Bool m_IsAutoIncrement;
+ sal_Bool m_IsRowVersion;
+ sal_Bool m_IsCurrency;
+
+ using OColumnDescriptor_BASE::rBHelper;
+ virtual ::cppu::IPropertyArrayHelper* createArrayHelper( sal_Int32 _nId) const;
+ virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
+
+ virtual ~OColumn();
+ public:
+ virtual void SAL_CALL acquire() throw();
+ virtual void SAL_CALL release() throw();
+
+ OColumn( sal_Bool _bCase);
+ OColumn( const ::rtl::OUString& _Name,
+ const ::rtl::OUString& _TypeName,
+ const ::rtl::OUString& _DefaultValue,
+ const ::rtl::OUString& _Description,
+ sal_Int32 _IsNullable,
+ sal_Int32 _Precision,
+ sal_Int32 _Scale,
+ sal_Int32 _Type,
+ sal_Bool _IsAutoIncrement,
+ sal_Bool _IsRowVersion,
+ sal_Bool _IsCurrency,
+ sal_Bool _bCase);
+
+ DECLARE_SERVICE_INFO();
+ //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);
+ // ODescriptor
+ virtual void construct();
+ // ::cppu::OComponentHelper
+ virtual void SAL_CALL disposing(void);
+ // XPropertySet
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
+ // XNamed
+ virtual ::rtl::OUString SAL_CALL getName( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setName( const ::rtl::OUString& aName ) throw(::com::sun::star::uno::RuntimeException);
+ // XDataDescriptorFactory
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL createDataDescriptor( ) throw(::com::sun::star::uno::RuntimeException);
+ };
+ }
+}
+
+#endif // _CONNECTIVITY_SDBCX_COLUMN_HXX_
+
diff --git a/connectivity/inc/connectivity/sdbcx/VDescriptor.hxx b/connectivity/inc/connectivity/sdbcx/VDescriptor.hxx
new file mode 100644
index 000000000000..99b251d17f42
--- /dev/null
+++ b/connectivity/inc/connectivity/sdbcx/VDescriptor.hxx
@@ -0,0 +1,102 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _CONNECTIVITY_SDBCX_DESCRIPTOR_HXX_
+#define _CONNECTIVITY_SDBCX_DESCRIPTOR_HXX_
+
+#include <comphelper/propertycontainer.hxx>
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <cppuhelper/typeprovider.hxx>
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+#include <comphelper/stl_types.hxx>
+#include "connectivity/dbtoolsdllapi.hxx"
+
+namespace connectivity
+{
+ namespace sdbcx
+ {
+ // =========================================================================
+ // = ODescriptor
+ // =========================================================================
+ typedef ::comphelper::OPropertyContainer ODescriptor_PBASE;
+ class OOO_DLLPUBLIC_DBTOOLS ODescriptor
+ :public ODescriptor_PBASE
+ ,public ::com::sun::star::lang::XUnoTunnel
+ {
+ protected:
+ ::rtl::OUString m_Name;
+
+ /** helper for derived classes to implement OPropertyArrayUsageHelper::createArrayHelper
+
+ This method just calls describeProperties, and flags all properties as READONLY if and
+ only if we do *not* act as descriptor, but as final object.
+
+ @seealso isNew
+ */
+ ::cppu::IPropertyArrayHelper* doCreateArrayHelper() const;
+
+ private:
+ comphelper::UStringMixEqual m_aCase;
+ sal_Bool m_bNew;
+
+ public:
+ ODescriptor(::cppu::OBroadcastHelper& _rBHelper,sal_Bool _bCase, sal_Bool _bNew = sal_False);
+
+ virtual ~ODescriptor();
+
+ sal_Bool isNew() const { return m_bNew; }
+ sal_Bool getNew() const { return m_bNew; }
+ virtual void setNew(sal_Bool _bNew);
+
+ sal_Bool isCaseSensitive() const { return m_aCase.isCaseSensitive(); }
+
+ virtual void construct();
+
+ // XInterface
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // compare
+ inline sal_Bool operator == ( const ::rtl::OUString & _rRH )
+ {
+ return m_aCase(m_Name,_rRH);
+ }
+
+ // com::sun::star::lang::XUnoTunnel
+ virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException);
+ static ::com::sun::star::uno::Sequence< sal_Int8 > getUnoTunnelImplementationId();
+
+ static ODescriptor* getImplementation( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxSomeComp );
+ // retrieves the ODescriptor implementation of a given UNO component, and returns its ->isNew flag
+ static sal_Bool isNew( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxDescriptor );
+ };
+ }
+
+}
+#endif // _CONNECTIVITY_SDBCX_DESCRIPTOR_HXX_
+
diff --git a/connectivity/inc/connectivity/sdbcx/VGroup.hxx b/connectivity/inc/connectivity/sdbcx/VGroup.hxx
new file mode 100644
index 000000000000..b65b4cd2fda4
--- /dev/null
+++ b/connectivity/inc/connectivity/sdbcx/VGroup.hxx
@@ -0,0 +1,113 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _CONNECTIVITY_SDBCX_GROUP_HXX_
+#define _CONNECTIVITY_SDBCX_GROUP_HXX_
+
+#include <osl/diagnose.h>
+
+
+#include <com/sun/star/sdbcx/XUsersSupplier.hpp>
+#include <com/sun/star/sdbcx/XAuthorizable.hpp>
+#include <com/sun/star/container/XNamed.hpp>
+#include <comphelper/proparrhlp.hxx>
+#include <cppuhelper/compbase4.hxx>
+//#ifndef _CONNECTIVITY_COMMONTOOLS_HXX_
+//#include "connectivity/CommonTools.hxx"
+//#endif
+#include <comphelper/broadcasthelper.hxx>
+#include "connectivity/sdbcx/VCollection.hxx"
+#include <comphelper/propertycontainer.hxx>
+#include "connectivity/sdbcx/IRefreshable.hxx"
+#include "connectivity/sdbcx/VDescriptor.hxx"
+#include "connectivity/dbtoolsdllapi.hxx"
+#include <com/sun/star/lang/XServiceInfo.hpp>
+
+namespace connectivity
+{
+ namespace sdbcx
+ {
+ typedef OCollection OUsers;
+
+ typedef ::cppu::WeakComponentImplHelper4< ::com::sun::star::sdbcx::XUsersSupplier,
+ ::com::sun::star::sdbcx::XAuthorizable,
+ ::com::sun::star::container::XNamed,
+ ::com::sun::star::lang::XServiceInfo> OGroup_BASE;
+
+ class OOO_DLLPUBLIC_DBTOOLS OGroup :
+ public comphelper::OBaseMutex,
+ public OGroup_BASE,
+ public IRefreshableUsers,
+ public ::comphelper::OPropertyArrayUsageHelper<OGroup>,
+ public ODescriptor
+ {
+ protected:
+ OUsers* m_pUsers;
+
+ using OGroup_BASE::rBHelper;
+
+ // OPropertyArrayUsageHelper
+ virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const;
+ // OPropertySetHelper
+ virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper();
+ public:
+ OGroup(sal_Bool _bCase);
+ OGroup( const ::rtl::OUString& _Name,sal_Bool _bCase);
+ virtual ~OGroup();
+ DECLARE_SERVICE_INFO();
+
+ // XInterface
+ virtual void SAL_CALL acquire() throw();
+ virtual void SAL_CALL release() 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);
+
+ // ::cppu::OComponentHelper
+ virtual void SAL_CALL disposing(void);
+ // XPropertySet
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
+ // XUsersSupplier
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL getUsers( ) throw(::com::sun::star::uno::RuntimeException);
+ // XAuthorizable
+ virtual sal_Int32 SAL_CALL getPrivileges( const ::rtl::OUString& objName, sal_Int32 objType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getGrantablePrivileges( const ::rtl::OUString& objName, sal_Int32 objType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL grantPrivileges( const ::rtl::OUString& objName, sal_Int32 objType, sal_Int32 objPrivileges ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL revokePrivileges( const ::rtl::OUString& objName, sal_Int32 objType, sal_Int32 objPrivileges ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+
+ // XNamed
+ virtual ::rtl::OUString SAL_CALL getName( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setName( const ::rtl::OUString& aName ) throw(::com::sun::star::uno::RuntimeException);
+ };
+ }
+}
+
+#endif // _CONNECTIVITY_SDBCX_GROUP_HXX_
+
+
diff --git a/connectivity/inc/connectivity/sdbcx/VIndex.hxx b/connectivity/inc/connectivity/sdbcx/VIndex.hxx
new file mode 100644
index 000000000000..b0669fdda540
--- /dev/null
+++ b/connectivity/inc/connectivity/sdbcx/VIndex.hxx
@@ -0,0 +1,117 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _CONNECTIVITY_SDBCX_INDEX_HXX_
+#define _CONNECTIVITY_SDBCX_INDEX_HXX_
+
+//#ifndef _OSL_DIAGNOSE_H_
+//#include <osl/diagnose.h>
+//#endif
+#include <com/sun/star/sdbcx/XDataDescriptorFactory.hpp>
+#include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
+#include <com/sun/star/container/XNamed.hpp>
+#include <comphelper/IdPropArrayHelper.hxx>
+#include <cppuhelper/compbase2.hxx>
+#include "connectivity/CommonTools.hxx"
+#include <comphelper/broadcasthelper.hxx>
+#include "connectivity/sdbcx/VTypeDef.hxx"
+#include "connectivity/sdbcx/IRefreshable.hxx"
+#include "connectivity/sdbcx/VDescriptor.hxx"
+#include "connectivity/dbtoolsdllapi.hxx"
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/sdbcx/XDataDescriptorFactory.hpp>
+#include <cppuhelper/implbase1.hxx>
+
+namespace connectivity
+{
+ namespace sdbcx
+ {
+ class OCollection;
+ class OIndex;
+ typedef ::cppu::ImplHelper1< ::com::sun::star::sdbcx::XDataDescriptorFactory > OIndex_BASE;
+ typedef ::comphelper::OIdPropertyArrayUsageHelper<OIndex> OIndex_PROP;
+
+ class OOO_DLLPUBLIC_DBTOOLS OIndex :
+ public comphelper::OBaseMutex,
+ public ODescriptor_BASE,
+ public IRefreshableColumns,
+ public OIndex_PROP,
+ public ODescriptor,
+ public OIndex_BASE
+ {
+ protected:
+ ::rtl::OUString m_Catalog;
+ sal_Bool m_IsUnique;
+ sal_Bool m_IsPrimaryKeyIndex;
+ sal_Bool m_IsClustered;
+
+ OCollection* m_pColumns;
+
+ using ODescriptor_BASE::rBHelper;
+ virtual void refreshColumns();
+ // OPropertyArrayUsageHelper
+ virtual ::cppu::IPropertyArrayHelper* createArrayHelper( sal_Int32 _nId) const;
+ virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
+ public:
+ OIndex(sal_Bool _bCase);
+ OIndex( const ::rtl::OUString& _Name,
+ const ::rtl::OUString& _Catalog,
+ sal_Bool _isUnique,
+ sal_Bool _isPrimaryKeyIndex,
+ sal_Bool _isClustered,
+ sal_Bool _bCase);
+
+ virtual ~OIndex( );
+
+ DECLARE_SERVICE_INFO();
+
+ //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);
+ // ODescriptor
+ virtual void construct();
+ // ::cppu::OComponentHelper
+ virtual void SAL_CALL disposing(void);
+ // XPropertySet
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
+ // XColumnsSupplier
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL getColumns( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // XNamed
+ virtual ::rtl::OUString SAL_CALL getName( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setName( const ::rtl::OUString& aName ) throw(::com::sun::star::uno::RuntimeException);
+ // XDataDescriptorFactory
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL createDataDescriptor( ) throw(::com::sun::star::uno::RuntimeException);
+ };
+ }
+}
+
+#endif // _CONNECTIVITY_SDBCX_INDEX_HXX_
+
diff --git a/connectivity/inc/connectivity/sdbcx/VIndexColumn.hxx b/connectivity/inc/connectivity/sdbcx/VIndexColumn.hxx
new file mode 100644
index 000000000000..da836b772f30
--- /dev/null
+++ b/connectivity/inc/connectivity/sdbcx/VIndexColumn.hxx
@@ -0,0 +1,69 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _CONNECTIVITY_SDBCX_INDEXCOLUMN_HXX_
+#define _CONNECTIVITY_SDBCX_INDEXCOLUMN_HXX_
+
+#include "connectivity/dbtoolsdllapi.hxx"
+#include "connectivity/sdbcx/VColumn.hxx"
+
+namespace connectivity
+{
+ namespace sdbcx
+ {
+ class OIndexColumn;
+ typedef ::comphelper::OIdPropertyArrayUsageHelper<OIndexColumn> OIndexColumn_PROP;
+
+ class OOO_DLLPUBLIC_DBTOOLS OIndexColumn :
+ public OColumn, public OIndexColumn_PROP
+ {
+ protected:
+ sal_Bool m_IsAscending;
+ virtual ::cppu::IPropertyArrayHelper* createArrayHelper( sal_Int32 _nId) const;
+ virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
+ public:
+ OIndexColumn( sal_Bool _bCase);
+ OIndexColumn( sal_Bool _IsAscending,
+ const ::rtl::OUString& _Name,
+ const ::rtl::OUString& _TypeName,
+ const ::rtl::OUString& _DefaultValue,
+ sal_Int32 _IsNullable,
+ sal_Int32 _Precision,
+ sal_Int32 _Scale,
+ sal_Int32 _Type,
+ sal_Bool _IsAutoIncrement,
+ sal_Bool _IsRowVersion,
+ sal_Bool _IsCurrency,
+ sal_Bool _bCase);
+
+ virtual void construct();
+ DECLARE_SERVICE_INFO();
+ };
+ }
+}
+#endif // _CONNECTIVITY_SDBCX_INDEXCOLUMN_HXX_
+
diff --git a/connectivity/inc/connectivity/sdbcx/VKey.hxx b/connectivity/inc/connectivity/sdbcx/VKey.hxx
new file mode 100644
index 000000000000..e4969cbced18
--- /dev/null
+++ b/connectivity/inc/connectivity/sdbcx/VKey.hxx
@@ -0,0 +1,128 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _CONNECTIVITY_SDBCX_KEY_HXX_
+#define _CONNECTIVITY_SDBCX_KEY_HXX_
+
+
+#include <comphelper/IdPropArrayHelper.hxx>
+#include "connectivity/CommonTools.hxx"
+#include <comphelper/broadcasthelper.hxx>
+#include "connectivity/sdbcx/VTypeDef.hxx"
+#include <com/sun/star/container/XNamed.hpp>
+#include "connectivity/sdbcx/IRefreshable.hxx"
+#include "connectivity/sdbcx/VDescriptor.hxx"
+#include "connectivity/dbtoolsdllapi.hxx"
+#include <cppuhelper/implbase1.hxx>
+#include <com/sun/star/sdbcx/XDataDescriptorFactory.hpp>
+#include <boost/shared_ptr.hpp>
+
+namespace connectivity
+{
+ namespace sdbcx
+ {
+
+ struct OOO_DLLPUBLIC_DBTOOLS KeyProperties
+ {
+ ::std::vector< ::rtl::OUString> m_aKeyColumnNames;
+ ::rtl::OUString m_ReferencedTable;
+ sal_Int32 m_Type;
+ sal_Int32 m_UpdateRule;
+ sal_Int32 m_DeleteRule;
+ KeyProperties(const ::rtl::OUString& _ReferencedTable,
+ sal_Int32 _Type,
+ sal_Int32 _UpdateRule,
+ sal_Int32 _DeleteRule)
+ :m_ReferencedTable(_ReferencedTable),
+ m_Type(_Type),
+ m_UpdateRule(_UpdateRule),
+ m_DeleteRule(_DeleteRule)
+ {}
+ KeyProperties():m_Type(0),m_UpdateRule(0),m_DeleteRule(0){}
+ };
+ typedef ::boost::shared_ptr< KeyProperties > TKeyProperties;
+ typedef ::cppu::ImplHelper1< ::com::sun::star::sdbcx::XDataDescriptorFactory > OKey_BASE;
+ class OCollection;
+
+ class OOO_DLLPUBLIC_DBTOOLS OKey :
+ public comphelper::OBaseMutex,
+ public ODescriptor_BASE,
+ public IRefreshableColumns,
+ public ::comphelper::OIdPropertyArrayUsageHelper<OKey>,
+ public ODescriptor,
+ public OKey_BASE
+ {
+ protected:
+ TKeyProperties m_aProps;
+ OCollection* m_pColumns;
+
+ using ODescriptor_BASE::rBHelper;
+ // OPropertyArrayUsageHelper
+ virtual ::cppu::IPropertyArrayHelper* createArrayHelper( sal_Int32 _nId) const;
+ // OPropertySetHelper
+ virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper();
+ public:
+ OKey(sal_Bool _bCase);
+ OKey(const ::rtl::OUString& _Name,const TKeyProperties& _rProps,sal_Bool _bCase);
+ /*OKey( const ::rtl::OUString& _Name,
+ const ::rtl::OUString& _ReferencedTable,
+ sal_Int32 _Type,
+ sal_Int32 _UpdateRule,
+ sal_Int32 _DeleteRule,
+ sal_Bool _bCase);*/
+
+ virtual ~OKey( );
+
+ DECLARE_SERVICE_INFO();
+ //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);
+ // ODescriptor
+ virtual void construct();
+
+ // ::cppu::OComponentHelper
+ virtual void SAL_CALL disposing();
+ // XPropertySet
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
+ // XColumnsSupplier
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL getColumns( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // XNamed
+ virtual ::rtl::OUString SAL_CALL getName( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setName( const ::rtl::OUString& aName ) throw(::com::sun::star::uno::RuntimeException);
+ // XDataDescriptorFactory
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL createDataDescriptor( ) throw(::com::sun::star::uno::RuntimeException);
+ };
+ }
+}
+
+#endif // _CONNECTIVITY_SDBCX_KEY_HXX_
+
+
diff --git a/connectivity/inc/connectivity/sdbcx/VKeyColumn.hxx b/connectivity/inc/connectivity/sdbcx/VKeyColumn.hxx
new file mode 100644
index 000000000000..a3526cc68028
--- /dev/null
+++ b/connectivity/inc/connectivity/sdbcx/VKeyColumn.hxx
@@ -0,0 +1,71 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _CONNECTIVITY_SDBCX_KEYCOLUMN_HXX_
+#define _CONNECTIVITY_SDBCX_KEYCOLUMN_HXX_
+
+#include "connectivity/dbtoolsdllapi.hxx"
+#include "connectivity/sdbcx/VColumn.hxx"
+
+namespace connectivity
+{
+ namespace sdbcx
+ {
+ class OKeyColumn;
+ typedef ::comphelper::OIdPropertyArrayUsageHelper<OKeyColumn> OKeyColumn_PROP;
+
+ class OOO_DLLPUBLIC_DBTOOLS OKeyColumn :
+ public OColumn, public OKeyColumn_PROP
+ {
+ protected:
+ ::rtl::OUString m_ReferencedColumn;
+ virtual ::cppu::IPropertyArrayHelper* createArrayHelper( sal_Int32 _nId) const;
+ virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
+ public:
+ OKeyColumn(sal_Bool _bCase);
+ OKeyColumn( const ::rtl::OUString& _ReferencedColumn,
+ const ::rtl::OUString& _Name,
+ const ::rtl::OUString& _TypeName,
+ const ::rtl::OUString& _DefaultValue,
+ sal_Int32 _IsNullable,
+ sal_Int32 _Precision,
+ sal_Int32 _Scale,
+ sal_Int32 _Type,
+ sal_Bool _IsAutoIncrement,
+ sal_Bool _IsRowVersion,
+ sal_Bool _IsCurrency,
+ sal_Bool _bCase);
+ // just to make it not inline
+ virtual ~OKeyColumn();
+
+ virtual void construct();
+ DECLARE_SERVICE_INFO();
+ };
+ }
+}
+#endif // _CONNECTIVITY_SDBCX_KEYCOLUMN_HXX_
+
diff --git a/connectivity/inc/connectivity/sdbcx/VTable.hxx b/connectivity/inc/connectivity/sdbcx/VTable.hxx
new file mode 100644
index 000000000000..c1ced96b4195
--- /dev/null
+++ b/connectivity/inc/connectivity/sdbcx/VTable.hxx
@@ -0,0 +1,148 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _CONNECTIVITY_SDBCX_TABLE_HXX_
+#define _CONNECTIVITY_SDBCX_TABLE_HXX_
+
+#include <com/sun/star/sdbcx/XDataDescriptorFactory.hpp>
+#include <com/sun/star/sdbcx/XIndexesSupplier.hpp>
+#include <com/sun/star/sdbcx/XRename.hpp>
+#include <com/sun/star/sdbcx/XAlterTable.hpp>
+#include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
+#include <com/sun/star/sdbcx/XKeysSupplier.hpp>
+#include <comphelper/IdPropArrayHelper.hxx>
+#include <cppuhelper/compbase4.hxx>
+#include <cppuhelper/implbase4.hxx>
+#include <comphelper/broadcasthelper.hxx>
+#include <com/sun/star/container/XNamed.hpp>
+#include "connectivity/sdbcx/IRefreshable.hxx"
+#include "connectivity/sdbcx/VDescriptor.hxx"
+#include "connectivity/CommonTools.hxx"
+#include "connectivity/dbtoolsdllapi.hxx"
+#include <com/sun/star/sdbc/XDatabaseMetaData.hpp>
+
+namespace connectivity
+{
+ namespace sdbcx
+ {
+
+ class OTable;
+ class OCollection;
+
+ typedef ::cppu::WeakComponentImplHelper4< ::com::sun::star::sdbcx::XColumnsSupplier,
+ ::com::sun::star::sdbcx::XKeysSupplier,
+ ::com::sun::star::container::XNamed,
+ ::com::sun::star::lang::XServiceInfo> OTableDescriptor_BASE;
+
+ typedef ::cppu::ImplHelper4< ::com::sun::star::sdbcx::XDataDescriptorFactory,
+ ::com::sun::star::sdbcx::XIndexesSupplier,
+ ::com::sun::star::sdbcx::XRename,
+ ::com::sun::star::sdbcx::XAlterTable > OTable_BASE;
+
+ typedef ::comphelper::OIdPropertyArrayUsageHelper<OTable> OTable_PROP;
+
+
+ class OOO_DLLPUBLIC_DBTOOLS OTable :
+ public comphelper::OBaseMutex,
+ public OTable_BASE,
+ public OTableDescriptor_BASE,
+ public IRefreshableColumns,
+ public OTable_PROP,
+ public ODescriptor
+ {
+ protected:
+ ::rtl::OUString m_CatalogName;
+ ::rtl::OUString m_SchemaName;
+ ::rtl::OUString m_Description;
+ ::rtl::OUString m_Type;
+
+ OCollection* m_pKeys;
+ OCollection* m_pColumns;
+ OCollection* m_pIndexes;
+ OCollection* m_pTables; // must hold his own container to notify him when renaming
+
+ using OTableDescriptor_BASE::rBHelper;
+
+ // OPropertyArrayUsageHelper
+ virtual ::cppu::IPropertyArrayHelper* createArrayHelper(sal_Int32 _nId ) const;
+ // OPropertySetHelper
+ virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper();
+ public:
+ OTable( OCollection* _pTables,
+ sal_Bool _bCase);
+ OTable( OCollection* _pTables,
+ sal_Bool _bCase,
+ const ::rtl::OUString& _Name,
+ const ::rtl::OUString& _Type,
+ const ::rtl::OUString& _Description = ::rtl::OUString(),
+ const ::rtl::OUString& _SchemaName = ::rtl::OUString(),
+ const ::rtl::OUString& _CatalogName = ::rtl::OUString());
+
+ virtual ~OTable();
+
+ DECLARE_SERVICE_INFO();
+ //XInterface
+ virtual void SAL_CALL acquire() throw();
+ virtual void SAL_CALL release() throw();
+ 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);
+
+ // ODescriptor
+ virtual void construct();
+ virtual void refreshColumns();
+ virtual void refreshKeys();
+ virtual void refreshIndexes();
+ // ::cppu::OComponentHelper
+ virtual void SAL_CALL disposing(void);
+ // XPropertySet
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
+ // XColumnsSupplier
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL getColumns( ) throw(::com::sun::star::uno::RuntimeException);
+ // XKeysSupplier
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > SAL_CALL getKeys( ) throw(::com::sun::star::uno::RuntimeException);
+ // XNamed
+ virtual ::rtl::OUString SAL_CALL getName() throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setName( const ::rtl::OUString& aName ) throw(::com::sun::star::uno::RuntimeException);
+ // XDataDescriptorFactory
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL createDataDescriptor( void ) throw(::com::sun::star::uno::RuntimeException);
+ // XIndexesSupplier
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL getIndexes( ) throw(::com::sun::star::uno::RuntimeException);
+ // XRename
+ virtual void SAL_CALL rename( const ::rtl::OUString& newName ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::container::ElementExistException, ::com::sun::star::uno::RuntimeException);
+ // XAlterTable
+ virtual void SAL_CALL alterColumnByName( const ::rtl::OUString& colName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL alterColumnByIndex( sal_Int32 index, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+
+ // helper method
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData> getMetaData() const;
+ };
+ }
+}
+
+#endif // _CONNECTIVITY_SDBCX_TABLE_HXX_
+
diff --git a/connectivity/inc/connectivity/sdbcx/VTypeDef.hxx b/connectivity/inc/connectivity/sdbcx/VTypeDef.hxx
new file mode 100644
index 000000000000..386cb254a69c
--- /dev/null
+++ b/connectivity/inc/connectivity/sdbcx/VTypeDef.hxx
@@ -0,0 +1,47 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _CONNECTIVITY_SDBCX_TYPEDEF_HXX_
+#define _CONNECTIVITY_SDBCX_TYPEDEF_HXX_
+
+#include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
+#include <cppuhelper/compbase3.hxx>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/container/XNamed.hpp>
+
+namespace connectivity
+{
+ namespace sdbcx
+ {
+ typedef ::cppu::WeakComponentImplHelper3< ::com::sun::star::sdbcx::XColumnsSupplier,
+ ::com::sun::star::container::XNamed,
+ ::com::sun::star::lang::XServiceInfo> ODescriptor_BASE;
+ }
+}
+
+#endif // _CONNECTIVITY_SDBCX_TYPEDEF_HXX_
+
diff --git a/connectivity/inc/connectivity/sdbcx/VUser.hxx b/connectivity/inc/connectivity/sdbcx/VUser.hxx
new file mode 100644
index 000000000000..529926bd0229
--- /dev/null
+++ b/connectivity/inc/connectivity/sdbcx/VUser.hxx
@@ -0,0 +1,107 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _CONNECTIVITY_SDBCX_USER_HXX_
+#define _CONNECTIVITY_SDBCX_USER_HXX_
+
+#include <osl/diagnose.h>
+#include <com/sun/star/sdbcx/XUser.hpp>
+#include <com/sun/star/sdbcx/XGroupsSupplier.hpp>
+#include <comphelper/proparrhlp.hxx>
+#include <cppuhelper/compbase4.hxx>
+#include "connectivity/CommonTools.hxx"
+#include <comphelper/broadcasthelper.hxx>
+#include "connectivity/sdbcx/VCollection.hxx"
+#include <com/sun/star/container/XNamed.hpp>
+#include "connectivity/sdbcx/IRefreshable.hxx"
+#include "connectivity/sdbcx/VDescriptor.hxx"
+#include "connectivity/dbtoolsdllapi.hxx"
+
+namespace connectivity
+{
+ namespace sdbcx
+ {
+ typedef OCollection OGroups;
+
+ typedef ::cppu::WeakComponentImplHelper4< ::com::sun::star::sdbcx::XUser,
+ ::com::sun::star::sdbcx::XGroupsSupplier,
+ ::com::sun::star::container::XNamed,
+ ::com::sun::star::lang::XServiceInfo> OUser_BASE;
+
+ class OOO_DLLPUBLIC_DBTOOLS OUser :
+ public comphelper::OBaseMutex,
+ public OUser_BASE,
+ public IRefreshableGroups,
+ public ::comphelper::OPropertyArrayUsageHelper<OUser>,
+ public ODescriptor
+ {
+ protected:
+ OGroups* m_pGroups;
+
+ using OUser_BASE::rBHelper;
+
+ // OPropertyArrayUsageHelper
+ virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const;
+ // OPropertySetHelper
+ virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper();
+ public:
+ OUser(sal_Bool _bCase);
+ OUser(const ::rtl::OUString& _Name,sal_Bool _bCase);
+
+ virtual ~OUser( );
+
+ DECLARE_SERVICE_INFO();
+
+ // ::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);
+ // XUser
+ virtual void SAL_CALL changePassword( const ::rtl::OUString& objPassword, const ::rtl::OUString& newPassword ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ // XAuthorizable
+ virtual sal_Int32 SAL_CALL getPrivileges( const ::rtl::OUString& objName, sal_Int32 objType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getGrantablePrivileges( const ::rtl::OUString& objName, sal_Int32 objType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL grantPrivileges( const ::rtl::OUString& objName, sal_Int32 objType, sal_Int32 objPrivileges ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL revokePrivileges( const ::rtl::OUString& objName, sal_Int32 objType, sal_Int32 objPrivileges ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ // XGroupsSupplier
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL getGroups( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // XNamed
+ virtual ::rtl::OUString SAL_CALL getName( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setName( const ::rtl::OUString& aName ) throw(::com::sun::star::uno::RuntimeException);
+ };
+ }
+}
+
+#endif // _CONNECTIVITY_SDBCX_USER_HXX_
+
diff --git a/connectivity/inc/connectivity/sdbcx/VView.hxx b/connectivity/inc/connectivity/sdbcx/VView.hxx
new file mode 100644
index 000000000000..ab386ad7c284
--- /dev/null
+++ b/connectivity/inc/connectivity/sdbcx/VView.hxx
@@ -0,0 +1,108 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _CONNECTIVITY_SDBCX_VIEW_HXX_
+#define _CONNECTIVITY_SDBCX_VIEW_HXX_
+
+#include <osl/diagnose.h>
+#include <com/sun/star/sdbcx/XDataDescriptorFactory.hpp>
+#include <com/sun/star/sdbc/XDatabaseMetaData.hpp>
+#include <comphelper/proparrhlp.hxx>
+#include <cppuhelper/compbase1.hxx>
+#include "connectivity/CommonTools.hxx"
+#include <cppuhelper/interfacecontainer.h>
+#include <com/sun/star/container/XNamed.hpp>
+#include "connectivity/sdbcx/VDescriptor.hxx"
+#include "connectivity/dbtoolsdllapi.hxx"
+#include <comphelper/IdPropArrayHelper.hxx>
+#include <cppuhelper/implbase2.hxx>
+
+namespace connectivity
+{
+ namespace sdbcx
+ {
+
+ typedef ::cppu::WeakImplHelper2< ::com::sun::star::lang::XServiceInfo,
+ ::com::sun::star::container::XNamed> OView_BASE;
+
+
+
+ class OOO_DLLPUBLIC_DBTOOLS OView :
+ public ::comphelper::OMutexAndBroadcastHelper,
+ public OView_BASE,
+ public ::comphelper::OIdPropertyArrayUsageHelper<OView>,
+ public ODescriptor
+ {
+ protected:
+ ::rtl::OUString m_CatalogName;
+ ::rtl::OUString m_SchemaName;
+ ::rtl::OUString m_Command;
+ sal_Int32 m_CheckOption;
+ // need for the getName method
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData > m_xMetaData;
+
+ // OPropertyArrayUsageHelper
+ virtual ::cppu::IPropertyArrayHelper* createArrayHelper( sal_Int32 _nId) const;
+ // OPropertySetHelper
+ virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper();
+
+ public:
+ DECLARE_SERVICE_INFO();
+
+ OView(sal_Bool _bCase,const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData >& _xMetaData);
+ OView( sal_Bool _bCase,
+ const ::rtl::OUString& _rName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData >& _xMetaData,
+ sal_Int32 _nCheckOption = 0,
+ const ::rtl::OUString& _rCommand = ::rtl::OUString(),
+ const ::rtl::OUString& _rSchemaName = ::rtl::OUString(),
+ const ::rtl::OUString& _rCatalogName = ::rtl::OUString());
+ virtual ~OView();
+
+ // ODescriptor
+ virtual void construct();
+
+ // ::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);
+ // XNamed
+ virtual ::rtl::OUString SAL_CALL getName( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setName( const ::rtl::OUString& ) throw(::com::sun::star::uno::RuntimeException);
+ };
+ }
+}
+
+#endif // _CONNECTIVITY_SDBCX_VIEW_HXX_
+
diff --git a/connectivity/inc/connectivity/sqlerror.hxx b/connectivity/inc/connectivity/sqlerror.hxx
new file mode 100644
index 000000000000..3d6be7edf383
--- /dev/null
+++ b/connectivity/inc/connectivity/sqlerror.hxx
@@ -0,0 +1,340 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef CONNECTIVITY_SQLERROR_HXX
+#define CONNECTIVITY_SQLERROR_HXX
+
+/** === begin UNO includes === **/
+#include <com/sun/star/sdbc/SQLException.hpp>
+/** === end UNO includes === **/
+
+#include <comphelper/componentcontext.hxx>
+
+#include <boost/shared_ptr.hpp>
+#include <boost/optional.hpp>
+#include "connectivity/dbtoolsdllapi.hxx"
+
+//........................................................................
+namespace connectivity
+{
+//........................................................................
+
+ //====================================================================
+ //= ErrorCondition
+ //====================================================================
+ /** the type of error codes to be used in SQLExceptions
+
+ @see com::sun::star::sdbc::SQLException::ErrorCode
+ */
+ typedef ::sal_Int32 ErrorCode;
+
+ /** error condition values as defined in <type scope="com::sun::star::sdb">ErrorCondition</type>
+ */
+ typedef ::sal_Int32 ErrorCondition;
+
+ //====================================================================
+ //= SQLError
+ //====================================================================
+ class SQLError_Impl;
+
+ /** a class which provides helpers for working with SQLErrors
+
+ In particular, this class provides vendor-specific error codes (where
+ the vendor is OpenOffice.org Base), which can be used in OOo's various
+ database drivers, and checked in application-level code, to properly
+ recognize highly specific error conditions.
+
+ @see ::com::sun::star::sdb::ErrorCondition
+ */
+ class OOO_DLLPUBLIC_DBTOOLS SQLError
+ {
+ public:
+ // --------------------------------------------------------------------
+ // - optional
+ // --------------------------------------------------------------------
+ /** convenience wrapper around boost::optional, allowing implicit construction
+ */
+ class ParamValue : public ::boost::optional< ::rtl::OUString >
+ {
+ typedef ::boost::optional< ::rtl::OUString > base_type;
+
+ public:
+ ParamValue( ) : base_type( ) { }
+ ParamValue( ::rtl::OUString const& val ) : base_type( val ) { }
+ ParamValue( ParamValue const& rhs ) : base_type( (base_type const&)rhs ) { }
+
+ bool is() const { return !base_type::operator!(); }
+ };
+
+
+ public:
+ explicit SQLError( const ::comphelper::ComponentContext& _rContext );
+ ~SQLError();
+
+ /** returns the message associated with a given error condition, after (optionally) replacing
+ a placeholder with a given string
+
+ Some error messages need to contain references to runtime-dependent data (say, the
+ name of a concrete table in the database), which in the resource file's strings are
+ represented by a placeholder, namely $1$, $2, and so on. This method allows to
+ retrieve such an error message, and replace upo to 3 placeholders with their concrete
+ values.
+
+ In a non-product build, assertions will fire if the number of placeholders in the
+ message's resource string does not match the number of passed parameter values.
+
+ As specified in the <type scope="com::sun::star::sdb">ErrorCondition</type> type,
+ error messages thrown by core components of OpenOffice.org Base will contain
+ a standardized prefix &quot;[OOoBase]&quot; in every message.
+
+ @param _rParamValue1
+ the value which the placeholder $1$ should be replaced with. If this value is
+ not present (see <code>::boost::optional::operator !</code>), then no replacement
+ will happen, and <code>_rParamValue2</code> and <code>_rParamValue3</code> will be
+ ignored.
+
+ @param _rParamValue2
+ the value which the placeholder $2$ should be replaced with. If this value is
+ not present (see <code>::boost::optional::operator !</code>), then no replacement
+ will happen, and <code>_rParamValue3</code> will be ignored.
+
+ @param _rParamValue1
+ the value which the placeholder $1$ should be replaced with. If this value is
+ not present (see <code>::boost::optional::operator !</code>), then no replacement
+ will happen.
+
+ @see ::com::sun::star::sdb::ErrorCondition
+ */
+ ::rtl::OUString getErrorMessage(
+ const ErrorCondition _eCondition,
+ const ParamValue& _rParamValue1 = ParamValue(),
+ const ParamValue& _rParamValue2 = ParamValue(),
+ const ParamValue& _rParamValue3 = ParamValue()
+ ) const;
+
+ /** returns the SQLState associated with a given error condition
+
+ @see getErrorMessage
+ @see getErrorCode
+ @see ::com::sun::star::sdb::ErrorCondition
+ @see ::com::sun::star::sdbc::SQLException::SQLState
+ */
+ ::rtl::OUString getSQLState( const ErrorCondition _eCondition ) const;
+
+ /** returns the error code associated with a given error condition
+
+ @see getErrorMessage
+ @see getSQLState
+ @see ::com::sun::star::sdb::ErrorCondition
+ @see ::com::sun::star::sdbc::SQLException::ErrorCode
+ */
+ static ErrorCode
+ getErrorCode( const ErrorCondition _eCondition );
+
+ /** returns the prefix which is used for OpenOffice.org Base's error messages
+
+ As specified in the <type scope="com::sun::star::sdb">ErrorCondition</type> type,
+ error messages thrown by core components of OpenOffice.org Base will
+ contain a standardized prefix in every message. <code>getBaseErrorMessagePrefix</code>
+ returns this prefix, so clients of such error messages might decide to strip this
+ prefix before presenting the message to the user, or use it to determine
+ whether a concrete error has been raised by a OpenOffice.org core component.
+ */
+ static const ::rtl::OUString&
+ getMessagePrefix();
+
+
+ /** throws an SQLException describing the given error condition
+
+ The thrown SQLException will contain the OOo-specific error code which derives
+ from the given error condition, and the error message associated with that condition.
+
+ @param _eCondition
+ the ErrorCondition which hit you
+
+ @param _rxContext
+ the context in which the error occured. This will be filled in as
+ <member scope="com::sun::star::uno">Exception::Context</member> member.
+
+ @param _rParamValue1
+ a runtime-dependent value which should be filled into the error message
+ which is associated with <arg>_eCondition</arg>, replacing the first placeholder
+ in this message.
+
+ @param _rParamValue2
+ a runtime-dependent value which should be filled into the error message
+ which is associated with <arg>_eCondition</arg>, replacing the second placeholder
+ in this message.
+
+ @param _rParamValue3
+ a runtime-dependent value which should be filled into the error message
+ which is associated with <arg>_eCondition</arg>, replacing the third placeholder
+ in this message.
+
+ @see getErrorMessage
+ @see getErrorCode
+ @see getSQLState
+ */
+ void raiseException(
+ const ErrorCondition _eCondition,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxContext,
+ const ParamValue& _rParamValue1 = ParamValue(),
+ const ParamValue& _rParamValue2 = ParamValue(),
+ const ParamValue& _rParamValue3 = ParamValue()
+ ) const;
+
+ /** throws an SQLException describing the given error condition
+
+ The thrown SQLException will contain the OOo-specific error code which derives
+ from the given error condition, and the error message associated with that condition.
+
+ Note: You should prefer the version of <type>raiseException</type> which takes
+ an additional <type>Context</type> parameter, since this allows clients of your
+ exception to examine where the error occured.
+
+ @param _eCondition
+ the ErrorCondition which hit you
+
+ @param _rParamValue1
+ a runtime-dependent value which should be filled into the error message
+ which is associated with <arg>_eCondition</arg>, replacing the first placeholder
+ in this message.
+
+ @param _rParamValue2
+ a runtime-dependent value which should be filled into the error message
+ which is associated with <arg>_eCondition</arg>, replacing the second placeholder
+ in this message.
+
+ @param _rParamValue3
+ a runtime-dependent value which should be filled into the error message
+ which is associated with <arg>_eCondition</arg>, replacing the third placeholder
+ in this message.
+
+ @see getErrorMessage
+ @see getErrorCode
+ @see getSQLState
+ */
+ void raiseException(
+ const ErrorCondition _eCondition,
+ const ParamValue& _rParamValue1 = ParamValue(),
+ const ParamValue& _rParamValue2 = ParamValue(),
+ const ParamValue& _rParamValue3 = ParamValue()
+ ) const;
+
+ /** raises a typed exception, that is, a UNO exception which is derived from
+ <type scope="com::sun::star::sdbc">SQLException</type>
+
+ @param _eCondition
+ the ErrorCondition which hit you
+
+ @param _rxContext
+ the context in which the error occured. This will be filled in as
+ <member scope="com::sun::star::uno">Exception::Context</member> member.
+
+ @param _rExceptionType
+ the type of the exception to throw. This type <em>must</em> specify
+ an exception class derived from <type scope="com::sun::star::sdbc">SQLException</type>.
+
+ @param _rParamValue1
+ a runtime-dependent value which should be filled into the error message
+ which is associated with <arg>_eCondition</arg>, replacing the first placeholder
+ in this message.
+
+ @param _rParamValue2
+ a runtime-dependent value which should be filled into the error message
+ which is associated with <arg>_eCondition</arg>, replacing the second placeholder
+ in this message.
+
+ @param _rParamValue3
+ a runtime-dependent value which should be filled into the error message
+ which is associated with <arg>_eCondition</arg>, replacing the third placeholder
+ in this message.
+
+ @throws ::std::bad_cast
+ if <arg>_rExceptionType</arg> does not specify an exception class derived from
+ <type scope="com::sun::star::sdbc">SQLException</type>.
+
+ @see getErrorMessage
+ @see getErrorCode
+ @see getSQLState
+ */
+ void raiseTypedException(
+ const ErrorCondition _eCondition,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxContext,
+ const ::com::sun::star::uno::Type& _rExceptionType,
+ const ParamValue& _rParamValue1 = ParamValue(),
+ const ParamValue& _rParamValue2 = ParamValue(),
+ const ParamValue& _rParamValue3 = ParamValue()
+ ) const;
+
+ /** retrieves an <code>SQLException</code> object which contains information about
+ the given error condition
+
+ @param _eCondition
+ the ErrorCondition which hit you
+
+ @param _rxContext
+ the context in which the error occured. This will be filled in as
+ <member scope="com::sun::star::uno">Exception::Context</member> member.
+
+ @param _rParamValue1
+ a runtime-dependent value which should be filled into the error message
+ which is associated with <arg>_eCondition</arg>, replacing the first placeholder
+ in this message.
+
+ @param _rParamValue2
+ a runtime-dependent value which should be filled into the error message
+ which is associated with <arg>_eCondition</arg>, replacing the second placeholder
+ in this message.
+
+ @param _rParamValue3
+ a runtime-dependent value which should be filled into the error message
+ which is associated with <arg>_eCondition</arg>, replacing the third placeholder
+ in this message.
+
+ @see getErrorMessage
+ @see getErrorCode
+ @see getSQLState
+ */
+ ::com::sun::star::sdbc::SQLException
+ getSQLException(
+ const ErrorCondition _eCondition,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxContext,
+ const ParamValue& _rParamValue1 = ParamValue(),
+ const ParamValue& _rParamValue2 = ParamValue(),
+ const ParamValue& _rParamValue3 = ParamValue()
+ ) const;
+
+ private:
+ ::boost::shared_ptr< SQLError_Impl > m_pImpl;
+ };
+
+//........................................................................
+} // namespace connectivity
+//........................................................................
+
+#endif // CONNECTIVITY_SQLERROR_HXX
diff --git a/connectivity/inc/connectivity/sqliterator.hxx b/connectivity/inc/connectivity/sqliterator.hxx
new file mode 100644
index 000000000000..5152b7221f85
--- /dev/null
+++ b/connectivity/inc/connectivity/sqliterator.hxx
@@ -0,0 +1,366 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CONNECTIVITY_PARSE_SQLITERATOR_HXX_
+#define _CONNECTIVITY_PARSE_SQLITERATOR_HXX_
+
+#include "connectivity/dbtoolsdllapi.hxx"
+#include "connectivity/sqlnode.hxx"
+#include <connectivity/IParseContext.hxx>
+#include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
+#include <com/sun/star/sdbc/DataType.hpp>
+#include <com/sun/star/sdbc/SQLWarning.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include "connectivity/CommonTools.hxx"
+#include <vos/ref.hxx>
+#include <cppuhelper/weak.hxx>
+
+#include <map>
+#include <memory>
+#include <vector>
+
+namespace connectivity
+{
+
+ class OSQLParseNode;
+ class OSQLParser;
+
+ typedef ::std::pair<const OSQLParseNode*,const OSQLParseNode* > TNodePair;
+
+ enum OSQLStatementType {
+ SQL_STATEMENT_UNKNOWN,
+ SQL_STATEMENT_SELECT,
+ SQL_STATEMENT_INSERT,
+ SQL_STATEMENT_UPDATE,
+ SQL_STATEMENT_DELETE,
+ SQL_STATEMENT_ODBC_CALL,
+ SQL_STATEMENT_CREATE_TABLE
+ };
+
+ struct OSQLParseTreeIteratorImpl;
+
+ class OOO_DLLPUBLIC_DBTOOLS OSQLParseTreeIterator
+ {
+ private:
+ ::com::sun::star::sdbc::SQLException m_aErrors; // conatins the error while iterating through the statement
+ const OSQLParseNode* m_pParseTree; // aktueller ParseTree
+ const OSQLParser& m_rParser; // if set used for general error messages from the context
+ OSQLStatementType m_eStatementType; // Art des Statements
+ ::vos::ORef<OSQLColumns> m_aSelectColumns; // alle Spalten aus dem Select-Clause
+ ::vos::ORef<OSQLColumns> m_aParameters; // all parameters
+ ::vos::ORef<OSQLColumns> m_aGroupColumns; // the group by columns
+ ::vos::ORef<OSQLColumns> m_aOrderColumns; // the order by columns
+ ::vos::ORef<OSQLColumns> m_aCreateColumns; // the columns for Create table clause
+
+ ::std::auto_ptr< OSQLParseTreeIteratorImpl > m_pImpl;
+
+ void traverseParameter(const OSQLParseNode* _pParseNode,const OSQLParseNode* _pColumnRef,const ::rtl::OUString& _aColumnName,const ::rtl::OUString& _aTableRange, const ::rtl::OUString& _rColumnAlias);
+ // F"ugt eine Tabelle in die Map ein
+ void traverseOneTableName( OSQLTables& _rTables,const OSQLParseNode * pTableName, const ::rtl::OUString & rTableRange );
+ void traverseORCriteria(OSQLParseNode * pSearchCondition);
+ void traverseANDCriteria(OSQLParseNode * pSearchCondition);
+ void traverseOnePredicate(
+ OSQLParseNode * pColumnRef,
+ ::rtl::OUString& aValue,
+ OSQLParseNode * pParameter);
+ void traverseByColumnNames(const OSQLParseNode* pSelectNode,sal_Bool _bOrder);
+ void traverseParameters(const OSQLParseNode* pSelectNode);
+
+ const OSQLParseNode* getTableNode( OSQLTables& _rTables, const OSQLParseNode* pTableRef, ::rtl::OUString& aTableRange );
+ void getQualified_join( OSQLTables& _rTables, const OSQLParseNode *pTableRef, ::rtl::OUString& aTableRange );
+ void getSelect_statement(OSQLTables& _rTables,const OSQLParseNode* pSelect);
+ ::rtl::OUString getUniqueColumnName(const ::rtl::OUString & rColumnName) const;
+
+ /** finds the column with a given name, belonging to a given table, in a given tables collection
+ @param _rTables
+ the tables collection to look in
+ @param rColumnName
+ the column name to look for
+ @param rTableRange
+ the table alias name
+ @return
+ the desired column object, or <NULL/> if no such column could be found
+ */
+ static ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > findColumn(
+ const OSQLTables& _rTables, const ::rtl::OUString & rColumnName, const ::rtl::OUString & rTableRange );
+
+ /** finds a column with a given name, belonging to a given table
+ @param rColumnName
+ the column name to look for
+ @param rTableRange
+ the table alias name
+ @param _bLookInSubTables
+ <TRUE/> if and only if not only our direct tables, but also our sub tables (from sub selects)
+ should be searched
+ @return
+ */
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > findColumn(
+ const ::rtl::OUString & rColumnName, const ::rtl::OUString & rTableRange, bool _bLookInSubTables );
+
+ protected:
+ void setSelectColumnName(::vos::ORef<OSQLColumns>& _rColumns,const ::rtl::OUString & rColumnName,const ::rtl::OUString & rColumnAlias, const ::rtl::OUString & rTableRange,sal_Bool bFkt=sal_False,sal_Int32 _nType = com::sun::star::sdbc::DataType::VARCHAR,sal_Bool bAggFkt=sal_False);
+ void appendColumns(::vos::ORef<OSQLColumns>& _rColumns,const ::rtl::OUString& _rTableAlias,const OSQLTable& _rTable);
+ // Weitere Member-Variable, die in den "set"-Funktionen zur
+ // Verfuegung stehen sollen, koennen in der abgeleiteten Klasse
+ // definiert werden und z. B. in deren Konstruktor initialisiert
+ // bzw. nach Benutzung der "traverse"-Routinen mit Hilfe weiterer
+ // Funktionen abgefragt werden.
+
+
+ private:
+ OSQLParseTreeIterator(); // never implemented
+ OSQLParseTreeIterator(const OSQLParseTreeIterator & rIter); // never implemented
+
+ public:
+ OSQLParseTreeIterator(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& _rxTables,
+ const OSQLParser& _rParser,
+ const OSQLParseNode* pRoot = NULL );
+ ~OSQLParseTreeIterator();
+
+ 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,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 *,void* ) SAL_THROW( () )
+ { }
+
+ void dispose();
+ bool isCaseSensitive() const;
+ // Der zu analysierende/zu traversierende Parse Tree:
+ // bei "Ubergabe von NULL wird der aktuelle Parsetree gel"oscht und der Fehlerstatus gecleared
+ void setParseTree(const OSQLParseNode * pNewParseTree);
+// void setParser(const OSQLParser* _pParser) { m_pParser = _pParser; }
+ const OSQLParseNode * getParseTree() const { return m_pParseTree; };
+
+ // Teilbaueme bei einem select statement
+ const OSQLParseNode* getWhereTree() const;
+ const OSQLParseNode* getOrderTree() const;
+ const OSQLParseNode* getGroupByTree() const;
+ const OSQLParseNode* getHavingTree() const;
+
+ const OSQLParseNode* getSimpleWhereTree() const;
+ const OSQLParseNode* getSimpleOrderTree() const;
+ const OSQLParseNode* getSimpleGroupByTree() const;
+ const OSQLParseNode* getSimpleHavingTree() const;
+
+ /** returns the errors which occured during parsing.
+
+ The returned object contains a chain (via SQLException::NextException) of SQLExceptions.
+ */
+ inline const ::com::sun::star::sdbc::SQLException& getErrors() const { return m_aErrors; }
+ inline bool hasErrors() const { return m_aErrors.Message.getLength() > 0; }
+
+ // Statement-Typ (wird bereits in setParseTree gesetzt):
+ OSQLStatementType getStatementType() const { return m_eStatementType; }
+
+ /** traverses the complete statement tree, and fills all our data with
+ the information obatined during traversal.
+
+ Implemented by calling the single traverse* methods in the proper
+ order (depending on the statement type).
+ */
+ void traverseAll();
+
+ enum TraversalParts
+ {
+ Parameters = 0x0001,
+ TableNames = 0x0002,
+ SelectColumns = 0x0006, // note that this includes TableNames. No SelectColumns without TableNames
+
+ // Those are not implemented currently
+ // GroupColumns = 0x0008,
+ // OrderColumns = 0x0010,
+ // SelectColumns = 0x0020,
+ // CreateColumns = 0x0040,
+
+ All = 0xFFFF
+ };
+ /** traverses selected parts of the statement tree, and fills our data with
+ the information obtained during traversal
+
+ @param _nIncludeMask
+ set of TraversalParts bits, specifying which information is to be collected.
+ Note TraversalParts is currently not
+ */
+ void traverseSome( sal_uInt32 _nIncludeMask );
+
+ // Die TableRangeMap enth"alt alle Tabellen unter dem zugeh"origen Rangenamen der zuerst gefunden wird
+ const OSQLTables& getTables() const;
+
+ ::vos::ORef<OSQLColumns> getSelectColumns() const { return m_aSelectColumns;}
+ ::vos::ORef<OSQLColumns> getGroupColumns() const { return m_aGroupColumns;}
+ ::vos::ORef<OSQLColumns> getOrderColumns() const { return m_aOrderColumns;}
+ ::vos::ORef<OSQLColumns> getParameters() const { return m_aParameters; }
+ ::vos::ORef<OSQLColumns> getCreateColumns() const { return m_aCreateColumns;}
+
+ /** return the columname and the table range
+ @param _pColumnRef
+ The column ref parse node.
+ @param _rColumnName
+ The column name to be set.
+ @param _rTableRange
+ The table range to be set.
+ */
+ void getColumnRange( const OSQLParseNode* _pColumnRef,
+ ::rtl::OUString &_rColumnName,
+ ::rtl::OUString& _rTableRange) const;
+
+ /** retrieves a column's name, table range, and alias
+
+ @param _pColumnRef
+ The column_ref parse node.
+ @param _out_rColumnName
+ The column name to be set.
+ @param _out_rTableRange
+ The table range to be set.
+ @param _out_rColumnAliasIfPresent
+ If the column specified by _pColumnRef is part of the select columns, and contains a column alias there,
+ this alias is returned here.
+ */
+ void getColumnRange( const OSQLParseNode* _pColumnRef,
+ ::rtl::OUString& _out_rColumnName,
+ ::rtl::OUString& _out_rTableRange,
+ ::rtl::OUString& _out_rColumnAliasIfPresent
+ ) const;
+
+ /** return the alias name of a column
+ @param _pDerivedColumn
+ The parse node where SQL_ISRULE(_pDerivedColumn,derived_column) must be true
+ @return
+ The alias name of the column or an empty string.
+ */
+ static ::rtl::OUString getColumnAlias(const OSQLParseNode* _pDerivedColumn);
+
+ /** return the columname and the table range
+ @param _pColumnRef
+ The column ref parse node.
+ @param _xMetaData
+ The database meta data.
+ @param _rColumnName
+ The column name to be set.
+ @param _rTableRange
+ The table range to be set.
+ */
+ static void getColumnRange( const OSQLParseNode* _pColumnRef,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection,
+ ::rtl::OUString &_rColumnName,
+ ::rtl::OUString& _rTableRange);
+
+ // Ermittelt fuer eine Funktion, Spalten den zugehoeren TableRange,
+ // wenn nicht eindeutig, dann leer
+ sal_Bool getColumnTableRange(const OSQLParseNode* pNode, ::rtl::OUString &rTableRange) const;
+
+ // return true when the tableNode is a rule like catalog_name, schema_name or table_name
+ sal_Bool isTableNode(const OSQLParseNode* _pTableNode) const;
+
+ // tries to find the correct type of the function
+ sal_Int32 getFunctionReturnType(const OSQLParseNode* _pNode );
+
+ // returns a lis of all joined columns
+ ::std::vector< TNodePair >& getJoinConditions() const;
+
+ private:
+ /** traverses the list of table names, and filles _rTables
+ */
+ bool traverseTableNames( OSQLTables& _rTables );
+
+ /// traverses columns in a SELECT statement
+ bool traverseSelectColumnNames(const OSQLParseNode* pSelectNode);
+ /// traverses columns in a CREATE TABLE statement
+ void traverseCreateColumns(const OSQLParseNode* pSelectNode);
+
+ bool traverseOrderByColumnNames(const OSQLParseNode* pSelectNode);
+ bool traverseGroupByColumnNames(const OSQLParseNode* pSelectNode);
+
+ bool traverseSelectionCriteria(const OSQLParseNode* pSelectNode);
+
+ private:
+ /** constructs a new iterator, which inherits some of the settings from a parent iterator
+ */
+ OSQLParseTreeIterator(
+ const OSQLParseTreeIterator& _rParentIterator,
+ const OSQLParser& _rParser,
+ const OSQLParseNode* pRoot );
+
+ /** creates a table object and inserts it into our tables collection
+
+ only used when we're iterating through a CREATE TABLE statement
+ */
+ OSQLTable impl_createTableObject(
+ const ::rtl::OUString& rTableName, const ::rtl::OUString& rCatalogName, const ::rtl::OUString& rSchemaName );
+
+ /** locates a record source (a table or query) with the given name
+ */
+ OSQLTable impl_locateRecordSource(
+ const ::rtl::OUString& _rComposedName
+ );
+
+ /** implementation for both traverseAll and traverseSome
+ */
+ void impl_traverse( sal_uInt32 _nIncludeMask );
+
+ /** retrieves the parameter columns of the given query
+ */
+ void impl_getQueryParameterColumns( const OSQLTable& _rQuery );
+
+ void setOrderByColumnName(const ::rtl::OUString & rColumnName, const ::rtl::OUString & rTableRange, sal_Bool bAscending);
+ void setGroupByColumnName(const ::rtl::OUString & rColumnName, const ::rtl::OUString & rTableRange);
+
+ private:
+ /** appends an SQLException corresponding to the given error code to our error collection
+
+ @param _eError
+ the code of the error which occured
+ @param _pReplaceToken1
+ if not <NULL/>, the first occurance of '#' in the error message will be replaced
+ with the given token
+ @param _pReplaceToken2
+ if not <NULL/>, and if _rReplaceToken1 is not <NULL/>, the second occurance of '#'
+ in the error message will be replaced with _rReplaceToken2
+ */
+ void impl_appendError( IParseContext::ErrorCode _eError,
+ const ::rtl::OUString* _pReplaceToken1 = NULL, const ::rtl::OUString* _pReplaceToken2 = NULL );
+
+ /** appends an SQLException corresponding to the given error code to our error collection
+ */
+ void impl_appendError( const ::com::sun::star::sdbc::SQLException& _rError );
+
+ /** resets our errors
+ */
+ inline void impl_resetErrors()
+ {
+ m_aErrors = ::com::sun::star::sdbc::SQLException();
+ }
+ void impl_fillJoinConditions(const OSQLParseNode* i_pJoinCondition);
+ };
+}
+
+#endif // _CONNECTIVITY_PARSE_SQLITERATOR_HXX_
+
diff --git a/connectivity/inc/connectivity/sqlnode.hxx b/connectivity/inc/connectivity/sqlnode.hxx
new file mode 100644
index 000000000000..04ec8dc153df
--- /dev/null
+++ b/connectivity/inc/connectivity/sqlnode.hxx
@@ -0,0 +1,473 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CONNECTIVITY_SQLNODE_HXX
+#define _CONNECTIVITY_SQLNODE_HXX
+
+#include "connectivity/dbtoolsdllapi.hxx"
+#include "connectivity/dbmetadata.hxx"
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/util/XNumberFormatTypes.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <vector>
+#include <functional>
+#include <set>
+#include <boost/shared_ptr.hpp>
+#include <rtl/ustrbuf.hxx>
+
+// forward declarations
+namespace com
+{
+ namespace sun
+ {
+ namespace star
+ {
+ namespace beans
+ {
+ class XPropertySet;
+ }
+ namespace util
+ {
+ class XNumberFormatter;
+ }
+ namespace container
+ {
+ class XNameAccess;
+ }
+ }
+ }
+}
+
+namespace rtl
+{
+ class OUStringBuffer;
+}
+
+namespace connectivity
+{
+ class OSQLParser;
+ class OSQLParseNode;
+ class IParseContext;
+
+ typedef ::std::vector< OSQLParseNode* > OSQLParseNodes;
+
+ enum SQLNodeType {SQL_NODE_RULE, SQL_NODE_LISTRULE, SQL_NODE_COMMALISTRULE,
+ SQL_NODE_KEYWORD, SQL_NODE_COMPARISON, SQL_NODE_NAME,
+ SQL_NODE_STRING, SQL_NODE_INTNUM, SQL_NODE_APPROXNUM,
+ SQL_NODE_EQUAL,SQL_NODE_LESS,SQL_NODE_GREAT,SQL_NODE_LESSEQ,SQL_NODE_GREATEQ,SQL_NODE_NOTEQUAL,
+ SQL_NODE_PUNCTUATION, SQL_NODE_AMMSC, SQL_NODE_ACCESS_DATE,SQL_NODE_DATE,SQL_NODE_CONCAT};
+
+ typedef ::std::set< ::rtl::OUString > QueryNameSet;
+ //==================================================================
+ //= SQLParseNodeParameter
+ //==================================================================
+ struct OOO_DLLPUBLIC_DBTOOLS SQLParseNodeParameter
+ {
+ const ::com::sun::star::lang::Locale& rLocale;
+ ::dbtools::DatabaseMetaData aMetaData;
+ OSQLParser* pParser;
+ ::boost::shared_ptr< QueryNameSet > pSubQueryHistory;
+ ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter > xFormatter;
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xField;
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > xQueries; // see bParseToSDBCLevel
+ const IParseContext& m_rContext;
+ sal_Char cDecSep;
+ bool bQuote : 1; /// should we quote identifiers?
+ bool bInternational : 1; /// should we internationalize keywords and placeholders?
+ bool bPredicate : 1; /// are we going to parse a mere predicate?
+ bool bParseToSDBCLevel : 1; /// should we create an SDBC-level statement (e.g. with substituted sub queries)?
+
+ SQLParseNodeParameter(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& _xFormatter,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _xField,
+ const ::com::sun::star::lang::Locale& _rLocale,
+ const IParseContext* _pContext,
+ bool _bIntl,
+ bool _bQuote,
+ sal_Char _cDecSep,
+ bool _bPredicate,
+ bool _bParseToSDBC
+ );
+ ~SQLParseNodeParameter();
+ };
+
+ //==========================================================================
+ //= OSQLParseNode
+ //==========================================================================
+ class OOO_DLLPUBLIC_DBTOOLS OSQLParseNode
+ {
+ friend class OSQLParser;
+
+ OSQLParseNodes m_aChildren;
+ OSQLParseNode* m_pParent; // pParent fuer Reuckverkettung im Baum
+ ::rtl::OUString m_aNodeValue; // Token-Name oder leer bei Regeln oder ::rtl::OUString bei
+ // ::rtl::OUString, INT, usw. -Werten
+ SQLNodeType m_eNodeType; // s. o.
+ sal_uInt32 m_nNodeID; // ::com::sun::star::chaos::Rule ID (bei IsRule()) oder Token ID (bei !IsRule())
+ // ::com::sun::star::chaos::Rule IDs und Token IDs koennen nicht anhand des Wertes
+ // unterschieden werden, dafuer ist IsRule() abzufragen!
+ public:
+ enum Rule
+ {
+ select_statement = 0,
+ table_exp,
+ table_ref_commalist,
+ table_ref,
+ catalog_name,
+ schema_name,
+ table_name,
+ opt_column_commalist,
+ column_commalist,
+ column_ref_commalist,
+ column_ref,
+ opt_order_by_clause,
+ ordering_spec_commalist,
+ ordering_spec,
+ opt_asc_desc,
+ where_clause,
+ opt_where_clause,
+ search_condition,
+ comparison_predicate,
+ between_predicate,
+ like_predicate,
+ opt_escape,
+ test_for_null,
+ scalar_exp_commalist,
+ scalar_exp,
+ parameter_ref,
+ parameter,
+ general_set_fct,
+ range_variable,
+ column,
+ delete_statement_positioned,
+ delete_statement_searched,
+ update_statement_positioned,
+ update_statement_searched,
+ assignment_commalist,
+ assignment,
+ values_or_query_spec,
+ insert_statement,
+ insert_atom_commalist,
+ insert_atom,
+ predicate_check,
+ from_clause,
+ qualified_join,
+ cross_union,
+ select_sublist,
+ derived_column,
+ column_val,
+ set_fct_spec,
+ boolean_term,
+ boolean_primary,
+ num_value_exp,
+ join_type,
+ position_exp,
+ extract_exp,
+ length_exp,
+ char_value_fct,
+ odbc_call_spec,
+ in_predicate,
+ existence_test,
+ unique_test,
+ all_or_any_predicate,
+ named_columns_join,
+ join_condition,
+ joined_table,
+ boolean_factor,
+ sql_not,
+ boolean_test,
+ manipulative_statement,
+ subquery,
+ value_exp_commalist,
+ odbc_fct_spec,
+ union_statement,
+ outer_join_type,
+ char_value_exp,
+ term,
+ value_exp_primary,
+ value_exp,
+ selection,
+ fold,
+ char_substring_fct,
+ factor,
+ base_table_def,
+ base_table_element_commalist,
+ data_type,
+ column_def,
+ table_node,
+ as,
+ op_column_commalist,
+ table_primary_as_range_column,
+ datetime_primary,
+ concatenation,
+ char_factor,
+ bit_value_fct,
+ comparison_predicate_part_2,
+ parenthesized_boolean_value_expression,
+ character_string_type,
+ other_like_predicate_part_2,
+ between_predicate_part_2,
+ cast_spec,
+ rule_count, // letzter_wert
+ UNKNOWN_RULE // ID indicating that a node is no rule with a matching Rule-enum value (see getKnownRuleID)
+ };
+
+ // must be ascii encoding for the value
+ OSQLParseNode(const sal_Char* _pValueStr,
+ SQLNodeType _eNodeType,
+ sal_uInt32 _nNodeID = 0);
+
+ OSQLParseNode(const ::rtl::OString& _rValue,
+ SQLNodeType eNewNodeType,
+ sal_uInt32 nNewNodeID=0);
+
+ OSQLParseNode(const sal_Unicode* _pValue,
+ SQLNodeType _eNodeType,
+ sal_uInt32 _nNodeID = 0);
+
+ OSQLParseNode(const ::rtl::OUString& _rValue,
+ SQLNodeType _eNodeType,
+ sal_uInt32 _nNodeID = 0);
+
+ // Kopiert den entsprechenden ParseNode
+ OSQLParseNode(const OSQLParseNode& rParseNode);
+ OSQLParseNode& operator=(const OSQLParseNode& rParseNode);
+
+ sal_Bool operator==(OSQLParseNode& rParseNode) const;
+
+ // Destruktor raeumt rekursiv den Baum ab
+ virtual ~OSQLParseNode();
+
+ // Parent gibt den Zeiger auf den Parent zurueck
+ OSQLParseNode* getParent() const {return m_pParent;};
+
+ // SetParent setzt den Parent-Zeiger eines ParseNodes
+ void setParent(OSQLParseNode* pParseNode) {m_pParent = pParseNode;};
+
+ // ChildCount liefert die Anzahl der Kinder eines Knotens
+ sal_uInt32 count() const {return m_aChildren.size();};
+ inline OSQLParseNode* getChild(sal_uInt32 nPos) const;
+
+ void append(OSQLParseNode* pNewSubTree);
+ void insert(sal_uInt32 nPos, OSQLParseNode* pNewSubTree);
+
+ OSQLParseNode* replaceAt(sal_uInt32 nPos, OSQLParseNode* pNewSubTree);
+ OSQLParseNode* replace(OSQLParseNode* pOldSubTree, OSQLParseNode* pNewSubTree);
+
+ OSQLParseNode* removeAt(sal_uInt32 nPos);
+ OSQLParseNode* remove(OSQLParseNode* pSubTree);
+
+ void replaceNodeValue(const ::rtl::OUString& rTableAlias,const ::rtl::OUString& rColumnName);
+
+ /** parses the node to a string which can be passed to a driver's connection for execution
+
+ Any particles of the parse tree which represent application-level features - such
+ as queries appearing in the FROM part - are subsituted, so that the resulting statement can
+ be executed at an SDBC-level connection.
+
+ @param _out_rString
+ is an output parameter taking the resulting SQL statement
+
+ @param _rxConnection
+ the connection relative to which to parse. This must be an SDB-level connection (e.g.
+ support the XQueriesSupplier interface) for the method to be able to do all necessary
+ substitutions.
+
+ @param _rParser
+ the SQLParser used to create the node. This is needed in case we need to parse
+ sub queries which are present in the SQL statement - those sub queries need to be parsed,
+ too, to check whether they contain nested sub queries.
+
+ @param _pErrorHolder
+ takes the error which occured while generating the statement, if any. Might be <NULL/>,
+ in this case the error is not reported back, and can only be recognized by examing the
+ return value.
+
+ @return
+ <TRUE/> if and only if the parsing was successful.<br/>
+
+ Currently, there's only one condition how this method can fail: If it contains a nested
+ query which causes a cycle. E.g., consider a statement <code>SELECT * from "foo"</code>,
+ where <code>bar </code> is a query defined as <code>SELECT * FROM "bar"</code>, where
+ <code>bar</code> is defined as <code>SELECT * FROM "foo"</code>. This statement obviously
+ cannot be parsed to an executable statement.
+
+ If this method returns <FALSE/>, you're encouraged to check and handle the error in
+ <arg>_pErrorHolder</arg>.
+ */
+ bool parseNodeToExecutableStatement( ::rtl::OUString& _out_rString,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection,
+ OSQLParser& _rParser,
+ ::com::sun::star::sdbc::SQLException* _pErrorHolder ) const;
+
+ void parseNodeToStr(::rtl::OUString& rString,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection,
+ const IParseContext* pContext = NULL,
+ sal_Bool _bIntl = sal_False,
+ sal_Bool _bQuote= sal_True) const;
+
+ // quoted und internationalisert
+ void parseNodeToPredicateStr(::rtl::OUString& rString,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter > & xFormatter,
+ const ::com::sun::star::lang::Locale& rIntl,
+ sal_Char _cDec,
+ const IParseContext* pContext = NULL ) const;
+
+ void parseNodeToPredicateStr(::rtl::OUString& rString,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter > & xFormatter,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & _xField,
+ const ::com::sun::star::lang::Locale& rIntl,
+ sal_Char _cDec,
+ const IParseContext* pContext = NULL ) const;
+
+ OSQLParseNode* getByRule(OSQLParseNode::Rule eRule) const;
+
+#if OSL_DEBUG_LEVEL > 0
+ // zeigt den ParseTree mit tabs und linefeeds
+ void showParseTree( ::rtl::OUString& rString ) const;
+ void showParseTree( ::rtl::OUStringBuffer& _inout_rBuf, sal_uInt32 nLevel ) const;
+#endif
+
+ // GetNodeType gibt den Knotentyp zurueck
+ SQLNodeType getNodeType() const {return m_eNodeType;};
+
+ // RuleId liefert die RuleId der Regel des Knotens (nur bei IsRule())
+ sal_uInt32 getRuleID() const {return m_nNodeID;}
+
+ /** returns the ID of the rule represented by the node
+
+ If the node does not represent a rule, UNKNOWN_RULE is returned
+ */
+ Rule getKnownRuleID() const;
+
+ // RuleId liefert die TokenId des Tokens des Knotens (nur bei ! IsRule())
+ sal_uInt32 getTokenID() const {return m_nNodeID;}
+
+ // IsRule testet ob ein Node eine Regel (NonTerminal) ist
+ // Achtung : Regeln koenne auch Blaetter sein, z.B. leere Listen
+ sal_Bool isRule() const
+ { return (m_eNodeType == SQL_NODE_RULE) || (m_eNodeType == SQL_NODE_LISTRULE)
+ || (m_eNodeType == SQL_NODE_COMMALISTRULE);}
+
+ // IsToken testet ob ein Node ein Token (Terminal) ist
+ sal_Bool isToken() const {return !isRule();} // ein Token ist keine Regel
+
+ // TokenValue liefert den NodeValue eines Tokens
+ const ::rtl::OUString& getTokenValue() const {return m_aNodeValue;}
+
+ // SetTokenValue setzt den NodeValue
+ void setTokenValue(const ::rtl::OUString& rString) { if (isToken()) m_aNodeValue = rString;}
+
+ // IsLeaf testet ob ein Node ein Blatt ist
+ sal_Bool isLeaf() const {return m_aChildren.empty();}
+
+ // negate only a searchcondition, any other rule could cause a gpf
+ static void negateSearchCondition(OSQLParseNode*& pSearchCondition,sal_Bool bNegate=sal_False);
+
+ // normalize a logic form
+ // e.q. (a or b) and (c or d) <=> a and c or a and d or b and c or b and d
+ static void disjunctiveNormalForm(OSQLParseNode*& pSearchCondition);
+
+ // Simplies logic expressions
+ // a * a = a
+ // a + a = a
+ // a * ( a + b) = a
+ // a + a * b = a
+ static void absorptions(OSQLParseNode*& pSearchCondition);
+
+ // erase not nessary braces
+ static void eraseBraces(OSQLParseNode*& pSearchCondition);
+
+ // makes the logic formula a little more smaller
+ static void compress(OSQLParseNode*& pSearchCondition);
+ // return the catalog, schema and tablename form this node
+ // _pTableNode must be a rule of that above or a SQL_TOKEN_NAME
+ static sal_Bool getTableComponents(const OSQLParseNode* _pTableNode,
+ ::com::sun::star::uno::Any &_rCatalog,
+ ::rtl::OUString &_rSchema,
+ ::rtl::OUString &_rTable
+ ,const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData >& _xMetaData);
+
+ // susbtitute all occurences of :var or [name] into the dynamic parameter ?
+ // _pNode will be modified if parameters exists
+ static void substituteParameterNames(OSQLParseNode* _pNode);
+
+ /** return a table range when it exists.
+ */
+ static ::rtl::OUString getTableRange(const OSQLParseNode* _pTableRef);
+
+ protected:
+ // ParseNodeToStr konkateniert alle Token (Blaetter) des ParseNodes
+ void parseNodeToStr(::rtl::OUString& rString,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter > & xFormatter,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & _xField,
+ const ::com::sun::star::lang::Locale& rIntl,
+ const IParseContext* pContext,
+ bool _bIntl,
+ bool _bQuote,
+ sal_Char _cDecSep,
+ bool _bPredicate,
+ bool _bSubstitute) const;
+
+ private:
+ void impl_parseNodeToString_throw( ::rtl::OUStringBuffer& rString, const SQLParseNodeParameter& rParam) const;
+ void impl_parseLikeNodeToString_throw( ::rtl::OUStringBuffer& rString, const SQLParseNodeParameter& rParam ) const;
+ void impl_parseTableRangeNodeToString_throw( ::rtl::OUStringBuffer& rString, const SQLParseNodeParameter& rParam ) const;
+
+ /** parses a table_name node into a SQL statement particle.
+ @return
+ <TRUE/> if and only if parsing was successful, <FALSE/> if default handling should
+ be applied.
+ */
+ bool impl_parseTableNameNodeToString_throw( ::rtl::OUStringBuffer& rString, const SQLParseNodeParameter& rParam ) const;
+
+ sal_Bool addDateValue(::rtl::OUStringBuffer& rString, const SQLParseNodeParameter& rParam) const;
+ ::rtl::OUString convertDateTimeString(const SQLParseNodeParameter& rParam, const ::rtl::OUString& rString) const;
+ ::rtl::OUString convertDateString(const SQLParseNodeParameter& rParam, const ::rtl::OUString& rString) const;
+ ::rtl::OUString convertTimeString(const SQLParseNodeParameter& rParam, const ::rtl::OUString& rString) const;
+ void parseLeaf(::rtl::OUStringBuffer& rString, const SQLParseNodeParameter& rParam) const;
+ };
+
+ //-----------------------------------------------------------------------------
+ inline OSQLParseNode* OSQLParseNode::getChild(sal_uInt32 nPos) const
+ {
+ OSL_ENSURE(nPos < m_aChildren.size(), "Invalid Position");
+
+ // return m_aChildren[nPos];
+ return m_aChildren.at(nPos);
+ }
+
+ // Utility-Methoden zum Abfragen auf bestimmte Rules, Token oder Punctuation:
+ #define SQL_ISRULE(pParseNode, eRule) ((pParseNode)->isRule() && (pParseNode)->getRuleID() == OSQLParser::RuleID(OSQLParseNode::eRule))
+ #define SQL_ISTOKEN(pParseNode, token) ((pParseNode)->isToken() && (pParseNode)->getTokenID() == SQL_TOKEN_##token)
+ #define SQL_ISPUNCTUATION(pParseNode, aString) ((pParseNode)->getNodeType() == SQL_NODE_PUNCTUATION && !(pParseNode)->getTokenValue().compareToAscii(aString))
+}
+
+#endif //_CONNECTIVITY_SQLNODE_HXX
diff --git a/connectivity/inc/connectivity/sqlparse.hxx b/connectivity/inc/connectivity/sqlparse.hxx
new file mode 100644
index 000000000000..03854e6c9faf
--- /dev/null
+++ b/connectivity/inc/connectivity/sqlparse.hxx
@@ -0,0 +1,261 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CONNECTIVITY_SQLPARSE_HXX
+#define _CONNECTIVITY_SQLPARSE_HXX
+
+#include <com/sun/star/uno/Reference.h>
+#include <osl/mutex.hxx>
+#include <connectivity/sqlnode.hxx>
+#ifndef YYBISON
+#ifndef FLEX_SCANNER
+#ifndef BISON_INCLUDED
+#define BISON_INCLUDED
+#include "sqlbison.hxx"
+#endif
+#endif
+#endif
+#include <com/sun/star/i18n/XCharacterClassification.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/i18n/XLocaleData.hpp>
+#include "connectivity/IParseContext.hxx"
+#include "connectivity/dbtoolsdllapi.hxx"
+#include <salhelper/singletonref.hxx>
+#include <osl/mutex.hxx>
+
+#include <map>
+
+// forward declarations
+namespace com
+{
+ namespace sun
+ {
+ namespace star
+ {
+ namespace beans
+ {
+ class XPropertySet;
+ }
+ namespace util
+ {
+ class XNumberFormatter;
+ }
+ namespace lang
+ {
+ struct Locale;
+ }
+ }
+ }
+}
+namespace connectivity
+{
+ class OSQLScanner;
+ class SQLError;
+
+ //==========================================================================
+ //= OParseContext
+ //==========================================================================
+ class OOO_DLLPUBLIC_DBTOOLS OParseContext : public IParseContext
+ {
+ public:
+ OParseContext();
+
+ virtual ~OParseContext();
+ // retrieves language specific error messages
+ virtual ::rtl::OUString getErrorMessage(ErrorCode _eCodes) const;
+
+ // retrieves language specific keyword strings (only ASCII allowed)
+ virtual ::rtl::OString getIntlKeywordAscii(InternationalKeyCode _eKey) const;
+
+ // finds out, if we have an international keyword (only ASCII allowed)
+ virtual InternationalKeyCode getIntlKeyCode(const ::rtl::OString& rToken) const;
+
+ // determines the default international setting
+ static const ::com::sun::star::lang::Locale& getDefaultLocale();
+
+ /** set's the default locale which should be used when analyzing strings
+ <p>If no locale is set, and any method which needs a locale is called, a default
+ (en-US) is used.</p>
+ <p>If, while parsing, the locale can be obtained from other sources (such as the number format
+ set for a table column), the preferred locale is ignored.</p>
+ */
+ static void setDefaultLocale( const ::com::sun::star::lang::Locale& _rLocale );
+
+ /** get's a locale instance which should be used when parsing in the context specified by this instance
+ <p>if this is not overridden by derived classes, it returns the static default locale.</p>
+ */
+ virtual ::com::sun::star::lang::Locale getPreferredLocale( ) const;
+ };
+
+ //==========================================================================
+ // OSQLParseNodesContainer
+ // grabage collection of nodes
+ //==========================================================================
+ class OSQLParseNodesContainer
+ {
+ ::osl::Mutex m_aMutex;
+ ::std::vector< OSQLParseNode* > m_aNodes;
+ public:
+ OSQLParseNodesContainer();
+ ~OSQLParseNodesContainer();
+
+ void push_back(OSQLParseNode* _pNode);
+ void erase(OSQLParseNode* _pNode);
+ bool empty() const;
+ void clear();
+ void clearAndDelete();
+ };
+
+ typedef salhelper::SingletonRef<OSQLParseNodesContainer> OSQLParseNodesGarbageCollector;
+
+ //==========================================================================
+ //= OSQLParser
+ //==========================================================================
+ struct OSQLParser_Data;
+ /** Parser for SQL92
+ */
+ class OOO_DLLPUBLIC_DBTOOLS OSQLParser
+ {
+ friend class OSQLParseNode;
+ friend class OSQLInternalNode;
+ friend struct SQLParseNodeParameter;
+
+ private:
+ typedef ::std::map< sal_uInt32, OSQLParseNode::Rule > RuleIDMap;
+ // static parts for parsers
+ static sal_uInt32 s_nRuleIDs[OSQLParseNode::rule_count + 1];
+ static RuleIDMap s_aReverseRuleIDLookup;
+ static OParseContext s_aDefaultContext;
+
+ static OSQLScanner* s_pScanner;
+ static OSQLParseNodesGarbageCollector* s_pGarbageCollector;
+ static sal_Int32 s_nRefCount;
+
+ // informations on the current parse action
+ const IParseContext* m_pContext;
+ OSQLParseNode* m_pParseTree; // result from parsing
+ ::std::auto_ptr< OSQLParser_Data >
+ m_pData;
+ ::rtl::OUString m_sFieldName; // current field name for a predicate
+ ::rtl::OUString m_sErrorMessage;// current error msg
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >
+ m_xField; // current field
+ ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >
+ m_xFormatter; // current number formatter
+ sal_Int32 m_nFormatKey; // numberformat, which should be used
+ sal_Int32 m_nDateFormatKey;
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xServiceFactory;
+ ::com::sun::star::uno::Reference< ::com::sun::star::i18n::XCharacterClassification> m_xCharClass;
+ static ::com::sun::star::uno::Reference< ::com::sun::star::i18n::XLocaleData> s_xLocaleData;
+ ::com::sun::star::uno::Reference< ::com::sun::star::i18n::XLocaleData> xDummy; // can be deleted after 627
+
+ // convert a string into double trim it to scale of _nscale and than transform it back to string
+ ::rtl::OUString stringToDouble(const ::rtl::OUString& _rValue,sal_Int16 _nScale);
+ OSQLParseNode* buildDate(sal_Int32 _nType,OSQLParseNode*& pLiteral);
+ bool extractDate(OSQLParseNode* pLiteral,double& _rfValue);
+ void killThousandSeparator(OSQLParseNode* pLiteral);
+ OSQLParseNode* convertNode(sal_Int32 nType,OSQLParseNode*& pLiteral);
+ // makes a string out of a number, pLiteral will be deleted
+ OSQLParseNode* buildNode_STR_NUM(OSQLParseNode*& pLiteral);
+ OSQLParseNode* buildNode_Date(const double& fValue, sal_Int32 nType);
+
+ static ::osl::Mutex& getMutex();
+
+ public:
+ // if NULL, a default context will be used
+ // the context must live as long as the parser
+ OSQLParser(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _xServiceFactory,const IParseContext* _pContext = NULL);
+ ~OSQLParser();
+
+ // Parsing an SQLStatement
+ OSQLParseNode* parseTree(::rtl::OUString& rErrorMessage,
+ const ::rtl::OUString& rStatement,
+ sal_Bool bInternational = sal_False);
+
+ // Check a Predicate
+ OSQLParseNode* predicateTree(::rtl::OUString& rErrorMessage, const ::rtl::OUString& rStatement,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter > & xFormatter,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & xField);
+
+ // Access to the context
+ const IParseContext& getContext() const {return *m_pContext;}
+
+ /// access to the SQLError instance owned by this parser
+ const SQLError& getErrorHelper() const;
+
+ // TokenIDToStr: Token-Name zu einer Token-Nr.
+ static ::rtl::OString TokenIDToStr(sal_uInt32 nTokenID, const IParseContext* pContext = NULL);
+
+ // StrToTokenID: Token-Nr. zu einem Token-Namen.
+ // static sal_uInt32 StrToTokenID(const ::rtl::OString & rName);
+
+ // RuleIDToStr gibt den zu einer RuleID gehoerenden ::rtl::OUString zurueck
+ // (Leerstring, falls nicht gefunden)
+ static ::rtl::OUString RuleIDToStr(sal_uInt32 nRuleID);
+
+ // StrToRuleID berechnet zu einem ::rtl::OUString die RuleID (d.h. ::com::sun::star::sdbcx::Index in yytname)
+ // (0, falls nicht gefunden). Die Suche nach der ID aufgrund eines Strings ist
+ // extrem ineffizient (sequentielle Suche nach ::rtl::OUString)!
+ static sal_uInt32 StrToRuleID(const ::rtl::OString & rValue);
+
+ static OSQLParseNode::Rule RuleIDToRule( sal_uInt32 _nRule );
+
+ // RuleId mit enum, wesentlich effizienter
+ static sal_uInt32 RuleID(OSQLParseNode::Rule eRule);
+ // compares the _sFunctionName with all known function names and return the DataType of the return value
+ static sal_Int32 getFunctionReturnType(const ::rtl::OUString& _sFunctionName, const IParseContext* pContext = NULL);
+
+ // returns the type for a parameter in a given function name
+ static sal_Int32 getFunctionParameterType(sal_uInt32 _nTokenId,sal_uInt32 _nPos);
+
+ void error(sal_Char *fmt);
+ int SQLlex();
+#ifdef YYBISON
+ void setParseTree(OSQLParseNode * pNewParseTree);
+
+ // Is the parse in a special mode?
+ // Predicate chack is used to check a condition for a field
+ sal_Bool inPredicateCheck() const {return m_xField.is();}
+ const ::rtl::OUString& getFieldName() const {return m_sFieldName;}
+
+ void reduceLiteral(OSQLParseNode*& pLiteral, sal_Bool bAppendBlank);
+ // does not change the pLiteral argument
+ sal_Int16 buildNode(OSQLParseNode*& pAppend,OSQLParseNode* pCompare,OSQLParseNode* pLiteral,OSQLParseNode* pLiteral2);
+
+ sal_Int16 buildComparsionRule(OSQLParseNode*& pAppend,OSQLParseNode* pLiteral);
+ // pCompre will be deleted if it is not used
+ sal_Int16 buildPredicateRule(OSQLParseNode*& pAppend,OSQLParseNode* pLiteral,OSQLParseNode*& pCompare,OSQLParseNode* pLiteral2 = NULL);
+
+ sal_Int16 buildLikeRule(OSQLParseNode*& pAppend,OSQLParseNode*& pLiteral,const OSQLParseNode* pEscape);
+ sal_Int16 buildStringNodes(OSQLParseNode*& pLiteral);
+#else
+#endif
+ };
+}
+
+
+#endif //_CONNECTIVITY_SQLPARSE_HXX
diff --git a/connectivity/inc/connectivity/standardsqlstate.hxx b/connectivity/inc/connectivity/standardsqlstate.hxx
new file mode 100644
index 000000000000..5f855a890f5f
--- /dev/null
+++ b/connectivity/inc/connectivity/standardsqlstate.hxx
@@ -0,0 +1,73 @@
+/*************************************************************************
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+************************************************************************/
+
+#ifndef CONNECTIVITY_STANDARD_SQL_STATE_HXX
+#define CONNECTIVITY_STANDARD_SQL_STATE_HXX
+
+//.........................................................................
+namespace dbtools
+{
+//.........................................................................
+
+ //----------------------------------------------------------------------------------
+ /** standard SQLStates to be used with an SQLException
+
+ Extend this list whenever you need a new state ...
+
+ @see http://msdn.microsoft.com/library/default.asp?url=/library/en-us/odbc/htm/odbcodbc_error_codes.asp
+ */
+ enum StandardSQLState
+ {
+ SQL_WRONG_PARAMETER_NUMBER, // 07001
+ SQL_INVALID_DESCRIPTOR_INDEX, // 07009
+ SQL_UNABLE_TO_CONNECT, // 08001
+ SQL_NUMERIC_OUT_OF_RANGE, // 22003
+ SQL_INVALID_DATE_TIME, // 22007
+ SQL_INVALID_CURSOR_STATE, // 24000
+ SQL_TABLE_OR_VIEW_EXISTS, // 42S01
+ SQL_TABLE_OR_VIEW_NOT_FOUND, // 42S02
+ SQL_INDEX_ESISTS, // 42S11
+ SQL_INDEX_NOT_FOUND, // 42S12
+ SQL_COLUMN_EXISTS, // 42S21
+ SQL_COLUMN_NOT_FOUND, // 42S22
+ SQL_GENERAL_ERROR, // HY000
+ SQL_INVALID_SQL_DATA_TYPE, // HY004
+ SQL_OPERATION_CANCELED, // HY008
+ SQL_FUNCTION_SEQUENCE_ERROR, // HY010
+ SQL_INVALID_CURSOR_POSITION, // HY109
+ SQL_INVALID_BOOKMARK_VALUE, // HY111
+ SQL_FEATURE_NOT_IMPLEMENTED, // HYC00
+ SQL_FUNCTION_NOT_SUPPORTED, // IM001
+ SQL_CONNECTION_DOES_NOT_EXIST, // 08003
+
+ SQL_ERROR_UNSPECIFIED = SAL_MAX_ENUM // special value indicating that an SQLState is not to be specified
+ };
+
+//.........................................................................
+} // namespace dbtools
+//.........................................................................
+
+#endif // CONNECTIVITY_STANDARD_SQL_STATE_HXX
diff --git a/connectivity/inc/connectivity/statementcomposer.hxx b/connectivity/inc/connectivity/statementcomposer.hxx
new file mode 100644
index 000000000000..3dde4d8e0b48
--- /dev/null
+++ b/connectivity/inc/connectivity/statementcomposer.hxx
@@ -0,0 +1,111 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef CONNECTIVITY_STATEMENTCOMPOSER_HXX
+#define CONNECTIVITY_STATEMENTCOMPOSER_HXX
+
+/** === begin UNO includes === **/
+#include <com/sun/star/sdbc/XConnection.hpp>
+#include <com/sun/star/sdb/XSingleSelectQueryComposer.hpp>
+/** === end UNO includes === **/
+
+#include <boost/noncopyable.hpp>
+
+#include <memory>
+#include "connectivity/dbtoolsdllapi.hxx"
+
+//........................................................................
+namespace dbtools
+{
+//........................................................................
+
+ //====================================================================
+ //= StatementComposer
+ //====================================================================
+ struct StatementComposer_Data;
+ /** a class which is able to compose queries (SELECT statements) from a command and a command type
+ */
+ class OOO_DLLPUBLIC_DBTOOLS StatementComposer : public ::boost::noncopyable
+ {
+ ::std::auto_ptr< StatementComposer_Data > m_pData;
+
+ public:
+ /** constructs an instance
+
+ @param _rxConnection
+ the connection to work with. Must not be <NULL/>.
+ */
+ StatementComposer(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection,
+ const ::rtl::OUString& _rCommand,
+ const sal_Int32 _nCommandType,
+ const sal_Bool _bEscapeProcessing
+ );
+
+ ~StatementComposer();
+
+ /** controls whether or not the instance disposes its XSingleSelectQueryComposer upon
+ destruction
+
+ Unless you explicitly call this method with the parameter being <TRUE/>,
+ the XSingleSelectQueryComposer will be disposed when the StatementComposer
+ instance is destroyed.
+ */
+ void setDisposeComposer( bool _bDoDispose );
+ bool getDisposeComposer() const;
+
+ void setFilter( const ::rtl::OUString& _rFilter );
+ void setOrder( const ::rtl::OUString& _rOrder );
+
+ /** returns the composer which has been fed with the current settings
+
+ @throws ::com::sun::star::sdbc::SQLException
+ if such an exception occurs while creating the composer
+ */
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XSingleSelectQueryComposer >
+ getComposer();
+
+ /** returns the composer statement
+
+ Effectively, this is equivalent to calling getComposer, and asking the composer
+ for its Query attribute.
+
+ @throws ::com::sun::star::sdbc::SQLException
+ if such an exception occurs while creating the composer
+ */
+ ::rtl::OUString
+ getQuery();
+
+ private:
+ StatementComposer(); // not implemented
+ };
+
+//........................................................................
+} // namespace dbtools
+//........................................................................
+
+#endif // CONNECTIVITY_STATEMENTCOMPOSER_HXX
diff --git a/connectivity/inc/connectivity/virtualdbtools.hxx b/connectivity/inc/connectivity/virtualdbtools.hxx
new file mode 100644
index 000000000000..70b17dcb37c9
--- /dev/null
+++ b/connectivity/inc/connectivity/virtualdbtools.hxx
@@ -0,0 +1,358 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef CONNECTIVITY_VIRTUAL_DBTOOLS_HXX
+#define CONNECTIVITY_VIRTUAL_DBTOOLS_HXX
+
+#include <rtl/ref.hxx>
+#include <rtl/ustring.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/util/Date.hpp>
+#include <com/sun/star/sdbc/SQLException.hpp>
+#include <com/sun/star/uno/Sequence.hxx>
+
+#include <vector>
+#include <memory>
+#include "connectivity/dbtoolsdllapi.hxx"
+
+//========================================================================
+//= forward declarations
+//========================================================================
+namespace com {
+ namespace sun {
+ namespace star {
+ namespace util {
+ class XNumberFormatter;
+ class XNumberFormatTypes;
+ class XNumberFormatsSupplier;
+ }
+ namespace beans {
+ class XPropertySet;
+ }
+ namespace lang {
+ class XMultiServiceFactory;
+ class XComponent;
+ class WrappedTargetException;
+ struct Locale;
+ }
+ namespace sdbc {
+ class XDatabaseMetaData;
+ class XConnection;
+ class XRowSet;
+ class XDataSource;
+ }
+ namespace sdb {
+ class XColumn;
+ class SQLContext;
+ }
+ namespace container {
+ class XNameAccess;
+ }
+ }
+ }
+}
+
+namespace dbtools {
+ class SQLExceptionInfo;
+ class FormattedColumnValue;
+}
+
+namespace comphelper {
+ class ComponentContext;
+}
+
+//========================================================================
+//= entry into this library
+//========================================================================
+/** this is the entry point for the load-on-call usage of the DBTOOLS
+ library.
+ <p>When you need one of the simple objects in this library, load the lib
+ and call this method. The returned pointer is a pointer to an IDataAccessToolsFactory
+ instance, which is acquired <em>once</em>.</p>
+ @return
+ a pointer to an object implementing the IDataAccessToolsFactory interface,
+ aquired exactly <em>once</em>.
+*/
+extern "C" OOO_DLLPUBLIC_DBTOOLS void* SAL_CALL createDataAccessToolsFactory();
+
+//========================================================================
+//=
+//========================================================================
+//........................................................................
+namespace connectivity
+{
+//........................................................................
+
+ class IParseContext;
+ //....................................................................
+ namespace simple
+ {
+ //....................................................................
+
+ typedef void* (SAL_CALL * createDataAccessToolsFactoryFunction)( );
+
+ //================================================================
+ //= IDataAccessTools
+ //================================================================
+ class OOO_DLLPUBLIC_DBTOOLS IDataAccessTools : public ::rtl::IReference
+ {
+ public:
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection> getConnection_withFeedback(
+ const ::rtl::OUString& _rDataSourceName,
+ const ::rtl::OUString& _rUser,
+ const ::rtl::OUString& _rPwd,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rxFactory
+ ) const SAL_THROW ( (::com::sun::star::sdbc::SQLException) ) = 0;
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection> connectRowset(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet>& _rxRowSet,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rxFactory,
+ sal_Bool _bSetAsActiveConnection
+ ) const SAL_THROW ( ( ::com::sun::star::sdbc::SQLException
+ , ::com::sun::star::lang::WrappedTargetException
+ , ::com::sun::star::uno::RuntimeException ) ) = 0;
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection> getRowSetConnection(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet>& _rxRowSet)
+ const SAL_THROW ( (::com::sun::star::uno::RuntimeException) ) = 0;
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier> getNumberFormats(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection>& _rxConn,
+ sal_Bool _bAllowDefault
+ ) const = 0;
+
+ virtual sal_Int32 getDefaultNumberFormat(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxColumn,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatTypes >& _rxTypes,
+ const ::com::sun::star::lang::Locale& _rLocale
+ ) const = 0;
+
+ virtual void TransferFormComponentProperties(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _rxOld,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _rxNew,
+ const ::com::sun::star::lang::Locale& _rLocale
+ ) const = 0;
+
+ virtual ::rtl::OUString quoteName(
+ const ::rtl::OUString& _rQuote,
+ const ::rtl::OUString& _rName
+ ) const = 0;
+
+ virtual ::rtl::OUString composeTableNameForSelect(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection,
+ const ::rtl::OUString& _rCatalog,
+ const ::rtl::OUString& _rSchema,
+ const ::rtl::OUString& _rName
+ ) const = 0;
+
+ virtual ::rtl::OUString composeTableNameForSelect(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _xTable
+ ) const = 0;
+
+ virtual ::com::sun::star::sdb::SQLContext prependContextInfo(
+ ::com::sun::star::sdbc::SQLException& _rException,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxContext,
+ const ::rtl::OUString& _rContextDescription,
+ const ::rtl::OUString& _rContextDetails
+ ) const = 0;
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDataSource > getDataSource(
+ const ::rtl::OUString& _rsRegisteredName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rxFactory
+ ) const = 0;
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >
+ getFieldsByCommandDescriptor(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection,
+ const sal_Int32 _nCommandType,
+ const ::rtl::OUString& _rCommand,
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& _rxKeepFieldsAlive,
+ ::dbtools::SQLExceptionInfo* _pErrorInfo = NULL
+ ) SAL_THROW( ( ) ) = 0;
+
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString >
+ getFieldNamesByCommandDescriptor(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection,
+ const sal_Int32 _nCommandType,
+ const ::rtl::OUString& _rCommand,
+ ::dbtools::SQLExceptionInfo* _pErrorInfo = NULL
+ ) SAL_THROW( ( ) ) = 0;
+
+ /** check if the property "Privileges" supports ::com::sun::star::sdbcx::Privilege::INSERT
+ @param _rxCursorSet the property set
+ */
+ virtual sal_Bool canInsert(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _rxCursorSet) const = 0;
+
+ /** check if the property "Privileges" supports ::com::sun::star::sdbcx::Privilege::UPDATE
+ @param _rxCursorSet the property set
+ */
+ virtual sal_Bool canUpdate(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _rxCursorSet) const = 0;
+
+ /** check if the property "Privileges" supports ::com::sun::star::sdbcx::Privilege::DELETE
+ @param _rxCursorSet the property set
+ */
+ virtual sal_Bool canDelete(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _rxCursorSet) const = 0;
+
+ /** determines whether the given component is part of a document which is an embedded database
+ document (such as a form)
+ */
+ virtual bool isEmbeddedInDatabase(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxComponent,
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxActualConnection
+ ) = 0;
+ };
+
+ //================================================================
+ //= IDataAccessCharSet
+ //================================================================
+ /** simple wrapper for the <type>OCharsetMap</type>
+ */
+ class OOO_DLLPUBLIC_DBTOOLS IDataAccessCharSet :
+ public ::rtl::IReference
+ {
+ // to be extended if necessary ....
+ public:
+ /** enumerates all supported char sets
+ @return the number of charsets supported
+ */
+ virtual sal_Int32 getSupportedTextEncodings(
+ ::std::vector< rtl_TextEncoding >& /* [out] */ _rEncs
+ ) const = 0;
+ };
+
+ //================================================================
+ //= IDataAccessTypeConversion
+ //================================================================
+ class OOO_DLLPUBLIC_DBTOOLS IDataAccessTypeConversion :
+ public ::rtl::IReference
+ {
+ public:
+ virtual ::com::sun::star::util::Date getStandardDate() const = 0;
+
+ virtual double getValue(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumn>& _rxVariant,
+ const ::com::sun::star::util::Date& rNullDate,
+ sal_Int16 nKeyType) const = 0;
+
+ virtual ::rtl::OUString getValue(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumn >& _rxColumn,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& _rxFormatter,
+ const ::com::sun::star::util::Date& _rNullDate,
+ sal_Int32 _nKey,
+ sal_Int16 _nKeyType) const = 0;
+
+ virtual ::rtl::OUString getValue(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _rxColumn,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter>& _rxFormatter,
+ const ::com::sun::star::lang::Locale& _rLocale,
+ const ::com::sun::star::util::Date& _rNullDate
+ ) const = 0;
+ };
+
+ //================================================================
+ //= ISQLParseNode
+ //================================================================
+ /** a simple version of the OSQLParseNode, with all methods beeing virtual
+ */
+ class OOO_DLLPUBLIC_DBTOOLS ISQLParseNode : public ::rtl::IReference
+ {
+ public:
+ virtual void parseNodeToStr(::rtl::OUString& _rString,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection,
+ const IParseContext* _pContext
+ ) const = 0;
+
+ virtual void parseNodeToPredicateStr(::rtl::OUString& _rString,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& _rxFormatter,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxField,
+ const ::com::sun::star::lang::Locale& _rIntl,
+ const sal_Char _cDecSeparator,
+ const IParseContext* _pContext
+ ) const = 0;
+ };
+
+ //================================================================
+ //= ISQLParser
+ //================================================================
+ /** a simple version of the OSQLParser, with all methods beeing virtual
+ */
+ class OOO_DLLPUBLIC_DBTOOLS ISQLParser : public ::rtl::IReference
+ {
+ public:
+ virtual ::rtl::Reference< ISQLParseNode > predicateTree(
+ ::rtl::OUString& rErrorMessage,
+ const ::rtl::OUString& rStatement,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& _rxFormatter,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxField
+ ) const = 0;
+
+ virtual const IParseContext& getContext() const = 0;
+ };
+
+ //================================================================
+ //= IDataAccessToolsFactory
+ //================================================================
+ /** the main factory for runtime-loadable tools in the DBTOOLS library
+ */
+ class OOO_DLLPUBLIC_DBTOOLS IDataAccessToolsFactory :
+ public ::rtl::IReference
+ {
+ public:
+ /// creates a simple version of the class OSQLParser
+ virtual ::rtl::Reference< ISQLParser > createSQLParser(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxServiceFactory,
+ const IParseContext* _pContext
+ ) const = 0;
+
+ /// creates a helper for charset related functionality (<type>OCharsetMap</type>)
+ virtual ::rtl::Reference< IDataAccessCharSet > createCharsetHelper( ) const = 0;
+
+ /// creates a simple version of the DBTypeConversion helper
+ virtual ::rtl::Reference< IDataAccessTypeConversion > getTypeConversionHelper() = 0;
+
+ /// creates a helper which can be used to access the static methods in dbtools.hxx
+ virtual ::rtl::Reference< IDataAccessTools > getDataAccessTools() = 0;
+
+ virtual ::std::auto_ptr< ::dbtools::FormattedColumnValue > createFormattedColumnValue(
+ const ::comphelper::ComponentContext& _rContext,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet >& _rxRowSet,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxColumn
+ ) = 0;
+ };
+
+ //....................................................................
+ } // namespace simple
+ //....................................................................
+
+//........................................................................
+} // namespace connectivity
+//........................................................................
+
+#endif // CONNECTIVITY_VIRTUAL_DBTOOLS_HXX
+
diff --git a/connectivity/inc/connectivity/warningscontainer.hxx b/connectivity/inc/connectivity/warningscontainer.hxx
new file mode 100644
index 000000000000..feb631a2098e
--- /dev/null
+++ b/connectivity/inc/connectivity/warningscontainer.hxx
@@ -0,0 +1,107 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef DBTOOLS_WARNINGSCONTAINER_HXX
+#define DBTOOLS_WARNINGSCONTAINER_HXX
+
+/** ==== begin UNO includes === **/
+#include <com/sun/star/sdbc/XWarningsSupplier.hpp>
+#include <com/sun/star/sdb/SQLContext.hpp>
+/** ==== end UNO includes === **/
+
+#include "connectivity/dbtoolsdllapi.hxx"
+
+//.........................................................................
+namespace dbtools
+{
+//.........................................................................
+
+ //=====================================================================
+ //= IWarningsContainer
+ //=====================================================================
+ class SAL_NO_VTABLE IWarningsContainer
+ {
+ public:
+ virtual void appendWarning(const ::com::sun::star::sdbc::SQLException& _rWarning) = 0;
+ virtual void appendWarning(const ::com::sun::star::sdbc::SQLWarning& _rWarning) = 0;
+ virtual void appendWarning(const ::com::sun::star::sdb::SQLContext& _rContext) = 0;
+ };
+
+ //====================================================================
+ //= WarningsContainer
+ //====================================================================
+ /** helper class for implementing XWarningsSupplier, which mixes own warnings with
+ warnings obtained from an external instance
+ */
+ class OOO_DLLPUBLIC_DBTOOLS WarningsContainer : public IWarningsContainer
+ {
+ private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XWarningsSupplier > m_xExternalWarnings;
+ ::com::sun::star::uno::Any m_aOwnWarnings;
+
+ public:
+ WarningsContainer() { }
+ WarningsContainer( const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XWarningsSupplier >& _rxExternalWarnings )
+ :m_xExternalWarnings( _rxExternalWarnings )
+ {
+ }
+ virtual ~WarningsContainer();
+
+ void setExternalWarnings( const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XWarningsSupplier >& _rxExternalWarnings )
+ {
+ m_xExternalWarnings = _rxExternalWarnings;
+ }
+
+ // convenience
+ /** appends an SQLWarning instance to the chain
+ @param _rWarning
+ the warning message
+ @param _pAsciiSQLState
+ the SQLState of the warning
+ @param _rxContext
+ the context of the warning
+ */
+ void appendWarning(
+ const ::rtl::OUString& _rWarning,
+ const sal_Char* _pAsciiSQLState,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxContext );
+
+ // IWarningsContainer
+ virtual void appendWarning(const ::com::sun::star::sdbc::SQLException& _rWarning);
+ virtual void appendWarning(const ::com::sun::star::sdbc::SQLWarning& _rWarning);
+ virtual void appendWarning(const ::com::sun::star::sdb::SQLContext& _rContext);
+
+ // XWarningsSupplier equivalents
+ ::com::sun::star::uno::Any SAL_CALL getWarnings( ) const;
+ void SAL_CALL clearWarnings( );
+ };
+
+//.........................................................................
+} // namespace dbtools
+//.........................................................................
+
+#endif // DBTOOLS_WARNINGSCONTAINER_HXX
diff --git a/connectivity/inc/makefile.mk b/connectivity/inc/makefile.mk
new file mode 100644
index 000000000000..51a3f225b30a
--- /dev/null
+++ b/connectivity/inc/makefile.mk
@@ -0,0 +1,47 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+PRJ=..
+
+PRJNAME=connectivity
+TARGET=inc
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+
+# --- Files --------------------------------------------------------
+# --- Targets -------------------------------------------------------
+
+.INCLUDE : target.mk
+
+.IF "$(ENABLE_PCH)"!=""
+ALLTAR : \
+ $(SLO)$/precompiled.pch \
+ $(SLO)$/precompiled_ex.pch
+
+.ENDIF # "$(ENABLE_PCH)"!=""
+
diff --git a/connectivity/inc/pch/precompiled_connectivity.cxx b/connectivity/inc/pch/precompiled_connectivity.cxx
new file mode 100644
index 000000000000..edbfe3801613
--- /dev/null
+++ b/connectivity/inc/pch/precompiled_connectivity.cxx
@@ -0,0 +1,29 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_connectivity.hxx"
+
diff --git a/connectivity/inc/pch/precompiled_connectivity.hxx b/connectivity/inc/pch/precompiled_connectivity.hxx
new file mode 100644
index 000000000000..41571202327a
--- /dev/null
+++ b/connectivity/inc/pch/precompiled_connectivity.hxx
@@ -0,0 +1,334 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): Generated on 2006-09-01 17:49:36.436601
+
+#ifdef PRECOMPILED_HEADERS
+
+//---MARKER---
+#include "sal/config.h"
+#include "sal/types.h"
+
+#include "boost/shared_ptr.hpp"
+
+#include "com/sun/star/awt/XWindow.hpp"
+#include "com/sun/star/beans/NamedValue.hpp"
+#include "com/sun/star/beans/Property.hpp"
+#include "com/sun/star/beans/PropertyAttribute.hpp"
+#include "com/sun/star/beans/PropertyState.hpp"
+#include "com/sun/star/beans/PropertyValue.hpp"
+#include "com/sun/star/beans/XFastPropertySet.hpp"
+#include "com/sun/star/beans/XPropertyChangeListener.hpp"
+#include "com/sun/star/beans/XPropertySet.hpp"
+#include "com/sun/star/beans/XPropertySetInfo.hpp"
+#include "com/sun/star/connection/XConnection.hpp"
+#include "com/sun/star/container/ElementExistException.hpp"
+#include "com/sun/star/container/XChild.hpp"
+#include "com/sun/star/container/XContainer.hpp"
+#include "com/sun/star/container/XContentEnumerationAccess.hpp"
+#include "com/sun/star/container/XEnumeration.hpp"
+#include "com/sun/star/container/XEnumerationAccess.hpp"
+#include "com/sun/star/container/XHierarchicalNameAccess.hpp"
+#include "com/sun/star/container/XIndexAccess.hpp"
+#include "com/sun/star/container/XNameAccess.hpp"
+#include "com/sun/star/container/XNamed.hpp"
+#include "com/sun/star/document/XDocumentSubStorageSupplier.hpp"
+#include "com/sun/star/embed/ElementModes.hpp"
+#include "com/sun/star/embed/XStorage.hpp"
+#include "com/sun/star/embed/XTransactedObject.hpp"
+#include "com/sun/star/embed/XTransactionBroadcaster.hpp"
+#include "com/sun/star/embed/XTransactionListener.hpp"
+#include "com/sun/star/form/FormComponentType.hpp"
+#include "com/sun/star/frame/XComponentLoader.hpp"
+#include "com/sun/star/frame/XDesktop.hpp"
+#include "com/sun/star/frame/XModel.hpp"
+#include "com/sun/star/frame/XTerminateListener.hpp"
+#include "com/sun/star/graphic/GraphicColorMode.hpp"
+#include "com/sun/star/graphic/XGraphicProvider.hpp"
+#include "com/sun/star/i18n/KParseTokens.hpp"
+#include "com/sun/star/i18n/KParseType.hpp"
+#include "com/sun/star/i18n/NumberFormatIndex.hpp"
+#include "com/sun/star/i18n/XCharacterClassification.hpp"
+#include "com/sun/star/i18n/XLocaleData.hpp"
+#include "com/sun/star/io/IOException.hpp"
+#include "com/sun/star/io/XInputStream.hpp"
+#include "com/sun/star/io/XOutputStream.hpp"
+#include "com/sun/star/io/XSeekable.hpp"
+#include "com/sun/star/io/XStream.hpp"
+#include "com/sun/star/java/XJavaVM.hpp"
+#include "com/sun/star/lang/DisposedException.hpp"
+#include "com/sun/star/lang/IllegalArgumentException.hpp"
+#include "com/sun/star/lang/IndexOutOfBoundsException.hpp"
+#include "com/sun/star/lang/Locale.hpp"
+#include "com/sun/star/lang/NullPointerException.hpp"
+#include "com/sun/star/lang/ServiceNotRegisteredException.hpp"
+#include "com/sun/star/lang/XComponent.hpp"
+#include "com/sun/star/lang/XEventListener.hpp"
+#include "com/sun/star/lang/XInitialization.hpp"
+#include "com/sun/star/lang/XMultiServiceFactory.hpp"
+#include "com/sun/star/lang/XServiceInfo.hpp"
+#include "com/sun/star/lang/XSingleComponentFactory.hpp"
+#include "com/sun/star/lang/XSingleServiceFactory.hpp"
+#include "com/sun/star/lang/XUnoTunnel.hpp"
+#include "com/sun/star/mozilla/MozillaProductType.hpp"
+#include "com/sun/star/mozilla/XCodeProxy.hpp"
+#include "com/sun/star/mozilla/XMozillaBootstrap.hpp"
+#include "com/sun/star/mozilla/XProxyRunner.hdl"
+#include "com/sun/star/mozilla/XProxyRunner.hpp"
+#include "com/sun/star/reflection/XProxyFactory.hpp"
+#include "com/sun/star/registry/XImplementationRegistration.hpp"
+#include "com/sun/star/script/XTypeConverter.hpp"
+#include "com/sun/star/sdb/CommandType.hpp"
+#include "com/sun/star/sdb/ParametersRequest.hpp"
+#include "com/sun/star/sdb/RowSetVetoException.hpp"
+#include "com/sun/star/sdb/SQLContext.hpp"
+#include "com/sun/star/sdb/SQLErrorEvent.hpp"
+#include "com/sun/star/sdb/SQLFilterOperator.hpp"
+#include "com/sun/star/sdb/XColumn.hpp"
+#include "com/sun/star/sdb/XColumnUpdate.hpp"
+#include "com/sun/star/sdb/XCompletedConnection.hpp"
+#include "com/sun/star/sdb/XDatabaseEnvironment.hpp"
+#include "com/sun/star/sdb/XInteractionSupplyParameters.hpp"
+#include "com/sun/star/sdb/XParametersSupplier.hpp"
+#include "com/sun/star/sdb/XQueriesSupplier.hpp"
+#include "com/sun/star/sdb/XSingleSelectQueryComposer.hpp"
+#include "com/sun/star/sdb/application/XTableUIProvider.hpp"
+#include "com/sun/star/sdbc/ColumnSearch.hpp"
+#include "com/sun/star/sdbc/ColumnValue.hpp"
+#include "com/sun/star/sdbc/DataType.hpp"
+#include "com/sun/star/sdbc/DriverPropertyInfo.hpp"
+#include "com/sun/star/sdbc/FetchDirection.hpp"
+#include "com/sun/star/sdbc/IndexType.hpp"
+#include "com/sun/star/sdbc/KeyRule.hpp"
+#include "com/sun/star/sdbc/ProcedureResult.hpp"
+#include "com/sun/star/sdbc/ResultSetConcurrency.hpp"
+#include "com/sun/star/sdbc/ResultSetType.hpp"
+#include "com/sun/star/sdbc/SQLException.hpp"
+#include "com/sun/star/sdbc/SQLWarning.hpp"
+#include "com/sun/star/sdbc/TransactionIsolation.hpp"
+#include "com/sun/star/sdbc/XArray.hpp"
+#include "com/sun/star/sdbc/XBatchExecution.hpp"
+#include "com/sun/star/sdbc/XBlob.hpp"
+#include "com/sun/star/sdbc/XClob.hpp"
+#include "com/sun/star/sdbc/XCloseable.hpp"
+#include "com/sun/star/sdbc/XColumnLocate.hpp"
+#include "com/sun/star/sdbc/XConnection.hpp"
+#include "com/sun/star/sdbc/XDataSource.hpp"
+#include "com/sun/star/sdbc/XDatabaseMetaData.hpp"
+#include "com/sun/star/sdbc/XDriver.hpp"
+#include "com/sun/star/sdbc/XDriverAccess.hpp"
+#include "com/sun/star/sdbc/XDriverManager.hpp"
+#include "com/sun/star/sdbc/XGeneratedResultSet.hpp"
+#include "com/sun/star/sdbc/XMultipleResults.hpp"
+#include "com/sun/star/sdbc/XOutParameters.hpp"
+#include "com/sun/star/sdbc/XParameters.hpp"
+#include "com/sun/star/sdbc/XPooledConnection.hpp"
+#include "com/sun/star/sdbc/XPreparedBatchExecution.hpp"
+#include "com/sun/star/sdbc/XPreparedStatement.hpp"
+#include "com/sun/star/sdbc/XRef.hpp"
+#include "com/sun/star/sdbc/XResultSet.hpp"
+#include "com/sun/star/sdbc/XResultSetMetaData.hpp"
+#include "com/sun/star/sdbc/XResultSetMetaDataSupplier.hpp"
+#include "com/sun/star/sdbc/XResultSetUpdate.hpp"
+#include "com/sun/star/sdbc/XRow.hpp"
+#include "com/sun/star/sdbc/XRowSet.hpp"
+#include "com/sun/star/sdbc/XRowUpdate.hpp"
+#include "com/sun/star/sdbc/XStatement.hpp"
+#include "com/sun/star/sdbc/XWarningsSupplier.hpp"
+#include "com/sun/star/sdbcx/CheckOption.hpp"
+#include "com/sun/star/sdbcx/CompareBookmark.hpp"
+#include "com/sun/star/sdbcx/KeyType.hpp"
+#include "com/sun/star/sdbcx/Privilege.hpp"
+#include "com/sun/star/sdbcx/PrivilegeObject.hpp"
+#include "com/sun/star/sdbcx/XAlterTable.hpp"
+#include "com/sun/star/sdbcx/XAppend.hpp"
+#include "com/sun/star/sdbcx/XAuthorizable.hpp"
+#include "com/sun/star/sdbcx/XColumnsSupplier.hpp"
+#include "com/sun/star/sdbcx/XCreateCatalog.hpp"
+#include "com/sun/star/sdbcx/XDataDefinitionSupplier.hpp"
+#include "com/sun/star/sdbcx/XDataDescriptorFactory.hpp"
+#include "com/sun/star/sdbcx/XDeleteRows.hpp"
+#include "com/sun/star/sdbcx/XDrop.hpp"
+#include "com/sun/star/sdbcx/XGroupsSupplier.hpp"
+#include "com/sun/star/sdbcx/XIndexesSupplier.hpp"
+#include "com/sun/star/sdbcx/XKeysSupplier.hpp"
+#include "com/sun/star/sdbcx/XRename.hpp"
+#include "com/sun/star/sdbcx/XRowLocate.hpp"
+#include "com/sun/star/sdbcx/XTablesSupplier.hpp"
+#include "com/sun/star/sdbcx/XUser.hpp"
+#include "com/sun/star/sdbcx/XUsersSupplier.hpp"
+#include "com/sun/star/sdbcx/XViewsSupplier.hpp"
+#include "com/sun/star/sheet/CellFlags.hpp"
+#include "com/sun/star/sheet/XCellRangeAddressable.hpp"
+#include "com/sun/star/sheet/XCellRangeReferrer.hpp"
+#include "com/sun/star/sheet/XCellRangesQuery.hpp"
+#include "com/sun/star/sheet/XDatabaseRange.hpp"
+#include "com/sun/star/sheet/XDatabaseRanges.hpp"
+#include "com/sun/star/sheet/XSpreadsheet.hpp"
+#include "com/sun/star/sheet/XSpreadsheetDocument.hpp"
+#include "com/sun/star/sheet/XUsedAreaCursor.hpp"
+#include "com/sun/star/task/XInteractionHandler.hpp"
+#include "com/sun/star/task/XInteractionRequest.hpp"
+#include "com/sun/star/text/XText.hpp"
+#include "com/sun/star/ucb/SearchCommandArgument.hpp"
+#include "com/sun/star/ucb/SearchRecursion.hpp"
+#include "com/sun/star/ucb/XCommandEnvironment.hpp"
+#include "com/sun/star/ucb/XContent.hpp"
+#include "com/sun/star/ucb/XContentAccess.hpp"
+#include "com/sun/star/ucb/XContentIdentifier.hpp"
+#include "com/sun/star/ucb/XContentProvider.hpp"
+#include "com/sun/star/ucb/XContentProviderManager.hpp"
+#include "com/sun/star/ucb/XDynamicResultSet.hpp"
+#include "com/sun/star/ucb/XSortedDynamicResultSetFactory.hpp"
+#include "com/sun/star/ui/dialogs/XExecutableDialog.hpp"
+#include "com/sun/star/uno/Any.hxx"
+#include "com/sun/star/uno/Exception.hpp"
+#include "com/sun/star/uno/Reference.h"
+#include "com/sun/star/uno/Reference.hxx"
+#include "com/sun/star/uno/RuntimeException.hpp"
+#include "com/sun/star/uno/Sequence.h"
+#include "com/sun/star/uno/Sequence.hxx"
+#include "com/sun/star/uno/XAggregation.hpp"
+#include "com/sun/star/uno/XInterface.hpp"
+#include "com/sun/star/uno/XNamingService.hpp"
+#include "com/sun/star/util/Date.hpp"
+#include "com/sun/star/util/DateTime.hpp"
+#include "com/sun/star/util/NumberFormat.hpp"
+#include "com/sun/star/util/Time.hpp"
+#include "com/sun/star/util/XCancellable.hpp"
+#include "com/sun/star/util/XFlushable.hpp"
+#include "com/sun/star/util/XNumberFormatTypes.hpp"
+#include "com/sun/star/util/XNumberFormats.hpp"
+#include "com/sun/star/util/XNumberFormatsSupplier.hpp"
+#include "com/sun/star/util/XNumberFormatter.hpp"
+#include "com/sun/star/util/XRefreshable.hpp"
+
+#include "comphelper/broadcasthelper.hxx"
+#include "comphelper/componentcontext.hxx"
+#include "comphelper/container.hxx"
+#include "comphelper/enumhelper.hxx"
+#include "comphelper/evtlistenerhlp.hxx"
+#include "comphelper/interaction.hxx"
+#include "comphelper/listenernotification.hxx"
+#include "comphelper/numbers.hxx"
+#include "comphelper/officeresourcebundle.hxx"
+#include "comphelper/processfactory.hxx"
+#include "comphelper/propertycontainer.hxx"
+#include "comphelper/regpathhelper.hxx"
+#include "comphelper/seqstream.hxx"
+#include "comphelper/sequence.hxx"
+#include "comphelper/types.hxx"
+#include "comphelper/uno3.hxx"
+
+#include "cppuhelper/bootstrap.hxx"
+#include "cppuhelper/compbase1.hxx"
+#include "cppuhelper/compbase10.hxx"
+#include "cppuhelper/compbase12.hxx"
+#include "cppuhelper/compbase2.hxx"
+#include "cppuhelper/compbase3.hxx"
+#include "cppuhelper/compbase4.hxx"
+#include "cppuhelper/compbase5.hxx"
+#include "cppuhelper/compbase6.hxx"
+#include "cppuhelper/compbase7.hxx"
+#include "cppuhelper/compbase8.hxx"
+#include "cppuhelper/component.hxx"
+#include "cppuhelper/component_context.hxx"
+#include "cppuhelper/exc_hlp.hxx"
+#include "cppuhelper/factory.hxx"
+#include "cppuhelper/implbase1.hxx"
+#include "cppuhelper/implbase10.hxx"
+#include "cppuhelper/implbase2.hxx"
+#include "cppuhelper/implbase3.hxx"
+#include "cppuhelper/implbase4.hxx"
+#include "cppuhelper/implbase5.hxx"
+#include "cppuhelper/interfacecontainer.h"
+#include "cppuhelper/interfacecontainer.hxx"
+#include "cppuhelper/propshlp.hxx"
+#include "cppuhelper/queryinterface.hxx"
+#include "cppuhelper/servicefactory.hxx"
+#include "cppuhelper/typeprovider.hxx"
+#include "cppuhelper/weak.hxx"
+#include "cppuhelper/weakref.hxx"
+
+#include "i18npool/mslangid.hxx"
+
+#include "jvmaccess/virtualmachine.hxx"
+
+#include "jvmfwk/framework.h"
+
+#include "osl/conditn.hxx"
+#include "osl/diagnose.h"
+#include "osl/file.h"
+#include "osl/file.hxx"
+#include "osl/interlck.h"
+#include "osl/module.h"
+#include "osl/mutex.hxx"
+#include "osl/nlsupport.h"
+#include "osl/process.h"
+#include "osl/security.hxx"
+#include "osl/thread.h"
+#include "osl/thread.hxx"
+
+#include "rtl/alloc.h"
+#include "rtl/bootstrap.hxx"
+#include "rtl/byteseq.hxx"
+#include "rtl/digest.h"
+#include "rtl/logfile.hxx"
+#include "rtl/math.hxx"
+#include "rtl/process.h"
+#include "rtl/ref.hxx"
+#include "rtl/string.h"
+#include "rtl/string.hxx"
+#include "rtl/tencinfo.h"
+#include "rtl/textenc.h"
+#include "rtl/ustrbuf.hxx"
+#include "rtl/ustring.hxx"
+
+#include "sys/types.h"
+
+#include "tools/diagnose_ex.h"
+
+#include "ucbhelper/content.hxx"
+#include "ucbhelper/contentbroker.hxx"
+
+#include "uno/environment.hxx"
+#include "uno/mapping.hxx"
+
+#include "unotools/configmgr.hxx"
+#include "unotools/confignode.hxx"
+#include "unotools/processfactory.hxx"
+#include "unotools/sharedunocomponent.hxx"
+
+#include "vos/mutex.hxx"
+#include "vos/process.hxx"
+#include "vos/ref.hxx"
+#include "vos/ref.hxx"
+#include "vos/refernce.hxx"
+#include "vos/timer.hxx"
+//---MARKER---
+
+#endif