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