1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
29*cdf0e10cSrcweir #include "precompiled_connectivity.hxx"
30*cdf0e10cSrcweir #include "ado/Awrapado.hxx"
31*cdf0e10cSrcweir #include "ado/Awrapadox.hxx"
32*cdf0e10cSrcweir #include <comphelper/types.hxx>
33*cdf0e10cSrcweir #include <rtl/ustrbuf.hxx>
34*cdf0e10cSrcweir #include "diagnose_ex.h"
35*cdf0e10cSrcweir 
36*cdf0e10cSrcweir namespace connectivity
37*cdf0e10cSrcweir {
38*cdf0e10cSrcweir 	namespace ado
39*cdf0e10cSrcweir 	{
40*cdf0e10cSrcweir 		sal_Int32 nAdoObjectCounter = 0;
41*cdf0e10cSrcweir 	}
42*cdf0e10cSrcweir }
43*cdf0e10cSrcweir 
44*cdf0e10cSrcweir using namespace connectivity::ado;
45*cdf0e10cSrcweir 
46*cdf0e10cSrcweir void WpADOCatalog::Create()
47*cdf0e10cSrcweir {
48*cdf0e10cSrcweir 	HRESULT         hr = -1;
49*cdf0e10cSrcweir 	_ADOCatalog* pCommand;
50*cdf0e10cSrcweir 	hr = CoCreateInstance(ADOS::CLSID_ADOCATALOG_25,
51*cdf0e10cSrcweir 						  NULL,
52*cdf0e10cSrcweir 						  CLSCTX_INPROC_SERVER,
53*cdf0e10cSrcweir 						  ADOS::IID_ADOCATALOG_25,
54*cdf0e10cSrcweir 						  (void**)&pCommand );
55*cdf0e10cSrcweir 
56*cdf0e10cSrcweir 
57*cdf0e10cSrcweir 	if( !FAILED( hr ) )
58*cdf0e10cSrcweir 		setWithOutAddRef(pCommand);
59*cdf0e10cSrcweir }
60*cdf0e10cSrcweir 
61*cdf0e10cSrcweir 
62*cdf0e10cSrcweir WpADOProperties WpADOConnection::get_Properties() const
63*cdf0e10cSrcweir {
64*cdf0e10cSrcweir 	ADOProperties* pProps=NULL;
65*cdf0e10cSrcweir 	pInterface->get_Properties(&pProps);
66*cdf0e10cSrcweir 	WpADOProperties aProps;
67*cdf0e10cSrcweir 	aProps.setWithOutAddRef(pProps);
68*cdf0e10cSrcweir 	return aProps;
69*cdf0e10cSrcweir }
70*cdf0e10cSrcweir 
71*cdf0e10cSrcweir rtl::OUString WpADOConnection::GetConnectionString() const
72*cdf0e10cSrcweir {
73*cdf0e10cSrcweir 	OSL_ENSURE(pInterface,"Interface is null!");
74*cdf0e10cSrcweir 	OLEString aBSTR;
75*cdf0e10cSrcweir 	pInterface->get_ConnectionString(&aBSTR);
76*cdf0e10cSrcweir 	return aBSTR;
77*cdf0e10cSrcweir }
78*cdf0e10cSrcweir 
79*cdf0e10cSrcweir sal_Bool WpADOConnection::PutConnectionString(const ::rtl::OUString &aCon) const
80*cdf0e10cSrcweir {
81*cdf0e10cSrcweir 	OSL_ENSURE(pInterface,"Interface is null!");
82*cdf0e10cSrcweir 	OLEString bstr(aCon);
83*cdf0e10cSrcweir 	sal_Bool bErg = SUCCEEDED(pInterface->put_ConnectionString(bstr));
84*cdf0e10cSrcweir 
85*cdf0e10cSrcweir 	return bErg;
86*cdf0e10cSrcweir }
87*cdf0e10cSrcweir 
88*cdf0e10cSrcweir sal_Int32 WpADOConnection::GetCommandTimeout() const
89*cdf0e10cSrcweir {
90*cdf0e10cSrcweir 	OSL_ENSURE(pInterface,"Interface is null!");
91*cdf0e10cSrcweir 	sal_Int32 nRet=0;
92*cdf0e10cSrcweir 	pInterface->get_CommandTimeout(&nRet);
93*cdf0e10cSrcweir 	return nRet;
94*cdf0e10cSrcweir }
95*cdf0e10cSrcweir 
96*cdf0e10cSrcweir void WpADOConnection::PutCommandTimeout(sal_Int32 nRet)
97*cdf0e10cSrcweir {
98*cdf0e10cSrcweir 	OSL_ENSURE(pInterface,"Interface is null!");
99*cdf0e10cSrcweir 	pInterface->put_CommandTimeout(nRet);
100*cdf0e10cSrcweir }
101*cdf0e10cSrcweir 
102*cdf0e10cSrcweir sal_Int32 WpADOConnection::GetConnectionTimeout() const
103*cdf0e10cSrcweir {
104*cdf0e10cSrcweir 	OSL_ENSURE(pInterface,"Interface is null!");
105*cdf0e10cSrcweir 	sal_Int32 nRet=0;
106*cdf0e10cSrcweir 	pInterface->get_ConnectionTimeout(&nRet);
107*cdf0e10cSrcweir 	return nRet;
108*cdf0e10cSrcweir }
109*cdf0e10cSrcweir 
110*cdf0e10cSrcweir void WpADOConnection::PutConnectionTimeout(sal_Int32 nRet)
111*cdf0e10cSrcweir {
112*cdf0e10cSrcweir 	OSL_ENSURE(pInterface,"Interface is null!");
113*cdf0e10cSrcweir 	pInterface->put_ConnectionTimeout(nRet);
114*cdf0e10cSrcweir }
115*cdf0e10cSrcweir 
116*cdf0e10cSrcweir sal_Bool WpADOConnection::Close( )
117*cdf0e10cSrcweir {
118*cdf0e10cSrcweir 	OSL_ENSURE(pInterface,"Interface is null!");
119*cdf0e10cSrcweir 	return (SUCCEEDED(pInterface->Close()));
120*cdf0e10cSrcweir }
121*cdf0e10cSrcweir 
122*cdf0e10cSrcweir sal_Bool WpADOConnection::Execute(const ::rtl::OUString& _CommandText,OLEVariant& RecordsAffected,long Options, WpADORecordset** ppiRset)
123*cdf0e10cSrcweir {
124*cdf0e10cSrcweir 	OSL_ENSURE(pInterface,"Interface is null!");
125*cdf0e10cSrcweir 	OLEString sStr1(_CommandText);
126*cdf0e10cSrcweir 	sal_Bool bErg = SUCCEEDED(pInterface->Execute(sStr1,&RecordsAffected,Options,(_ADORecordset**)ppiRset));
127*cdf0e10cSrcweir 	return bErg;
128*cdf0e10cSrcweir }
129*cdf0e10cSrcweir 
130*cdf0e10cSrcweir sal_Bool WpADOConnection::BeginTrans()
131*cdf0e10cSrcweir {
132*cdf0e10cSrcweir 	OSL_ENSURE(pInterface,"Interface is null!");
133*cdf0e10cSrcweir 	sal_Int32 nIso=0;
134*cdf0e10cSrcweir 	return SUCCEEDED(pInterface->BeginTrans(&nIso));
135*cdf0e10cSrcweir }
136*cdf0e10cSrcweir 
137*cdf0e10cSrcweir sal_Bool WpADOConnection::CommitTrans( )
138*cdf0e10cSrcweir {
139*cdf0e10cSrcweir 	OSL_ENSURE(pInterface,"Interface is null!");
140*cdf0e10cSrcweir 	return SUCCEEDED(pInterface->CommitTrans());
141*cdf0e10cSrcweir }
142*cdf0e10cSrcweir 
143*cdf0e10cSrcweir sal_Bool WpADOConnection::RollbackTrans( )
144*cdf0e10cSrcweir {
145*cdf0e10cSrcweir 	OSL_ENSURE(pInterface,"Interface is null!");
146*cdf0e10cSrcweir 	return SUCCEEDED(pInterface->RollbackTrans());
147*cdf0e10cSrcweir }
148*cdf0e10cSrcweir 
149*cdf0e10cSrcweir sal_Bool WpADOConnection::Open(const ::rtl::OUString& ConnectionString, const ::rtl::OUString& UserID,const ::rtl::OUString& Password,long Options)
150*cdf0e10cSrcweir {
151*cdf0e10cSrcweir 	OSL_ENSURE(pInterface,"Interface is null!");
152*cdf0e10cSrcweir 	OLEString sStr1(ConnectionString);
153*cdf0e10cSrcweir 	OLEString sStr2(UserID);
154*cdf0e10cSrcweir 	OLEString sStr3(Password);
155*cdf0e10cSrcweir 	sal_Bool bErg = SUCCEEDED(pInterface->Open(sStr1,sStr2,sStr3,Options));
156*cdf0e10cSrcweir 	return bErg;
157*cdf0e10cSrcweir }
158*cdf0e10cSrcweir 
159*cdf0e10cSrcweir sal_Bool WpADOConnection::GetErrors(ADOErrors** pErrors)
160*cdf0e10cSrcweir {
161*cdf0e10cSrcweir 	OSL_ENSURE(pInterface,"Interface is null!");
162*cdf0e10cSrcweir 	return SUCCEEDED(pInterface->get_Errors(pErrors));
163*cdf0e10cSrcweir }
164*cdf0e10cSrcweir 
165*cdf0e10cSrcweir ::rtl::OUString WpADOConnection::GetDefaultDatabase() const
166*cdf0e10cSrcweir {
167*cdf0e10cSrcweir 	OSL_ENSURE(pInterface,"Interface is null!");
168*cdf0e10cSrcweir 	OLEString aBSTR; pInterface->get_DefaultDatabase(&aBSTR);
169*cdf0e10cSrcweir 	return aBSTR;
170*cdf0e10cSrcweir }
171*cdf0e10cSrcweir 
172*cdf0e10cSrcweir sal_Bool WpADOConnection::PutDefaultDatabase(const ::rtl::OUString& _bstr)
173*cdf0e10cSrcweir {
174*cdf0e10cSrcweir 	OSL_ENSURE(pInterface,"Interface is null!");
175*cdf0e10cSrcweir 	OLEString bstr(_bstr);
176*cdf0e10cSrcweir 	sal_Bool bErg = SUCCEEDED(pInterface->put_DefaultDatabase(bstr));
177*cdf0e10cSrcweir 
178*cdf0e10cSrcweir 	return bErg;
179*cdf0e10cSrcweir }
180*cdf0e10cSrcweir 
181*cdf0e10cSrcweir IsolationLevelEnum WpADOConnection::get_IsolationLevel() const
182*cdf0e10cSrcweir {
183*cdf0e10cSrcweir 	OSL_ENSURE(pInterface,"Interface is null!");
184*cdf0e10cSrcweir 	IsolationLevelEnum eNum=adXactUnspecified;
185*cdf0e10cSrcweir 	pInterface->get_IsolationLevel(&eNum);
186*cdf0e10cSrcweir 	return eNum;
187*cdf0e10cSrcweir }
188*cdf0e10cSrcweir 
189*cdf0e10cSrcweir sal_Bool WpADOConnection::put_IsolationLevel(const IsolationLevelEnum& eNum)
190*cdf0e10cSrcweir {
191*cdf0e10cSrcweir 	OSL_ENSURE(pInterface,"Interface is null!");
192*cdf0e10cSrcweir 	return SUCCEEDED(pInterface->put_IsolationLevel(eNum));
193*cdf0e10cSrcweir }
194*cdf0e10cSrcweir 
195*cdf0e10cSrcweir sal_Int32 WpADOConnection::get_Attributes() const
196*cdf0e10cSrcweir {
197*cdf0e10cSrcweir 	OSL_ENSURE(pInterface,"Interface is null!");
198*cdf0e10cSrcweir 	sal_Int32 nRet=0;
199*cdf0e10cSrcweir 	pInterface->get_Attributes(&nRet);
200*cdf0e10cSrcweir 	return nRet;
201*cdf0e10cSrcweir }
202*cdf0e10cSrcweir 
203*cdf0e10cSrcweir sal_Bool WpADOConnection::put_Attributes(sal_Int32 nRet)
204*cdf0e10cSrcweir {
205*cdf0e10cSrcweir 	OSL_ENSURE(pInterface,"Interface is null!");
206*cdf0e10cSrcweir 	return SUCCEEDED(pInterface->put_Attributes(nRet));
207*cdf0e10cSrcweir }
208*cdf0e10cSrcweir 
209*cdf0e10cSrcweir CursorLocationEnum WpADOConnection::get_CursorLocation() const
210*cdf0e10cSrcweir {
211*cdf0e10cSrcweir 	OSL_ENSURE(pInterface,"Interface is null!");
212*cdf0e10cSrcweir 	CursorLocationEnum eNum=adUseNone;
213*cdf0e10cSrcweir 	pInterface->get_CursorLocation(&eNum);
214*cdf0e10cSrcweir 	return eNum;
215*cdf0e10cSrcweir }
216*cdf0e10cSrcweir 
217*cdf0e10cSrcweir sal_Bool WpADOConnection::put_CursorLocation(const CursorLocationEnum &eNum)
218*cdf0e10cSrcweir {
219*cdf0e10cSrcweir 	OSL_ENSURE(pInterface,"Interface is null!");
220*cdf0e10cSrcweir 	return SUCCEEDED(pInterface->put_CursorLocation(eNum));
221*cdf0e10cSrcweir }
222*cdf0e10cSrcweir 
223*cdf0e10cSrcweir ConnectModeEnum WpADOConnection::get_Mode() const
224*cdf0e10cSrcweir {
225*cdf0e10cSrcweir 	OSL_ENSURE(pInterface,"Interface is null!");
226*cdf0e10cSrcweir 	ConnectModeEnum eNum=adModeUnknown;
227*cdf0e10cSrcweir 	pInterface->get_Mode(&eNum);
228*cdf0e10cSrcweir 	return eNum;
229*cdf0e10cSrcweir }
230*cdf0e10cSrcweir 
231*cdf0e10cSrcweir sal_Bool WpADOConnection::put_Mode(const ConnectModeEnum &eNum)
232*cdf0e10cSrcweir {
233*cdf0e10cSrcweir 	OSL_ENSURE(pInterface,"Interface is null!");
234*cdf0e10cSrcweir 	return SUCCEEDED(pInterface->put_Mode(eNum));
235*cdf0e10cSrcweir }
236*cdf0e10cSrcweir 
237*cdf0e10cSrcweir ::rtl::OUString WpADOConnection::get_Provider() const
238*cdf0e10cSrcweir {
239*cdf0e10cSrcweir 	OSL_ENSURE(pInterface,"Interface is null!");
240*cdf0e10cSrcweir 	OLEString aBSTR; pInterface->get_Provider(&aBSTR);
241*cdf0e10cSrcweir 	return aBSTR;
242*cdf0e10cSrcweir }
243*cdf0e10cSrcweir 
244*cdf0e10cSrcweir sal_Bool WpADOConnection::put_Provider(const ::rtl::OUString& _bstr)
245*cdf0e10cSrcweir {
246*cdf0e10cSrcweir 	OSL_ENSURE(pInterface,"Interface is null!");
247*cdf0e10cSrcweir 	OLEString bstr(_bstr);
248*cdf0e10cSrcweir 	return SUCCEEDED(pInterface->put_Provider(bstr));
249*cdf0e10cSrcweir }
250*cdf0e10cSrcweir 
251*cdf0e10cSrcweir sal_Int32 WpADOConnection::get_State() const
252*cdf0e10cSrcweir {
253*cdf0e10cSrcweir 	OSL_ENSURE(pInterface,"Interface is null!");
254*cdf0e10cSrcweir 	sal_Int32 nRet=0;
255*cdf0e10cSrcweir 	pInterface->get_State(&nRet);
256*cdf0e10cSrcweir 	return nRet;
257*cdf0e10cSrcweir }
258*cdf0e10cSrcweir 
259*cdf0e10cSrcweir sal_Bool WpADOConnection::OpenSchema(SchemaEnum eNum,OLEVariant& Restrictions,OLEVariant& SchemaID,ADORecordset**pprset)
260*cdf0e10cSrcweir {
261*cdf0e10cSrcweir 	OSL_ENSURE(pInterface,"Interface is null!");
262*cdf0e10cSrcweir 	return SUCCEEDED(pInterface->OpenSchema(eNum,Restrictions,SchemaID,pprset));
263*cdf0e10cSrcweir }
264*cdf0e10cSrcweir 
265*cdf0e10cSrcweir ::rtl::OUString WpADOConnection::get_Version() const
266*cdf0e10cSrcweir {
267*cdf0e10cSrcweir 	OSL_ENSURE(pInterface,"Interface is null!");
268*cdf0e10cSrcweir 	OLEString aBSTR;
269*cdf0e10cSrcweir 	pInterface->get_Version(&aBSTR);
270*cdf0e10cSrcweir 	return aBSTR;
271*cdf0e10cSrcweir }
272*cdf0e10cSrcweir 
273*cdf0e10cSrcweir sal_Bool WpADOCommand::putref_ActiveConnection( WpADOConnection *pCon)
274*cdf0e10cSrcweir {
275*cdf0e10cSrcweir 	OSL_ENSURE(pInterface,"Interface is null!");
276*cdf0e10cSrcweir 	if(pCon)
277*cdf0e10cSrcweir 		return SUCCEEDED(pInterface->putref_ActiveConnection(pCon->pInterface));
278*cdf0e10cSrcweir 	else
279*cdf0e10cSrcweir 		return SUCCEEDED(pInterface->putref_ActiveConnection(NULL));
280*cdf0e10cSrcweir }
281*cdf0e10cSrcweir 
282*cdf0e10cSrcweir void WpADOCommand::put_ActiveConnection(/* [in] */ const OLEVariant& vConn)
283*cdf0e10cSrcweir {
284*cdf0e10cSrcweir 	OSL_ENSURE(pInterface,"Interface is null!");
285*cdf0e10cSrcweir 	pInterface->put_ActiveConnection(vConn);
286*cdf0e10cSrcweir }
287*cdf0e10cSrcweir 
288*cdf0e10cSrcweir void WpADOCommand::Create()
289*cdf0e10cSrcweir {
290*cdf0e10cSrcweir 	IClassFactory2* pInterface2	= NULL;
291*cdf0e10cSrcweir 	IUnknown        *pOuter		= NULL;
292*cdf0e10cSrcweir 	HRESULT         hr;
293*cdf0e10cSrcweir 	hr = CoGetClassObject( ADOS::CLSID_ADOCOMMAND_21,
294*cdf0e10cSrcweir 						  CLSCTX_INPROC_SERVER,
295*cdf0e10cSrcweir 						  NULL,
296*cdf0e10cSrcweir 						  IID_IClassFactory2,
297*cdf0e10cSrcweir 						  (void**)&pInterface2 );
298*cdf0e10cSrcweir 
299*cdf0e10cSrcweir 	if( !FAILED( hr ) )
300*cdf0e10cSrcweir 	{
301*cdf0e10cSrcweir 		ADOCommand* pCommand=NULL;
302*cdf0e10cSrcweir 
303*cdf0e10cSrcweir 		hr = pInterface2->CreateInstanceLic(  pOuter,
304*cdf0e10cSrcweir 											NULL,
305*cdf0e10cSrcweir 											ADOS::IID_ADOCOMMAND_21,
306*cdf0e10cSrcweir 											ADOS::GetKeyStr(),
307*cdf0e10cSrcweir 											(void**) &pCommand);
308*cdf0e10cSrcweir 
309*cdf0e10cSrcweir 		if( !FAILED( hr ) )
310*cdf0e10cSrcweir 		{
311*cdf0e10cSrcweir 			operator=(pCommand);
312*cdf0e10cSrcweir 			pCommand->Release();
313*cdf0e10cSrcweir 		}
314*cdf0e10cSrcweir 
315*cdf0e10cSrcweir 		pInterface2->Release();
316*cdf0e10cSrcweir 	}
317*cdf0e10cSrcweir }
318*cdf0e10cSrcweir 
319*cdf0e10cSrcweir sal_Int32 WpADOCommand::get_State() const
320*cdf0e10cSrcweir {
321*cdf0e10cSrcweir 	OSL_ENSURE(pInterface,"Interface is null!");
322*cdf0e10cSrcweir 	sal_Int32 nRet=0;
323*cdf0e10cSrcweir 	pInterface->get_State(&nRet);
324*cdf0e10cSrcweir 	return nRet;
325*cdf0e10cSrcweir }
326*cdf0e10cSrcweir 
327*cdf0e10cSrcweir ::rtl::OUString WpADOCommand::get_CommandText() const
328*cdf0e10cSrcweir {
329*cdf0e10cSrcweir 	OSL_ENSURE(pInterface,"Interface is null!");
330*cdf0e10cSrcweir 	OLEString aBSTR;
331*cdf0e10cSrcweir 	pInterface->get_CommandText(&aBSTR);
332*cdf0e10cSrcweir 	return aBSTR;
333*cdf0e10cSrcweir }
334*cdf0e10cSrcweir 
335*cdf0e10cSrcweir sal_Bool WpADOCommand::put_CommandText(const ::rtl::OUString &aCon)
336*cdf0e10cSrcweir {
337*cdf0e10cSrcweir 	OSL_ENSURE(pInterface,"Interface is null!");
338*cdf0e10cSrcweir 	OLEString bstr(aCon);
339*cdf0e10cSrcweir 	sal_Bool bErg = SUCCEEDED(pInterface->put_CommandText(bstr));
340*cdf0e10cSrcweir 
341*cdf0e10cSrcweir 	return bErg;
342*cdf0e10cSrcweir }
343*cdf0e10cSrcweir 
344*cdf0e10cSrcweir sal_Int32 WpADOCommand::get_CommandTimeout() const
345*cdf0e10cSrcweir {
346*cdf0e10cSrcweir 	OSL_ENSURE(pInterface,"Interface is null!");
347*cdf0e10cSrcweir 	sal_Int32 nRet=0;
348*cdf0e10cSrcweir 	pInterface->get_CommandTimeout(&nRet);
349*cdf0e10cSrcweir 	return nRet;
350*cdf0e10cSrcweir }
351*cdf0e10cSrcweir 
352*cdf0e10cSrcweir void WpADOCommand::put_CommandTimeout(sal_Int32 nRet)
353*cdf0e10cSrcweir {
354*cdf0e10cSrcweir 	OSL_ENSURE(pInterface,"Interface is null!");
355*cdf0e10cSrcweir 	pInterface->put_CommandTimeout(nRet);
356*cdf0e10cSrcweir }
357*cdf0e10cSrcweir 
358*cdf0e10cSrcweir sal_Bool WpADOCommand::get_Prepared() const
359*cdf0e10cSrcweir {
360*cdf0e10cSrcweir 	OSL_ENSURE(pInterface,"Interface is null!");
361*cdf0e10cSrcweir 	VARIANT_BOOL bPrepared = VARIANT_FALSE;
362*cdf0e10cSrcweir 	pInterface->get_Prepared(&bPrepared);
363*cdf0e10cSrcweir 	return bPrepared == VARIANT_TRUE;
364*cdf0e10cSrcweir }
365*cdf0e10cSrcweir 
366*cdf0e10cSrcweir sal_Bool WpADOCommand::put_Prepared(VARIANT_BOOL bPrepared) const
367*cdf0e10cSrcweir {
368*cdf0e10cSrcweir 	OSL_ENSURE(pInterface,"Interface is null!");
369*cdf0e10cSrcweir 	return SUCCEEDED(pInterface->put_Prepared(bPrepared));
370*cdf0e10cSrcweir }
371*cdf0e10cSrcweir 
372*cdf0e10cSrcweir sal_Bool WpADOCommand::Execute(OLEVariant& RecordsAffected,OLEVariant& Parameters,long Options, ADORecordset** ppiRset)
373*cdf0e10cSrcweir {
374*cdf0e10cSrcweir 	OSL_ENSURE(pInterface,"Interface is null!");
375*cdf0e10cSrcweir 	return SUCCEEDED(pInterface->Execute(&RecordsAffected,&Parameters,Options,ppiRset));
376*cdf0e10cSrcweir }
377*cdf0e10cSrcweir 
378*cdf0e10cSrcweir ADOParameter* WpADOCommand::CreateParameter(const ::rtl::OUString &_bstr,DataTypeEnum Type,ParameterDirectionEnum Direction,long nSize,const OLEVariant &Value)
379*cdf0e10cSrcweir {
380*cdf0e10cSrcweir 	OSL_ENSURE(pInterface,"Interface is null!");
381*cdf0e10cSrcweir 	ADOParameter* pPara = NULL;
382*cdf0e10cSrcweir 	OLEString bstr(_bstr);
383*cdf0e10cSrcweir 	sal_Bool bErg = SUCCEEDED(pInterface->CreateParameter(bstr,Type,Direction,nSize,Value,&pPara));
384*cdf0e10cSrcweir 
385*cdf0e10cSrcweir 	return bErg ? pPara : NULL;
386*cdf0e10cSrcweir }
387*cdf0e10cSrcweir 
388*cdf0e10cSrcweir ADOParameters* WpADOCommand::get_Parameters() const
389*cdf0e10cSrcweir {
390*cdf0e10cSrcweir 	OSL_ENSURE(pInterface,"Interface is null!");
391*cdf0e10cSrcweir 	ADOParameters* pPara=NULL;
392*cdf0e10cSrcweir 	pInterface->get_Parameters(&pPara);
393*cdf0e10cSrcweir 	return pPara;
394*cdf0e10cSrcweir }
395*cdf0e10cSrcweir 
396*cdf0e10cSrcweir sal_Bool WpADOCommand::put_CommandType( /* [in] */ CommandTypeEnum lCmdType)
397*cdf0e10cSrcweir {
398*cdf0e10cSrcweir 	OSL_ENSURE(pInterface,"Interface is null!");
399*cdf0e10cSrcweir 	return SUCCEEDED(pInterface->put_CommandType(lCmdType));
400*cdf0e10cSrcweir }
401*cdf0e10cSrcweir 
402*cdf0e10cSrcweir CommandTypeEnum WpADOCommand::get_CommandType( ) const
403*cdf0e10cSrcweir {
404*cdf0e10cSrcweir 	OSL_ENSURE(pInterface,"Interface is null!");
405*cdf0e10cSrcweir 	CommandTypeEnum eNum=adCmdUnspecified;
406*cdf0e10cSrcweir 	pInterface->get_CommandType(&eNum);
407*cdf0e10cSrcweir 	return eNum;
408*cdf0e10cSrcweir }
409*cdf0e10cSrcweir 
410*cdf0e10cSrcweir // gibt den Namen des Feldes zur"ueck
411*cdf0e10cSrcweir ::rtl::OUString WpADOCommand::GetName() const
412*cdf0e10cSrcweir {
413*cdf0e10cSrcweir 	OSL_ENSURE(pInterface,"Interface is null!");
414*cdf0e10cSrcweir 	OLEString aBSTR;
415*cdf0e10cSrcweir 	pInterface->get_Name(&aBSTR);
416*cdf0e10cSrcweir 	return aBSTR;
417*cdf0e10cSrcweir }
418*cdf0e10cSrcweir 
419*cdf0e10cSrcweir sal_Bool WpADOCommand::put_Name(const ::rtl::OUString& _Name)
420*cdf0e10cSrcweir {
421*cdf0e10cSrcweir 	OSL_ENSURE(pInterface,"Interface is null!");
422*cdf0e10cSrcweir 	OLEString bstr(_Name);
423*cdf0e10cSrcweir 	sal_Bool bErg = SUCCEEDED(pInterface->put_Name(bstr));
424*cdf0e10cSrcweir 
425*cdf0e10cSrcweir 	return bErg;
426*cdf0e10cSrcweir }
427*cdf0e10cSrcweir sal_Bool WpADOCommand::Cancel()
428*cdf0e10cSrcweir {
429*cdf0e10cSrcweir 	OSL_ENSURE(pInterface,"Interface is null!");
430*cdf0e10cSrcweir 	return SUCCEEDED(pInterface->Cancel());
431*cdf0e10cSrcweir }
432*cdf0e10cSrcweir 
433*cdf0e10cSrcweir ::rtl::OUString WpADOError::GetDescription() const
434*cdf0e10cSrcweir {
435*cdf0e10cSrcweir 	OSL_ENSURE(pInterface,"Interface is null!");
436*cdf0e10cSrcweir 	OLEString aBSTR;
437*cdf0e10cSrcweir 	pInterface->get_Description(&aBSTR);
438*cdf0e10cSrcweir 	return aBSTR;
439*cdf0e10cSrcweir }
440*cdf0e10cSrcweir 
441*cdf0e10cSrcweir  ::rtl::OUString WpADOError::GetSource() const
442*cdf0e10cSrcweir {
443*cdf0e10cSrcweir 	 OSL_ENSURE(pInterface,"Interface is null!");
444*cdf0e10cSrcweir 	OLEString aBSTR;
445*cdf0e10cSrcweir 	pInterface->get_Source(&aBSTR);
446*cdf0e10cSrcweir 	return aBSTR;
447*cdf0e10cSrcweir }
448*cdf0e10cSrcweir 
449*cdf0e10cSrcweir  sal_Int32 WpADOError::GetNumber() const
450*cdf0e10cSrcweir {
451*cdf0e10cSrcweir 	 OSL_ENSURE(pInterface,"Interface is null!");
452*cdf0e10cSrcweir 	sal_Int32 nErrNr=0;
453*cdf0e10cSrcweir 	pInterface->get_Number(&nErrNr);
454*cdf0e10cSrcweir 	return nErrNr;
455*cdf0e10cSrcweir }
456*cdf0e10cSrcweir 
457*cdf0e10cSrcweir  ::rtl::OUString WpADOError::GetSQLState() const
458*cdf0e10cSrcweir {
459*cdf0e10cSrcweir 	 OSL_ENSURE(pInterface,"Interface is null!");
460*cdf0e10cSrcweir 	OLEString aBSTR;
461*cdf0e10cSrcweir 	pInterface->get_SQLState(&aBSTR);
462*cdf0e10cSrcweir 	return aBSTR;
463*cdf0e10cSrcweir }
464*cdf0e10cSrcweir 
465*cdf0e10cSrcweir  sal_Int32 WpADOError::GetNativeError() const
466*cdf0e10cSrcweir {
467*cdf0e10cSrcweir 	 OSL_ENSURE(pInterface,"Interface is null!");
468*cdf0e10cSrcweir 	sal_Int32 nErrNr=0;
469*cdf0e10cSrcweir 	pInterface->get_NativeError(&nErrNr);
470*cdf0e10cSrcweir 	return nErrNr;
471*cdf0e10cSrcweir }
472*cdf0e10cSrcweir WpADOProperties WpADOField::get_Properties()
473*cdf0e10cSrcweir {
474*cdf0e10cSrcweir 	 OSL_ENSURE(pInterface,"Interface is null!");
475*cdf0e10cSrcweir 	ADOProperties* pProps = NULL;
476*cdf0e10cSrcweir 	pInterface->get_Properties(&pProps);
477*cdf0e10cSrcweir 	WpADOProperties aProps;
478*cdf0e10cSrcweir 
479*cdf0e10cSrcweir 	aProps.setWithOutAddRef(pProps);
480*cdf0e10cSrcweir 	return aProps;
481*cdf0e10cSrcweir }
482*cdf0e10cSrcweir 
483*cdf0e10cSrcweir  sal_Int32 WpADOField::GetActualSize() const
484*cdf0e10cSrcweir {
485*cdf0e10cSrcweir 	 OSL_ENSURE(pInterface,"Interface is null!");
486*cdf0e10cSrcweir 	sal_Int32 nActualSize=0;
487*cdf0e10cSrcweir 	pInterface->get_ActualSize(&nActualSize);
488*cdf0e10cSrcweir 	return nActualSize;
489*cdf0e10cSrcweir }
490*cdf0e10cSrcweir 
491*cdf0e10cSrcweir  sal_Int32 WpADOField::GetAttributes() const
492*cdf0e10cSrcweir {
493*cdf0e10cSrcweir 	 OSL_ENSURE(pInterface,"Interface is null!");
494*cdf0e10cSrcweir 	sal_Int32 eADOSFieldAttributes=0;
495*cdf0e10cSrcweir 	pInterface->get_Attributes(&eADOSFieldAttributes);
496*cdf0e10cSrcweir 	return eADOSFieldAttributes;
497*cdf0e10cSrcweir }
498*cdf0e10cSrcweir 
499*cdf0e10cSrcweir sal_Int32 WpADOField::GetStatus() const
500*cdf0e10cSrcweir {
501*cdf0e10cSrcweir 	OSL_ENSURE(pInterface,"Interface is null!");
502*cdf0e10cSrcweir 	sal_Int32 eADOSFieldAttributes=0;
503*cdf0e10cSrcweir 	//	pInterface->get_Status(&eADOSFieldAttributes);
504*cdf0e10cSrcweir 	return eADOSFieldAttributes;
505*cdf0e10cSrcweir }
506*cdf0e10cSrcweir 
507*cdf0e10cSrcweir sal_Int32 WpADOField::GetDefinedSize() const
508*cdf0e10cSrcweir {
509*cdf0e10cSrcweir 	OSL_ENSURE(pInterface,"Interface is null!");
510*cdf0e10cSrcweir 	sal_Int32 nDefinedSize=0;
511*cdf0e10cSrcweir 	pInterface->get_DefinedSize(&nDefinedSize);
512*cdf0e10cSrcweir 	return nDefinedSize;
513*cdf0e10cSrcweir }
514*cdf0e10cSrcweir 
515*cdf0e10cSrcweir // gibt den Namen des Feldes zur"ueck
516*cdf0e10cSrcweir ::rtl::OUString WpADOField::GetName() const
517*cdf0e10cSrcweir {
518*cdf0e10cSrcweir 	OSL_ENSURE(pInterface,"Interface is null!");
519*cdf0e10cSrcweir 	OLEString aBSTR;
520*cdf0e10cSrcweir 	pInterface->get_Name(&aBSTR);
521*cdf0e10cSrcweir 	return aBSTR;
522*cdf0e10cSrcweir }
523*cdf0e10cSrcweir 
524*cdf0e10cSrcweir  DataTypeEnum WpADOField::GetADOType() const
525*cdf0e10cSrcweir {
526*cdf0e10cSrcweir 	OSL_ENSURE(pInterface,"Interface is null!");
527*cdf0e10cSrcweir 	DataTypeEnum eType=adEmpty;
528*cdf0e10cSrcweir 	pInterface->get_Type(&eType);
529*cdf0e10cSrcweir 	return eType;
530*cdf0e10cSrcweir }
531*cdf0e10cSrcweir 
532*cdf0e10cSrcweir  void WpADOField::get_Value(OLEVariant& aValVar) const
533*cdf0e10cSrcweir {
534*cdf0e10cSrcweir 	OSL_ENSURE(pInterface,"Interface is null!");
535*cdf0e10cSrcweir 	aValVar.setEmpty();
536*cdf0e10cSrcweir 	sal_Bool bOk = SUCCEEDED(pInterface->get_Value(&aValVar));
537*cdf0e10cSrcweir     (void)bOk;
538*cdf0e10cSrcweir }
539*cdf0e10cSrcweir 
540*cdf0e10cSrcweir  OLEVariant WpADOField::get_Value() const
541*cdf0e10cSrcweir {
542*cdf0e10cSrcweir 	OSL_ENSURE(pInterface,"Interface is null!");
543*cdf0e10cSrcweir 	OLEVariant aValVar;
544*cdf0e10cSrcweir 	pInterface->get_Value(&aValVar);
545*cdf0e10cSrcweir 	return aValVar;
546*cdf0e10cSrcweir }
547*cdf0e10cSrcweir 
548*cdf0e10cSrcweir  sal_Bool WpADOField::PutValue(const OLEVariant& aVariant)
549*cdf0e10cSrcweir {
550*cdf0e10cSrcweir 	OSL_ENSURE(pInterface,"Interface is null!");
551*cdf0e10cSrcweir 	return (SUCCEEDED(pInterface->put_Value(aVariant)));
552*cdf0e10cSrcweir }
553*cdf0e10cSrcweir 
554*cdf0e10cSrcweir sal_Int32 WpADOField::GetPrecision() const
555*cdf0e10cSrcweir {
556*cdf0e10cSrcweir 	OSL_ENSURE(pInterface,"Interface is null!");
557*cdf0e10cSrcweir 	sal_uInt8 eType=0;
558*cdf0e10cSrcweir 	pInterface->get_Precision(&eType);
559*cdf0e10cSrcweir 	return eType;
560*cdf0e10cSrcweir }
561*cdf0e10cSrcweir 
562*cdf0e10cSrcweir  sal_Int32 WpADOField::GetNumericScale() const
563*cdf0e10cSrcweir {
564*cdf0e10cSrcweir 	OSL_ENSURE(pInterface,"Interface is null!");
565*cdf0e10cSrcweir 	sal_uInt8 eType=0;
566*cdf0e10cSrcweir 	pInterface->get_NumericScale(&eType);
567*cdf0e10cSrcweir 	return eType;
568*cdf0e10cSrcweir }
569*cdf0e10cSrcweir 
570*cdf0e10cSrcweir  sal_Bool WpADOField::AppendChunk(const OLEVariant& _Variant)
571*cdf0e10cSrcweir {
572*cdf0e10cSrcweir 	OSL_ENSURE(pInterface,"Interface is null!");
573*cdf0e10cSrcweir 	return (SUCCEEDED(pInterface->AppendChunk(_Variant)));
574*cdf0e10cSrcweir }
575*cdf0e10cSrcweir 
576*cdf0e10cSrcweir OLEVariant WpADOField::GetChunk(long Length) const
577*cdf0e10cSrcweir {
578*cdf0e10cSrcweir 	OSL_ENSURE(pInterface,"Interface is null!");
579*cdf0e10cSrcweir 	OLEVariant aValVar;
580*cdf0e10cSrcweir 	pInterface->GetChunk(Length,&aValVar);
581*cdf0e10cSrcweir 	return aValVar;
582*cdf0e10cSrcweir }
583*cdf0e10cSrcweir 
584*cdf0e10cSrcweir void WpADOField::GetChunk(long Length,OLEVariant &aValVar) const
585*cdf0e10cSrcweir {
586*cdf0e10cSrcweir 	OSL_ENSURE(pInterface,"Interface is null!");
587*cdf0e10cSrcweir 	pInterface->GetChunk(Length,&aValVar);
588*cdf0e10cSrcweir }
589*cdf0e10cSrcweir 
590*cdf0e10cSrcweir OLEVariant WpADOField::GetOriginalValue() const
591*cdf0e10cSrcweir {
592*cdf0e10cSrcweir 	OSL_ENSURE(pInterface,"Interface is null!");
593*cdf0e10cSrcweir 	OLEVariant aValVar;
594*cdf0e10cSrcweir 	pInterface->get_OriginalValue(&aValVar);
595*cdf0e10cSrcweir 	return aValVar;
596*cdf0e10cSrcweir }
597*cdf0e10cSrcweir 
598*cdf0e10cSrcweir void WpADOField::GetOriginalValue(OLEVariant &aValVar) const
599*cdf0e10cSrcweir {
600*cdf0e10cSrcweir 	OSL_ENSURE(pInterface,"Interface is null!");
601*cdf0e10cSrcweir 	pInterface->get_OriginalValue(&aValVar);
602*cdf0e10cSrcweir }
603*cdf0e10cSrcweir 
604*cdf0e10cSrcweir OLEVariant WpADOField::GetUnderlyingValue() const
605*cdf0e10cSrcweir {
606*cdf0e10cSrcweir 	OSL_ENSURE(pInterface,"Interface is null!");
607*cdf0e10cSrcweir 	OLEVariant aValVar;
608*cdf0e10cSrcweir 	pInterface->get_UnderlyingValue(&aValVar);
609*cdf0e10cSrcweir 	return aValVar;
610*cdf0e10cSrcweir }
611*cdf0e10cSrcweir 
612*cdf0e10cSrcweir  void WpADOField::GetUnderlyingValue(OLEVariant &aValVar) const
613*cdf0e10cSrcweir {
614*cdf0e10cSrcweir 	 OSL_ENSURE(pInterface,"Interface is null!");
615*cdf0e10cSrcweir 	pInterface->get_UnderlyingValue(&aValVar);
616*cdf0e10cSrcweir }
617*cdf0e10cSrcweir 
618*cdf0e10cSrcweir  sal_Bool WpADOField::PutPrecision(sal_Int8 _prec)
619*cdf0e10cSrcweir {
620*cdf0e10cSrcweir 	 OSL_ENSURE(pInterface,"Interface is null!");
621*cdf0e10cSrcweir 	return (SUCCEEDED(pInterface->put_Precision(_prec)));
622*cdf0e10cSrcweir }
623*cdf0e10cSrcweir 
624*cdf0e10cSrcweir  sal_Bool WpADOField::PutNumericScale(sal_Int8 _prec)
625*cdf0e10cSrcweir {
626*cdf0e10cSrcweir 	 OSL_ENSURE(pInterface,"Interface is null!");
627*cdf0e10cSrcweir 	return (SUCCEEDED(pInterface->put_NumericScale(_prec)));
628*cdf0e10cSrcweir }
629*cdf0e10cSrcweir 
630*cdf0e10cSrcweir  void WpADOField::PutADOType(DataTypeEnum eType)
631*cdf0e10cSrcweir {
632*cdf0e10cSrcweir 	 OSL_ENSURE(pInterface,"Interface is null!");
633*cdf0e10cSrcweir 	pInterface->put_Type(eType);
634*cdf0e10cSrcweir }
635*cdf0e10cSrcweir 
636*cdf0e10cSrcweir  sal_Bool WpADOField::PutDefinedSize(sal_Int32 _nDefSize)
637*cdf0e10cSrcweir {
638*cdf0e10cSrcweir 	 OSL_ENSURE(pInterface,"Interface is null!");
639*cdf0e10cSrcweir 	return (SUCCEEDED(pInterface->put_DefinedSize(_nDefSize)));
640*cdf0e10cSrcweir }
641*cdf0e10cSrcweir 
642*cdf0e10cSrcweir  sal_Bool WpADOField::PutAttributes(sal_Int32 _nDefSize)
643*cdf0e10cSrcweir {
644*cdf0e10cSrcweir 	 OSL_ENSURE(pInterface,"Interface is null!");
645*cdf0e10cSrcweir 	return (SUCCEEDED(pInterface->put_Attributes(_nDefSize)));
646*cdf0e10cSrcweir }
647*cdf0e10cSrcweir 
648*cdf0e10cSrcweir OLEVariant WpADOProperty::GetValue() const
649*cdf0e10cSrcweir {
650*cdf0e10cSrcweir 	OLEVariant aValVar;
651*cdf0e10cSrcweir 	if(pInterface)
652*cdf0e10cSrcweir 		pInterface->get_Value(&aValVar);
653*cdf0e10cSrcweir 	return aValVar;
654*cdf0e10cSrcweir }
655*cdf0e10cSrcweir 
656*cdf0e10cSrcweir void WpADOProperty::GetValue(OLEVariant &aValVar) const
657*cdf0e10cSrcweir {
658*cdf0e10cSrcweir 	OSL_ENSURE(pInterface,"Interface is null!");
659*cdf0e10cSrcweir 	if(pInterface)
660*cdf0e10cSrcweir 		pInterface->get_Value(&aValVar);
661*cdf0e10cSrcweir }
662*cdf0e10cSrcweir 
663*cdf0e10cSrcweir sal_Bool WpADOProperty::PutValue(const OLEVariant &aValVar)
664*cdf0e10cSrcweir {
665*cdf0e10cSrcweir 	OSL_ENSURE(pInterface,"Interface is null!");
666*cdf0e10cSrcweir 	return (SUCCEEDED(pInterface->put_Value(aValVar)));
667*cdf0e10cSrcweir }
668*cdf0e10cSrcweir 
669*cdf0e10cSrcweir  ::rtl::OUString WpADOProperty::GetName() const
670*cdf0e10cSrcweir {
671*cdf0e10cSrcweir 	 OSL_ENSURE(pInterface,"Interface is null!");
672*cdf0e10cSrcweir 	OLEString aBSTR;
673*cdf0e10cSrcweir 	pInterface->get_Name(&aBSTR);
674*cdf0e10cSrcweir 	return aBSTR;
675*cdf0e10cSrcweir }
676*cdf0e10cSrcweir 
677*cdf0e10cSrcweir  DataTypeEnum WpADOProperty::GetADOType() const
678*cdf0e10cSrcweir {
679*cdf0e10cSrcweir 	 OSL_ENSURE(pInterface,"Interface is null!");
680*cdf0e10cSrcweir 	DataTypeEnum eType=adEmpty;
681*cdf0e10cSrcweir 	pInterface->get_Type(&eType);
682*cdf0e10cSrcweir 	return eType;
683*cdf0e10cSrcweir }
684*cdf0e10cSrcweir 
685*cdf0e10cSrcweir  sal_Int32 WpADOProperty::GetAttributes() const
686*cdf0e10cSrcweir {
687*cdf0e10cSrcweir 	 OSL_ENSURE(pInterface,"Interface is null!");
688*cdf0e10cSrcweir 	sal_Int32 eADOSFieldAttributes=0;
689*cdf0e10cSrcweir 	pInterface->get_Attributes(&eADOSFieldAttributes);
690*cdf0e10cSrcweir 	return eADOSFieldAttributes;
691*cdf0e10cSrcweir }
692*cdf0e10cSrcweir 
693*cdf0e10cSrcweir  sal_Bool WpADOProperty::PutAttributes(sal_Int32 _nDefSize)
694*cdf0e10cSrcweir {
695*cdf0e10cSrcweir 	 OSL_ENSURE(pInterface,"Interface is null!");
696*cdf0e10cSrcweir 	return (SUCCEEDED(pInterface->put_Attributes(_nDefSize)));
697*cdf0e10cSrcweir }
698*cdf0e10cSrcweir  void WpADORecordset::Create()
699*cdf0e10cSrcweir {
700*cdf0e10cSrcweir 	IClassFactory2* pInterface2	= NULL;
701*cdf0e10cSrcweir 	IUnknown        *pOuter		= NULL;
702*cdf0e10cSrcweir 	HRESULT         hr;
703*cdf0e10cSrcweir 	hr = CoGetClassObject( ADOS::CLSID_ADORECORDSET_21,
704*cdf0e10cSrcweir 						  CLSCTX_INPROC_SERVER,
705*cdf0e10cSrcweir 						  NULL,
706*cdf0e10cSrcweir 						  IID_IClassFactory2,
707*cdf0e10cSrcweir 						  (void**)&pInterface2 );
708*cdf0e10cSrcweir 
709*cdf0e10cSrcweir 	if( !FAILED( hr ) )
710*cdf0e10cSrcweir 	{
711*cdf0e10cSrcweir 		ADORecordset *pRec = NULL;
712*cdf0e10cSrcweir 		hr = pInterface2->CreateInstanceLic(  pOuter,
713*cdf0e10cSrcweir 											NULL,
714*cdf0e10cSrcweir 											ADOS::IID_ADORECORDSET_21,
715*cdf0e10cSrcweir 											ADOS::GetKeyStr(),
716*cdf0e10cSrcweir 											(void**) &pRec);
717*cdf0e10cSrcweir 
718*cdf0e10cSrcweir 		if( !FAILED( hr ) )
719*cdf0e10cSrcweir 		{
720*cdf0e10cSrcweir 			operator=(pRec);
721*cdf0e10cSrcweir 			pRec->Release();
722*cdf0e10cSrcweir 		}
723*cdf0e10cSrcweir 
724*cdf0e10cSrcweir 		pInterface2->Release();
725*cdf0e10cSrcweir 	}
726*cdf0e10cSrcweir }
727*cdf0e10cSrcweir 
728*cdf0e10cSrcweir  sal_Bool WpADORecordset::Open(
729*cdf0e10cSrcweir 		/* [optional][in] */ VARIANT Source,
730*cdf0e10cSrcweir 		/* [optional][in] */ VARIANT ActiveConnection,
731*cdf0e10cSrcweir 		/* [defaultvalue][in] */ CursorTypeEnum CursorType,
732*cdf0e10cSrcweir 		/* [defaultvalue][in] */ LockTypeEnum LockType,
733*cdf0e10cSrcweir 		/* [defaultvalue][in] */ sal_Int32 Options)
734*cdf0e10cSrcweir {
735*cdf0e10cSrcweir 	 OSL_ENSURE(pInterface,"Interface is null!");
736*cdf0e10cSrcweir 	return (SUCCEEDED(pInterface->Open(Source,ActiveConnection,CursorType,LockType,Options)));
737*cdf0e10cSrcweir }
738*cdf0e10cSrcweir 
739*cdf0e10cSrcweir 
740*cdf0e10cSrcweir LockTypeEnum WpADORecordset::GetLockType()
741*cdf0e10cSrcweir {
742*cdf0e10cSrcweir 	OSL_ENSURE(pInterface,"Interface is null!");
743*cdf0e10cSrcweir 	LockTypeEnum eType=adLockUnspecified;
744*cdf0e10cSrcweir 	pInterface->get_LockType(&eType);
745*cdf0e10cSrcweir 	return eType;
746*cdf0e10cSrcweir }
747*cdf0e10cSrcweir 
748*cdf0e10cSrcweir void WpADORecordset::Close()
749*cdf0e10cSrcweir {
750*cdf0e10cSrcweir 	OSL_ENSURE(pInterface,"Interface is null!");
751*cdf0e10cSrcweir 	OSL_ENSURE(pInterface,"Interface is null!");
752*cdf0e10cSrcweir 	pInterface->Close();
753*cdf0e10cSrcweir }
754*cdf0e10cSrcweir 
755*cdf0e10cSrcweir  sal_Bool WpADORecordset::Cancel() const
756*cdf0e10cSrcweir {
757*cdf0e10cSrcweir 	 OSL_ENSURE(pInterface,"Interface is null!");
758*cdf0e10cSrcweir 	return (SUCCEEDED(pInterface->Cancel()));
759*cdf0e10cSrcweir }
760*cdf0e10cSrcweir 
761*cdf0e10cSrcweir  sal_Int32 WpADORecordset::get_State( )
762*cdf0e10cSrcweir {
763*cdf0e10cSrcweir 	 OSL_ENSURE(pInterface,"Interface is null!");
764*cdf0e10cSrcweir 	sal_Int32 nState = 0;
765*cdf0e10cSrcweir 	pInterface->get_State(&nState);
766*cdf0e10cSrcweir 	return nState;
767*cdf0e10cSrcweir }
768*cdf0e10cSrcweir 
769*cdf0e10cSrcweir  sal_Bool WpADORecordset::Supports( /* [in] */ CursorOptionEnum CursorOptions)
770*cdf0e10cSrcweir {
771*cdf0e10cSrcweir 	 OSL_ENSURE(pInterface,"Interface is null!");
772*cdf0e10cSrcweir 	VARIANT_BOOL bSupports=VARIANT_FALSE;
773*cdf0e10cSrcweir 	pInterface->Supports(CursorOptions,&bSupports);
774*cdf0e10cSrcweir 	return bSupports == VARIANT_TRUE;
775*cdf0e10cSrcweir }
776*cdf0e10cSrcweir 
777*cdf0e10cSrcweir PositionEnum WpADORecordset::get_AbsolutePosition()
778*cdf0e10cSrcweir {
779*cdf0e10cSrcweir 	OSL_ENSURE(pInterface,"Interface is null!");
780*cdf0e10cSrcweir 	PositionEnum aTemp=adPosUnknown;
781*cdf0e10cSrcweir 	pInterface->get_AbsolutePosition(&aTemp);
782*cdf0e10cSrcweir 	return aTemp;
783*cdf0e10cSrcweir }
784*cdf0e10cSrcweir 
785*cdf0e10cSrcweir  void WpADORecordset::GetDataSource(IUnknown** _pInterface) const
786*cdf0e10cSrcweir {
787*cdf0e10cSrcweir 	 OSL_ENSURE(pInterface,"Interface is null!");
788*cdf0e10cSrcweir 	pInterface->get_DataSource(_pInterface);
789*cdf0e10cSrcweir }
790*cdf0e10cSrcweir 
791*cdf0e10cSrcweir  void WpADORecordset::PutRefDataSource(IUnknown* _pInterface)
792*cdf0e10cSrcweir {
793*cdf0e10cSrcweir 	 OSL_ENSURE(pInterface,"Interface is null!");
794*cdf0e10cSrcweir 	pInterface->putref_DataSource(_pInterface);
795*cdf0e10cSrcweir }
796*cdf0e10cSrcweir 
797*cdf0e10cSrcweir  void WpADORecordset::GetBookmark(VARIANT& var)
798*cdf0e10cSrcweir {
799*cdf0e10cSrcweir 	 OSL_ENSURE(pInterface,"Interface is null!");
800*cdf0e10cSrcweir 	pInterface->get_Bookmark(&var);
801*cdf0e10cSrcweir }
802*cdf0e10cSrcweir 
803*cdf0e10cSrcweir  OLEVariant WpADORecordset::GetBookmark()
804*cdf0e10cSrcweir {
805*cdf0e10cSrcweir 	 OSL_ENSURE(pInterface,"Interface is null!");
806*cdf0e10cSrcweir 	OLEVariant var;
807*cdf0e10cSrcweir 	pInterface->get_Bookmark(&var);
808*cdf0e10cSrcweir 	return var;
809*cdf0e10cSrcweir }
810*cdf0e10cSrcweir 
811*cdf0e10cSrcweir CompareEnum WpADORecordset::CompareBookmarks(const OLEVariant& left,const OLEVariant& right)
812*cdf0e10cSrcweir {
813*cdf0e10cSrcweir 	OSL_ENSURE(pInterface,"Interface is null!");
814*cdf0e10cSrcweir 	CompareEnum eNum=adCompareNotComparable;
815*cdf0e10cSrcweir 	pInterface->CompareBookmarks(left,right,&eNum);
816*cdf0e10cSrcweir 	return eNum;
817*cdf0e10cSrcweir }
818*cdf0e10cSrcweir 
819*cdf0e10cSrcweir  sal_Bool WpADORecordset::SetBookmark(const OLEVariant &pSafeAr)
820*cdf0e10cSrcweir {
821*cdf0e10cSrcweir 	 OSL_ENSURE(pInterface,"Interface is null!");
822*cdf0e10cSrcweir 	return SUCCEEDED(pInterface->put_Bookmark(pSafeAr));
823*cdf0e10cSrcweir }
824*cdf0e10cSrcweir 
825*cdf0e10cSrcweir 
826*cdf0e10cSrcweir WpADOFields WpADORecordset::GetFields() const
827*cdf0e10cSrcweir {
828*cdf0e10cSrcweir 	 OSL_ENSURE(pInterface,"Interface is null!");
829*cdf0e10cSrcweir 	ADOFields* pFields=NULL;
830*cdf0e10cSrcweir 	pInterface->get_Fields(&pFields);
831*cdf0e10cSrcweir 	WpADOFields aFields;
832*cdf0e10cSrcweir 	aFields.setWithOutAddRef(pFields);
833*cdf0e10cSrcweir 	return aFields;
834*cdf0e10cSrcweir }
835*cdf0e10cSrcweir 
836*cdf0e10cSrcweir 
837*cdf0e10cSrcweir  sal_Bool WpADORecordset::Move(sal_Int32 nRows, VARIANT aBmk)	{return pInterface && SUCCEEDED(pInterface->Move(nRows, aBmk));}
838*cdf0e10cSrcweir  sal_Bool WpADORecordset::MoveNext() {return pInterface && SUCCEEDED(pInterface->MoveNext());}
839*cdf0e10cSrcweir  sal_Bool WpADORecordset::MovePrevious() {return pInterface && SUCCEEDED(pInterface->MovePrevious());}
840*cdf0e10cSrcweir  sal_Bool WpADORecordset::MoveFirst() {return pInterface && SUCCEEDED(pInterface->MoveFirst());}
841*cdf0e10cSrcweir  sal_Bool WpADORecordset::MoveLast()	{return pInterface && SUCCEEDED(pInterface->MoveLast());}
842*cdf0e10cSrcweir 
843*cdf0e10cSrcweir  sal_Bool WpADORecordset::IsAtBOF() const
844*cdf0e10cSrcweir {
845*cdf0e10cSrcweir 	 OSL_ENSURE(pInterface,"Interface is null!");
846*cdf0e10cSrcweir 	VARIANT_BOOL bIsAtBOF=VARIANT_FALSE;
847*cdf0e10cSrcweir 	pInterface->get_BOF(&bIsAtBOF);
848*cdf0e10cSrcweir 	return bIsAtBOF == VARIANT_TRUE;
849*cdf0e10cSrcweir }
850*cdf0e10cSrcweir 
851*cdf0e10cSrcweir  sal_Bool WpADORecordset::IsAtEOF() const
852*cdf0e10cSrcweir {
853*cdf0e10cSrcweir 	 OSL_ENSURE(pInterface,"Interface is null!");
854*cdf0e10cSrcweir 	VARIANT_BOOL bIsAtEOF=VARIANT_FALSE;
855*cdf0e10cSrcweir 	pInterface->get_EOF(&bIsAtEOF);
856*cdf0e10cSrcweir 	return bIsAtEOF == VARIANT_TRUE;
857*cdf0e10cSrcweir }
858*cdf0e10cSrcweir 
859*cdf0e10cSrcweir  sal_Bool WpADORecordset::Delete(AffectEnum eNum)
860*cdf0e10cSrcweir {
861*cdf0e10cSrcweir 	 OSL_ENSURE(pInterface,"Interface is null!");
862*cdf0e10cSrcweir 	return SUCCEEDED(pInterface->Delete(eNum));
863*cdf0e10cSrcweir }
864*cdf0e10cSrcweir 
865*cdf0e10cSrcweir  sal_Bool WpADORecordset::AddNew(const OLEVariant &FieldList,const OLEVariant &Values)
866*cdf0e10cSrcweir {
867*cdf0e10cSrcweir 	 OSL_ENSURE(pInterface,"Interface is null!");
868*cdf0e10cSrcweir 	return SUCCEEDED(pInterface->AddNew(FieldList,Values));
869*cdf0e10cSrcweir }
870*cdf0e10cSrcweir 
871*cdf0e10cSrcweir  sal_Bool WpADORecordset::Update(const OLEVariant &FieldList,const OLEVariant &Values)
872*cdf0e10cSrcweir {
873*cdf0e10cSrcweir 	 OSL_ENSURE(pInterface,"Interface is null!");
874*cdf0e10cSrcweir 	return SUCCEEDED(pInterface->Update(FieldList,Values));
875*cdf0e10cSrcweir }
876*cdf0e10cSrcweir 
877*cdf0e10cSrcweir  sal_Bool WpADORecordset::CancelUpdate()
878*cdf0e10cSrcweir {
879*cdf0e10cSrcweir 	 OSL_ENSURE(pInterface,"Interface is null!");
880*cdf0e10cSrcweir 	return SUCCEEDED(pInterface->CancelUpdate());
881*cdf0e10cSrcweir }
882*cdf0e10cSrcweir 
883*cdf0e10cSrcweir WpADOProperties WpADORecordset::get_Properties() const
884*cdf0e10cSrcweir {
885*cdf0e10cSrcweir 	 OSL_ENSURE(pInterface,"Interface is null!");
886*cdf0e10cSrcweir 	ADOProperties* pProps=NULL;
887*cdf0e10cSrcweir 	pInterface->get_Properties(&pProps);
888*cdf0e10cSrcweir 	WpADOProperties aProps;
889*cdf0e10cSrcweir 	aProps.setWithOutAddRef(pProps);
890*cdf0e10cSrcweir 	return aProps;
891*cdf0e10cSrcweir }
892*cdf0e10cSrcweir 
893*cdf0e10cSrcweir  sal_Bool WpADORecordset::NextRecordset(OLEVariant& RecordsAffected,ADORecordset** ppiRset)
894*cdf0e10cSrcweir {
895*cdf0e10cSrcweir 	 OSL_ENSURE(pInterface,"Interface is null!");
896*cdf0e10cSrcweir 	return SUCCEEDED(pInterface->NextRecordset(&RecordsAffected,ppiRset));
897*cdf0e10cSrcweir }
898*cdf0e10cSrcweir 
899*cdf0e10cSrcweir  sal_Bool WpADORecordset::get_RecordCount(sal_Int32 &_nRet) const
900*cdf0e10cSrcweir {
901*cdf0e10cSrcweir 	 OSL_ENSURE(pInterface,"Interface is null!");
902*cdf0e10cSrcweir 	return SUCCEEDED(pInterface->get_RecordCount(&_nRet));
903*cdf0e10cSrcweir }
904*cdf0e10cSrcweir 
905*cdf0e10cSrcweir  sal_Bool WpADORecordset::get_MaxRecords(sal_Int32 &_nRet) const
906*cdf0e10cSrcweir {
907*cdf0e10cSrcweir 	 OSL_ENSURE(pInterface,"Interface is null!");
908*cdf0e10cSrcweir 	return SUCCEEDED(pInterface->get_MaxRecords(&_nRet));
909*cdf0e10cSrcweir }
910*cdf0e10cSrcweir 
911*cdf0e10cSrcweir  sal_Bool WpADORecordset::put_MaxRecords(sal_Int32 _nRet)
912*cdf0e10cSrcweir {
913*cdf0e10cSrcweir 	 OSL_ENSURE(pInterface,"Interface is null!");
914*cdf0e10cSrcweir 	return SUCCEEDED(pInterface->put_MaxRecords(_nRet));
915*cdf0e10cSrcweir }
916*cdf0e10cSrcweir 
917*cdf0e10cSrcweir  sal_Bool WpADORecordset::get_CursorType(CursorTypeEnum &_nRet) const
918*cdf0e10cSrcweir {
919*cdf0e10cSrcweir 	 OSL_ENSURE(pInterface,"Interface is null!");
920*cdf0e10cSrcweir 	return SUCCEEDED(pInterface->get_CursorType(&_nRet));
921*cdf0e10cSrcweir }
922*cdf0e10cSrcweir 
923*cdf0e10cSrcweir  sal_Bool WpADORecordset::put_CursorType(CursorTypeEnum _nRet)
924*cdf0e10cSrcweir {
925*cdf0e10cSrcweir 	 OSL_ENSURE(pInterface,"Interface is null!");
926*cdf0e10cSrcweir 	return SUCCEEDED(pInterface->put_CursorType(_nRet));
927*cdf0e10cSrcweir }
928*cdf0e10cSrcweir 
929*cdf0e10cSrcweir  sal_Bool WpADORecordset::get_LockType(LockTypeEnum &_nRet) const
930*cdf0e10cSrcweir {
931*cdf0e10cSrcweir 	 OSL_ENSURE(pInterface,"Interface is null!");
932*cdf0e10cSrcweir 	return SUCCEEDED(pInterface->get_LockType(&_nRet));
933*cdf0e10cSrcweir }
934*cdf0e10cSrcweir 
935*cdf0e10cSrcweir  sal_Bool WpADORecordset::put_LockType(LockTypeEnum _nRet)
936*cdf0e10cSrcweir {
937*cdf0e10cSrcweir 	 OSL_ENSURE(pInterface,"Interface is null!");
938*cdf0e10cSrcweir 	return SUCCEEDED(pInterface->put_LockType(_nRet));
939*cdf0e10cSrcweir }
940*cdf0e10cSrcweir 
941*cdf0e10cSrcweir  sal_Bool WpADORecordset::get_CacheSize(sal_Int32 &_nRet) const
942*cdf0e10cSrcweir {
943*cdf0e10cSrcweir 	 OSL_ENSURE(pInterface,"Interface is null!");
944*cdf0e10cSrcweir 	return SUCCEEDED(pInterface->get_CacheSize(&_nRet));
945*cdf0e10cSrcweir }
946*cdf0e10cSrcweir 
947*cdf0e10cSrcweir  sal_Bool WpADORecordset::put_CacheSize(sal_Int32 _nRet)
948*cdf0e10cSrcweir {
949*cdf0e10cSrcweir 	 OSL_ENSURE(pInterface,"Interface is null!");
950*cdf0e10cSrcweir 	return SUCCEEDED(pInterface->put_CacheSize(_nRet));
951*cdf0e10cSrcweir }
952*cdf0e10cSrcweir 
953*cdf0e10cSrcweir  sal_Bool WpADORecordset::UpdateBatch(AffectEnum AffectRecords)
954*cdf0e10cSrcweir {
955*cdf0e10cSrcweir 	 OSL_ENSURE(pInterface,"Interface is null!");
956*cdf0e10cSrcweir 	return SUCCEEDED(pInterface->UpdateBatch(AffectRecords));
957*cdf0e10cSrcweir }
958*cdf0e10cSrcweir 
959*cdf0e10cSrcweir  ::rtl::OUString WpADOParameter::GetName() const
960*cdf0e10cSrcweir {
961*cdf0e10cSrcweir 	 OSL_ENSURE(pInterface,"Interface is null!");
962*cdf0e10cSrcweir 	OLEString aBSTR;
963*cdf0e10cSrcweir 	pInterface->get_Name(&aBSTR);
964*cdf0e10cSrcweir 	return aBSTR;
965*cdf0e10cSrcweir }
966*cdf0e10cSrcweir 
967*cdf0e10cSrcweir  DataTypeEnum WpADOParameter::GetADOType() const
968*cdf0e10cSrcweir {
969*cdf0e10cSrcweir 	 OSL_ENSURE(pInterface,"Interface is null!");
970*cdf0e10cSrcweir 	DataTypeEnum eType=adEmpty;
971*cdf0e10cSrcweir 	pInterface->get_Type(&eType);
972*cdf0e10cSrcweir 	return eType;
973*cdf0e10cSrcweir }
974*cdf0e10cSrcweir 
975*cdf0e10cSrcweir void WpADOParameter::put_Type(const DataTypeEnum& _eType)
976*cdf0e10cSrcweir {
977*cdf0e10cSrcweir 	OSL_ENSURE(pInterface,"Interface is null!");
978*cdf0e10cSrcweir 	pInterface->put_Type(_eType);
979*cdf0e10cSrcweir }
980*cdf0e10cSrcweir 
981*cdf0e10cSrcweir  sal_Int32 WpADOParameter::GetAttributes() const
982*cdf0e10cSrcweir {
983*cdf0e10cSrcweir 	 OSL_ENSURE(pInterface,"Interface is null!");
984*cdf0e10cSrcweir 	sal_Int32 eADOSFieldAttributes=0;
985*cdf0e10cSrcweir 	pInterface->get_Attributes(&eADOSFieldAttributes);
986*cdf0e10cSrcweir 	return eADOSFieldAttributes;
987*cdf0e10cSrcweir }
988*cdf0e10cSrcweir 
989*cdf0e10cSrcweir  sal_Int32 WpADOParameter::GetPrecision() const
990*cdf0e10cSrcweir {
991*cdf0e10cSrcweir 	 OSL_ENSURE(pInterface,"Interface is null!");
992*cdf0e10cSrcweir 	sal_uInt8 eType=0;
993*cdf0e10cSrcweir 	pInterface->get_Precision(&eType);
994*cdf0e10cSrcweir 	return eType;
995*cdf0e10cSrcweir }
996*cdf0e10cSrcweir 
997*cdf0e10cSrcweir  sal_Int32 WpADOParameter::GetNumericScale() const
998*cdf0e10cSrcweir {
999*cdf0e10cSrcweir 	 OSL_ENSURE(pInterface,"Interface is null!");
1000*cdf0e10cSrcweir 	sal_uInt8 eType=0;
1001*cdf0e10cSrcweir 	pInterface->get_NumericScale(&eType);
1002*cdf0e10cSrcweir 	return eType;
1003*cdf0e10cSrcweir }
1004*cdf0e10cSrcweir 
1005*cdf0e10cSrcweir  ParameterDirectionEnum WpADOParameter::get_Direction() const
1006*cdf0e10cSrcweir {
1007*cdf0e10cSrcweir 	 OSL_ENSURE(pInterface,"Interface is null!");
1008*cdf0e10cSrcweir 	ParameterDirectionEnum alParmDirection=adParamUnknown;
1009*cdf0e10cSrcweir 	pInterface->get_Direction(&alParmDirection);
1010*cdf0e10cSrcweir 	return alParmDirection;
1011*cdf0e10cSrcweir }
1012*cdf0e10cSrcweir 
1013*cdf0e10cSrcweir  void WpADOParameter::GetValue(OLEVariant& aValVar) const
1014*cdf0e10cSrcweir {
1015*cdf0e10cSrcweir 	 OSL_ENSURE(pInterface,"Interface is null!");
1016*cdf0e10cSrcweir 	pInterface->get_Value(&aValVar);
1017*cdf0e10cSrcweir }
1018*cdf0e10cSrcweir 
1019*cdf0e10cSrcweir  OLEVariant WpADOParameter::GetValue() const
1020*cdf0e10cSrcweir {
1021*cdf0e10cSrcweir 	 OSL_ENSURE(pInterface,"Interface is null!");
1022*cdf0e10cSrcweir 	OLEVariant aValVar;
1023*cdf0e10cSrcweir 	pInterface->get_Value(&aValVar);
1024*cdf0e10cSrcweir 	return aValVar;
1025*cdf0e10cSrcweir }
1026*cdf0e10cSrcweir 
1027*cdf0e10cSrcweir sal_Bool WpADOParameter::PutValue(const OLEVariant& aVariant)
1028*cdf0e10cSrcweir {
1029*cdf0e10cSrcweir 	 OSL_ENSURE(pInterface,"Interface is null!");
1030*cdf0e10cSrcweir 	return (SUCCEEDED(pInterface->put_Value(aVariant)));
1031*cdf0e10cSrcweir }
1032*cdf0e10cSrcweir sal_Bool WpADOParameter::AppendChunk(const OLEVariant& aVariant)
1033*cdf0e10cSrcweir {
1034*cdf0e10cSrcweir 	OSL_ENSURE(pInterface,"Interface is null!");
1035*cdf0e10cSrcweir 	return (SUCCEEDED(pInterface->AppendChunk(aVariant)));
1036*cdf0e10cSrcweir }
1037*cdf0e10cSrcweir sal_Bool WpADOParameter::put_Size(const sal_Int32& _nSize)
1038*cdf0e10cSrcweir {
1039*cdf0e10cSrcweir 	OSL_ENSURE(pInterface,"Interface is null!");
1040*cdf0e10cSrcweir 	return (SUCCEEDED(pInterface->put_Size(_nSize)));
1041*cdf0e10cSrcweir }
1042*cdf0e10cSrcweir 
1043*cdf0e10cSrcweir  ::rtl::OUString WpADOColumn::get_Name() const
1044*cdf0e10cSrcweir {
1045*cdf0e10cSrcweir 	 OSL_ENSURE(pInterface,"Interface is null!");
1046*cdf0e10cSrcweir 	OLEString aBSTR;
1047*cdf0e10cSrcweir 	pInterface->get_Name(&aBSTR);
1048*cdf0e10cSrcweir 	return aBSTR;
1049*cdf0e10cSrcweir }
1050*cdf0e10cSrcweir 
1051*cdf0e10cSrcweir ::rtl::OUString WpADOColumn::get_RelatedColumn() const
1052*cdf0e10cSrcweir {
1053*cdf0e10cSrcweir 	OSL_ENSURE(pInterface,"Interface is null!");
1054*cdf0e10cSrcweir 	OLEString aBSTR;
1055*cdf0e10cSrcweir 	pInterface->get_RelatedColumn(&aBSTR);
1056*cdf0e10cSrcweir 	return aBSTR;
1057*cdf0e10cSrcweir }
1058*cdf0e10cSrcweir 
1059*cdf0e10cSrcweir void WpADOColumn::put_Name(const ::rtl::OUString& _rName)
1060*cdf0e10cSrcweir {
1061*cdf0e10cSrcweir 	OSL_ENSURE(pInterface,"Interface is null!");
1062*cdf0e10cSrcweir 	OLEString bstr(_rName);
1063*cdf0e10cSrcweir 	sal_Bool bErg = SUCCEEDED(pInterface->put_Name(bstr));
1064*cdf0e10cSrcweir     (void)bErg;
1065*cdf0e10cSrcweir }
1066*cdf0e10cSrcweir void WpADOColumn::put_RelatedColumn(const ::rtl::OUString& _rName)
1067*cdf0e10cSrcweir {
1068*cdf0e10cSrcweir 	OSL_ENSURE(pInterface,"Interface is null!");
1069*cdf0e10cSrcweir 	OLEString bstr(_rName);
1070*cdf0e10cSrcweir 	sal_Bool bErg = SUCCEEDED(pInterface->put_RelatedColumn(bstr));
1071*cdf0e10cSrcweir     (void)bErg;
1072*cdf0e10cSrcweir }
1073*cdf0e10cSrcweir 
1074*cdf0e10cSrcweir DataTypeEnum WpADOColumn::get_Type() const
1075*cdf0e10cSrcweir {
1076*cdf0e10cSrcweir 	OSL_ENSURE(pInterface,"Interface is null!");
1077*cdf0e10cSrcweir 	DataTypeEnum eNum = adVarChar;
1078*cdf0e10cSrcweir 	pInterface->get_Type(&eNum);
1079*cdf0e10cSrcweir 	return eNum;
1080*cdf0e10cSrcweir }
1081*cdf0e10cSrcweir 
1082*cdf0e10cSrcweir void WpADOColumn::put_Type(const DataTypeEnum& _eNum)
1083*cdf0e10cSrcweir {
1084*cdf0e10cSrcweir 	OSL_ENSURE(pInterface,"Interface is null!");
1085*cdf0e10cSrcweir 	pInterface->put_Type(_eNum);
1086*cdf0e10cSrcweir }
1087*cdf0e10cSrcweir 
1088*cdf0e10cSrcweir sal_Int32 WpADOColumn::get_Precision() const
1089*cdf0e10cSrcweir {
1090*cdf0e10cSrcweir 	OSL_ENSURE(pInterface,"Interface is null!");
1091*cdf0e10cSrcweir 	sal_Int32 nPrec=0;
1092*cdf0e10cSrcweir 	pInterface->get_Precision(&nPrec);
1093*cdf0e10cSrcweir 	return nPrec;
1094*cdf0e10cSrcweir }
1095*cdf0e10cSrcweir 
1096*cdf0e10cSrcweir void WpADOColumn::put_Precision(sal_Int32 _nPre)
1097*cdf0e10cSrcweir {
1098*cdf0e10cSrcweir 	OSL_ENSURE(pInterface,"Interface is null!");
1099*cdf0e10cSrcweir 	pInterface->put_Precision(_nPre);
1100*cdf0e10cSrcweir }
1101*cdf0e10cSrcweir 
1102*cdf0e10cSrcweir sal_Int32 WpADOColumn::get_DefinedSize() const
1103*cdf0e10cSrcweir {
1104*cdf0e10cSrcweir 	OSL_ENSURE(pInterface,"Interface is null!");
1105*cdf0e10cSrcweir 	sal_Int32 nPrec=0;
1106*cdf0e10cSrcweir 	pInterface->get_DefinedSize(&nPrec);
1107*cdf0e10cSrcweir 	return nPrec;
1108*cdf0e10cSrcweir }
1109*cdf0e10cSrcweir sal_uInt8 WpADOColumn::get_NumericScale() const
1110*cdf0e10cSrcweir {
1111*cdf0e10cSrcweir 	OSL_ENSURE(pInterface,"Interface is null!");
1112*cdf0e10cSrcweir 	sal_uInt8 nPrec=0;
1113*cdf0e10cSrcweir 	pInterface->get_NumericScale(&nPrec);
1114*cdf0e10cSrcweir 	return nPrec;
1115*cdf0e10cSrcweir }
1116*cdf0e10cSrcweir 
1117*cdf0e10cSrcweir void WpADOColumn::put_NumericScale(sal_Int8 _nScale)
1118*cdf0e10cSrcweir {
1119*cdf0e10cSrcweir 	OSL_ENSURE(pInterface,"Interface is null!");
1120*cdf0e10cSrcweir 	pInterface->put_NumericScale(_nScale);
1121*cdf0e10cSrcweir }
1122*cdf0e10cSrcweir 
1123*cdf0e10cSrcweir SortOrderEnum WpADOColumn::get_SortOrder() const
1124*cdf0e10cSrcweir {
1125*cdf0e10cSrcweir 	OSL_ENSURE(pInterface,"Interface is null!");
1126*cdf0e10cSrcweir 	SortOrderEnum nPrec=adSortAscending;
1127*cdf0e10cSrcweir 	pInterface->get_SortOrder(&nPrec);
1128*cdf0e10cSrcweir 	return nPrec;
1129*cdf0e10cSrcweir }
1130*cdf0e10cSrcweir 
1131*cdf0e10cSrcweir void WpADOColumn::put_SortOrder(SortOrderEnum _nScale)
1132*cdf0e10cSrcweir {
1133*cdf0e10cSrcweir 	OSL_ENSURE(pInterface,"Interface is null!");
1134*cdf0e10cSrcweir 	pInterface->put_SortOrder(_nScale);
1135*cdf0e10cSrcweir }
1136*cdf0e10cSrcweir 
1137*cdf0e10cSrcweir ColumnAttributesEnum WpADOColumn::get_Attributes() const
1138*cdf0e10cSrcweir {
1139*cdf0e10cSrcweir 	OSL_ENSURE(pInterface,"Interface is null!");
1140*cdf0e10cSrcweir 	ColumnAttributesEnum eNum=adColNullable;
1141*cdf0e10cSrcweir 	pInterface->get_Attributes(&eNum);
1142*cdf0e10cSrcweir 	return eNum;
1143*cdf0e10cSrcweir }
1144*cdf0e10cSrcweir 
1145*cdf0e10cSrcweir sal_Bool WpADOColumn::put_Attributes(const ColumnAttributesEnum& _eNum)
1146*cdf0e10cSrcweir {
1147*cdf0e10cSrcweir 	OSL_ENSURE(pInterface,"Interface is null!");
1148*cdf0e10cSrcweir 	return SUCCEEDED(pInterface->put_Attributes(_eNum));
1149*cdf0e10cSrcweir }
1150*cdf0e10cSrcweir 
1151*cdf0e10cSrcweir WpADOProperties WpADOColumn::get_Properties() const
1152*cdf0e10cSrcweir {
1153*cdf0e10cSrcweir 	OSL_ENSURE(pInterface,"Interface is null!");
1154*cdf0e10cSrcweir 	ADOProperties* pProps = NULL;
1155*cdf0e10cSrcweir 	pInterface->get_Properties(&pProps);
1156*cdf0e10cSrcweir 	WpADOProperties aProps;
1157*cdf0e10cSrcweir 
1158*cdf0e10cSrcweir 	aProps.setWithOutAddRef(pProps);
1159*cdf0e10cSrcweir 	return aProps;
1160*cdf0e10cSrcweir }
1161*cdf0e10cSrcweir 
1162*cdf0e10cSrcweir ::rtl::OUString WpADOKey::get_Name() const
1163*cdf0e10cSrcweir {
1164*cdf0e10cSrcweir 	OSL_ENSURE(pInterface,"Interface is null!");
1165*cdf0e10cSrcweir 	OLEString aBSTR;
1166*cdf0e10cSrcweir 	pInterface->get_Name(&aBSTR);
1167*cdf0e10cSrcweir 	return aBSTR;
1168*cdf0e10cSrcweir }
1169*cdf0e10cSrcweir 
1170*cdf0e10cSrcweir void WpADOKey::put_Name(const ::rtl::OUString& _rName)
1171*cdf0e10cSrcweir {
1172*cdf0e10cSrcweir 	OSL_ENSURE(pInterface,"Interface is null!");
1173*cdf0e10cSrcweir 	OLEString bstr(_rName);
1174*cdf0e10cSrcweir 	sal_Bool bErg = SUCCEEDED(pInterface->put_Name(bstr));
1175*cdf0e10cSrcweir     (void)bErg;
1176*cdf0e10cSrcweir }
1177*cdf0e10cSrcweir 
1178*cdf0e10cSrcweir KeyTypeEnum WpADOKey::get_Type() const
1179*cdf0e10cSrcweir {
1180*cdf0e10cSrcweir 	OSL_ENSURE(pInterface,"Interface is null!");
1181*cdf0e10cSrcweir 	KeyTypeEnum eNum=adKeyPrimary;
1182*cdf0e10cSrcweir 	pInterface->get_Type(&eNum);
1183*cdf0e10cSrcweir 	return eNum;
1184*cdf0e10cSrcweir }
1185*cdf0e10cSrcweir 
1186*cdf0e10cSrcweir void WpADOKey::put_Type(const KeyTypeEnum& _eNum)
1187*cdf0e10cSrcweir {
1188*cdf0e10cSrcweir 	OSL_ENSURE(pInterface,"Interface is null!");
1189*cdf0e10cSrcweir 	pInterface->put_Type(_eNum);
1190*cdf0e10cSrcweir }
1191*cdf0e10cSrcweir 
1192*cdf0e10cSrcweir ::rtl::OUString WpADOKey::get_RelatedTable() const
1193*cdf0e10cSrcweir {
1194*cdf0e10cSrcweir 	OSL_ENSURE(pInterface,"Interface is null!");
1195*cdf0e10cSrcweir 	OLEString aBSTR;
1196*cdf0e10cSrcweir 	pInterface->get_RelatedTable(&aBSTR);
1197*cdf0e10cSrcweir 	return aBSTR;
1198*cdf0e10cSrcweir }
1199*cdf0e10cSrcweir 
1200*cdf0e10cSrcweir void WpADOKey::put_RelatedTable(const ::rtl::OUString& _rName)
1201*cdf0e10cSrcweir {
1202*cdf0e10cSrcweir 	OSL_ENSURE(pInterface,"Interface is null!");
1203*cdf0e10cSrcweir 	OLEString bstr(_rName);
1204*cdf0e10cSrcweir 	sal_Bool bErg = SUCCEEDED(pInterface->put_RelatedTable(bstr));
1205*cdf0e10cSrcweir     (void)bErg;
1206*cdf0e10cSrcweir }
1207*cdf0e10cSrcweir 
1208*cdf0e10cSrcweir RuleEnum WpADOKey::get_DeleteRule() const
1209*cdf0e10cSrcweir {
1210*cdf0e10cSrcweir 	OSL_ENSURE(pInterface,"Interface is null!");
1211*cdf0e10cSrcweir 	RuleEnum eNum = adRINone;
1212*cdf0e10cSrcweir 	pInterface->get_DeleteRule(&eNum);
1213*cdf0e10cSrcweir 	return eNum;
1214*cdf0e10cSrcweir }
1215*cdf0e10cSrcweir 
1216*cdf0e10cSrcweir void WpADOKey::put_DeleteRule(const RuleEnum& _eNum)
1217*cdf0e10cSrcweir {
1218*cdf0e10cSrcweir 	OSL_ENSURE(pInterface,"Interface is null!");
1219*cdf0e10cSrcweir 	pInterface->put_DeleteRule(_eNum);
1220*cdf0e10cSrcweir }
1221*cdf0e10cSrcweir 
1222*cdf0e10cSrcweir RuleEnum WpADOKey::get_UpdateRule() const
1223*cdf0e10cSrcweir {
1224*cdf0e10cSrcweir 	OSL_ENSURE(pInterface,"Interface is null!");
1225*cdf0e10cSrcweir 	RuleEnum eNum = adRINone;
1226*cdf0e10cSrcweir 	pInterface->get_UpdateRule(&eNum);
1227*cdf0e10cSrcweir 	return eNum;
1228*cdf0e10cSrcweir }
1229*cdf0e10cSrcweir 
1230*cdf0e10cSrcweir void WpADOKey::put_UpdateRule(const RuleEnum& _eNum)
1231*cdf0e10cSrcweir {
1232*cdf0e10cSrcweir 	OSL_ENSURE(pInterface,"Interface is null!");
1233*cdf0e10cSrcweir 	pInterface->put_UpdateRule(_eNum);
1234*cdf0e10cSrcweir }
1235*cdf0e10cSrcweir 
1236*cdf0e10cSrcweir WpADOColumns WpADOKey::get_Columns() const
1237*cdf0e10cSrcweir {
1238*cdf0e10cSrcweir 	OSL_ENSURE(pInterface,"Interface is null!");
1239*cdf0e10cSrcweir 	ADOColumns* pCols = NULL;
1240*cdf0e10cSrcweir 	pInterface->get_Columns(&pCols);
1241*cdf0e10cSrcweir 	WpADOColumns aCols;
1242*cdf0e10cSrcweir 	aCols.setWithOutAddRef(pCols);
1243*cdf0e10cSrcweir 	return aCols;
1244*cdf0e10cSrcweir }
1245*cdf0e10cSrcweir 
1246*cdf0e10cSrcweir ::rtl::OUString WpADOIndex::get_Name() const
1247*cdf0e10cSrcweir {
1248*cdf0e10cSrcweir 	OSL_ENSURE(pInterface,"Interface is null!");
1249*cdf0e10cSrcweir 	OLEString aBSTR;
1250*cdf0e10cSrcweir 	pInterface->get_Name(&aBSTR);
1251*cdf0e10cSrcweir 	return aBSTR;
1252*cdf0e10cSrcweir }
1253*cdf0e10cSrcweir 
1254*cdf0e10cSrcweir void WpADOIndex::put_Name(const ::rtl::OUString& _rName)
1255*cdf0e10cSrcweir {
1256*cdf0e10cSrcweir 	OSL_ENSURE(pInterface,"Interface is null!");
1257*cdf0e10cSrcweir 	OLEString bstr(_rName);
1258*cdf0e10cSrcweir 	sal_Bool bErg = SUCCEEDED(pInterface->put_Name(bstr));
1259*cdf0e10cSrcweir     (void)bErg;
1260*cdf0e10cSrcweir }
1261*cdf0e10cSrcweir 
1262*cdf0e10cSrcweir sal_Bool WpADOIndex::get_Clustered() const
1263*cdf0e10cSrcweir {
1264*cdf0e10cSrcweir 	OSL_ENSURE(pInterface,"Interface is null!");
1265*cdf0e10cSrcweir 	VARIANT_BOOL eNum = VARIANT_FALSE;
1266*cdf0e10cSrcweir 	pInterface->get_Clustered(&eNum);
1267*cdf0e10cSrcweir 	return eNum == VARIANT_TRUE;
1268*cdf0e10cSrcweir }
1269*cdf0e10cSrcweir 
1270*cdf0e10cSrcweir void WpADOIndex::put_Clustered(sal_Bool _b)
1271*cdf0e10cSrcweir {
1272*cdf0e10cSrcweir 	OSL_ENSURE(pInterface,"Interface is null!");
1273*cdf0e10cSrcweir 	pInterface->put_Clustered(_b ? VARIANT_TRUE : VARIANT_FALSE);
1274*cdf0e10cSrcweir }
1275*cdf0e10cSrcweir 
1276*cdf0e10cSrcweir sal_Bool WpADOIndex::get_Unique() const
1277*cdf0e10cSrcweir {
1278*cdf0e10cSrcweir 	OSL_ENSURE(pInterface,"Interface is null!");
1279*cdf0e10cSrcweir 	VARIANT_BOOL eNum = VARIANT_FALSE;
1280*cdf0e10cSrcweir 	pInterface->get_Unique(&eNum);
1281*cdf0e10cSrcweir 	return eNum == VARIANT_TRUE;
1282*cdf0e10cSrcweir }
1283*cdf0e10cSrcweir 
1284*cdf0e10cSrcweir void WpADOIndex::put_Unique(sal_Bool _b)
1285*cdf0e10cSrcweir {
1286*cdf0e10cSrcweir 	OSL_ENSURE(pInterface,"Interface is null!");
1287*cdf0e10cSrcweir 	pInterface->put_Unique(_b ? VARIANT_TRUE : VARIANT_FALSE);
1288*cdf0e10cSrcweir }
1289*cdf0e10cSrcweir 
1290*cdf0e10cSrcweir sal_Bool WpADOIndex::get_PrimaryKey() const
1291*cdf0e10cSrcweir {
1292*cdf0e10cSrcweir 	OSL_ENSURE(pInterface,"Interface is null!");
1293*cdf0e10cSrcweir 	VARIANT_BOOL eNum = VARIANT_FALSE;
1294*cdf0e10cSrcweir 	pInterface->get_PrimaryKey(&eNum);
1295*cdf0e10cSrcweir 	return eNum == VARIANT_TRUE;
1296*cdf0e10cSrcweir }
1297*cdf0e10cSrcweir 
1298*cdf0e10cSrcweir void WpADOIndex::put_PrimaryKey(sal_Bool _b)
1299*cdf0e10cSrcweir {
1300*cdf0e10cSrcweir 	OSL_ENSURE(pInterface,"Interface is null!");
1301*cdf0e10cSrcweir 	pInterface->put_PrimaryKey(_b ? VARIANT_TRUE : VARIANT_FALSE);
1302*cdf0e10cSrcweir }
1303*cdf0e10cSrcweir 
1304*cdf0e10cSrcweir WpADOColumns WpADOIndex::get_Columns() const
1305*cdf0e10cSrcweir {
1306*cdf0e10cSrcweir 	OSL_ENSURE(pInterface,"Interface is null!");
1307*cdf0e10cSrcweir 	ADOColumns* pCols = NULL;
1308*cdf0e10cSrcweir 	pInterface->get_Columns(&pCols);
1309*cdf0e10cSrcweir 	WpADOColumns aCols;
1310*cdf0e10cSrcweir 	aCols.setWithOutAddRef(pCols);
1311*cdf0e10cSrcweir 	return aCols;
1312*cdf0e10cSrcweir }
1313*cdf0e10cSrcweir 
1314*cdf0e10cSrcweir void WpADOCatalog::putref_ActiveConnection(IDispatch* pCon)
1315*cdf0e10cSrcweir {
1316*cdf0e10cSrcweir 	OSL_ENSURE(pInterface,"Interface is null!");
1317*cdf0e10cSrcweir 	pInterface->putref_ActiveConnection(pCon);
1318*cdf0e10cSrcweir }
1319*cdf0e10cSrcweir 
1320*cdf0e10cSrcweir WpADOTables	WpADOCatalog::get_Tables()
1321*cdf0e10cSrcweir {
1322*cdf0e10cSrcweir 	OSL_ENSURE(pInterface,"Interface is null!");
1323*cdf0e10cSrcweir 	ADOTables* pRet = NULL;
1324*cdf0e10cSrcweir 	pInterface->get_Tables(&pRet);
1325*cdf0e10cSrcweir 	WpADOTables aRet;
1326*cdf0e10cSrcweir 	aRet.setWithOutAddRef(pRet);
1327*cdf0e10cSrcweir 	return aRet;
1328*cdf0e10cSrcweir }
1329*cdf0e10cSrcweir 
1330*cdf0e10cSrcweir WpADOViews WpADOCatalog::get_Views()
1331*cdf0e10cSrcweir {
1332*cdf0e10cSrcweir 	OSL_ENSURE(pInterface,"Interface is null!");
1333*cdf0e10cSrcweir 	ADOViews* pRet = NULL;
1334*cdf0e10cSrcweir 	pInterface->get_Views(&pRet);
1335*cdf0e10cSrcweir 	WpADOViews aRet;
1336*cdf0e10cSrcweir 	aRet.setWithOutAddRef(pRet);
1337*cdf0e10cSrcweir 	return aRet;
1338*cdf0e10cSrcweir }
1339*cdf0e10cSrcweir 
1340*cdf0e10cSrcweir WpADOGroups WpADOCatalog::get_Groups()
1341*cdf0e10cSrcweir {
1342*cdf0e10cSrcweir 	OSL_ENSURE(pInterface,"Interface is null!");
1343*cdf0e10cSrcweir 	ADOGroups* pRet = NULL;
1344*cdf0e10cSrcweir 	pInterface->get_Groups(&pRet);
1345*cdf0e10cSrcweir 	WpADOGroups aRet;
1346*cdf0e10cSrcweir 	aRet.setWithOutAddRef(pRet);
1347*cdf0e10cSrcweir 	return aRet;
1348*cdf0e10cSrcweir }
1349*cdf0e10cSrcweir 
1350*cdf0e10cSrcweir WpADOUsers WpADOCatalog::get_Users()
1351*cdf0e10cSrcweir {
1352*cdf0e10cSrcweir 	OSL_ENSURE(pInterface,"Interface is null!");
1353*cdf0e10cSrcweir 	ADOUsers* pRet = NULL;
1354*cdf0e10cSrcweir 	pInterface->get_Users(&pRet);
1355*cdf0e10cSrcweir 	WpADOUsers aRet;
1356*cdf0e10cSrcweir 	aRet.setWithOutAddRef(pRet);
1357*cdf0e10cSrcweir 	return aRet;
1358*cdf0e10cSrcweir }
1359*cdf0e10cSrcweir 
1360*cdf0e10cSrcweir ADOProcedures* WpADOCatalog::get_Procedures()
1361*cdf0e10cSrcweir {
1362*cdf0e10cSrcweir 	OSL_ENSURE(pInterface,"Interface is null!");
1363*cdf0e10cSrcweir 	ADOProcedures* pRet = NULL;
1364*cdf0e10cSrcweir 	pInterface->get_Procedures(&pRet);
1365*cdf0e10cSrcweir 	return pRet;
1366*cdf0e10cSrcweir }
1367*cdf0e10cSrcweir 
1368*cdf0e10cSrcweir ::rtl::OUString WpADOTable::get_Name() const
1369*cdf0e10cSrcweir {
1370*cdf0e10cSrcweir 	OSL_ENSURE(pInterface,"Interface is null!");
1371*cdf0e10cSrcweir 	OLEString aBSTR;
1372*cdf0e10cSrcweir 	pInterface->get_Name(&aBSTR);
1373*cdf0e10cSrcweir 	return aBSTR;
1374*cdf0e10cSrcweir }
1375*cdf0e10cSrcweir 
1376*cdf0e10cSrcweir void WpADOTable::put_Name(const ::rtl::OUString& _rName)
1377*cdf0e10cSrcweir {
1378*cdf0e10cSrcweir 	OSL_ENSURE(pInterface,"Interface is null!");
1379*cdf0e10cSrcweir 	OLEString bstr(_rName);
1380*cdf0e10cSrcweir 	sal_Bool bErg = SUCCEEDED(pInterface->put_Name(bstr));
1381*cdf0e10cSrcweir     (void)bErg;
1382*cdf0e10cSrcweir }
1383*cdf0e10cSrcweir 
1384*cdf0e10cSrcweir ::rtl::OUString WpADOTable::get_Type() const
1385*cdf0e10cSrcweir {
1386*cdf0e10cSrcweir 	OSL_ENSURE(pInterface,"Interface is null!");
1387*cdf0e10cSrcweir 	OLEString aBSTR;
1388*cdf0e10cSrcweir 	pInterface->get_Type(&aBSTR);
1389*cdf0e10cSrcweir 	return aBSTR;
1390*cdf0e10cSrcweir }
1391*cdf0e10cSrcweir 
1392*cdf0e10cSrcweir WpADOColumns WpADOTable::get_Columns() const
1393*cdf0e10cSrcweir {
1394*cdf0e10cSrcweir 	OSL_ENSURE(pInterface,"Interface is null!");
1395*cdf0e10cSrcweir 	ADOColumns* pCols = NULL;
1396*cdf0e10cSrcweir 	pInterface->get_Columns(&pCols);
1397*cdf0e10cSrcweir 	WpADOColumns aCols;
1398*cdf0e10cSrcweir 	aCols.setWithOutAddRef(pCols);
1399*cdf0e10cSrcweir 	return aCols;
1400*cdf0e10cSrcweir }
1401*cdf0e10cSrcweir 
1402*cdf0e10cSrcweir WpADOIndexes WpADOTable::get_Indexes() const
1403*cdf0e10cSrcweir {
1404*cdf0e10cSrcweir 	OSL_ENSURE(pInterface,"Interface is null!");
1405*cdf0e10cSrcweir 	ADOIndexes* pCols = NULL;
1406*cdf0e10cSrcweir 	pInterface->get_Indexes(&pCols);
1407*cdf0e10cSrcweir 	WpADOIndexes aRet;
1408*cdf0e10cSrcweir 	aRet.setWithOutAddRef(pCols);
1409*cdf0e10cSrcweir 	return aRet;
1410*cdf0e10cSrcweir }
1411*cdf0e10cSrcweir 
1412*cdf0e10cSrcweir WpADOKeys WpADOTable::get_Keys() const
1413*cdf0e10cSrcweir {
1414*cdf0e10cSrcweir 	OSL_ENSURE(pInterface,"Interface is null!");
1415*cdf0e10cSrcweir 	ADOKeys* pCols = NULL;
1416*cdf0e10cSrcweir 	pInterface->get_Keys(&pCols);
1417*cdf0e10cSrcweir 	WpADOKeys aRet;
1418*cdf0e10cSrcweir 	aRet.setWithOutAddRef(pCols);
1419*cdf0e10cSrcweir 	return aRet;
1420*cdf0e10cSrcweir }
1421*cdf0e10cSrcweir 
1422*cdf0e10cSrcweir WpADOCatalog WpADOTable::get_ParentCatalog() const
1423*cdf0e10cSrcweir {
1424*cdf0e10cSrcweir 	OSL_ENSURE(pInterface,"Interface is null!");
1425*cdf0e10cSrcweir 	ADOCatalog* pCat = NULL;
1426*cdf0e10cSrcweir 	pInterface->get_ParentCatalog(&pCat);
1427*cdf0e10cSrcweir 	WpADOCatalog aRet;
1428*cdf0e10cSrcweir 	aRet.setWithOutAddRef(pCat);
1429*cdf0e10cSrcweir 	return aRet;
1430*cdf0e10cSrcweir }
1431*cdf0e10cSrcweir 
1432*cdf0e10cSrcweir WpADOProperties WpADOTable::get_Properties() const
1433*cdf0e10cSrcweir {
1434*cdf0e10cSrcweir 	OSL_ENSURE(pInterface,"Interface is null!");
1435*cdf0e10cSrcweir 	ADOProperties* pProps = NULL;
1436*cdf0e10cSrcweir 	pInterface->get_Properties(&pProps);
1437*cdf0e10cSrcweir 	WpADOProperties aProps;
1438*cdf0e10cSrcweir 	aProps.setWithOutAddRef(pProps);
1439*cdf0e10cSrcweir 	return aProps;
1440*cdf0e10cSrcweir }
1441*cdf0e10cSrcweir 
1442*cdf0e10cSrcweir ::rtl::OUString WpADOView::get_Name() const
1443*cdf0e10cSrcweir {
1444*cdf0e10cSrcweir 	OSL_ENSURE(pInterface,"Interface is null!");
1445*cdf0e10cSrcweir 	OLEString aBSTR;
1446*cdf0e10cSrcweir 	pInterface->get_Name(&aBSTR);
1447*cdf0e10cSrcweir 	return aBSTR;
1448*cdf0e10cSrcweir }
1449*cdf0e10cSrcweir 
1450*cdf0e10cSrcweir void WpADOView::get_Command(OLEVariant& _rVar) const
1451*cdf0e10cSrcweir {
1452*cdf0e10cSrcweir 	OSL_ENSURE(pInterface,"Interface is null!");
1453*cdf0e10cSrcweir 	pInterface->get_Command(&_rVar);
1454*cdf0e10cSrcweir }
1455*cdf0e10cSrcweir 
1456*cdf0e10cSrcweir void WpADOView::put_Command(OLEVariant& _rVar)
1457*cdf0e10cSrcweir {
1458*cdf0e10cSrcweir 	pInterface->put_Command(_rVar);
1459*cdf0e10cSrcweir }
1460*cdf0e10cSrcweir 
1461*cdf0e10cSrcweir ::rtl::OUString WpADOGroup::get_Name() const
1462*cdf0e10cSrcweir {
1463*cdf0e10cSrcweir 	OLEString aBSTR;
1464*cdf0e10cSrcweir 	pInterface->get_Name(&aBSTR);
1465*cdf0e10cSrcweir 	return aBSTR;
1466*cdf0e10cSrcweir }
1467*cdf0e10cSrcweir 
1468*cdf0e10cSrcweir void WpADOGroup::put_Name(const ::rtl::OUString& _rName)
1469*cdf0e10cSrcweir {
1470*cdf0e10cSrcweir 	OLEString bstr(_rName);
1471*cdf0e10cSrcweir 	sal_Bool bErg = SUCCEEDED(pInterface->put_Name(bstr));
1472*cdf0e10cSrcweir     (void)bErg;
1473*cdf0e10cSrcweir }
1474*cdf0e10cSrcweir 
1475*cdf0e10cSrcweir RightsEnum WpADOGroup::GetPermissions(
1476*cdf0e10cSrcweir 	/* [in] */ const OLEVariant& Name,
1477*cdf0e10cSrcweir 	/* [in] */ ObjectTypeEnum ObjectType)
1478*cdf0e10cSrcweir {
1479*cdf0e10cSrcweir 	RightsEnum Rights=adRightNone;
1480*cdf0e10cSrcweir 	OLEVariant ObjectTypeId;
1481*cdf0e10cSrcweir 	ObjectTypeId.setNoArg();
1482*cdf0e10cSrcweir 	pInterface->GetPermissions(Name,ObjectType,ObjectTypeId,&Rights);
1483*cdf0e10cSrcweir 	return Rights;
1484*cdf0e10cSrcweir }
1485*cdf0e10cSrcweir 
1486*cdf0e10cSrcweir sal_Bool WpADOGroup::SetPermissions(
1487*cdf0e10cSrcweir 	/* [in] */ const OLEVariant& Name,
1488*cdf0e10cSrcweir 	/* [in] */ ObjectTypeEnum ObjectType,
1489*cdf0e10cSrcweir 	/* [in] */ ActionEnum Action,
1490*cdf0e10cSrcweir 	/* [in] */ RightsEnum Rights)
1491*cdf0e10cSrcweir {
1492*cdf0e10cSrcweir 	OLEVariant ObjectTypeId;
1493*cdf0e10cSrcweir 	ObjectTypeId.setNoArg();
1494*cdf0e10cSrcweir 	return SUCCEEDED(pInterface->SetPermissions(Name,ObjectType,Action,Rights,adInheritNone,ObjectTypeId));
1495*cdf0e10cSrcweir }
1496*cdf0e10cSrcweir 
1497*cdf0e10cSrcweir WpADOUsers WpADOGroup::get_Users( )
1498*cdf0e10cSrcweir {
1499*cdf0e10cSrcweir 	ADOUsers* pRet = NULL;
1500*cdf0e10cSrcweir 	pInterface->get_Users( &pRet);
1501*cdf0e10cSrcweir 	WpADOUsers aRet;
1502*cdf0e10cSrcweir 	aRet.setWithOutAddRef(pRet);
1503*cdf0e10cSrcweir 	return aRet;
1504*cdf0e10cSrcweir }
1505*cdf0e10cSrcweir 
1506*cdf0e10cSrcweir ::rtl::OUString WpADOUser::get_Name() const
1507*cdf0e10cSrcweir {
1508*cdf0e10cSrcweir 	OLEString aBSTR;
1509*cdf0e10cSrcweir 	pInterface->get_Name(&aBSTR);
1510*cdf0e10cSrcweir 	return aBSTR;
1511*cdf0e10cSrcweir }
1512*cdf0e10cSrcweir 
1513*cdf0e10cSrcweir void WpADOUser::put_Name(const ::rtl::OUString& _rName)
1514*cdf0e10cSrcweir {
1515*cdf0e10cSrcweir 	OLEString bstr(_rName);
1516*cdf0e10cSrcweir 	sal_Bool bErg = SUCCEEDED(pInterface->put_Name(bstr));
1517*cdf0e10cSrcweir     (void)bErg;
1518*cdf0e10cSrcweir }
1519*cdf0e10cSrcweir 
1520*cdf0e10cSrcweir sal_Bool WpADOUser::ChangePassword(const ::rtl::OUString& _rPwd,const ::rtl::OUString& _rNewPwd)
1521*cdf0e10cSrcweir {
1522*cdf0e10cSrcweir 	OLEString sStr1(_rPwd);
1523*cdf0e10cSrcweir 	OLEString sStr2(_rNewPwd);
1524*cdf0e10cSrcweir 	sal_Bool bErg = SUCCEEDED(pInterface->ChangePassword(sStr1,sStr2));
1525*cdf0e10cSrcweir 	return bErg;
1526*cdf0e10cSrcweir }
1527*cdf0e10cSrcweir 
1528*cdf0e10cSrcweir WpADOGroups WpADOUser::get_Groups()
1529*cdf0e10cSrcweir {
1530*cdf0e10cSrcweir 	ADOGroups* pRet = NULL;
1531*cdf0e10cSrcweir 	pInterface->get_Groups(&pRet);
1532*cdf0e10cSrcweir 	WpADOGroups aRet;
1533*cdf0e10cSrcweir 	aRet.setWithOutAddRef(pRet);
1534*cdf0e10cSrcweir 	return aRet;
1535*cdf0e10cSrcweir }
1536*cdf0e10cSrcweir 
1537*cdf0e10cSrcweir RightsEnum WpADOUser::GetPermissions(
1538*cdf0e10cSrcweir 	/* [in] */ const OLEVariant& Name,
1539*cdf0e10cSrcweir 	/* [in] */ ObjectTypeEnum ObjectType)
1540*cdf0e10cSrcweir {
1541*cdf0e10cSrcweir 	RightsEnum Rights=adRightNone;
1542*cdf0e10cSrcweir 	OLEVariant ObjectTypeId;
1543*cdf0e10cSrcweir 	ObjectTypeId.setNoArg();
1544*cdf0e10cSrcweir 	pInterface->GetPermissions(Name,ObjectType,ObjectTypeId,&Rights);
1545*cdf0e10cSrcweir 	return Rights;
1546*cdf0e10cSrcweir }
1547*cdf0e10cSrcweir 
1548*cdf0e10cSrcweir sal_Bool WpADOUser::SetPermissions(
1549*cdf0e10cSrcweir 	/* [in] */ const OLEVariant& Name,
1550*cdf0e10cSrcweir 	/* [in] */ ObjectTypeEnum ObjectType,
1551*cdf0e10cSrcweir 	/* [in] */ ActionEnum Action,
1552*cdf0e10cSrcweir 	/* [in] */ RightsEnum Rights)
1553*cdf0e10cSrcweir {
1554*cdf0e10cSrcweir 	OLEVariant ObjectTypeId;
1555*cdf0e10cSrcweir 	ObjectTypeId.setNoArg();
1556*cdf0e10cSrcweir 	return SUCCEEDED(pInterface->SetPermissions(Name,ObjectType,Action,Rights,adInheritNone,ObjectTypeId));
1557*cdf0e10cSrcweir }
1558*cdf0e10cSrcweir 
1559*cdf0e10cSrcweir WpBase::WpBase() : pIUnknown(NULL)
1560*cdf0e10cSrcweir {
1561*cdf0e10cSrcweir }
1562*cdf0e10cSrcweir WpBase::WpBase(IDispatch* pInt)
1563*cdf0e10cSrcweir 	:pIUnknown(pInt)
1564*cdf0e10cSrcweir {
1565*cdf0e10cSrcweir 	if (pIUnknown)
1566*cdf0e10cSrcweir 	{
1567*cdf0e10cSrcweir 		ULONG nCount = pIUnknown->AddRef();
1568*cdf0e10cSrcweir         (void)nCount;
1569*cdf0e10cSrcweir 		//	OSL_ENSURE(nCount == 1,"Count is greater than 1");
1570*cdf0e10cSrcweir 	}
1571*cdf0e10cSrcweir }
1572*cdf0e10cSrcweir 
1573*cdf0e10cSrcweir //inline
1574*cdf0e10cSrcweir WpBase& WpBase::operator=(const WpBase& rhs)
1575*cdf0e10cSrcweir {
1576*cdf0e10cSrcweir 	if (rhs.pIUnknown != pIUnknown)
1577*cdf0e10cSrcweir 	{
1578*cdf0e10cSrcweir 		if (pIUnknown)
1579*cdf0e10cSrcweir 			pIUnknown->Release();
1580*cdf0e10cSrcweir 		pIUnknown = rhs.pIUnknown;
1581*cdf0e10cSrcweir 		if (pIUnknown)
1582*cdf0e10cSrcweir 			pIUnknown->AddRef();
1583*cdf0e10cSrcweir 	}
1584*cdf0e10cSrcweir 	return *this;
1585*cdf0e10cSrcweir };
1586*cdf0e10cSrcweir 
1587*cdf0e10cSrcweir WpBase& WpBase::operator=(IDispatch* rhs)
1588*cdf0e10cSrcweir {
1589*cdf0e10cSrcweir 	if (pIUnknown != rhs)
1590*cdf0e10cSrcweir 	{
1591*cdf0e10cSrcweir 		if (pIUnknown)
1592*cdf0e10cSrcweir 			pIUnknown->Release();
1593*cdf0e10cSrcweir 		pIUnknown = rhs;
1594*cdf0e10cSrcweir 		if (pIUnknown)
1595*cdf0e10cSrcweir 			pIUnknown->AddRef();
1596*cdf0e10cSrcweir 	}
1597*cdf0e10cSrcweir 	return *this;
1598*cdf0e10cSrcweir }
1599*cdf0e10cSrcweir 
1600*cdf0e10cSrcweir WpBase::WpBase(const WpBase& aWrapper)
1601*cdf0e10cSrcweir {
1602*cdf0e10cSrcweir 	operator=(aWrapper);
1603*cdf0e10cSrcweir }
1604*cdf0e10cSrcweir 
1605*cdf0e10cSrcweir WpBase::~WpBase()
1606*cdf0e10cSrcweir {
1607*cdf0e10cSrcweir 	if (pIUnknown)
1608*cdf0e10cSrcweir 	{
1609*cdf0e10cSrcweir 		pIUnknown->Release();
1610*cdf0e10cSrcweir 		pIUnknown = NULL;
1611*cdf0e10cSrcweir 	}
1612*cdf0e10cSrcweir }
1613*cdf0e10cSrcweir 
1614*cdf0e10cSrcweir void WpBase::clear()
1615*cdf0e10cSrcweir {
1616*cdf0e10cSrcweir 	if (pIUnknown)
1617*cdf0e10cSrcweir 	{
1618*cdf0e10cSrcweir 		pIUnknown->Release();
1619*cdf0e10cSrcweir 		pIUnknown = NULL;
1620*cdf0e10cSrcweir 	}
1621*cdf0e10cSrcweir }
1622*cdf0e10cSrcweir 
1623*cdf0e10cSrcweir 
1624*cdf0e10cSrcweir sal_Bool WpBase::IsValid() const
1625*cdf0e10cSrcweir {
1626*cdf0e10cSrcweir 	return pIUnknown != NULL;
1627*cdf0e10cSrcweir }
1628*cdf0e10cSrcweir WpBase::operator IDispatch*()
1629*cdf0e10cSrcweir {
1630*cdf0e10cSrcweir 	return pIUnknown;
1631*cdf0e10cSrcweir }
1632*cdf0e10cSrcweir 
1633*cdf0e10cSrcweir ADORecordset* WpADOConnection::getExportedKeys( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table )
1634*cdf0e10cSrcweir {
1635*cdf0e10cSrcweir 	// Create elements used in the array
1636*cdf0e10cSrcweir 	HRESULT hr = S_OK;
1637*cdf0e10cSrcweir 	SAFEARRAYBOUND rgsabound[1];
1638*cdf0e10cSrcweir 	SAFEARRAY *psa = NULL;
1639*cdf0e10cSrcweir 	OLEVariant varCriteria[6];
1640*cdf0e10cSrcweir 
1641*cdf0e10cSrcweir 	// Create SafeArray Bounds and initialize the array
1642*cdf0e10cSrcweir 	rgsabound[0].lLbound   = 0;
1643*cdf0e10cSrcweir 	rgsabound[0].cElements = sizeof varCriteria / sizeof varCriteria[0];
1644*cdf0e10cSrcweir 	psa         = SafeArrayCreate( VT_VARIANT, 1, rgsabound );
1645*cdf0e10cSrcweir 
1646*cdf0e10cSrcweir 	sal_Int32 nPos=0;
1647*cdf0e10cSrcweir 	if(catalog.hasValue())
1648*cdf0e10cSrcweir 		varCriteria[nPos].setString(::comphelper::getString(catalog));
1649*cdf0e10cSrcweir 
1650*cdf0e10cSrcweir 	hr = SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_CATALOG
1651*cdf0e10cSrcweir 	if(schema.getLength() && schema.toChar() != '%')
1652*cdf0e10cSrcweir 		varCriteria[nPos].setString(schema);
1653*cdf0e10cSrcweir 	hr = SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_SCHEMA
1654*cdf0e10cSrcweir 
1655*cdf0e10cSrcweir 	varCriteria[nPos].setString(table);
1656*cdf0e10cSrcweir 	hr = SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_NAME
1657*cdf0e10cSrcweir 
1658*cdf0e10cSrcweir 	hr = SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_CATALOG
1659*cdf0e10cSrcweir 	hr = SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_SCHEMA
1660*cdf0e10cSrcweir 	hr = SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_NAME
1661*cdf0e10cSrcweir 
1662*cdf0e10cSrcweir 	OLEVariant  vtEmpty;
1663*cdf0e10cSrcweir 	vtEmpty.setNoArg();
1664*cdf0e10cSrcweir 
1665*cdf0e10cSrcweir 	// Initialize and fill the SafeArray
1666*cdf0e10cSrcweir 	OLEVariant vsa;
1667*cdf0e10cSrcweir 	vsa.setArray(psa,VT_VARIANT);
1668*cdf0e10cSrcweir 
1669*cdf0e10cSrcweir 	ADORecordset *pRecordset = NULL;
1670*cdf0e10cSrcweir 	OpenSchema(adSchemaForeignKeys,vsa,vtEmpty,&pRecordset);
1671*cdf0e10cSrcweir 	return pRecordset;
1672*cdf0e10cSrcweir }
1673*cdf0e10cSrcweir // -----------------------------------------------------------------------------
1674*cdf0e10cSrcweir ADORecordset* WpADOConnection::getImportedKeys( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table )
1675*cdf0e10cSrcweir {
1676*cdf0e10cSrcweir 	// Create elements used in the array
1677*cdf0e10cSrcweir 	HRESULT hr = S_OK;
1678*cdf0e10cSrcweir 	SAFEARRAYBOUND rgsabound[1];
1679*cdf0e10cSrcweir 	SAFEARRAY *psa = NULL;
1680*cdf0e10cSrcweir 	OLEVariant varCriteria[6];
1681*cdf0e10cSrcweir 
1682*cdf0e10cSrcweir 	// Create SafeArray Bounds and initialize the array
1683*cdf0e10cSrcweir 	rgsabound[0].lLbound   = 0;
1684*cdf0e10cSrcweir 	rgsabound[0].cElements = sizeof varCriteria / sizeof varCriteria[0];
1685*cdf0e10cSrcweir 	psa         = SafeArrayCreate( VT_VARIANT, 1, rgsabound );
1686*cdf0e10cSrcweir 
1687*cdf0e10cSrcweir 	sal_Int32 nPos=0;
1688*cdf0e10cSrcweir 	hr = SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_CATALOG
1689*cdf0e10cSrcweir 	hr = SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_SCHEMA
1690*cdf0e10cSrcweir 	hr = SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_NAME
1691*cdf0e10cSrcweir 
1692*cdf0e10cSrcweir 	if(catalog.hasValue())
1693*cdf0e10cSrcweir 		varCriteria[nPos].setString(::comphelper::getString(catalog));
1694*cdf0e10cSrcweir 
1695*cdf0e10cSrcweir 	hr = SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_CATALOG
1696*cdf0e10cSrcweir 	if(schema.getLength() && schema.toChar() != '%')
1697*cdf0e10cSrcweir 		varCriteria[nPos].setString(schema);
1698*cdf0e10cSrcweir 	hr = SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_SCHEMA
1699*cdf0e10cSrcweir 
1700*cdf0e10cSrcweir 	varCriteria[nPos].setString(table);
1701*cdf0e10cSrcweir 	hr = SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_NAME
1702*cdf0e10cSrcweir 
1703*cdf0e10cSrcweir 	OLEVariant  vtEmpty;
1704*cdf0e10cSrcweir 	vtEmpty.setNoArg();
1705*cdf0e10cSrcweir 
1706*cdf0e10cSrcweir 	// Initialize and fill the SafeArray
1707*cdf0e10cSrcweir 	OLEVariant vsa;
1708*cdf0e10cSrcweir 	vsa.setArray(psa,VT_VARIANT);
1709*cdf0e10cSrcweir 
1710*cdf0e10cSrcweir 	ADORecordset *pRecordset = NULL;
1711*cdf0e10cSrcweir 	OpenSchema(adSchemaForeignKeys,vsa,vtEmpty,&pRecordset);
1712*cdf0e10cSrcweir 
1713*cdf0e10cSrcweir 	return pRecordset;
1714*cdf0e10cSrcweir 
1715*cdf0e10cSrcweir }
1716*cdf0e10cSrcweir // -----------------------------------------------------------------------------
1717*cdf0e10cSrcweir ADORecordset* WpADOConnection::getPrimaryKeys( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table )
1718*cdf0e10cSrcweir {
1719*cdf0e10cSrcweir 	// Create elements used in the array
1720*cdf0e10cSrcweir 	HRESULT hr = S_OK;
1721*cdf0e10cSrcweir 	SAFEARRAYBOUND rgsabound[1];
1722*cdf0e10cSrcweir 	SAFEARRAY *psa = NULL;
1723*cdf0e10cSrcweir 	OLEVariant varCriteria[3];
1724*cdf0e10cSrcweir 
1725*cdf0e10cSrcweir 	// Create SafeArray Bounds and initialize the array
1726*cdf0e10cSrcweir 	rgsabound[0].lLbound   = 0;
1727*cdf0e10cSrcweir 	rgsabound[0].cElements = sizeof varCriteria / sizeof varCriteria[0];
1728*cdf0e10cSrcweir 	psa         = SafeArrayCreate( VT_VARIANT, 1, rgsabound );
1729*cdf0e10cSrcweir 
1730*cdf0e10cSrcweir 	sal_Int32 nPos=0;
1731*cdf0e10cSrcweir 	if(catalog.hasValue())
1732*cdf0e10cSrcweir 		varCriteria[nPos].setString(::comphelper::getString(catalog));
1733*cdf0e10cSrcweir 
1734*cdf0e10cSrcweir 	hr = SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_CATALOG
1735*cdf0e10cSrcweir 	if(schema.getLength() && schema.toChar() != '%')
1736*cdf0e10cSrcweir 		varCriteria[nPos].setString(schema);
1737*cdf0e10cSrcweir 	hr = SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_SCHEMA
1738*cdf0e10cSrcweir 
1739*cdf0e10cSrcweir 	varCriteria[nPos].setString(table);
1740*cdf0e10cSrcweir 	hr = SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_NAME
1741*cdf0e10cSrcweir 
1742*cdf0e10cSrcweir 
1743*cdf0e10cSrcweir 	OLEVariant  vtEmpty;
1744*cdf0e10cSrcweir 	vtEmpty.setNoArg();
1745*cdf0e10cSrcweir 
1746*cdf0e10cSrcweir 	// Initialize and fill the SafeArray
1747*cdf0e10cSrcweir 	OLEVariant vsa;
1748*cdf0e10cSrcweir 	vsa.setArray(psa,VT_VARIANT);
1749*cdf0e10cSrcweir 
1750*cdf0e10cSrcweir 	ADORecordset *pRecordset = NULL;
1751*cdf0e10cSrcweir 	OpenSchema(adSchemaPrimaryKeys,vsa,vtEmpty,&pRecordset);
1752*cdf0e10cSrcweir 
1753*cdf0e10cSrcweir 	return pRecordset;
1754*cdf0e10cSrcweir }
1755*cdf0e10cSrcweir // -----------------------------------------------------------------------------
1756*cdf0e10cSrcweir ADORecordset* WpADOConnection::getIndexInfo(
1757*cdf0e10cSrcweir 	const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table,
1758*cdf0e10cSrcweir 	sal_Bool /*unique*/, sal_Bool /*approximate*/ )
1759*cdf0e10cSrcweir {
1760*cdf0e10cSrcweir 	// Create elements used in the array
1761*cdf0e10cSrcweir 	HRESULT hr = S_OK;
1762*cdf0e10cSrcweir 	SAFEARRAYBOUND rgsabound[1];
1763*cdf0e10cSrcweir 	SAFEARRAY *psa = NULL;
1764*cdf0e10cSrcweir 	OLEVariant varCriteria[5];
1765*cdf0e10cSrcweir 
1766*cdf0e10cSrcweir 	// Create SafeArray Bounds and initialize the array
1767*cdf0e10cSrcweir 	rgsabound[0].lLbound   = 0;
1768*cdf0e10cSrcweir 	rgsabound[0].cElements = sizeof varCriteria / sizeof varCriteria[0];
1769*cdf0e10cSrcweir 	psa         = SafeArrayCreate( VT_VARIANT, 1, rgsabound );
1770*cdf0e10cSrcweir 
1771*cdf0e10cSrcweir 	sal_Int32 nPos=0;
1772*cdf0e10cSrcweir 	if(catalog.hasValue())
1773*cdf0e10cSrcweir 		varCriteria[nPos].setString(::comphelper::getString(catalog));
1774*cdf0e10cSrcweir 
1775*cdf0e10cSrcweir 	hr = SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_CATALOG
1776*cdf0e10cSrcweir 	if(schema.getLength() && schema.toChar() != '%')
1777*cdf0e10cSrcweir 		varCriteria[nPos].setString(schema);
1778*cdf0e10cSrcweir 	hr = SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_SCHEMA
1779*cdf0e10cSrcweir 
1780*cdf0e10cSrcweir 	hr = SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// INDEX_NAME
1781*cdf0e10cSrcweir 
1782*cdf0e10cSrcweir 	hr = SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TYPE
1783*cdf0e10cSrcweir 
1784*cdf0e10cSrcweir 	varCriteria[nPos].setString(table);
1785*cdf0e10cSrcweir 	hr = SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_NAME
1786*cdf0e10cSrcweir 
1787*cdf0e10cSrcweir 	OLEVariant  vtEmpty;
1788*cdf0e10cSrcweir 	vtEmpty.setNoArg();
1789*cdf0e10cSrcweir 
1790*cdf0e10cSrcweir 	// Initialize and fill the SafeArray
1791*cdf0e10cSrcweir 	OLEVariant vsa;
1792*cdf0e10cSrcweir 	vsa.setArray(psa,VT_VARIANT);
1793*cdf0e10cSrcweir 
1794*cdf0e10cSrcweir 	ADORecordset *pRecordset = NULL;
1795*cdf0e10cSrcweir 	OpenSchema(adSchemaIndexes,vsa,vtEmpty,&pRecordset);
1796*cdf0e10cSrcweir 
1797*cdf0e10cSrcweir 	return pRecordset;
1798*cdf0e10cSrcweir }
1799*cdf0e10cSrcweir // -----------------------------------------------------------------------------
1800*cdf0e10cSrcweir ADORecordset* WpADOConnection::getTablePrivileges( const ::com::sun::star::uno::Any& catalog,
1801*cdf0e10cSrcweir 												  const ::rtl::OUString& schemaPattern,
1802*cdf0e10cSrcweir 												  const ::rtl::OUString& tableNamePattern )
1803*cdf0e10cSrcweir {
1804*cdf0e10cSrcweir 	HRESULT hr = S_OK;
1805*cdf0e10cSrcweir 	SAFEARRAYBOUND rgsabound[1];
1806*cdf0e10cSrcweir 	SAFEARRAY *psa = NULL;
1807*cdf0e10cSrcweir 	OLEVariant varCriteria[5];
1808*cdf0e10cSrcweir 
1809*cdf0e10cSrcweir 	// Create SafeArray Bounds and initialize the array
1810*cdf0e10cSrcweir 	rgsabound[0].lLbound   = 0;
1811*cdf0e10cSrcweir 	rgsabound[0].cElements = sizeof varCriteria / sizeof varCriteria[0];
1812*cdf0e10cSrcweir 	psa         = SafeArrayCreate( VT_VARIANT, 1, rgsabound );
1813*cdf0e10cSrcweir 
1814*cdf0e10cSrcweir 	sal_Int32 nPos=0;
1815*cdf0e10cSrcweir 	if(catalog.hasValue())
1816*cdf0e10cSrcweir 		varCriteria[nPos].setString(::comphelper::getString(catalog));
1817*cdf0e10cSrcweir 
1818*cdf0e10cSrcweir 	hr = SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_CATALOG
1819*cdf0e10cSrcweir 	if(schemaPattern.getLength() && schemaPattern.toChar() != '%')
1820*cdf0e10cSrcweir 		varCriteria[nPos].setString(schemaPattern);
1821*cdf0e10cSrcweir 	hr = SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_SCHEMA
1822*cdf0e10cSrcweir 
1823*cdf0e10cSrcweir 	if(tableNamePattern.toChar() != '%')
1824*cdf0e10cSrcweir 		varCriteria[nPos].setString(tableNamePattern);
1825*cdf0e10cSrcweir 	hr = SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_NAME
1826*cdf0e10cSrcweir 
1827*cdf0e10cSrcweir 	hr = SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// GRANTOR
1828*cdf0e10cSrcweir 	hr = SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// GRANTEE
1829*cdf0e10cSrcweir 
1830*cdf0e10cSrcweir 	OLEVariant  vtEmpty;
1831*cdf0e10cSrcweir 	vtEmpty.setNoArg();
1832*cdf0e10cSrcweir 
1833*cdf0e10cSrcweir 	// Initialize and fill the SafeArray
1834*cdf0e10cSrcweir 	OLEVariant vsa;
1835*cdf0e10cSrcweir 	vsa.setArray(psa,VT_VARIANT);
1836*cdf0e10cSrcweir 
1837*cdf0e10cSrcweir 	ADORecordset *pRecordset = NULL;
1838*cdf0e10cSrcweir 	OpenSchema(adSchemaTablePrivileges,vsa,vtEmpty,&pRecordset);
1839*cdf0e10cSrcweir 
1840*cdf0e10cSrcweir 	return pRecordset;
1841*cdf0e10cSrcweir }
1842*cdf0e10cSrcweir // -----------------------------------------------------------------------------
1843*cdf0e10cSrcweir ADORecordset* WpADOConnection::getCrossReference( const ::com::sun::star::uno::Any& primaryCatalog,
1844*cdf0e10cSrcweir 												  const ::rtl::OUString& primarySchema,
1845*cdf0e10cSrcweir 												  const ::rtl::OUString& primaryTable,
1846*cdf0e10cSrcweir 												  const ::com::sun::star::uno::Any& foreignCatalog,
1847*cdf0e10cSrcweir 												  const ::rtl::OUString& foreignSchema,
1848*cdf0e10cSrcweir 												  const ::rtl::OUString& foreignTable)
1849*cdf0e10cSrcweir {
1850*cdf0e10cSrcweir 	// Create elements used in the array
1851*cdf0e10cSrcweir 	HRESULT hr = S_OK;
1852*cdf0e10cSrcweir 	SAFEARRAYBOUND rgsabound[1];
1853*cdf0e10cSrcweir 	SAFEARRAY *psa = NULL;
1854*cdf0e10cSrcweir 	OLEVariant varCriteria[6];
1855*cdf0e10cSrcweir 
1856*cdf0e10cSrcweir 	// Create SafeArray Bounds and initialize the array
1857*cdf0e10cSrcweir 	rgsabound[0].lLbound   = 0;
1858*cdf0e10cSrcweir 	rgsabound[0].cElements = sizeof varCriteria / sizeof varCriteria[0];
1859*cdf0e10cSrcweir 	psa         = SafeArrayCreate( VT_VARIANT, 1, rgsabound );
1860*cdf0e10cSrcweir 
1861*cdf0e10cSrcweir 	sal_Int32 nPos=0;
1862*cdf0e10cSrcweir 	if(primaryCatalog.hasValue())
1863*cdf0e10cSrcweir 		varCriteria[nPos].setString(::comphelper::getString(primaryCatalog));
1864*cdf0e10cSrcweir 
1865*cdf0e10cSrcweir 	hr = SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_CATALOG
1866*cdf0e10cSrcweir 	if(primarySchema.getLength() && primarySchema.toChar() != '%')
1867*cdf0e10cSrcweir 		varCriteria[nPos].setString(primarySchema);
1868*cdf0e10cSrcweir 	hr = SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_SCHEMA
1869*cdf0e10cSrcweir 
1870*cdf0e10cSrcweir 	varCriteria[nPos].setString(primaryTable);
1871*cdf0e10cSrcweir 	hr = SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_NAME
1872*cdf0e10cSrcweir 
1873*cdf0e10cSrcweir 	if(foreignCatalog.hasValue())
1874*cdf0e10cSrcweir 		varCriteria[nPos].setString(::comphelper::getString(foreignCatalog));
1875*cdf0e10cSrcweir 
1876*cdf0e10cSrcweir 	hr = SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_CATALOG
1877*cdf0e10cSrcweir 	if(foreignSchema.getLength() && foreignSchema.toChar() != '%')
1878*cdf0e10cSrcweir 		varCriteria[nPos].setString(foreignSchema);
1879*cdf0e10cSrcweir 	hr = SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_SCHEMA
1880*cdf0e10cSrcweir 
1881*cdf0e10cSrcweir 	varCriteria[nPos].setString(foreignTable);
1882*cdf0e10cSrcweir 	hr = SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_NAME
1883*cdf0e10cSrcweir 
1884*cdf0e10cSrcweir 	OLEVariant  vtEmpty;
1885*cdf0e10cSrcweir 	vtEmpty.setNoArg();
1886*cdf0e10cSrcweir 
1887*cdf0e10cSrcweir 	// Initialize and fill the SafeArray
1888*cdf0e10cSrcweir 	OLEVariant vsa;
1889*cdf0e10cSrcweir 	vsa.setArray(psa,VT_VARIANT);
1890*cdf0e10cSrcweir 
1891*cdf0e10cSrcweir 	ADORecordset *pRecordset = NULL;
1892*cdf0e10cSrcweir 	OpenSchema(adSchemaForeignKeys,vsa,vtEmpty,&pRecordset);
1893*cdf0e10cSrcweir 
1894*cdf0e10cSrcweir 	return pRecordset;
1895*cdf0e10cSrcweir }
1896*cdf0e10cSrcweir // -----------------------------------------------------------------------------
1897*cdf0e10cSrcweir ADORecordset* WpADOConnection::getProcedures( const ::com::sun::star::uno::Any& catalog,
1898*cdf0e10cSrcweir 												  const ::rtl::OUString& schemaPattern,
1899*cdf0e10cSrcweir 												  const ::rtl::OUString& procedureNamePattern )
1900*cdf0e10cSrcweir {
1901*cdf0e10cSrcweir 	HRESULT hr = S_OK;
1902*cdf0e10cSrcweir 	SAFEARRAYBOUND rgsabound[1];
1903*cdf0e10cSrcweir 	SAFEARRAY *psa = NULL;
1904*cdf0e10cSrcweir 	OLEVariant varCriteria[3];
1905*cdf0e10cSrcweir 
1906*cdf0e10cSrcweir 	// Create SafeArray Bounds and initialize the array
1907*cdf0e10cSrcweir 	rgsabound[0].lLbound   = 0;
1908*cdf0e10cSrcweir 	rgsabound[0].cElements = sizeof varCriteria / sizeof varCriteria[0];
1909*cdf0e10cSrcweir 	psa         = SafeArrayCreate( VT_VARIANT, 1, rgsabound );
1910*cdf0e10cSrcweir 
1911*cdf0e10cSrcweir 	sal_Int32 nPos=0;
1912*cdf0e10cSrcweir 	if(catalog.hasValue())
1913*cdf0e10cSrcweir 		varCriteria[nPos].setString(::comphelper::getString(catalog));
1914*cdf0e10cSrcweir 
1915*cdf0e10cSrcweir 	hr = SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_CATALOG
1916*cdf0e10cSrcweir 	if(schemaPattern.getLength() && schemaPattern.toChar() != '%')
1917*cdf0e10cSrcweir 		varCriteria[nPos].setString(schemaPattern);
1918*cdf0e10cSrcweir 	hr = SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_SCHEMA
1919*cdf0e10cSrcweir 
1920*cdf0e10cSrcweir 	if(procedureNamePattern.toChar() != '%')
1921*cdf0e10cSrcweir 		varCriteria[nPos].setString(procedureNamePattern);
1922*cdf0e10cSrcweir 	hr = SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_NAME
1923*cdf0e10cSrcweir 
1924*cdf0e10cSrcweir 	OLEVariant  vtEmpty;
1925*cdf0e10cSrcweir 	vtEmpty.setNoArg();
1926*cdf0e10cSrcweir 
1927*cdf0e10cSrcweir 	// Initialize and fill the SafeArray
1928*cdf0e10cSrcweir 	OLEVariant vsa;
1929*cdf0e10cSrcweir 	vsa.setArray(psa,VT_VARIANT);
1930*cdf0e10cSrcweir 
1931*cdf0e10cSrcweir 	ADORecordset *pRecordset = NULL;
1932*cdf0e10cSrcweir 	OpenSchema(adSchemaProcedures,vsa,vtEmpty,&pRecordset);
1933*cdf0e10cSrcweir 
1934*cdf0e10cSrcweir 	return pRecordset;
1935*cdf0e10cSrcweir }
1936*cdf0e10cSrcweir // -----------------------------------------------------------------------------
1937*cdf0e10cSrcweir ADORecordset* WpADOConnection::getProcedureColumns( const ::com::sun::star::uno::Any& catalog,
1938*cdf0e10cSrcweir 												  const ::rtl::OUString& schemaPattern,
1939*cdf0e10cSrcweir 												  const ::rtl::OUString& procedureNamePattern,
1940*cdf0e10cSrcweir 												  const ::rtl::OUString& columnNamePattern )
1941*cdf0e10cSrcweir {
1942*cdf0e10cSrcweir 	// Create elements used in the array
1943*cdf0e10cSrcweir 	HRESULT hr = S_OK;
1944*cdf0e10cSrcweir 	SAFEARRAYBOUND rgsabound[1];
1945*cdf0e10cSrcweir 	SAFEARRAY *psa = NULL;
1946*cdf0e10cSrcweir 	OLEVariant varCriteria[4];
1947*cdf0e10cSrcweir 
1948*cdf0e10cSrcweir 	// Create SafeArray Bounds and initialize the array
1949*cdf0e10cSrcweir 	rgsabound[0].lLbound   = 0;
1950*cdf0e10cSrcweir 	rgsabound[0].cElements = sizeof varCriteria / sizeof varCriteria[0];
1951*cdf0e10cSrcweir 	psa         = SafeArrayCreate( VT_VARIANT, 1, rgsabound );
1952*cdf0e10cSrcweir 
1953*cdf0e10cSrcweir 	sal_Int32 nPos=0;
1954*cdf0e10cSrcweir 	if(catalog.hasValue())
1955*cdf0e10cSrcweir 		varCriteria[nPos].setString(::comphelper::getString(catalog));
1956*cdf0e10cSrcweir 
1957*cdf0e10cSrcweir 	hr = SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_CATALOG
1958*cdf0e10cSrcweir 	if(schemaPattern.getLength() && schemaPattern.toChar() != '%')
1959*cdf0e10cSrcweir 		varCriteria[nPos].setString(schemaPattern);
1960*cdf0e10cSrcweir 	hr = SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_SCHEMA
1961*cdf0e10cSrcweir 
1962*cdf0e10cSrcweir 	if(procedureNamePattern.toChar() != '%')
1963*cdf0e10cSrcweir 		varCriteria[nPos].setString(procedureNamePattern);
1964*cdf0e10cSrcweir 	hr = SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_NAME
1965*cdf0e10cSrcweir 
1966*cdf0e10cSrcweir 	if(columnNamePattern.toChar() != '%')
1967*cdf0e10cSrcweir 		varCriteria[nPos].setString(columnNamePattern);
1968*cdf0e10cSrcweir 	hr = SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// COLUMN_NAME
1969*cdf0e10cSrcweir 
1970*cdf0e10cSrcweir 	OLEVariant  vtEmpty;
1971*cdf0e10cSrcweir 	vtEmpty.setNoArg();
1972*cdf0e10cSrcweir 
1973*cdf0e10cSrcweir 	// Initialize and fill the SafeArray
1974*cdf0e10cSrcweir 	OLEVariant vsa;
1975*cdf0e10cSrcweir 	vsa.setArray(psa,VT_VARIANT);
1976*cdf0e10cSrcweir 
1977*cdf0e10cSrcweir 	ADORecordset *pRecordset = NULL;
1978*cdf0e10cSrcweir 	OpenSchema(adSchemaProcedureParameters,vsa,vtEmpty,&pRecordset);
1979*cdf0e10cSrcweir 
1980*cdf0e10cSrcweir 	return pRecordset;
1981*cdf0e10cSrcweir }
1982*cdf0e10cSrcweir // -----------------------------------------------------------------------------
1983*cdf0e10cSrcweir ADORecordset* WpADOConnection::getTables( const ::com::sun::star::uno::Any& catalog,
1984*cdf0e10cSrcweir 												  const ::rtl::OUString& schemaPattern,
1985*cdf0e10cSrcweir 												  const ::rtl::OUString& tableNamePattern,
1986*cdf0e10cSrcweir 												  const ::com::sun::star::uno::Sequence< ::rtl::OUString >& types )
1987*cdf0e10cSrcweir {
1988*cdf0e10cSrcweir 	// Create elements used in the array
1989*cdf0e10cSrcweir 	HRESULT hr = S_OK;
1990*cdf0e10cSrcweir 	OLEVariant varCriteria[4];
1991*cdf0e10cSrcweir 
1992*cdf0e10cSrcweir 	sal_Int32 nPos=0;
1993*cdf0e10cSrcweir     ::rtl::OUString sCatalog;
1994*cdf0e10cSrcweir 	if ( catalog.hasValue() && (catalog >>= sCatalog) )
1995*cdf0e10cSrcweir 		varCriteria[nPos].setString(sCatalog);
1996*cdf0e10cSrcweir 
1997*cdf0e10cSrcweir     ++nPos;
1998*cdf0e10cSrcweir 	if(schemaPattern.getLength() && schemaPattern.toChar() != '%')
1999*cdf0e10cSrcweir 		varCriteria[nPos].setString(schemaPattern);
2000*cdf0e10cSrcweir 
2001*cdf0e10cSrcweir 	++nPos;
2002*cdf0e10cSrcweir 	if(tableNamePattern.toChar() != '%')
2003*cdf0e10cSrcweir 		varCriteria[nPos].setString(tableNamePattern);
2004*cdf0e10cSrcweir 
2005*cdf0e10cSrcweir 	++nPos;
2006*cdf0e10cSrcweir 	::rtl::OUStringBuffer aTypes;
2007*cdf0e10cSrcweir     ::rtl::OUString aComma = ::rtl::OUString::createFromAscii(",");
2008*cdf0e10cSrcweir 	const ::rtl::OUString* pIter = types.getConstArray();
2009*cdf0e10cSrcweir 	const ::rtl::OUString* pEnd = pIter + types.getLength();
2010*cdf0e10cSrcweir 	for( ; pIter != pEnd ; ++pIter)
2011*cdf0e10cSrcweir     {
2012*cdf0e10cSrcweir         if ( aTypes.getLength() )
2013*cdf0e10cSrcweir             aTypes.append(aComma);
2014*cdf0e10cSrcweir 		aTypes.append(*pIter);
2015*cdf0e10cSrcweir     }
2016*cdf0e10cSrcweir 
2017*cdf0e10cSrcweir     ::rtl::OUString sTypeNames = aTypes.makeStringAndClear();
2018*cdf0e10cSrcweir 	if ( sTypeNames.getLength() )
2019*cdf0e10cSrcweir 		varCriteria[nPos].setString(sTypeNames);
2020*cdf0e10cSrcweir 
2021*cdf0e10cSrcweir     // Create SafeArray Bounds and initialize the array
2022*cdf0e10cSrcweir     const sal_Int32 nCrit = sizeof varCriteria / sizeof varCriteria[0];
2023*cdf0e10cSrcweir     SAFEARRAYBOUND rgsabound[1];
2024*cdf0e10cSrcweir     rgsabound[0].lLbound   = 0;
2025*cdf0e10cSrcweir     rgsabound[0].cElements = nCrit;
2026*cdf0e10cSrcweir     SAFEARRAY *psa         = SafeArrayCreate( VT_VARIANT, 1, rgsabound );
2027*cdf0e10cSrcweir 
2028*cdf0e10cSrcweir     // Set the values for each element of the array
2029*cdf0e10cSrcweir     for( long i = 0 ; i < nCrit && SUCCEEDED( hr );i++)
2030*cdf0e10cSrcweir     {
2031*cdf0e10cSrcweir         hr  = SafeArrayPutElement(psa, &i,&varCriteria[i]);
2032*cdf0e10cSrcweir     }
2033*cdf0e10cSrcweir 
2034*cdf0e10cSrcweir 	OLEVariant  vtEmpty;
2035*cdf0e10cSrcweir 	vtEmpty.setNoArg();
2036*cdf0e10cSrcweir 
2037*cdf0e10cSrcweir 	// Initialize and fill the SafeArray
2038*cdf0e10cSrcweir 	OLEVariant vsa;
2039*cdf0e10cSrcweir 	vsa.setArray(psa,VT_VARIANT);
2040*cdf0e10cSrcweir 
2041*cdf0e10cSrcweir 	ADORecordset *pRecordset = NULL;
2042*cdf0e10cSrcweir 	OpenSchema(adSchemaTables,vsa,vtEmpty,&pRecordset);
2043*cdf0e10cSrcweir 
2044*cdf0e10cSrcweir 	return pRecordset;
2045*cdf0e10cSrcweir }
2046*cdf0e10cSrcweir // -----------------------------------------------------------------------------
2047*cdf0e10cSrcweir ADORecordset* WpADOConnection::getColumns( const ::com::sun::star::uno::Any& catalog,
2048*cdf0e10cSrcweir 												  const ::rtl::OUString& schemaPattern,
2049*cdf0e10cSrcweir 												  const ::rtl::OUString& tableNamePattern,
2050*cdf0e10cSrcweir 												  const ::rtl::OUString& columnNamePattern )
2051*cdf0e10cSrcweir {
2052*cdf0e10cSrcweir 	// Create elements used in the array
2053*cdf0e10cSrcweir 	HRESULT hr = S_OK;
2054*cdf0e10cSrcweir 	SAFEARRAYBOUND rgsabound[1];
2055*cdf0e10cSrcweir 	SAFEARRAY *psa = NULL;
2056*cdf0e10cSrcweir 	OLEVariant varCriteria[4];
2057*cdf0e10cSrcweir 
2058*cdf0e10cSrcweir 	// Create SafeArray Bounds and initialize the array
2059*cdf0e10cSrcweir 	rgsabound[0].lLbound   = 0;
2060*cdf0e10cSrcweir 	rgsabound[0].cElements = sizeof varCriteria / sizeof varCriteria[0];
2061*cdf0e10cSrcweir 	psa         = SafeArrayCreate( VT_VARIANT, 1, rgsabound );
2062*cdf0e10cSrcweir 
2063*cdf0e10cSrcweir 	sal_Int32 nPos=0;
2064*cdf0e10cSrcweir 	if(catalog.hasValue())
2065*cdf0e10cSrcweir 		varCriteria[nPos].setString(::comphelper::getString(catalog));
2066*cdf0e10cSrcweir 
2067*cdf0e10cSrcweir 	hr = SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_CATALOG
2068*cdf0e10cSrcweir 	if(schemaPattern.getLength() && schemaPattern.toChar() != '%')
2069*cdf0e10cSrcweir 		varCriteria[nPos].setString(schemaPattern);
2070*cdf0e10cSrcweir 	hr = SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_SCHEMA
2071*cdf0e10cSrcweir 
2072*cdf0e10cSrcweir 	if(tableNamePattern.toChar() != '%')
2073*cdf0e10cSrcweir 		varCriteria[nPos].setString(tableNamePattern);
2074*cdf0e10cSrcweir 	hr = SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_NAME
2075*cdf0e10cSrcweir 
2076*cdf0e10cSrcweir 	varCriteria[nPos].setString(columnNamePattern);
2077*cdf0e10cSrcweir 	hr = SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// COLUMN_NAME
2078*cdf0e10cSrcweir 
2079*cdf0e10cSrcweir 	OLEVariant  vtEmpty;
2080*cdf0e10cSrcweir 	vtEmpty.setNoArg();
2081*cdf0e10cSrcweir 
2082*cdf0e10cSrcweir 	// Initialize and fill the SafeArray
2083*cdf0e10cSrcweir 	OLEVariant vsa;
2084*cdf0e10cSrcweir 	vsa.setArray(psa,VT_VARIANT);
2085*cdf0e10cSrcweir 
2086*cdf0e10cSrcweir 	ADORecordset *pRecordset = NULL;
2087*cdf0e10cSrcweir 	OpenSchema(adSchemaColumns,vsa,vtEmpty,&pRecordset);
2088*cdf0e10cSrcweir 
2089*cdf0e10cSrcweir 	return pRecordset;
2090*cdf0e10cSrcweir }
2091*cdf0e10cSrcweir // -----------------------------------------------------------------------------
2092*cdf0e10cSrcweir ADORecordset* WpADOConnection::getColumnPrivileges( const ::com::sun::star::uno::Any& catalog,
2093*cdf0e10cSrcweir 												  const ::rtl::OUString& schema,
2094*cdf0e10cSrcweir 												  const ::rtl::OUString& table,
2095*cdf0e10cSrcweir 												  const ::rtl::OUString& columnNamePattern )
2096*cdf0e10cSrcweir {
2097*cdf0e10cSrcweir 	// Create elements used in the array
2098*cdf0e10cSrcweir 	HRESULT hr = S_OK;
2099*cdf0e10cSrcweir 	SAFEARRAYBOUND rgsabound[1];
2100*cdf0e10cSrcweir 	SAFEARRAY *psa = NULL;
2101*cdf0e10cSrcweir 	OLEVariant varCriteria[4];
2102*cdf0e10cSrcweir 
2103*cdf0e10cSrcweir 	// Create SafeArray Bounds and initialize the array
2104*cdf0e10cSrcweir 	rgsabound[0].lLbound   = 0;
2105*cdf0e10cSrcweir 	rgsabound[0].cElements = sizeof varCriteria / sizeof varCriteria[0];
2106*cdf0e10cSrcweir 	psa         = SafeArrayCreate( VT_VARIANT, 1, rgsabound );
2107*cdf0e10cSrcweir 
2108*cdf0e10cSrcweir 	sal_Int32 nPos=0;
2109*cdf0e10cSrcweir 	if(catalog.hasValue())
2110*cdf0e10cSrcweir 		varCriteria[nPos].setString(::comphelper::getString(catalog));
2111*cdf0e10cSrcweir 
2112*cdf0e10cSrcweir 	hr = SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_CATALOG
2113*cdf0e10cSrcweir 	if(schema.getLength() && schema.toChar() != '%')
2114*cdf0e10cSrcweir 		varCriteria[nPos].setString(schema);
2115*cdf0e10cSrcweir 	hr = SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_SCHEMA
2116*cdf0e10cSrcweir 
2117*cdf0e10cSrcweir 	varCriteria[nPos].setString(table);
2118*cdf0e10cSrcweir 	hr = SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_NAME
2119*cdf0e10cSrcweir 
2120*cdf0e10cSrcweir 	varCriteria[nPos].setString(columnNamePattern);
2121*cdf0e10cSrcweir 	hr = SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// COLUMN_NAME
2122*cdf0e10cSrcweir 
2123*cdf0e10cSrcweir 	OLEVariant  vtEmpty;
2124*cdf0e10cSrcweir 	vtEmpty.setNoArg();
2125*cdf0e10cSrcweir 
2126*cdf0e10cSrcweir 	// Initialize and fill the SafeArray
2127*cdf0e10cSrcweir 	OLEVariant vsa;
2128*cdf0e10cSrcweir 	vsa.setArray(psa,VT_VARIANT);
2129*cdf0e10cSrcweir 
2130*cdf0e10cSrcweir 	ADORecordset *pRecordset = NULL;
2131*cdf0e10cSrcweir 	OpenSchema(adSchemaColumnPrivileges,vsa,vtEmpty,&pRecordset);
2132*cdf0e10cSrcweir 
2133*cdf0e10cSrcweir 	return pRecordset;
2134*cdf0e10cSrcweir }
2135*cdf0e10cSrcweir // -----------------------------------------------------------------------------
2136*cdf0e10cSrcweir ADORecordset* WpADOConnection::getTypeInfo(DataTypeEnum /*_eType*/)
2137*cdf0e10cSrcweir {
2138*cdf0e10cSrcweir 	// Create elements used in the array
2139*cdf0e10cSrcweir 	OLEVariant varCriteria[2];
2140*cdf0e10cSrcweir 	const int nCrit = sizeof varCriteria / sizeof varCriteria[0];
2141*cdf0e10cSrcweir 	// Create SafeArray Bounds and initialize the array
2142*cdf0e10cSrcweir 	SAFEARRAYBOUND rgsabound[1];
2143*cdf0e10cSrcweir 	rgsabound[0].lLbound   = 0;
2144*cdf0e10cSrcweir 	rgsabound[0].cElements = nCrit;
2145*cdf0e10cSrcweir 	SAFEARRAY *psa         = SafeArrayCreate( VT_VARIANT, 1, rgsabound );
2146*cdf0e10cSrcweir 
2147*cdf0e10cSrcweir 	sal_Int32 nPos = 0;
2148*cdf0e10cSrcweir 	SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;
2149*cdf0e10cSrcweir 	SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;
2150*cdf0e10cSrcweir 
2151*cdf0e10cSrcweir 	// Initialize and fill the SafeArray
2152*cdf0e10cSrcweir 	OLEVariant vsa;
2153*cdf0e10cSrcweir 	vsa.setArray(psa,VT_VARIANT);
2154*cdf0e10cSrcweir 
2155*cdf0e10cSrcweir 	OLEVariant aEmpty;
2156*cdf0e10cSrcweir 	aEmpty.setNoArg();
2157*cdf0e10cSrcweir 
2158*cdf0e10cSrcweir 	ADORecordset *pRec=NULL;
2159*cdf0e10cSrcweir 	OpenSchema(adSchemaProviderTypes,vsa,aEmpty,&pRec);
2160*cdf0e10cSrcweir 
2161*cdf0e10cSrcweir 	return pRec;
2162*cdf0e10cSrcweir }
2163*cdf0e10cSrcweir // -----------------------------------------------------------------------------
2164*cdf0e10cSrcweir void WpADOColumn::put_ParentCatalog(/* [in] */ _ADOCatalog __RPC_FAR *ppvObject)
2165*cdf0e10cSrcweir {
2166*cdf0e10cSrcweir 	OSL_ENSURE(pInterface,"Interface is null!");
2167*cdf0e10cSrcweir 	sal_Bool bRet = SUCCEEDED(pInterface->put_ParentCatalog(ppvObject));
2168*cdf0e10cSrcweir 	OSL_ENSURE(bRet,"Could not set ParentCatalog!");
2169*cdf0e10cSrcweir     OSL_UNUSED(bRet);
2170*cdf0e10cSrcweir }
2171*cdf0e10cSrcweir // -----------------------------------------------------------------------------
2172*cdf0e10cSrcweir void WpADOTable::putref_ParentCatalog(/* [in] */ _ADOCatalog __RPC_FAR *ppvObject)
2173*cdf0e10cSrcweir {
2174*cdf0e10cSrcweir 	OSL_ENSURE(pInterface,"Interface is null!");
2175*cdf0e10cSrcweir 	sal_Bool bRet = SUCCEEDED(pInterface->putref_ParentCatalog(ppvObject));
2176*cdf0e10cSrcweir 	OSL_ENSURE(bRet,"Could not set ParentCatalog!");
2177*cdf0e10cSrcweir     OSL_UNUSED(bRet);
2178*cdf0e10cSrcweir }
2179*cdf0e10cSrcweir // -----------------------------------------------------------------------------
2180*cdf0e10cSrcweir void WpBase::setIDispatch(IDispatch* _pIUnknown)
2181*cdf0e10cSrcweir {
2182*cdf0e10cSrcweir 	pIUnknown = _pIUnknown;
2183*cdf0e10cSrcweir }
2184*cdf0e10cSrcweir // -----------------------------------------------------------------------------
2185*cdf0e10cSrcweir void OTools::putValue(const WpADOProperties& _rProps,const OLEVariant &_aPosition,const OLEVariant &_aValVar)
2186*cdf0e10cSrcweir {
2187*cdf0e10cSrcweir 	OSL_ENSURE(_rProps.IsValid(),"Properties are not valid!");
2188*cdf0e10cSrcweir 	WpADOProperty aProp(_rProps.GetItem(_aPosition));
2189*cdf0e10cSrcweir 	if ( aProp.IsValid() )
2190*cdf0e10cSrcweir 	{
2191*cdf0e10cSrcweir 		sal_Bool bRet = aProp.PutValue(_aValVar);
2192*cdf0e10cSrcweir 		OSL_ENSURE(bRet,"Could not put value!");
2193*cdf0e10cSrcweir         OSL_UNUSED(bRet);
2194*cdf0e10cSrcweir 	}
2195*cdf0e10cSrcweir }
2196*cdf0e10cSrcweir // -----------------------------------------------------------------------------
2197*cdf0e10cSrcweir OLEVariant OTools::getValue(const WpADOProperties& _rProps,const OLEVariant &_aPosition)
2198*cdf0e10cSrcweir {
2199*cdf0e10cSrcweir 	WpADOProperty aProp(_rProps.GetItem(_aPosition));
2200*cdf0e10cSrcweir 	return aProp.GetValue();
2201*cdf0e10cSrcweir }
2202