1*2e2212a7SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*2e2212a7SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*2e2212a7SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*2e2212a7SAndrew Rist  * distributed with this work for additional information
6*2e2212a7SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*2e2212a7SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*2e2212a7SAndrew Rist  * "License"); you may not use this file except in compliance
9*2e2212a7SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*2e2212a7SAndrew Rist  *
11*2e2212a7SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*2e2212a7SAndrew Rist  *
13*2e2212a7SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*2e2212a7SAndrew Rist  * software distributed under the License is distributed on an
15*2e2212a7SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*2e2212a7SAndrew Rist  * KIND, either express or implied.  See the License for the
17*2e2212a7SAndrew Rist  * specific language governing permissions and limitations
18*2e2212a7SAndrew Rist  * under the License.
19*2e2212a7SAndrew Rist  *
20*2e2212a7SAndrew Rist  *************************************************************/
21*2e2212a7SAndrew Rist 
22*2e2212a7SAndrew Rist 
23cdf0e10cSrcweir #ifndef DBA_HELPERCOLLECTIONS_HXX
24cdf0e10cSrcweir #define DBA_HELPERCOLLECTIONS_HXX
25cdf0e10cSrcweir 
26cdf0e10cSrcweir #ifndef _CONNECTIVITY_SDBCX_COLLECTION_HXX_
27cdf0e10cSrcweir #include "connectivity/sdbcx/VCollection.hxx"
28cdf0e10cSrcweir #endif
29cdf0e10cSrcweir #ifndef _CONNECTIVITY_DBTOOLS_HXX_
30cdf0e10cSrcweir #include <connectivity/dbtools.hxx>
31cdf0e10cSrcweir #endif
32cdf0e10cSrcweir #ifndef _DBHELPER_DBCONVERSION_HXX_
33cdf0e10cSrcweir #include <connectivity/dbconversion.hxx>
34cdf0e10cSrcweir #endif
35cdf0e10cSrcweir #ifndef _CONNECTIVITY_SDBCX_COLUMN_HXX_
36cdf0e10cSrcweir #include <connectivity/PColumn.hxx>
37cdf0e10cSrcweir #endif
38cdf0e10cSrcweir #ifndef _VOS_REF_HXX_
39cdf0e10cSrcweir #include <vos/ref.hxx>
40cdf0e10cSrcweir #endif
41cdf0e10cSrcweir 
42cdf0e10cSrcweir namespace dbaccess
43cdf0e10cSrcweir {
44cdf0e10cSrcweir 	using namespace dbtools;
45cdf0e10cSrcweir 	using namespace comphelper;
46cdf0e10cSrcweir 	using namespace connectivity;
47cdf0e10cSrcweir 	using namespace ::com::sun::star::uno;
48cdf0e10cSrcweir 	using namespace ::com::sun::star::beans;
49cdf0e10cSrcweir 	using namespace ::com::sun::star::sdbc;
50cdf0e10cSrcweir 	using namespace ::com::sun::star::sdb;
51cdf0e10cSrcweir 	using namespace ::com::sun::star::sdbcx;
52cdf0e10cSrcweir 	using namespace ::com::sun::star::container;
53cdf0e10cSrcweir 	using namespace ::com::sun::star::lang;
54cdf0e10cSrcweir 	using namespace ::com::sun::star::script;
55cdf0e10cSrcweir 	using namespace ::cppu;
56cdf0e10cSrcweir 	using namespace ::osl;
57cdf0e10cSrcweir 	// -----------------------------------------------------------------------------
58cdf0e10cSrcweir 	typedef connectivity::sdbcx::OCollection OPrivateColumns_Base;
59cdf0e10cSrcweir 	class OPrivateColumns : public OPrivateColumns_Base
60cdf0e10cSrcweir 	{
61cdf0e10cSrcweir 		::vos::ORef< ::connectivity::OSQLColumns>	m_aColumns;
62cdf0e10cSrcweir 	protected:
63cdf0e10cSrcweir 		virtual connectivity::sdbcx::ObjectType createObject(const ::rtl::OUString& _rName);
impl_refresh()64cdf0e10cSrcweir 		virtual void impl_refresh() throw(RuntimeException) {}
createDescriptor()65cdf0e10cSrcweir 		virtual Reference< XPropertySet > createDescriptor()
66cdf0e10cSrcweir 		{
67cdf0e10cSrcweir 			return NULL;
68cdf0e10cSrcweir 		}
69cdf0e10cSrcweir 	public:
70cdf0e10cSrcweir 		OPrivateColumns(const ::vos::ORef< ::connectivity::OSQLColumns>& _rColumns,
71cdf0e10cSrcweir 						sal_Bool _bCase,
72cdf0e10cSrcweir 						::cppu::OWeakObject& _rParent,
73cdf0e10cSrcweir 						::osl::Mutex& _rMutex,
74cdf0e10cSrcweir 						const ::std::vector< ::rtl::OUString> &_rVector,
75cdf0e10cSrcweir 						sal_Bool _bUseAsIndex = sal_False
76cdf0e10cSrcweir 					);
77cdf0e10cSrcweir 
78cdf0e10cSrcweir         /** creates a columns instance as above, but taking the names from the columns itself
79cdf0e10cSrcweir         */
80cdf0e10cSrcweir 		static OPrivateColumns* createWithIntrinsicNames(
81cdf0e10cSrcweir             const ::vos::ORef< ::connectivity::OSQLColumns >& _rColumns,
82cdf0e10cSrcweir 			sal_Bool _bCase,
83cdf0e10cSrcweir 			::cppu::OWeakObject& _rParent,
84cdf0e10cSrcweir 			::osl::Mutex& _rMutex
85cdf0e10cSrcweir 		);
86cdf0e10cSrcweir 
87cdf0e10cSrcweir 		virtual void SAL_CALL disposing(void);
88cdf0e10cSrcweir 	};
89cdf0e10cSrcweir 	typedef connectivity::sdbcx::OCollection OPrivateTables_BASE;
90cdf0e10cSrcweir 
91cdf0e10cSrcweir 	//==========================================================================
92cdf0e10cSrcweir 	//= OPrivateTables
93cdf0e10cSrcweir 	//==========================================================================
94cdf0e10cSrcweir 	class OPrivateTables : public OPrivateTables_BASE
95cdf0e10cSrcweir 	{
96cdf0e10cSrcweir 		OSQLTables	m_aTables;
97cdf0e10cSrcweir 	protected:
98cdf0e10cSrcweir 		virtual connectivity::sdbcx::ObjectType createObject(const ::rtl::OUString& _rName);
impl_refresh()99cdf0e10cSrcweir 		virtual void impl_refresh() throw(RuntimeException) {}
createDescriptor()100cdf0e10cSrcweir 		virtual Reference< XPropertySet > createDescriptor()
101cdf0e10cSrcweir 		{
102cdf0e10cSrcweir 			return NULL;
103cdf0e10cSrcweir 		}
104cdf0e10cSrcweir 	public:
OPrivateTables(const OSQLTables & _rTables,sal_Bool _bCase,::cppu::OWeakObject & _rParent,::osl::Mutex & _rMutex,const::std::vector<::rtl::OUString> & _rVector)105cdf0e10cSrcweir 		OPrivateTables(	const OSQLTables& _rTables,
106cdf0e10cSrcweir 						sal_Bool _bCase,
107cdf0e10cSrcweir 						::cppu::OWeakObject& _rParent,
108cdf0e10cSrcweir 						::osl::Mutex& _rMutex,
109cdf0e10cSrcweir 						const ::std::vector< ::rtl::OUString> &_rVector
110cdf0e10cSrcweir 					) : sdbcx::OCollection(_rParent,_bCase,_rMutex,_rVector)
111cdf0e10cSrcweir 						,m_aTables(_rTables)
112cdf0e10cSrcweir 		{
113cdf0e10cSrcweir 		}
disposing(void)114cdf0e10cSrcweir 		virtual void SAL_CALL disposing(void)
115cdf0e10cSrcweir 		{
116cdf0e10cSrcweir 			clear_NoDispose();
117cdf0e10cSrcweir 				// we're not owner of the objects we're holding, instead the object we got in our ctor is
118cdf0e10cSrcweir 				// So we're not allowed to dispose our elements.
119cdf0e10cSrcweir 			m_aTables.clear();
120cdf0e10cSrcweir 			OPrivateTables_BASE::disposing();
121cdf0e10cSrcweir 		}
122cdf0e10cSrcweir 	};
123cdf0e10cSrcweir }
124cdf0e10cSrcweir #endif // DBA_HELPERCOLLECTIONS_HXX
125