1*9b5730f6SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*9b5730f6SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*9b5730f6SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*9b5730f6SAndrew Rist  * distributed with this work for additional information
6*9b5730f6SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*9b5730f6SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*9b5730f6SAndrew Rist  * "License"); you may not use this file except in compliance
9*9b5730f6SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*9b5730f6SAndrew Rist  *
11*9b5730f6SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*9b5730f6SAndrew Rist  *
13*9b5730f6SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*9b5730f6SAndrew Rist  * software distributed under the License is distributed on an
15*9b5730f6SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*9b5730f6SAndrew Rist  * KIND, either express or implied.  See the License for the
17*9b5730f6SAndrew Rist  * specific language governing permissions and limitations
18*9b5730f6SAndrew Rist  * under the License.
19*9b5730f6SAndrew Rist  *
20*9b5730f6SAndrew Rist  *************************************************************/
21*9b5730f6SAndrew Rist 
22*9b5730f6SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_connectivity.hxx"
26cdf0e10cSrcweir #include "ado/AView.hxx"
27cdf0e10cSrcweir #include <com/sun/star/lang/DisposedException.hpp>
28cdf0e10cSrcweir #include "ado/adoimp.hxx"
29cdf0e10cSrcweir #include <cppuhelper/typeprovider.hxx>
30cdf0e10cSrcweir #include "ado/Awrapado.hxx"
31cdf0e10cSrcweir #include <comphelper/sequence.hxx>
32cdf0e10cSrcweir #include <comphelper/types.hxx>
33cdf0e10cSrcweir #include "TConnection.hxx"
34cdf0e10cSrcweir 
35cdf0e10cSrcweir // -------------------------------------------------------------------------
36cdf0e10cSrcweir using namespace comphelper;
37cdf0e10cSrcweir using namespace connectivity::ado;
38cdf0e10cSrcweir using namespace com::sun::star::uno;
39cdf0e10cSrcweir using namespace com::sun::star::lang;
40cdf0e10cSrcweir using namespace com::sun::star::beans;
41cdf0e10cSrcweir using namespace com::sun::star::sdbc;
42cdf0e10cSrcweir 
43cdf0e10cSrcweir //	IMPLEMENT_SERVICE_INFO(OAdoView,"com.sun.star.sdbcx.AView","com.sun.star.sdbcx.View");
44cdf0e10cSrcweir // -------------------------------------------------------------------------
OAdoView(sal_Bool _bCase,ADOView * _pView)45cdf0e10cSrcweir OAdoView::OAdoView(sal_Bool _bCase,ADOView* _pView) : OView_ADO(_bCase,NULL)
46cdf0e10cSrcweir ,m_aView(_pView)
47cdf0e10cSrcweir {
48cdf0e10cSrcweir }
49cdf0e10cSrcweir //--------------------------------------------------------------------------
getUnoTunnelImplementationId()50cdf0e10cSrcweir Sequence< sal_Int8 > OAdoView::getUnoTunnelImplementationId()
51cdf0e10cSrcweir {
52cdf0e10cSrcweir 	static ::cppu::OImplementationId * pId = 0;
53cdf0e10cSrcweir 	if (! pId)
54cdf0e10cSrcweir 	{
55cdf0e10cSrcweir 		::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
56cdf0e10cSrcweir 		if (! pId)
57cdf0e10cSrcweir 		{
58cdf0e10cSrcweir 			static ::cppu::OImplementationId aId;
59cdf0e10cSrcweir 			pId = &aId;
60cdf0e10cSrcweir 		}
61cdf0e10cSrcweir 	}
62cdf0e10cSrcweir 	return pId->getImplementationId();
63cdf0e10cSrcweir }
64cdf0e10cSrcweir 
65cdf0e10cSrcweir // com::sun::star::lang::XUnoTunnel
66cdf0e10cSrcweir //------------------------------------------------------------------
getSomething(const Sequence<sal_Int8> & rId)67cdf0e10cSrcweir sal_Int64 OAdoView::getSomething( const Sequence< sal_Int8 > & rId ) throw (RuntimeException)
68cdf0e10cSrcweir {
69cdf0e10cSrcweir 	return (rId.getLength() == 16 && 0 == rtl_compareMemory(getUnoTunnelImplementationId().getConstArray(),  rId.getConstArray(), 16 ) )
70cdf0e10cSrcweir 				? reinterpret_cast< sal_Int64 >( this )
71cdf0e10cSrcweir 				: OView_ADO::getSomething(rId);
72cdf0e10cSrcweir }
73cdf0e10cSrcweir 
74cdf0e10cSrcweir // -------------------------------------------------------------------------
getFastPropertyValue(Any & rValue,sal_Int32 nHandle) const75cdf0e10cSrcweir void OAdoView::getFastPropertyValue(Any& rValue,sal_Int32 nHandle) const
76cdf0e10cSrcweir {
77cdf0e10cSrcweir 	if(m_aView.IsValid())
78cdf0e10cSrcweir 	{
79cdf0e10cSrcweir 		switch(nHandle)
80cdf0e10cSrcweir 		{
81cdf0e10cSrcweir 			case PROPERTY_ID_NAME:
82cdf0e10cSrcweir 				rValue <<= m_aView.get_Name();
83cdf0e10cSrcweir 				break;
84cdf0e10cSrcweir 			case PROPERTY_ID_CATALOGNAME:
85cdf0e10cSrcweir 				break;
86cdf0e10cSrcweir 			case PROPERTY_ID_SCHEMANAME:
87cdf0e10cSrcweir 				//	rValue <<= m_aView.get_Type();
88cdf0e10cSrcweir 				break;
89cdf0e10cSrcweir 			case PROPERTY_ID_COMMAND:
90cdf0e10cSrcweir 				{
91cdf0e10cSrcweir 					OLEVariant aVar;
92cdf0e10cSrcweir 					m_aView.get_Command(aVar);
93cdf0e10cSrcweir 					if(!aVar.isNull() && !aVar.isEmpty())
94cdf0e10cSrcweir 					{
95cdf0e10cSrcweir 						ADOCommand* pCom = (ADOCommand*)aVar.getIDispatch();
96cdf0e10cSrcweir 						OLEString aBSTR;
97cdf0e10cSrcweir 						pCom->get_CommandText(&aBSTR);
98cdf0e10cSrcweir 						rValue <<= (::rtl::OUString) aBSTR;
99cdf0e10cSrcweir 					}
100cdf0e10cSrcweir 				}
101cdf0e10cSrcweir 				break;
102cdf0e10cSrcweir 		}
103cdf0e10cSrcweir 	}
104cdf0e10cSrcweir 	else
105cdf0e10cSrcweir 		OView_ADO::getFastPropertyValue(rValue,nHandle);
106cdf0e10cSrcweir }
107cdf0e10cSrcweir // -----------------------------------------------------------------------------
acquire()108cdf0e10cSrcweir void SAL_CALL OAdoView::acquire() throw()
109cdf0e10cSrcweir {
110cdf0e10cSrcweir 	OView_ADO::acquire();
111cdf0e10cSrcweir }
112cdf0e10cSrcweir // -----------------------------------------------------------------------------
release()113cdf0e10cSrcweir void SAL_CALL OAdoView::release() throw()
114cdf0e10cSrcweir {
115cdf0e10cSrcweir 	OView_ADO::release();
116cdf0e10cSrcweir }
117cdf0e10cSrcweir // -----------------------------------------------------------------------------
118cdf0e10cSrcweir 
119cdf0e10cSrcweir 
120