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