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