Version 4.3.0.0.beta1, tag libreoffice-4.3.0.0.beta1
[LibreOffice.git] / connectivity / source / drivers / ado / Awrapado.cxx
blob026390aa307bcdd1975429f4b7a29f415dada64d
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include <sal/macros.h>
21 #include "ado/Awrapado.hxx"
22 #include "ado/Awrapadox.hxx"
23 #include <comphelper/types.hxx>
24 #include <rtl/ustrbuf.hxx>
25 #include "diagnose_ex.h"
27 namespace connectivity
29 namespace ado
31 sal_Int32 nAdoObjectCounter = 0;
35 using namespace connectivity::ado;
37 void WpADOCatalog::Create()
39 _ADOCatalog* pCommand;
40 HRESULT hr = CoCreateInstance(ADOS::CLSID_ADOCATALOG_25,
41 NULL,
42 CLSCTX_INPROC_SERVER,
43 ADOS::IID_ADOCATALOG_25,
44 (void**)&pCommand );
47 if( !FAILED( hr ) )
48 setWithOutAddRef(pCommand);
52 WpADOProperties WpADOConnection::get_Properties() const
54 ADOProperties* pProps=NULL;
55 pInterface->get_Properties(&pProps);
56 WpADOProperties aProps;
57 aProps.setWithOutAddRef(pProps);
58 return aProps;
61 OUString WpADOConnection::GetConnectionString() const
63 OSL_ENSURE(pInterface,"Interface is null!");
64 OLEString aBSTR;
65 pInterface->get_ConnectionString(&aBSTR);
66 return aBSTR;
69 sal_Bool WpADOConnection::PutConnectionString(const OUString &aCon) const
71 OSL_ENSURE(pInterface,"Interface is null!");
72 OLEString bstr(aCon);
73 sal_Bool bErg = SUCCEEDED(pInterface->put_ConnectionString(bstr));
75 return bErg;
78 sal_Int32 WpADOConnection::GetCommandTimeout() const
80 OSL_ENSURE(pInterface,"Interface is null!");
81 sal_Int32 nRet=0;
82 pInterface->get_CommandTimeout(&nRet);
83 return nRet;
86 void WpADOConnection::PutCommandTimeout(sal_Int32 nRet)
88 OSL_ENSURE(pInterface,"Interface is null!");
89 pInterface->put_CommandTimeout(nRet);
92 sal_Int32 WpADOConnection::GetConnectionTimeout() const
94 OSL_ENSURE(pInterface,"Interface is null!");
95 sal_Int32 nRet=0;
96 pInterface->get_ConnectionTimeout(&nRet);
97 return nRet;
100 void WpADOConnection::PutConnectionTimeout(sal_Int32 nRet)
102 OSL_ENSURE(pInterface,"Interface is null!");
103 pInterface->put_ConnectionTimeout(nRet);
106 sal_Bool WpADOConnection::Close( )
108 OSL_ENSURE(pInterface,"Interface is null!");
109 return (SUCCEEDED(pInterface->Close()));
112 sal_Bool WpADOConnection::Execute(const OUString& _CommandText,OLEVariant& RecordsAffected,long Options, WpADORecordset** ppiRset)
114 OSL_ENSURE(pInterface,"Interface is null!");
115 OLEString sStr1(_CommandText);
116 sal_Bool bErg = SUCCEEDED(pInterface->Execute(sStr1,&RecordsAffected,Options,(_ADORecordset**)ppiRset));
117 return bErg;
120 sal_Bool WpADOConnection::BeginTrans()
122 OSL_ENSURE(pInterface,"Interface is null!");
123 sal_Int32 nIso=0;
124 return SUCCEEDED(pInterface->BeginTrans(&nIso));
127 sal_Bool WpADOConnection::CommitTrans( )
129 OSL_ENSURE(pInterface,"Interface is null!");
130 return SUCCEEDED(pInterface->CommitTrans());
133 sal_Bool WpADOConnection::RollbackTrans( )
135 OSL_ENSURE(pInterface,"Interface is null!");
136 return SUCCEEDED(pInterface->RollbackTrans());
139 sal_Bool WpADOConnection::Open(const OUString& ConnectionString, const OUString& UserID,const OUString& Password,long Options)
141 OSL_ENSURE(pInterface,"Interface is null!");
142 OLEString sStr1(ConnectionString);
143 OLEString sStr2(UserID);
144 OLEString sStr3(Password);
145 sal_Bool bErg = SUCCEEDED(pInterface->Open(sStr1,sStr2,sStr3,Options));
146 return bErg;
149 sal_Bool WpADOConnection::GetErrors(ADOErrors** pErrors)
151 OSL_ENSURE(pInterface,"Interface is null!");
152 return SUCCEEDED(pInterface->get_Errors(pErrors));
155 OUString WpADOConnection::GetDefaultDatabase() const
157 OSL_ENSURE(pInterface,"Interface is null!");
158 OLEString aBSTR; pInterface->get_DefaultDatabase(&aBSTR);
159 return aBSTR;
162 sal_Bool WpADOConnection::PutDefaultDatabase(const OUString& _bstr)
164 OSL_ENSURE(pInterface,"Interface is null!");
165 OLEString bstr(_bstr);
166 sal_Bool bErg = SUCCEEDED(pInterface->put_DefaultDatabase(bstr));
168 return bErg;
171 IsolationLevelEnum WpADOConnection::get_IsolationLevel() const
173 OSL_ENSURE(pInterface,"Interface is null!");
174 IsolationLevelEnum eNum=adXactUnspecified;
175 pInterface->get_IsolationLevel(&eNum);
176 return eNum;
179 sal_Bool WpADOConnection::put_IsolationLevel(const IsolationLevelEnum& eNum)
181 OSL_ENSURE(pInterface,"Interface is null!");
182 return SUCCEEDED(pInterface->put_IsolationLevel(eNum));
185 sal_Int32 WpADOConnection::get_Attributes() const
187 OSL_ENSURE(pInterface,"Interface is null!");
188 sal_Int32 nRet=0;
189 pInterface->get_Attributes(&nRet);
190 return nRet;
193 sal_Bool WpADOConnection::put_Attributes(sal_Int32 nRet)
195 OSL_ENSURE(pInterface,"Interface is null!");
196 return SUCCEEDED(pInterface->put_Attributes(nRet));
199 CursorLocationEnum WpADOConnection::get_CursorLocation() const
201 OSL_ENSURE(pInterface,"Interface is null!");
202 CursorLocationEnum eNum=adUseNone;
203 pInterface->get_CursorLocation(&eNum);
204 return eNum;
207 sal_Bool WpADOConnection::put_CursorLocation(const CursorLocationEnum &eNum)
209 OSL_ENSURE(pInterface,"Interface is null!");
210 return SUCCEEDED(pInterface->put_CursorLocation(eNum));
213 ConnectModeEnum WpADOConnection::get_Mode() const
215 OSL_ENSURE(pInterface,"Interface is null!");
216 ConnectModeEnum eNum=adModeUnknown;
217 pInterface->get_Mode(&eNum);
218 return eNum;
221 sal_Bool WpADOConnection::put_Mode(const ConnectModeEnum &eNum)
223 OSL_ENSURE(pInterface,"Interface is null!");
224 return SUCCEEDED(pInterface->put_Mode(eNum));
227 OUString WpADOConnection::get_Provider() const
229 OSL_ENSURE(pInterface,"Interface is null!");
230 OLEString aBSTR; pInterface->get_Provider(&aBSTR);
231 return aBSTR;
234 sal_Bool WpADOConnection::put_Provider(const OUString& _bstr)
236 OSL_ENSURE(pInterface,"Interface is null!");
237 OLEString bstr(_bstr);
238 return SUCCEEDED(pInterface->put_Provider(bstr));
241 sal_Int32 WpADOConnection::get_State() const
243 OSL_ENSURE(pInterface,"Interface is null!");
244 sal_Int32 nRet=0;
245 pInterface->get_State(&nRet);
246 return nRet;
249 sal_Bool WpADOConnection::OpenSchema(SchemaEnum eNum,OLEVariant& Restrictions,OLEVariant& SchemaID,ADORecordset**pprset)
251 OSL_ENSURE(pInterface,"Interface is null!");
252 return SUCCEEDED(pInterface->OpenSchema(eNum,Restrictions,SchemaID,pprset));
255 OUString WpADOConnection::get_Version() const
257 OSL_ENSURE(pInterface,"Interface is null!");
258 OLEString aBSTR;
259 pInterface->get_Version(&aBSTR);
260 return aBSTR;
263 sal_Bool WpADOCommand::putref_ActiveConnection( WpADOConnection *pCon)
265 OSL_ENSURE(pInterface,"Interface is null!");
266 if(pCon)
267 return SUCCEEDED(pInterface->putref_ActiveConnection(pCon->pInterface));
268 else
269 return SUCCEEDED(pInterface->putref_ActiveConnection(NULL));
272 void WpADOCommand::put_ActiveConnection(/* [in] */ const OLEVariant& vConn)
274 OSL_ENSURE(pInterface,"Interface is null!");
275 pInterface->put_ActiveConnection(vConn);
278 void WpADOCommand::Create()
280 IClassFactory2* pInterface2 = NULL;
281 HRESULT hr = CoGetClassObject( ADOS::CLSID_ADOCOMMAND_21,
282 CLSCTX_INPROC_SERVER,
283 NULL,
284 IID_IClassFactory2,
285 (void**)&pInterface2 );
287 if( !FAILED( hr ) )
289 ADOCommand* pCommand=NULL;
290 IUnknown* pOuter=NULL;
292 hr = pInterface2->CreateInstanceLic( pOuter,
293 NULL,
294 ADOS::IID_ADOCOMMAND_21,
295 ADOS::GetKeyStr(),
296 (void**) &pCommand);
298 if( !FAILED( hr ) )
300 operator=(pCommand);
301 pCommand->Release();
304 pInterface2->Release();
308 sal_Int32 WpADOCommand::get_State() const
310 OSL_ENSURE(pInterface,"Interface is null!");
311 sal_Int32 nRet=0;
312 pInterface->get_State(&nRet);
313 return nRet;
316 OUString WpADOCommand::get_CommandText() const
318 OSL_ENSURE(pInterface,"Interface is null!");
319 OLEString aBSTR;
320 pInterface->get_CommandText(&aBSTR);
321 return aBSTR;
324 sal_Bool WpADOCommand::put_CommandText(const OUString &aCon)
326 OSL_ENSURE(pInterface,"Interface is null!");
327 OLEString bstr(aCon);
328 sal_Bool bErg = SUCCEEDED(pInterface->put_CommandText(bstr));
330 return bErg;
333 sal_Int32 WpADOCommand::get_CommandTimeout() const
335 OSL_ENSURE(pInterface,"Interface is null!");
336 sal_Int32 nRet=0;
337 pInterface->get_CommandTimeout(&nRet);
338 return nRet;
341 void WpADOCommand::put_CommandTimeout(sal_Int32 nRet)
343 OSL_ENSURE(pInterface,"Interface is null!");
344 pInterface->put_CommandTimeout(nRet);
347 sal_Bool WpADOCommand::get_Prepared() const
349 OSL_ENSURE(pInterface,"Interface is null!");
350 VARIANT_BOOL bPrepared = VARIANT_FALSE;
351 pInterface->get_Prepared(&bPrepared);
352 return bPrepared == VARIANT_TRUE;
355 sal_Bool WpADOCommand::put_Prepared(VARIANT_BOOL bPrepared) const
357 OSL_ENSURE(pInterface,"Interface is null!");
358 return SUCCEEDED(pInterface->put_Prepared(bPrepared));
361 sal_Bool WpADOCommand::Execute(OLEVariant& RecordsAffected,OLEVariant& Params,long Options, ADORecordset** ppiRset)
363 OSL_ENSURE(pInterface,"Interface is null!");
364 return SUCCEEDED(pInterface->Execute(&RecordsAffected,&Params,Options,ppiRset));
367 ADOParameter* WpADOCommand::CreateParameter(const OUString &_bstr,DataTypeEnum Type,ParameterDirectionEnum Direction,long nSize,const OLEVariant &Value)
369 OSL_ENSURE(pInterface,"Interface is null!");
370 ADOParameter* pPara = NULL;
371 OLEString bstr(_bstr);
372 sal_Bool bErg = SUCCEEDED(pInterface->CreateParameter(bstr,Type,Direction,nSize,Value,&pPara));
374 return bErg ? pPara : NULL;
377 ADOParameters* WpADOCommand::get_Parameters() const
379 OSL_ENSURE(pInterface,"Interface is null!");
380 ADOParameters* pPara=NULL;
381 pInterface->get_Parameters(&pPara);
382 return pPara;
385 sal_Bool WpADOCommand::put_CommandType( /* [in] */ CommandTypeEnum lCmdType)
387 OSL_ENSURE(pInterface,"Interface is null!");
388 return SUCCEEDED(pInterface->put_CommandType(lCmdType));
391 CommandTypeEnum WpADOCommand::get_CommandType( ) const
393 OSL_ENSURE(pInterface,"Interface is null!");
394 CommandTypeEnum eNum=adCmdUnspecified;
395 pInterface->get_CommandType(&eNum);
396 return eNum;
399 // returns the name of the field
400 OUString WpADOCommand::GetName() const
402 OSL_ENSURE(pInterface,"Interface is null!");
403 OLEString aBSTR;
404 pInterface->get_Name(&aBSTR);
405 return aBSTR;
408 sal_Bool WpADOCommand::put_Name(const OUString& _Name)
410 OSL_ENSURE(pInterface,"Interface is null!");
411 OLEString bstr(_Name);
412 sal_Bool bErg = SUCCEEDED(pInterface->put_Name(bstr));
414 return bErg;
416 sal_Bool WpADOCommand::Cancel()
418 OSL_ENSURE(pInterface,"Interface is null!");
419 return SUCCEEDED(pInterface->Cancel());
422 OUString WpADOError::GetDescription() const
424 OSL_ENSURE(pInterface,"Interface is null!");
425 OLEString aBSTR;
426 pInterface->get_Description(&aBSTR);
427 return aBSTR;
430 OUString WpADOError::GetSource() const
432 OSL_ENSURE(pInterface,"Interface is null!");
433 OLEString aBSTR;
434 pInterface->get_Source(&aBSTR);
435 return aBSTR;
438 sal_Int32 WpADOError::GetNumber() const
440 OSL_ENSURE(pInterface,"Interface is null!");
441 sal_Int32 nErrNr=0;
442 pInterface->get_Number(&nErrNr);
443 return nErrNr;
446 OUString WpADOError::GetSQLState() const
448 OSL_ENSURE(pInterface,"Interface is null!");
449 OLEString aBSTR;
450 pInterface->get_SQLState(&aBSTR);
451 return aBSTR;
454 sal_Int32 WpADOError::GetNativeError() const
456 OSL_ENSURE(pInterface,"Interface is null!");
457 sal_Int32 nErrNr=0;
458 pInterface->get_NativeError(&nErrNr);
459 return nErrNr;
461 WpADOProperties WpADOField::get_Properties()
463 OSL_ENSURE(pInterface,"Interface is null!");
464 ADOProperties* pProps = NULL;
465 pInterface->get_Properties(&pProps);
466 WpADOProperties aProps;
468 aProps.setWithOutAddRef(pProps);
469 return aProps;
472 sal_Int32 WpADOField::GetActualSize() const
474 OSL_ENSURE(pInterface,"Interface is null!");
475 ADO_LONGPTR nActualSize=0;
476 pInterface->get_ActualSize(&nActualSize);
477 return nActualSize;
480 sal_Int32 WpADOField::GetAttributes() const
482 OSL_ENSURE(pInterface,"Interface is null!");
483 sal_Int32 eADOSFieldAttributes=0;
484 pInterface->get_Attributes(&eADOSFieldAttributes);
485 return eADOSFieldAttributes;
488 sal_Int32 WpADOField::GetStatus() const
490 OSL_ENSURE(pInterface,"Interface is null!");
491 sal_Int32 eADOSFieldAttributes=0;
492 // pInterface->get_Status(&eADOSFieldAttributes);
493 return eADOSFieldAttributes;
496 sal_Int32 WpADOField::GetDefinedSize() const
498 OSL_ENSURE(pInterface,"Interface is null!");
499 ADO_LONGPTR nDefinedSize=0;
500 pInterface->get_DefinedSize(&nDefinedSize);
501 return nDefinedSize;
504 // returns the name of the field
505 OUString WpADOField::GetName() const
507 OSL_ENSURE(pInterface,"Interface is null!");
508 OLEString aBSTR;
509 pInterface->get_Name(&aBSTR);
510 return aBSTR;
513 DataTypeEnum WpADOField::GetADOType() const
515 OSL_ENSURE(pInterface,"Interface is null!");
516 DataTypeEnum eType=adEmpty;
517 pInterface->get_Type(&eType);
518 return eType;
521 void WpADOField::get_Value(OLEVariant& aValVar) const
523 OSL_ENSURE(pInterface,"Interface is null!");
524 aValVar.setEmpty();
525 sal_Bool bOk = SUCCEEDED(pInterface->get_Value(&aValVar));
526 (void)bOk;
529 OLEVariant WpADOField::get_Value() const
531 OSL_ENSURE(pInterface,"Interface is null!");
532 OLEVariant aValVar;
533 pInterface->get_Value(&aValVar);
534 return aValVar;
537 sal_Bool WpADOField::PutValue(const OLEVariant& aVariant)
539 OSL_ENSURE(pInterface,"Interface is null!");
540 return (SUCCEEDED(pInterface->put_Value(aVariant)));
543 sal_Int32 WpADOField::GetPrecision() const
545 OSL_ENSURE(pInterface,"Interface is null!");
546 sal_uInt8 eType=0;
547 pInterface->get_Precision(&eType);
548 return eType;
551 sal_Int32 WpADOField::GetNumericScale() const
553 OSL_ENSURE(pInterface,"Interface is null!");
554 sal_uInt8 eType=0;
555 pInterface->get_NumericScale(&eType);
556 return eType;
559 sal_Bool WpADOField::AppendChunk(const OLEVariant& _Variant)
561 OSL_ENSURE(pInterface,"Interface is null!");
562 return (SUCCEEDED(pInterface->AppendChunk(_Variant)));
565 OLEVariant WpADOField::GetChunk(long Length) const
567 OSL_ENSURE(pInterface,"Interface is null!");
568 OLEVariant aValVar;
569 pInterface->GetChunk(Length,&aValVar);
570 return aValVar;
573 void WpADOField::GetChunk(long Length,OLEVariant &aValVar) const
575 OSL_ENSURE(pInterface,"Interface is null!");
576 pInterface->GetChunk(Length,&aValVar);
579 OLEVariant WpADOField::GetOriginalValue() const
581 OSL_ENSURE(pInterface,"Interface is null!");
582 OLEVariant aValVar;
583 pInterface->get_OriginalValue(&aValVar);
584 return aValVar;
587 void WpADOField::GetOriginalValue(OLEVariant &aValVar) const
589 OSL_ENSURE(pInterface,"Interface is null!");
590 pInterface->get_OriginalValue(&aValVar);
593 OLEVariant WpADOField::GetUnderlyingValue() const
595 OSL_ENSURE(pInterface,"Interface is null!");
596 OLEVariant aValVar;
597 pInterface->get_UnderlyingValue(&aValVar);
598 return aValVar;
601 void WpADOField::GetUnderlyingValue(OLEVariant &aValVar) const
603 OSL_ENSURE(pInterface,"Interface is null!");
604 pInterface->get_UnderlyingValue(&aValVar);
607 sal_Bool WpADOField::PutPrecision(sal_Int8 _prec)
609 OSL_ENSURE(pInterface,"Interface is null!");
610 return (SUCCEEDED(pInterface->put_Precision(_prec)));
613 sal_Bool WpADOField::PutNumericScale(sal_Int8 _prec)
615 OSL_ENSURE(pInterface,"Interface is null!");
616 return (SUCCEEDED(pInterface->put_NumericScale(_prec)));
619 void WpADOField::PutADOType(DataTypeEnum eType)
621 OSL_ENSURE(pInterface,"Interface is null!");
622 pInterface->put_Type(eType);
625 sal_Bool WpADOField::PutDefinedSize(sal_Int32 _nDefSize)
627 OSL_ENSURE(pInterface,"Interface is null!");
628 return (SUCCEEDED(pInterface->put_DefinedSize(_nDefSize)));
631 sal_Bool WpADOField::PutAttributes(sal_Int32 _nDefSize)
633 OSL_ENSURE(pInterface,"Interface is null!");
634 return (SUCCEEDED(pInterface->put_Attributes(_nDefSize)));
637 OLEVariant WpADOProperty::GetValue() const
639 OLEVariant aValVar;
640 if(pInterface)
641 pInterface->get_Value(&aValVar);
642 return aValVar;
645 void WpADOProperty::GetValue(OLEVariant &aValVar) const
647 OSL_ENSURE(pInterface,"Interface is null!");
648 if(pInterface)
649 pInterface->get_Value(&aValVar);
652 sal_Bool WpADOProperty::PutValue(const OLEVariant &aValVar)
654 OSL_ENSURE(pInterface,"Interface is null!");
655 return (SUCCEEDED(pInterface->put_Value(aValVar)));
658 OUString WpADOProperty::GetName() const
660 OSL_ENSURE(pInterface,"Interface is null!");
661 OLEString aBSTR;
662 pInterface->get_Name(&aBSTR);
663 return aBSTR;
666 DataTypeEnum WpADOProperty::GetADOType() const
668 OSL_ENSURE(pInterface,"Interface is null!");
669 DataTypeEnum eType=adEmpty;
670 pInterface->get_Type(&eType);
671 return eType;
674 sal_Int32 WpADOProperty::GetAttributes() const
676 OSL_ENSURE(pInterface,"Interface is null!");
677 sal_Int32 eADOSFieldAttributes=0;
678 pInterface->get_Attributes(&eADOSFieldAttributes);
679 return eADOSFieldAttributes;
682 sal_Bool WpADOProperty::PutAttributes(sal_Int32 _nDefSize)
684 OSL_ENSURE(pInterface,"Interface is null!");
685 return (SUCCEEDED(pInterface->put_Attributes(_nDefSize)));
687 void WpADORecordset::Create()
689 IClassFactory2* pInterface2 = NULL;
690 HRESULT hr = CoGetClassObject( ADOS::CLSID_ADORECORDSET_21,
691 CLSCTX_INPROC_SERVER,
692 NULL,
693 IID_IClassFactory2,
694 (void**)&pInterface2 );
696 if( !FAILED( hr ) )
698 ADORecordset *pRec = NULL;
699 IUnknown *pOuter = NULL;
700 hr = pInterface2->CreateInstanceLic( pOuter,
701 NULL,
702 ADOS::IID_ADORECORDSET_21,
703 ADOS::GetKeyStr(),
704 (void**) &pRec);
706 if( !FAILED( hr ) )
708 operator=(pRec);
709 pRec->Release();
712 pInterface2->Release();
716 sal_Bool WpADORecordset::Open(
717 /* [optional][in] */ VARIANT Source,
718 /* [optional][in] */ VARIANT ActiveConnection,
719 /* [defaultvalue][in] */ CursorTypeEnum CursorType,
720 /* [defaultvalue][in] */ LockTypeEnum LockType,
721 /* [defaultvalue][in] */ sal_Int32 Options)
723 OSL_ENSURE(pInterface,"Interface is null!");
724 return (SUCCEEDED(pInterface->Open(Source,ActiveConnection,CursorType,LockType,Options)));
728 LockTypeEnum WpADORecordset::GetLockType()
730 OSL_ENSURE(pInterface,"Interface is null!");
731 LockTypeEnum eType=adLockUnspecified;
732 pInterface->get_LockType(&eType);
733 return eType;
736 void WpADORecordset::Close()
738 OSL_ENSURE(pInterface,"Interface is null!");
739 OSL_ENSURE(pInterface,"Interface is null!");
740 pInterface->Close();
743 sal_Bool WpADORecordset::Cancel() const
745 OSL_ENSURE(pInterface,"Interface is null!");
746 return (SUCCEEDED(pInterface->Cancel()));
749 sal_Int32 WpADORecordset::get_State( )
751 OSL_ENSURE(pInterface,"Interface is null!");
752 sal_Int32 nState = 0;
753 pInterface->get_State(&nState);
754 return nState;
757 sal_Bool WpADORecordset::Supports( /* [in] */ CursorOptionEnum CursorOptions)
759 OSL_ENSURE(pInterface,"Interface is null!");
760 VARIANT_BOOL bSupports=VARIANT_FALSE;
761 pInterface->Supports(CursorOptions,&bSupports);
762 return bSupports == VARIANT_TRUE;
765 PositionEnum_Param WpADORecordset::get_AbsolutePosition()
767 OSL_ENSURE(pInterface,"Interface is null!");
768 PositionEnum_Param aTemp=adPosUnknown;
769 pInterface->get_AbsolutePosition(&aTemp);
770 return aTemp;
773 void WpADORecordset::GetDataSource(IUnknown** _pInterface) const
775 OSL_ENSURE(pInterface,"Interface is null!");
776 pInterface->get_DataSource(_pInterface);
779 void WpADORecordset::PutRefDataSource(IUnknown* _pInterface)
781 OSL_ENSURE(pInterface,"Interface is null!");
782 pInterface->putref_DataSource(_pInterface);
785 void WpADORecordset::GetBookmark(VARIANT& var)
787 OSL_ENSURE(pInterface,"Interface is null!");
788 pInterface->get_Bookmark(&var);
791 OLEVariant WpADORecordset::GetBookmark()
793 OSL_ENSURE(pInterface,"Interface is null!");
794 OLEVariant var;
795 pInterface->get_Bookmark(&var);
796 return var;
799 CompareEnum WpADORecordset::CompareBookmarks(const OLEVariant& left,const OLEVariant& right)
801 OSL_ENSURE(pInterface,"Interface is null!");
802 CompareEnum eNum=adCompareNotComparable;
803 pInterface->CompareBookmarks(left,right,&eNum);
804 return eNum;
807 sal_Bool WpADORecordset::SetBookmark(const OLEVariant &pSafeAr)
809 OSL_ENSURE(pInterface,"Interface is null!");
810 return SUCCEEDED(pInterface->put_Bookmark(pSafeAr));
814 WpADOFields WpADORecordset::GetFields() const
816 OSL_ENSURE(pInterface,"Interface is null!");
817 ADOFields* pFields=NULL;
818 pInterface->get_Fields(&pFields);
819 WpADOFields aFields;
820 aFields.setWithOutAddRef(pFields);
821 return aFields;
825 sal_Bool WpADORecordset::Move(sal_Int32 nRows, VARIANT aBmk) {return pInterface && SUCCEEDED(pInterface->Move(nRows, aBmk));}
826 sal_Bool WpADORecordset::MoveNext() {return pInterface && SUCCEEDED(pInterface->MoveNext());}
827 sal_Bool WpADORecordset::MovePrevious() {return pInterface && SUCCEEDED(pInterface->MovePrevious());}
828 sal_Bool WpADORecordset::MoveFirst() {return pInterface && SUCCEEDED(pInterface->MoveFirst());}
829 sal_Bool WpADORecordset::MoveLast() {return pInterface && SUCCEEDED(pInterface->MoveLast());}
831 sal_Bool WpADORecordset::IsAtBOF() const
833 OSL_ENSURE(pInterface,"Interface is null!");
834 VARIANT_BOOL bIsAtBOF=VARIANT_FALSE;
835 pInterface->get_BOF(&bIsAtBOF);
836 return bIsAtBOF == VARIANT_TRUE;
839 sal_Bool WpADORecordset::IsAtEOF() const
841 OSL_ENSURE(pInterface,"Interface is null!");
842 VARIANT_BOOL bIsAtEOF=VARIANT_FALSE;
843 pInterface->get_EOF(&bIsAtEOF);
844 return bIsAtEOF == VARIANT_TRUE;
847 sal_Bool WpADORecordset::Delete(AffectEnum eNum)
849 OSL_ENSURE(pInterface,"Interface is null!");
850 return SUCCEEDED(pInterface->Delete(eNum));
853 sal_Bool WpADORecordset::AddNew(const OLEVariant &FieldList,const OLEVariant &Values)
855 OSL_ENSURE(pInterface,"Interface is null!");
856 return SUCCEEDED(pInterface->AddNew(FieldList,Values));
859 sal_Bool WpADORecordset::Update(const OLEVariant &FieldList,const OLEVariant &Values)
861 OSL_ENSURE(pInterface,"Interface is null!");
862 return SUCCEEDED(pInterface->Update(FieldList,Values));
865 sal_Bool WpADORecordset::CancelUpdate()
867 OSL_ENSURE(pInterface,"Interface is null!");
868 return SUCCEEDED(pInterface->CancelUpdate());
871 WpADOProperties WpADORecordset::get_Properties() const
873 OSL_ENSURE(pInterface,"Interface is null!");
874 ADOProperties* pProps=NULL;
875 pInterface->get_Properties(&pProps);
876 WpADOProperties aProps;
877 aProps.setWithOutAddRef(pProps);
878 return aProps;
881 sal_Bool WpADORecordset::NextRecordset(OLEVariant& RecordsAffected,ADORecordset** ppiRset)
883 OSL_ENSURE(pInterface,"Interface is null!");
884 return SUCCEEDED(pInterface->NextRecordset(&RecordsAffected,ppiRset));
887 sal_Bool WpADORecordset::get_RecordCount(ADO_LONGPTR &_nRet) const
889 OSL_ENSURE(pInterface,"Interface is null!");
890 return SUCCEEDED(pInterface->get_RecordCount(&_nRet));
893 sal_Bool WpADORecordset::get_MaxRecords(ADO_LONGPTR &_nRet) const
895 OSL_ENSURE(pInterface,"Interface is null!");
896 return SUCCEEDED(pInterface->get_MaxRecords(&_nRet));
899 sal_Bool WpADORecordset::put_MaxRecords(ADO_LONGPTR _nRet)
901 OSL_ENSURE(pInterface,"Interface is null!");
902 return SUCCEEDED(pInterface->put_MaxRecords(_nRet));
905 sal_Bool WpADORecordset::get_CursorType(CursorTypeEnum &_nRet) const
907 OSL_ENSURE(pInterface,"Interface is null!");
908 return SUCCEEDED(pInterface->get_CursorType(&_nRet));
911 sal_Bool WpADORecordset::put_CursorType(CursorTypeEnum _nRet)
913 OSL_ENSURE(pInterface,"Interface is null!");
914 return SUCCEEDED(pInterface->put_CursorType(_nRet));
917 sal_Bool WpADORecordset::get_LockType(LockTypeEnum &_nRet) const
919 OSL_ENSURE(pInterface,"Interface is null!");
920 return SUCCEEDED(pInterface->get_LockType(&_nRet));
923 sal_Bool WpADORecordset::put_LockType(LockTypeEnum _nRet)
925 OSL_ENSURE(pInterface,"Interface is null!");
926 return SUCCEEDED(pInterface->put_LockType(_nRet));
929 sal_Bool WpADORecordset::get_CacheSize(sal_Int32 &_nRet) const
931 OSL_ENSURE(pInterface,"Interface is null!");
932 return SUCCEEDED(pInterface->get_CacheSize(&_nRet));
935 sal_Bool WpADORecordset::put_CacheSize(sal_Int32 _nRet)
937 OSL_ENSURE(pInterface,"Interface is null!");
938 return SUCCEEDED(pInterface->put_CacheSize(_nRet));
941 sal_Bool WpADORecordset::UpdateBatch(AffectEnum AffectRecords)
943 OSL_ENSURE(pInterface,"Interface is null!");
944 return SUCCEEDED(pInterface->UpdateBatch(AffectRecords));
947 OUString WpADOParameter::GetName() const
949 OSL_ENSURE(pInterface,"Interface is null!");
950 OLEString aBSTR;
951 pInterface->get_Name(&aBSTR);
952 return aBSTR;
955 DataTypeEnum WpADOParameter::GetADOType() const
957 OSL_ENSURE(pInterface,"Interface is null!");
958 DataTypeEnum eType=adEmpty;
959 pInterface->get_Type(&eType);
960 return eType;
963 void WpADOParameter::put_Type(const DataTypeEnum& _eType)
965 OSL_ENSURE(pInterface,"Interface is null!");
966 pInterface->put_Type(_eType);
969 sal_Int32 WpADOParameter::GetAttributes() const
971 OSL_ENSURE(pInterface,"Interface is null!");
972 sal_Int32 eADOSFieldAttributes=0;
973 pInterface->get_Attributes(&eADOSFieldAttributes);
974 return eADOSFieldAttributes;
977 sal_Int32 WpADOParameter::GetPrecision() const
979 OSL_ENSURE(pInterface,"Interface is null!");
980 sal_uInt8 eType=0;
981 pInterface->get_Precision(&eType);
982 return eType;
985 sal_Int32 WpADOParameter::GetNumericScale() const
987 OSL_ENSURE(pInterface,"Interface is null!");
988 sal_uInt8 eType=0;
989 pInterface->get_NumericScale(&eType);
990 return eType;
993 ParameterDirectionEnum WpADOParameter::get_Direction() const
995 OSL_ENSURE(pInterface,"Interface is null!");
996 ParameterDirectionEnum alParmDirection=adParamUnknown;
997 pInterface->get_Direction(&alParmDirection);
998 return alParmDirection;
1001 void WpADOParameter::GetValue(OLEVariant& aValVar) const
1003 OSL_ENSURE(pInterface,"Interface is null!");
1004 pInterface->get_Value(&aValVar);
1007 OLEVariant WpADOParameter::GetValue() const
1009 OSL_ENSURE(pInterface,"Interface is null!");
1010 OLEVariant aValVar;
1011 pInterface->get_Value(&aValVar);
1012 return aValVar;
1015 sal_Bool WpADOParameter::PutValue(const OLEVariant& aVariant)
1017 OSL_ENSURE(pInterface,"Interface is null!");
1018 return (SUCCEEDED(pInterface->put_Value(aVariant)));
1020 sal_Bool WpADOParameter::AppendChunk(const OLEVariant& aVariant)
1022 OSL_ENSURE(pInterface,"Interface is null!");
1023 return (SUCCEEDED(pInterface->AppendChunk(aVariant)));
1025 sal_Bool WpADOParameter::put_Size(const sal_Int32& _nSize)
1027 OSL_ENSURE(pInterface,"Interface is null!");
1028 return (SUCCEEDED(pInterface->put_Size(_nSize)));
1031 OUString WpADOColumn::get_Name() const
1033 OSL_ENSURE(pInterface,"Interface is null!");
1034 OLEString aBSTR;
1035 pInterface->get_Name(&aBSTR);
1036 return aBSTR;
1039 OUString WpADOColumn::get_RelatedColumn() const
1041 OSL_ENSURE(pInterface,"Interface is null!");
1042 OLEString aBSTR;
1043 pInterface->get_RelatedColumn(&aBSTR);
1044 return aBSTR;
1047 void WpADOColumn::put_Name(const OUString& _rName)
1049 OSL_ENSURE(pInterface,"Interface is null!");
1050 OLEString bstr(_rName);
1051 sal_Bool bErg = SUCCEEDED(pInterface->put_Name(bstr));
1052 (void)bErg;
1054 void WpADOColumn::put_RelatedColumn(const OUString& _rName)
1056 OSL_ENSURE(pInterface,"Interface is null!");
1057 OLEString bstr(_rName);
1058 sal_Bool bErg = SUCCEEDED(pInterface->put_RelatedColumn(bstr));
1059 (void)bErg;
1062 DataTypeEnum WpADOColumn::get_Type() const
1064 OSL_ENSURE(pInterface,"Interface is null!");
1065 DataTypeEnum eNum = adVarChar;
1066 pInterface->get_Type(&eNum);
1067 return eNum;
1070 void WpADOColumn::put_Type(const DataTypeEnum& _eNum)
1072 OSL_ENSURE(pInterface,"Interface is null!");
1073 pInterface->put_Type(_eNum);
1076 sal_Int32 WpADOColumn::get_Precision() const
1078 OSL_ENSURE(pInterface,"Interface is null!");
1079 sal_Int32 nPrec=0;
1080 pInterface->get_Precision(&nPrec);
1081 return nPrec;
1084 void WpADOColumn::put_Precision(sal_Int32 _nPre)
1086 OSL_ENSURE(pInterface,"Interface is null!");
1087 pInterface->put_Precision(_nPre);
1090 sal_Int32 WpADOColumn::get_DefinedSize() const
1092 OSL_ENSURE(pInterface,"Interface is null!");
1093 sal_Int32 nPrec=0;
1094 pInterface->get_DefinedSize(&nPrec);
1095 return nPrec;
1097 sal_uInt8 WpADOColumn::get_NumericScale() const
1099 OSL_ENSURE(pInterface,"Interface is null!");
1100 sal_uInt8 nPrec=0;
1101 pInterface->get_NumericScale(&nPrec);
1102 return nPrec;
1105 void WpADOColumn::put_NumericScale(sal_Int8 _nScale)
1107 OSL_ENSURE(pInterface,"Interface is null!");
1108 pInterface->put_NumericScale(_nScale);
1111 SortOrderEnum WpADOColumn::get_SortOrder() const
1113 OSL_ENSURE(pInterface,"Interface is null!");
1114 SortOrderEnum nPrec=adSortAscending;
1115 pInterface->get_SortOrder(&nPrec);
1116 return nPrec;
1119 void WpADOColumn::put_SortOrder(SortOrderEnum _nScale)
1121 OSL_ENSURE(pInterface,"Interface is null!");
1122 pInterface->put_SortOrder(_nScale);
1125 ColumnAttributesEnum WpADOColumn::get_Attributes() const
1127 OSL_ENSURE(pInterface,"Interface is null!");
1128 ColumnAttributesEnum eNum=adColNullable;
1129 pInterface->get_Attributes(&eNum);
1130 return eNum;
1133 sal_Bool WpADOColumn::put_Attributes(const ColumnAttributesEnum& _eNum)
1135 OSL_ENSURE(pInterface,"Interface is null!");
1136 return SUCCEEDED(pInterface->put_Attributes(_eNum));
1139 WpADOProperties WpADOColumn::get_Properties() const
1141 OSL_ENSURE(pInterface,"Interface is null!");
1142 ADOProperties* pProps = NULL;
1143 pInterface->get_Properties(&pProps);
1144 WpADOProperties aProps;
1146 aProps.setWithOutAddRef(pProps);
1147 return aProps;
1150 OUString WpADOKey::get_Name() const
1152 OSL_ENSURE(pInterface,"Interface is null!");
1153 OLEString aBSTR;
1154 pInterface->get_Name(&aBSTR);
1155 return aBSTR;
1158 void WpADOKey::put_Name(const OUString& _rName)
1160 OSL_ENSURE(pInterface,"Interface is null!");
1161 OLEString bstr(_rName);
1162 sal_Bool bErg = SUCCEEDED(pInterface->put_Name(bstr));
1163 (void)bErg;
1166 KeyTypeEnum WpADOKey::get_Type() const
1168 OSL_ENSURE(pInterface,"Interface is null!");
1169 KeyTypeEnum eNum=adKeyPrimary;
1170 pInterface->get_Type(&eNum);
1171 return eNum;
1174 void WpADOKey::put_Type(const KeyTypeEnum& _eNum)
1176 OSL_ENSURE(pInterface,"Interface is null!");
1177 pInterface->put_Type(_eNum);
1180 OUString WpADOKey::get_RelatedTable() const
1182 OSL_ENSURE(pInterface,"Interface is null!");
1183 OLEString aBSTR;
1184 pInterface->get_RelatedTable(&aBSTR);
1185 return aBSTR;
1188 void WpADOKey::put_RelatedTable(const OUString& _rName)
1190 OSL_ENSURE(pInterface,"Interface is null!");
1191 OLEString bstr(_rName);
1192 sal_Bool bErg = SUCCEEDED(pInterface->put_RelatedTable(bstr));
1193 (void)bErg;
1196 RuleEnum WpADOKey::get_DeleteRule() const
1198 OSL_ENSURE(pInterface,"Interface is null!");
1199 RuleEnum eNum = adRINone;
1200 pInterface->get_DeleteRule(&eNum);
1201 return eNum;
1204 void WpADOKey::put_DeleteRule(const RuleEnum& _eNum)
1206 OSL_ENSURE(pInterface,"Interface is null!");
1207 pInterface->put_DeleteRule(_eNum);
1210 RuleEnum WpADOKey::get_UpdateRule() const
1212 OSL_ENSURE(pInterface,"Interface is null!");
1213 RuleEnum eNum = adRINone;
1214 pInterface->get_UpdateRule(&eNum);
1215 return eNum;
1218 void WpADOKey::put_UpdateRule(const RuleEnum& _eNum)
1220 OSL_ENSURE(pInterface,"Interface is null!");
1221 pInterface->put_UpdateRule(_eNum);
1224 WpADOColumns WpADOKey::get_Columns() const
1226 OSL_ENSURE(pInterface,"Interface is null!");
1227 ADOColumns* pCols = NULL;
1228 pInterface->get_Columns(&pCols);
1229 WpADOColumns aCols;
1230 aCols.setWithOutAddRef(pCols);
1231 return aCols;
1234 OUString WpADOIndex::get_Name() const
1236 OSL_ENSURE(pInterface,"Interface is null!");
1237 OLEString aBSTR;
1238 pInterface->get_Name(&aBSTR);
1239 return aBSTR;
1242 void WpADOIndex::put_Name(const OUString& _rName)
1244 OSL_ENSURE(pInterface,"Interface is null!");
1245 OLEString bstr(_rName);
1246 sal_Bool bErg = SUCCEEDED(pInterface->put_Name(bstr));
1247 (void)bErg;
1250 sal_Bool WpADOIndex::get_Clustered() const
1252 OSL_ENSURE(pInterface,"Interface is null!");
1253 VARIANT_BOOL eNum = VARIANT_FALSE;
1254 pInterface->get_Clustered(&eNum);
1255 return eNum == VARIANT_TRUE;
1258 void WpADOIndex::put_Clustered(sal_Bool _b)
1260 OSL_ENSURE(pInterface,"Interface is null!");
1261 pInterface->put_Clustered(_b ? VARIANT_TRUE : VARIANT_FALSE);
1264 sal_Bool WpADOIndex::get_Unique() const
1266 OSL_ENSURE(pInterface,"Interface is null!");
1267 VARIANT_BOOL eNum = VARIANT_FALSE;
1268 pInterface->get_Unique(&eNum);
1269 return eNum == VARIANT_TRUE;
1272 void WpADOIndex::put_Unique(sal_Bool _b)
1274 OSL_ENSURE(pInterface,"Interface is null!");
1275 pInterface->put_Unique(_b ? VARIANT_TRUE : VARIANT_FALSE);
1278 sal_Bool WpADOIndex::get_PrimaryKey() const
1280 OSL_ENSURE(pInterface,"Interface is null!");
1281 VARIANT_BOOL eNum = VARIANT_FALSE;
1282 pInterface->get_PrimaryKey(&eNum);
1283 return eNum == VARIANT_TRUE;
1286 void WpADOIndex::put_PrimaryKey(sal_Bool _b)
1288 OSL_ENSURE(pInterface,"Interface is null!");
1289 pInterface->put_PrimaryKey(_b ? VARIANT_TRUE : VARIANT_FALSE);
1292 WpADOColumns WpADOIndex::get_Columns() const
1294 OSL_ENSURE(pInterface,"Interface is null!");
1295 ADOColumns* pCols = NULL;
1296 pInterface->get_Columns(&pCols);
1297 WpADOColumns aCols;
1298 aCols.setWithOutAddRef(pCols);
1299 return aCols;
1302 void WpADOCatalog::putref_ActiveConnection(IDispatch* pCon)
1304 OSL_ENSURE(pInterface,"Interface is null!");
1305 pInterface->putref_ActiveConnection(pCon);
1308 WpADOTables WpADOCatalog::get_Tables()
1310 OSL_ENSURE(pInterface,"Interface is null!");
1311 ADOTables* pRet = NULL;
1312 pInterface->get_Tables(&pRet);
1313 WpADOTables aRet;
1314 aRet.setWithOutAddRef(pRet);
1315 return aRet;
1318 WpADOViews WpADOCatalog::get_Views()
1320 OSL_ENSURE(pInterface,"Interface is null!");
1321 ADOViews* pRet = NULL;
1322 pInterface->get_Views(&pRet);
1323 WpADOViews aRet;
1324 aRet.setWithOutAddRef(pRet);
1325 return aRet;
1328 WpADOGroups WpADOCatalog::get_Groups()
1330 OSL_ENSURE(pInterface,"Interface is null!");
1331 ADOGroups* pRet = NULL;
1332 pInterface->get_Groups(&pRet);
1333 WpADOGroups aRet;
1334 aRet.setWithOutAddRef(pRet);
1335 return aRet;
1338 WpADOUsers WpADOCatalog::get_Users()
1340 OSL_ENSURE(pInterface,"Interface is null!");
1341 ADOUsers* pRet = NULL;
1342 pInterface->get_Users(&pRet);
1343 WpADOUsers aRet;
1344 aRet.setWithOutAddRef(pRet);
1345 return aRet;
1348 ADOProcedures* WpADOCatalog::get_Procedures()
1350 OSL_ENSURE(pInterface,"Interface is null!");
1351 ADOProcedures* pRet = NULL;
1352 pInterface->get_Procedures(&pRet);
1353 return pRet;
1356 OUString WpADOTable::get_Name() const
1358 OSL_ENSURE(pInterface,"Interface is null!");
1359 OLEString aBSTR;
1360 pInterface->get_Name(&aBSTR);
1361 return aBSTR;
1364 void WpADOTable::put_Name(const OUString& _rName)
1366 OSL_ENSURE(pInterface,"Interface is null!");
1367 OLEString bstr(_rName);
1368 sal_Bool bErg = SUCCEEDED(pInterface->put_Name(bstr));
1369 (void)bErg;
1372 OUString WpADOTable::get_Type() const
1374 OSL_ENSURE(pInterface,"Interface is null!");
1375 OLEString aBSTR;
1376 pInterface->get_Type(&aBSTR);
1377 return aBSTR;
1380 WpADOColumns WpADOTable::get_Columns() const
1382 OSL_ENSURE(pInterface,"Interface is null!");
1383 ADOColumns* pCols = NULL;
1384 pInterface->get_Columns(&pCols);
1385 WpADOColumns aCols;
1386 aCols.setWithOutAddRef(pCols);
1387 return aCols;
1390 WpADOIndexes WpADOTable::get_Indexes() const
1392 OSL_ENSURE(pInterface,"Interface is null!");
1393 ADOIndexes* pCols = NULL;
1394 pInterface->get_Indexes(&pCols);
1395 WpADOIndexes aRet;
1396 aRet.setWithOutAddRef(pCols);
1397 return aRet;
1400 WpADOKeys WpADOTable::get_Keys() const
1402 OSL_ENSURE(pInterface,"Interface is null!");
1403 ADOKeys* pCols = NULL;
1404 pInterface->get_Keys(&pCols);
1405 WpADOKeys aRet;
1406 aRet.setWithOutAddRef(pCols);
1407 return aRet;
1410 WpADOCatalog WpADOTable::get_ParentCatalog() const
1412 OSL_ENSURE(pInterface,"Interface is null!");
1413 ADOCatalog* pCat = NULL;
1414 pInterface->get_ParentCatalog(&pCat);
1415 WpADOCatalog aRet;
1416 aRet.setWithOutAddRef(pCat);
1417 return aRet;
1420 WpADOProperties WpADOTable::get_Properties() const
1422 OSL_ENSURE(pInterface,"Interface is null!");
1423 ADOProperties* pProps = NULL;
1424 pInterface->get_Properties(&pProps);
1425 WpADOProperties aProps;
1426 aProps.setWithOutAddRef(pProps);
1427 return aProps;
1430 OUString WpADOView::get_Name() const
1432 OSL_ENSURE(pInterface,"Interface is null!");
1433 OLEString aBSTR;
1434 pInterface->get_Name(&aBSTR);
1435 return aBSTR;
1438 void WpADOView::get_Command(OLEVariant& _rVar) const
1440 OSL_ENSURE(pInterface,"Interface is null!");
1441 pInterface->get_Command(&_rVar);
1444 void WpADOView::put_Command(OLEVariant& _rVar)
1446 pInterface->put_Command(_rVar);
1449 OUString WpADOGroup::get_Name() const
1451 OLEString aBSTR;
1452 pInterface->get_Name(&aBSTR);
1453 return aBSTR;
1456 void WpADOGroup::put_Name(const OUString& _rName)
1458 OLEString bstr(_rName);
1459 sal_Bool bErg = SUCCEEDED(pInterface->put_Name(bstr));
1460 (void)bErg;
1463 RightsEnum WpADOGroup::GetPermissions(
1464 /* [in] */ const OLEVariant& Name,
1465 /* [in] */ ObjectTypeEnum ObjectType)
1467 RightsEnum Rights=adRightNone;
1468 OLEVariant ObjectTypeId;
1469 ObjectTypeId.setNoArg();
1470 pInterface->GetPermissions(Name,ObjectType,ObjectTypeId,&Rights);
1471 return Rights;
1474 sal_Bool WpADOGroup::SetPermissions(
1475 /* [in] */ const OLEVariant& Name,
1476 /* [in] */ ObjectTypeEnum ObjectType,
1477 /* [in] */ ActionEnum Action,
1478 /* [in] */ RightsEnum Rights)
1480 OLEVariant ObjectTypeId;
1481 ObjectTypeId.setNoArg();
1482 return SUCCEEDED(pInterface->SetPermissions(Name,ObjectType,Action,Rights,adInheritNone,ObjectTypeId));
1485 WpADOUsers WpADOGroup::get_Users( )
1487 ADOUsers* pRet = NULL;
1488 pInterface->get_Users( &pRet);
1489 WpADOUsers aRet;
1490 aRet.setWithOutAddRef(pRet);
1491 return aRet;
1494 OUString WpADOUser::get_Name() const
1496 OLEString aBSTR;
1497 pInterface->get_Name(&aBSTR);
1498 return aBSTR;
1501 void WpADOUser::put_Name(const OUString& _rName)
1503 OLEString bstr(_rName);
1504 sal_Bool bErg = SUCCEEDED(pInterface->put_Name(bstr));
1505 (void)bErg;
1508 sal_Bool WpADOUser::ChangePassword(const OUString& _rPwd,const OUString& _rNewPwd)
1510 OLEString sStr1(_rPwd);
1511 OLEString sStr2(_rNewPwd);
1512 sal_Bool bErg = SUCCEEDED(pInterface->ChangePassword(sStr1,sStr2));
1513 return bErg;
1516 WpADOGroups WpADOUser::get_Groups()
1518 ADOGroups* pRet = NULL;
1519 pInterface->get_Groups(&pRet);
1520 WpADOGroups aRet;
1521 aRet.setWithOutAddRef(pRet);
1522 return aRet;
1525 RightsEnum WpADOUser::GetPermissions(
1526 /* [in] */ const OLEVariant& Name,
1527 /* [in] */ ObjectTypeEnum ObjectType)
1529 RightsEnum Rights=adRightNone;
1530 OLEVariant ObjectTypeId;
1531 ObjectTypeId.setNoArg();
1532 pInterface->GetPermissions(Name,ObjectType,ObjectTypeId,&Rights);
1533 return Rights;
1536 sal_Bool WpADOUser::SetPermissions(
1537 /* [in] */ const OLEVariant& Name,
1538 /* [in] */ ObjectTypeEnum ObjectType,
1539 /* [in] */ ActionEnum Action,
1540 /* [in] */ RightsEnum Rights)
1542 OLEVariant ObjectTypeId;
1543 ObjectTypeId.setNoArg();
1544 return SUCCEEDED(pInterface->SetPermissions(Name,ObjectType,Action,Rights,adInheritNone,ObjectTypeId));
1547 WpBase::WpBase() : pIUnknown(NULL)
1550 WpBase::WpBase(IDispatch* pInt)
1551 :pIUnknown(pInt)
1553 if (pIUnknown)
1555 ULONG nCount = pIUnknown->AddRef();
1556 (void)nCount;
1557 // OSL_ENSURE(nCount == 1,"Count is greater than 1");
1561 WpBase::WpBase(const WpBase& aWrapper)
1562 :pIUnknown(aWrapper.pIUnknown)
1564 if (pIUnknown)
1565 pIUnknown->AddRef();
1568 //inline
1569 WpBase& WpBase::operator=(const WpBase& rhs)
1571 if (rhs.pIUnknown != pIUnknown)
1573 if (pIUnknown)
1574 pIUnknown->Release();
1575 pIUnknown = rhs.pIUnknown;
1576 if (pIUnknown)
1577 pIUnknown->AddRef();
1579 return *this;
1582 WpBase& WpBase::operator=(IDispatch* rhs)
1584 if (pIUnknown != rhs)
1586 if (pIUnknown)
1587 pIUnknown->Release();
1588 pIUnknown = rhs;
1589 if (pIUnknown)
1590 pIUnknown->AddRef();
1592 return *this;
1595 WpBase::~WpBase()
1597 if (pIUnknown)
1599 pIUnknown->Release();
1600 pIUnknown = NULL;
1604 void WpBase::clear()
1606 if (pIUnknown)
1608 pIUnknown->Release();
1609 pIUnknown = NULL;
1614 sal_Bool WpBase::IsValid() const
1616 return pIUnknown != NULL;
1618 WpBase::operator IDispatch*()
1620 return pIUnknown;
1623 ADORecordset* WpADOConnection::getExportedKeys( const ::com::sun::star::uno::Any& catalog, const OUString& schema, const OUString& table )
1625 // Create elements used in the array
1626 SAFEARRAYBOUND rgsabound[1];
1627 SAFEARRAY *psa = NULL;
1628 OLEVariant varCriteria[6];
1630 // Create SafeArray Bounds and initialize the array
1631 rgsabound[0].lLbound = 0;
1632 rgsabound[0].cElements = sizeof varCriteria / sizeof varCriteria[0];
1633 psa = SafeArrayCreate( VT_VARIANT, 1, rgsabound );
1635 sal_Int32 nPos=0;
1636 if(catalog.hasValue())
1637 varCriteria[nPos].setString(::comphelper::getString(catalog));
1639 SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_CATALOG
1640 if(schema.getLength() && schema.toChar() != '%')
1641 varCriteria[nPos].setString(schema);
1642 SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_SCHEMA
1644 varCriteria[nPos].setString(table);
1645 SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_NAME
1647 SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_CATALOG
1648 SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_SCHEMA
1649 SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_NAME
1651 OLEVariant vtEmpty;
1652 vtEmpty.setNoArg();
1654 // Initialize and fill the SafeArray
1655 OLEVariant vsa;
1656 vsa.setArray(psa,VT_VARIANT);
1658 ADORecordset *pRecordset = NULL;
1659 OpenSchema(adSchemaForeignKeys,vsa,vtEmpty,&pRecordset);
1660 return pRecordset;
1663 ADORecordset* WpADOConnection::getImportedKeys( const ::com::sun::star::uno::Any& catalog, const OUString& schema, const OUString& table )
1665 // Create elements used in the array
1666 SAFEARRAYBOUND rgsabound[1];
1667 SAFEARRAY *psa = NULL;
1668 OLEVariant varCriteria[6];
1670 // Create SafeArray Bounds and initialize the array
1671 rgsabound[0].lLbound = 0;
1672 rgsabound[0].cElements = sizeof varCriteria / sizeof varCriteria[0];
1673 psa = SafeArrayCreate( VT_VARIANT, 1, rgsabound );
1675 sal_Int32 nPos=0;
1676 SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_CATALOG
1677 SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_SCHEMA
1678 SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_NAME
1680 if(catalog.hasValue())
1681 varCriteria[nPos].setString(::comphelper::getString(catalog));
1683 SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_CATALOG
1684 if(schema.getLength() && schema.toChar() != '%')
1685 varCriteria[nPos].setString(schema);
1686 SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_SCHEMA
1688 varCriteria[nPos].setString(table);
1689 SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_NAME
1691 OLEVariant vtEmpty;
1692 vtEmpty.setNoArg();
1694 // Initialize and fill the SafeArray
1695 OLEVariant vsa;
1696 vsa.setArray(psa,VT_VARIANT);
1698 ADORecordset *pRecordset = NULL;
1699 OpenSchema(adSchemaForeignKeys,vsa,vtEmpty,&pRecordset);
1701 return pRecordset;
1705 ADORecordset* WpADOConnection::getPrimaryKeys( const ::com::sun::star::uno::Any& catalog, const OUString& schema, const OUString& table )
1707 // Create elements used in the array
1708 SAFEARRAYBOUND rgsabound[1];
1709 SAFEARRAY *psa = NULL;
1710 OLEVariant varCriteria[3];
1712 // Create SafeArray Bounds and initialize the array
1713 rgsabound[0].lLbound = 0;
1714 rgsabound[0].cElements = sizeof varCriteria / sizeof varCriteria[0];
1715 psa = SafeArrayCreate( VT_VARIANT, 1, rgsabound );
1717 sal_Int32 nPos=0;
1718 if(catalog.hasValue())
1719 varCriteria[nPos].setString(::comphelper::getString(catalog));
1721 SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_CATALOG
1722 if(schema.getLength() && schema.toChar() != '%')
1723 varCriteria[nPos].setString(schema);
1724 SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_SCHEMA
1726 varCriteria[nPos].setString(table);
1727 SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_NAME
1730 OLEVariant vtEmpty;
1731 vtEmpty.setNoArg();
1733 // Initialize and fill the SafeArray
1734 OLEVariant vsa;
1735 vsa.setArray(psa,VT_VARIANT);
1737 ADORecordset *pRecordset = NULL;
1738 OpenSchema(adSchemaPrimaryKeys,vsa,vtEmpty,&pRecordset);
1740 return pRecordset;
1743 ADORecordset* WpADOConnection::getIndexInfo(
1744 const ::com::sun::star::uno::Any& catalog, const OUString& schema, const OUString& table,
1745 sal_Bool /*unique*/, sal_Bool /*approximate*/ )
1747 // Create elements used in the array
1748 SAFEARRAYBOUND rgsabound[1];
1749 SAFEARRAY *psa = NULL;
1750 OLEVariant varCriteria[5];
1752 // Create SafeArray Bounds and initialize the array
1753 rgsabound[0].lLbound = 0;
1754 rgsabound[0].cElements = sizeof varCriteria / sizeof varCriteria[0];
1755 psa = SafeArrayCreate( VT_VARIANT, 1, rgsabound );
1757 sal_Int32 nPos=0;
1758 if(catalog.hasValue())
1759 varCriteria[nPos].setString(::comphelper::getString(catalog));
1761 SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_CATALOG
1762 if(schema.getLength() && schema.toChar() != '%')
1763 varCriteria[nPos].setString(schema);
1764 SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_SCHEMA
1766 SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// INDEX_NAME
1768 SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TYPE
1770 varCriteria[nPos].setString(table);
1771 SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_NAME
1773 OLEVariant vtEmpty;
1774 vtEmpty.setNoArg();
1776 // Initialize and fill the SafeArray
1777 OLEVariant vsa;
1778 vsa.setArray(psa,VT_VARIANT);
1780 ADORecordset *pRecordset = NULL;
1781 OpenSchema(adSchemaIndexes,vsa,vtEmpty,&pRecordset);
1783 return pRecordset;
1786 ADORecordset* WpADOConnection::getTablePrivileges( const ::com::sun::star::uno::Any& catalog,
1787 const OUString& schemaPattern,
1788 const OUString& tableNamePattern )
1790 SAFEARRAYBOUND rgsabound[1];
1791 SAFEARRAY *psa = NULL;
1792 OLEVariant varCriteria[5];
1794 // Create SafeArray Bounds and initialize the array
1795 rgsabound[0].lLbound = 0;
1796 rgsabound[0].cElements = sizeof varCriteria / sizeof varCriteria[0];
1797 psa = SafeArrayCreate( VT_VARIANT, 1, rgsabound );
1799 sal_Int32 nPos=0;
1800 if(catalog.hasValue())
1801 varCriteria[nPos].setString(::comphelper::getString(catalog));
1803 SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_CATALOG
1804 if(schemaPattern.getLength() && schemaPattern.toChar() != '%')
1805 varCriteria[nPos].setString(schemaPattern);
1806 SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_SCHEMA
1808 if(tableNamePattern.toChar() != '%')
1809 varCriteria[nPos].setString(tableNamePattern);
1810 SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_NAME
1812 SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// GRANTOR
1813 SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// GRANTEE
1815 OLEVariant vtEmpty;
1816 vtEmpty.setNoArg();
1818 // Initialize and fill the SafeArray
1819 OLEVariant vsa;
1820 vsa.setArray(psa,VT_VARIANT);
1822 ADORecordset *pRecordset = NULL;
1823 OpenSchema(adSchemaTablePrivileges,vsa,vtEmpty,&pRecordset);
1825 return pRecordset;
1828 ADORecordset* WpADOConnection::getCrossReference( const ::com::sun::star::uno::Any& primaryCatalog,
1829 const OUString& primarySchema,
1830 const OUString& primaryTable,
1831 const ::com::sun::star::uno::Any& foreignCatalog,
1832 const OUString& foreignSchema,
1833 const OUString& foreignTable)
1835 // Create elements used in the array
1836 SAFEARRAYBOUND rgsabound[1];
1837 SAFEARRAY *psa = NULL;
1838 OLEVariant varCriteria[6];
1840 // Create SafeArray Bounds and initialize the array
1841 rgsabound[0].lLbound = 0;
1842 rgsabound[0].cElements = sizeof varCriteria / sizeof varCriteria[0];
1843 psa = SafeArrayCreate( VT_VARIANT, 1, rgsabound );
1845 sal_Int32 nPos=0;
1846 if(primaryCatalog.hasValue())
1847 varCriteria[nPos].setString(::comphelper::getString(primaryCatalog));
1849 SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_CATALOG
1850 if(primarySchema.getLength() && primarySchema.toChar() != '%')
1851 varCriteria[nPos].setString(primarySchema);
1852 SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_SCHEMA
1854 varCriteria[nPos].setString(primaryTable);
1855 SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_NAME
1857 if(foreignCatalog.hasValue())
1858 varCriteria[nPos].setString(::comphelper::getString(foreignCatalog));
1860 SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_CATALOG
1861 if(foreignSchema.getLength() && foreignSchema.toChar() != '%')
1862 varCriteria[nPos].setString(foreignSchema);
1863 SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_SCHEMA
1865 varCriteria[nPos].setString(foreignTable);
1866 SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_NAME
1868 OLEVariant vtEmpty;
1869 vtEmpty.setNoArg();
1871 // Initialize and fill the SafeArray
1872 OLEVariant vsa;
1873 vsa.setArray(psa,VT_VARIANT);
1875 ADORecordset *pRecordset = NULL;
1876 OpenSchema(adSchemaForeignKeys,vsa,vtEmpty,&pRecordset);
1878 return pRecordset;
1881 ADORecordset* WpADOConnection::getProcedures( const ::com::sun::star::uno::Any& catalog,
1882 const OUString& schemaPattern,
1883 const OUString& procedureNamePattern )
1885 SAFEARRAYBOUND rgsabound[1];
1886 SAFEARRAY *psa = NULL;
1887 OLEVariant varCriteria[3];
1889 // Create SafeArray Bounds and initialize the array
1890 rgsabound[0].lLbound = 0;
1891 rgsabound[0].cElements = sizeof varCriteria / sizeof varCriteria[0];
1892 psa = SafeArrayCreate( VT_VARIANT, 1, rgsabound );
1894 sal_Int32 nPos=0;
1895 if(catalog.hasValue())
1896 varCriteria[nPos].setString(::comphelper::getString(catalog));
1898 SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_CATALOG
1899 if(schemaPattern.getLength() && schemaPattern.toChar() != '%')
1900 varCriteria[nPos].setString(schemaPattern);
1901 SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_SCHEMA
1903 if(procedureNamePattern.toChar() != '%')
1904 varCriteria[nPos].setString(procedureNamePattern);
1905 SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_NAME
1907 OLEVariant vtEmpty;
1908 vtEmpty.setNoArg();
1910 // Initialize and fill the SafeArray
1911 OLEVariant vsa;
1912 vsa.setArray(psa,VT_VARIANT);
1914 ADORecordset *pRecordset = NULL;
1915 OpenSchema(adSchemaProcedures,vsa,vtEmpty,&pRecordset);
1917 return pRecordset;
1920 ADORecordset* WpADOConnection::getProcedureColumns( const ::com::sun::star::uno::Any& catalog,
1921 const OUString& schemaPattern,
1922 const OUString& procedureNamePattern,
1923 const OUString& columnNamePattern )
1925 // Create elements used in the array
1926 SAFEARRAYBOUND rgsabound[1];
1927 SAFEARRAY *psa = NULL;
1928 OLEVariant varCriteria[4];
1930 // Create SafeArray Bounds and initialize the array
1931 rgsabound[0].lLbound = 0;
1932 rgsabound[0].cElements = sizeof varCriteria / sizeof varCriteria[0];
1933 psa = SafeArrayCreate( VT_VARIANT, 1, rgsabound );
1935 sal_Int32 nPos=0;
1936 if(catalog.hasValue())
1937 varCriteria[nPos].setString(::comphelper::getString(catalog));
1939 SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_CATALOG
1940 if(schemaPattern.getLength() && schemaPattern.toChar() != '%')
1941 varCriteria[nPos].setString(schemaPattern);
1942 SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_SCHEMA
1944 if(procedureNamePattern.toChar() != '%')
1945 varCriteria[nPos].setString(procedureNamePattern);
1946 SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_NAME
1948 if(columnNamePattern.toChar() != '%')
1949 varCriteria[nPos].setString(columnNamePattern);
1950 SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// COLUMN_NAME
1952 OLEVariant vtEmpty;
1953 vtEmpty.setNoArg();
1955 // Initialize and fill the SafeArray
1956 OLEVariant vsa;
1957 vsa.setArray(psa,VT_VARIANT);
1959 ADORecordset *pRecordset = NULL;
1960 OpenSchema(adSchemaProcedureParameters,vsa,vtEmpty,&pRecordset);
1962 return pRecordset;
1965 ADORecordset* WpADOConnection::getTables( const ::com::sun::star::uno::Any& catalog,
1966 const OUString& schemaPattern,
1967 const OUString& tableNamePattern,
1968 const ::com::sun::star::uno::Sequence< OUString >& types )
1970 // Create elements used in the array
1971 HRESULT hr = S_OK;
1972 OLEVariant varCriteria[4];
1974 sal_Int32 nPos=0;
1975 OUString sCatalog;
1976 if ( catalog.hasValue() && (catalog >>= sCatalog) )
1977 varCriteria[nPos].setString(sCatalog);
1979 ++nPos;
1980 if(schemaPattern.getLength() && schemaPattern.toChar() != '%')
1981 varCriteria[nPos].setString(schemaPattern);
1983 ++nPos;
1984 if(tableNamePattern.toChar() != '%')
1985 varCriteria[nPos].setString(tableNamePattern);
1987 ++nPos;
1988 OUStringBuffer aTypes;
1989 OUString aComma( "," );
1990 const OUString* pIter = types.getConstArray();
1991 const OUString* pEnd = pIter + types.getLength();
1992 for( ; pIter != pEnd ; ++pIter)
1994 if ( aTypes.getLength() )
1995 aTypes.append(aComma);
1996 aTypes.append(*pIter);
1999 OUString sTypeNames = aTypes.makeStringAndClear();
2000 if ( sTypeNames.getLength() )
2001 varCriteria[nPos].setString(sTypeNames);
2003 // Create SafeArray Bounds and initialize the array
2004 const sal_Int32 nCrit = sizeof varCriteria / sizeof varCriteria[0];
2005 SAFEARRAYBOUND rgsabound[1];
2006 rgsabound[0].lLbound = 0;
2007 rgsabound[0].cElements = nCrit;
2008 SAFEARRAY *psa = SafeArrayCreate( VT_VARIANT, 1, rgsabound );
2010 // Set the values for each element of the array
2011 for( long i = 0 ; i < nCrit && SUCCEEDED( hr );i++)
2013 hr = SafeArrayPutElement(psa, &i,&varCriteria[i]);
2016 OLEVariant vtEmpty;
2017 vtEmpty.setNoArg();
2019 // Initialize and fill the SafeArray
2020 OLEVariant vsa;
2021 vsa.setArray(psa,VT_VARIANT);
2023 ADORecordset *pRecordset = NULL;
2024 OpenSchema(adSchemaTables,vsa,vtEmpty,&pRecordset);
2026 return pRecordset;
2029 ADORecordset* WpADOConnection::getColumns( const ::com::sun::star::uno::Any& catalog,
2030 const OUString& schemaPattern,
2031 const OUString& tableNamePattern,
2032 const OUString& columnNamePattern )
2034 // Create elements used in the array
2035 SAFEARRAYBOUND rgsabound[1];
2036 SAFEARRAY *psa = NULL;
2037 OLEVariant varCriteria[4];
2039 // Create SafeArray Bounds and initialize the array
2040 rgsabound[0].lLbound = 0;
2041 rgsabound[0].cElements = sizeof varCriteria / sizeof varCriteria[0];
2042 psa = SafeArrayCreate( VT_VARIANT, 1, rgsabound );
2044 sal_Int32 nPos=0;
2045 if(catalog.hasValue())
2046 varCriteria[nPos].setString(::comphelper::getString(catalog));
2048 SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_CATALOG
2049 if(schemaPattern.getLength() && schemaPattern.toChar() != '%')
2050 varCriteria[nPos].setString(schemaPattern);
2051 SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_SCHEMA
2053 if(tableNamePattern.toChar() != '%')
2054 varCriteria[nPos].setString(tableNamePattern);
2055 SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_NAME
2057 varCriteria[nPos].setString(columnNamePattern);
2058 SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// COLUMN_NAME
2060 OLEVariant vtEmpty;
2061 vtEmpty.setNoArg();
2063 // Initialize and fill the SafeArray
2064 OLEVariant vsa;
2065 vsa.setArray(psa,VT_VARIANT);
2067 ADORecordset *pRecordset = NULL;
2068 OpenSchema(adSchemaColumns,vsa,vtEmpty,&pRecordset);
2070 return pRecordset;
2073 ADORecordset* WpADOConnection::getColumnPrivileges( const ::com::sun::star::uno::Any& catalog,
2074 const OUString& schema,
2075 const OUString& table,
2076 const OUString& columnNamePattern )
2078 // Create elements used in the array
2079 SAFEARRAYBOUND rgsabound[1];
2080 SAFEARRAY *psa = NULL;
2081 OLEVariant varCriteria[4];
2083 // Create SafeArray Bounds and initialize the array
2084 rgsabound[0].lLbound = 0;
2085 rgsabound[0].cElements = sizeof varCriteria / sizeof varCriteria[0];
2086 psa = SafeArrayCreate( VT_VARIANT, 1, rgsabound );
2088 sal_Int32 nPos=0;
2089 if(catalog.hasValue())
2090 varCriteria[nPos].setString(::comphelper::getString(catalog));
2092 SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_CATALOG
2093 if(schema.getLength() && schema.toChar() != '%')
2094 varCriteria[nPos].setString(schema);
2095 SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_SCHEMA
2097 varCriteria[nPos].setString(table);
2098 SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_NAME
2100 varCriteria[nPos].setString(columnNamePattern);
2101 SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// COLUMN_NAME
2103 OLEVariant vtEmpty;
2104 vtEmpty.setNoArg();
2106 // Initialize and fill the SafeArray
2107 OLEVariant vsa;
2108 vsa.setArray(psa,VT_VARIANT);
2110 ADORecordset *pRecordset = NULL;
2111 OpenSchema(adSchemaColumnPrivileges,vsa,vtEmpty,&pRecordset);
2113 return pRecordset;
2116 ADORecordset* WpADOConnection::getTypeInfo(DataTypeEnum /*_eType*/)
2118 // Create elements used in the array
2119 OLEVariant varCriteria[2];
2120 const int nCrit = sizeof varCriteria / sizeof varCriteria[0];
2121 // Create SafeArray Bounds and initialize the array
2122 SAFEARRAYBOUND rgsabound[1];
2123 rgsabound[0].lLbound = 0;
2124 rgsabound[0].cElements = nCrit;
2125 SAFEARRAY *psa = SafeArrayCreate( VT_VARIANT, 1, rgsabound );
2127 sal_Int32 nPos = 0;
2128 SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;
2129 SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;
2131 // Initialize and fill the SafeArray
2132 OLEVariant vsa;
2133 vsa.setArray(psa,VT_VARIANT);
2135 OLEVariant aEmpty;
2136 aEmpty.setNoArg();
2138 ADORecordset *pRec=NULL;
2139 OpenSchema(adSchemaProviderTypes,vsa,aEmpty,&pRec);
2141 return pRec;
2144 void WpADOColumn::put_ParentCatalog(/* [in] */ _ADOCatalog __RPC_FAR *ppvObject)
2146 OSL_ENSURE(pInterface,"Interface is null!");
2147 sal_Bool bRet = SUCCEEDED(pInterface->put_ParentCatalog(ppvObject));
2148 OSL_ENSURE(bRet,"Could not set ParentCatalog!");
2149 OSL_UNUSED(bRet);
2152 void WpADOTable::putref_ParentCatalog(/* [in] */ _ADOCatalog __RPC_FAR *ppvObject)
2154 OSL_ENSURE(pInterface,"Interface is null!");
2155 sal_Bool bRet = SUCCEEDED(pInterface->putref_ParentCatalog(ppvObject));
2156 OSL_ENSURE(bRet,"Could not set ParentCatalog!");
2157 OSL_UNUSED(bRet);
2160 void WpBase::setIDispatch(IDispatch* _pIUnknown)
2162 pIUnknown = _pIUnknown;
2165 void OTools::putValue(const WpADOProperties& _rProps,const OLEVariant &_aPosition,const OLEVariant &_aValVar)
2167 OSL_ENSURE(_rProps.IsValid(),"Properties are not valid!");
2168 WpADOProperty aProp(_rProps.GetItem(_aPosition));
2169 if ( aProp.IsValid() )
2171 sal_Bool bRet = aProp.PutValue(_aValVar);
2172 OSL_ENSURE(bRet,"Could not put value!");
2173 OSL_UNUSED(bRet);
2177 OLEVariant OTools::getValue(const WpADOProperties& _rProps,const OLEVariant &_aPosition)
2179 WpADOProperty aProp(_rProps.GetItem(_aPosition));
2180 return aProp.GetValue();
2183 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */