1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: Awrapado.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_connectivity.hxx"
33 #include "ado/Awrapado.hxx"
34 #include "ado/Awrapadox.hxx"
35 #include <comphelper/types.hxx>
36 #include <rtl/ustrbuf.hxx>
37 #include "diagnose_ex.h"
39 namespace connectivity
43 sal_Int32 nAdoObjectCounter
= 0;
47 using namespace connectivity::ado
;
49 void WpADOCatalog::Create()
52 _ADOCatalog
* pCommand
;
53 hr
= CoCreateInstance(ADOS::CLSID_ADOCATALOG_25
,
56 ADOS::IID_ADOCATALOG_25
,
61 setWithOutAddRef(pCommand
);
65 WpADOProperties
WpADOConnection::get_Properties() const
67 ADOProperties
* pProps
=NULL
;
68 pInterface
->get_Properties(&pProps
);
69 WpADOProperties aProps
;
70 aProps
.setWithOutAddRef(pProps
);
74 rtl::OUString
WpADOConnection::GetConnectionString() const
76 OSL_ENSURE(pInterface
,"Interface is null!");
78 pInterface
->get_ConnectionString(&aBSTR
);
82 sal_Bool
WpADOConnection::PutConnectionString(const ::rtl::OUString
&aCon
) const
84 OSL_ENSURE(pInterface
,"Interface is null!");
86 sal_Bool bErg
= SUCCEEDED(pInterface
->put_ConnectionString(bstr
));
91 sal_Int32
WpADOConnection::GetCommandTimeout() const
93 OSL_ENSURE(pInterface
,"Interface is null!");
95 pInterface
->get_CommandTimeout(&nRet
);
99 void WpADOConnection::PutCommandTimeout(sal_Int32 nRet
)
101 OSL_ENSURE(pInterface
,"Interface is null!");
102 pInterface
->put_CommandTimeout(nRet
);
105 sal_Int32
WpADOConnection::GetConnectionTimeout() const
107 OSL_ENSURE(pInterface
,"Interface is null!");
109 pInterface
->get_ConnectionTimeout(&nRet
);
113 void WpADOConnection::PutConnectionTimeout(sal_Int32 nRet
)
115 OSL_ENSURE(pInterface
,"Interface is null!");
116 pInterface
->put_ConnectionTimeout(nRet
);
119 sal_Bool
WpADOConnection::Close( )
121 OSL_ENSURE(pInterface
,"Interface is null!");
122 return (SUCCEEDED(pInterface
->Close()));
125 sal_Bool
WpADOConnection::Execute(const ::rtl::OUString
& _CommandText
,OLEVariant
& RecordsAffected
,long Options
, WpADORecordset
** ppiRset
)
127 OSL_ENSURE(pInterface
,"Interface is null!");
128 OLEString
sStr1(_CommandText
);
129 sal_Bool bErg
= SUCCEEDED(pInterface
->Execute(sStr1
,&RecordsAffected
,Options
,(_ADORecordset
**)ppiRset
));
133 sal_Bool
WpADOConnection::BeginTrans()
135 OSL_ENSURE(pInterface
,"Interface is null!");
137 return SUCCEEDED(pInterface
->BeginTrans(&nIso
));
140 sal_Bool
WpADOConnection::CommitTrans( )
142 OSL_ENSURE(pInterface
,"Interface is null!");
143 return SUCCEEDED(pInterface
->CommitTrans());
146 sal_Bool
WpADOConnection::RollbackTrans( )
148 OSL_ENSURE(pInterface
,"Interface is null!");
149 return SUCCEEDED(pInterface
->RollbackTrans());
152 sal_Bool
WpADOConnection::Open(const ::rtl::OUString
& ConnectionString
, const ::rtl::OUString
& UserID
,const ::rtl::OUString
& Password
,long Options
)
154 OSL_ENSURE(pInterface
,"Interface is null!");
155 OLEString
sStr1(ConnectionString
);
156 OLEString
sStr2(UserID
);
157 OLEString
sStr3(Password
);
158 sal_Bool bErg
= SUCCEEDED(pInterface
->Open(sStr1
,sStr2
,sStr3
,Options
));
162 sal_Bool
WpADOConnection::GetErrors(ADOErrors
** pErrors
)
164 OSL_ENSURE(pInterface
,"Interface is null!");
165 return SUCCEEDED(pInterface
->get_Errors(pErrors
));
168 ::rtl::OUString
WpADOConnection::GetDefaultDatabase() const
170 OSL_ENSURE(pInterface
,"Interface is null!");
171 OLEString aBSTR
; pInterface
->get_DefaultDatabase(&aBSTR
);
175 sal_Bool
WpADOConnection::PutDefaultDatabase(const ::rtl::OUString
& _bstr
)
177 OSL_ENSURE(pInterface
,"Interface is null!");
178 OLEString
bstr(_bstr
);
179 sal_Bool bErg
= SUCCEEDED(pInterface
->put_DefaultDatabase(bstr
));
184 IsolationLevelEnum
WpADOConnection::get_IsolationLevel() const
186 OSL_ENSURE(pInterface
,"Interface is null!");
187 IsolationLevelEnum eNum
=adXactUnspecified
;
188 pInterface
->get_IsolationLevel(&eNum
);
192 sal_Bool
WpADOConnection::put_IsolationLevel(const IsolationLevelEnum
& eNum
)
194 OSL_ENSURE(pInterface
,"Interface is null!");
195 return SUCCEEDED(pInterface
->put_IsolationLevel(eNum
));
198 sal_Int32
WpADOConnection::get_Attributes() const
200 OSL_ENSURE(pInterface
,"Interface is null!");
202 pInterface
->get_Attributes(&nRet
);
206 sal_Bool
WpADOConnection::put_Attributes(sal_Int32 nRet
)
208 OSL_ENSURE(pInterface
,"Interface is null!");
209 return SUCCEEDED(pInterface
->put_Attributes(nRet
));
212 CursorLocationEnum
WpADOConnection::get_CursorLocation() const
214 OSL_ENSURE(pInterface
,"Interface is null!");
215 CursorLocationEnum eNum
=adUseNone
;
216 pInterface
->get_CursorLocation(&eNum
);
220 sal_Bool
WpADOConnection::put_CursorLocation(const CursorLocationEnum
&eNum
)
222 OSL_ENSURE(pInterface
,"Interface is null!");
223 return SUCCEEDED(pInterface
->put_CursorLocation(eNum
));
226 ConnectModeEnum
WpADOConnection::get_Mode() const
228 OSL_ENSURE(pInterface
,"Interface is null!");
229 ConnectModeEnum eNum
=adModeUnknown
;
230 pInterface
->get_Mode(&eNum
);
234 sal_Bool
WpADOConnection::put_Mode(const ConnectModeEnum
&eNum
)
236 OSL_ENSURE(pInterface
,"Interface is null!");
237 return SUCCEEDED(pInterface
->put_Mode(eNum
));
240 ::rtl::OUString
WpADOConnection::get_Provider() const
242 OSL_ENSURE(pInterface
,"Interface is null!");
243 OLEString aBSTR
; pInterface
->get_Provider(&aBSTR
);
247 sal_Bool
WpADOConnection::put_Provider(const ::rtl::OUString
& _bstr
)
249 OSL_ENSURE(pInterface
,"Interface is null!");
250 OLEString
bstr(_bstr
);
251 return SUCCEEDED(pInterface
->put_Provider(bstr
));
254 sal_Int32
WpADOConnection::get_State() const
256 OSL_ENSURE(pInterface
,"Interface is null!");
258 pInterface
->get_State(&nRet
);
262 sal_Bool
WpADOConnection::OpenSchema(SchemaEnum eNum
,OLEVariant
& Restrictions
,OLEVariant
& SchemaID
,ADORecordset
**pprset
)
264 OSL_ENSURE(pInterface
,"Interface is null!");
265 return SUCCEEDED(pInterface
->OpenSchema(eNum
,Restrictions
,SchemaID
,pprset
));
268 ::rtl::OUString
WpADOConnection::get_Version() const
270 OSL_ENSURE(pInterface
,"Interface is null!");
272 pInterface
->get_Version(&aBSTR
);
276 sal_Bool
WpADOCommand::putref_ActiveConnection( WpADOConnection
*pCon
)
278 OSL_ENSURE(pInterface
,"Interface is null!");
280 return SUCCEEDED(pInterface
->putref_ActiveConnection(pCon
->pInterface
));
282 return SUCCEEDED(pInterface
->putref_ActiveConnection(NULL
));
285 void WpADOCommand::put_ActiveConnection(/* [in] */ const OLEVariant
& vConn
)
287 OSL_ENSURE(pInterface
,"Interface is null!");
288 pInterface
->put_ActiveConnection(vConn
);
291 void WpADOCommand::Create()
293 IClassFactory2
* pInterface2
= NULL
;
294 IUnknown
*pOuter
= NULL
;
296 hr
= CoGetClassObject( ADOS::CLSID_ADOCOMMAND_21
,
297 CLSCTX_INPROC_SERVER
,
300 (void**)&pInterface2
);
304 ADOCommand
* pCommand
=NULL
;
306 hr
= pInterface2
->CreateInstanceLic( pOuter
,
308 ADOS::IID_ADOCOMMAND_21
,
318 pInterface2
->Release();
322 sal_Int32
WpADOCommand::get_State() const
324 OSL_ENSURE(pInterface
,"Interface is null!");
326 pInterface
->get_State(&nRet
);
330 ::rtl::OUString
WpADOCommand::get_CommandText() const
332 OSL_ENSURE(pInterface
,"Interface is null!");
334 pInterface
->get_CommandText(&aBSTR
);
338 sal_Bool
WpADOCommand::put_CommandText(const ::rtl::OUString
&aCon
)
340 OSL_ENSURE(pInterface
,"Interface is null!");
341 OLEString
bstr(aCon
);
342 sal_Bool bErg
= SUCCEEDED(pInterface
->put_CommandText(bstr
));
347 sal_Int32
WpADOCommand::get_CommandTimeout() const
349 OSL_ENSURE(pInterface
,"Interface is null!");
351 pInterface
->get_CommandTimeout(&nRet
);
355 void WpADOCommand::put_CommandTimeout(sal_Int32 nRet
)
357 OSL_ENSURE(pInterface
,"Interface is null!");
358 pInterface
->put_CommandTimeout(nRet
);
361 sal_Bool
WpADOCommand::get_Prepared() const
363 OSL_ENSURE(pInterface
,"Interface is null!");
364 VARIANT_BOOL bPrepared
= VARIANT_FALSE
;
365 pInterface
->get_Prepared(&bPrepared
);
366 return bPrepared
== VARIANT_TRUE
;
369 sal_Bool
WpADOCommand::put_Prepared(VARIANT_BOOL bPrepared
) const
371 OSL_ENSURE(pInterface
,"Interface is null!");
372 return SUCCEEDED(pInterface
->put_Prepared(bPrepared
));
375 sal_Bool
WpADOCommand::Execute(OLEVariant
& RecordsAffected
,OLEVariant
& Parameters
,long Options
, ADORecordset
** ppiRset
)
377 OSL_ENSURE(pInterface
,"Interface is null!");
378 return SUCCEEDED(pInterface
->Execute(&RecordsAffected
,&Parameters
,Options
,ppiRset
));
381 ADOParameter
* WpADOCommand::CreateParameter(const ::rtl::OUString
&_bstr
,DataTypeEnum Type
,ParameterDirectionEnum Direction
,long nSize
,const OLEVariant
&Value
)
383 OSL_ENSURE(pInterface
,"Interface is null!");
384 ADOParameter
* pPara
= NULL
;
385 OLEString
bstr(_bstr
);
386 sal_Bool bErg
= SUCCEEDED(pInterface
->CreateParameter(bstr
,Type
,Direction
,nSize
,Value
,&pPara
));
388 return bErg
? pPara
: NULL
;
391 ADOParameters
* WpADOCommand::get_Parameters() const
393 OSL_ENSURE(pInterface
,"Interface is null!");
394 ADOParameters
* pPara
=NULL
;
395 pInterface
->get_Parameters(&pPara
);
399 sal_Bool
WpADOCommand::put_CommandType( /* [in] */ CommandTypeEnum lCmdType
)
401 OSL_ENSURE(pInterface
,"Interface is null!");
402 return SUCCEEDED(pInterface
->put_CommandType(lCmdType
));
405 CommandTypeEnum
WpADOCommand::get_CommandType( ) const
407 OSL_ENSURE(pInterface
,"Interface is null!");
408 CommandTypeEnum eNum
=adCmdUnspecified
;
409 pInterface
->get_CommandType(&eNum
);
413 // gibt den Namen des Feldes zur"ueck
414 ::rtl::OUString
WpADOCommand::GetName() const
416 OSL_ENSURE(pInterface
,"Interface is null!");
418 pInterface
->get_Name(&aBSTR
);
422 sal_Bool
WpADOCommand::put_Name(const ::rtl::OUString
& _Name
)
424 OSL_ENSURE(pInterface
,"Interface is null!");
425 OLEString
bstr(_Name
);
426 sal_Bool bErg
= SUCCEEDED(pInterface
->put_Name(bstr
));
430 sal_Bool
WpADOCommand::Cancel()
432 OSL_ENSURE(pInterface
,"Interface is null!");
433 return SUCCEEDED(pInterface
->Cancel());
436 ::rtl::OUString
WpADOError::GetDescription() const
438 OSL_ENSURE(pInterface
,"Interface is null!");
440 pInterface
->get_Description(&aBSTR
);
444 ::rtl::OUString
WpADOError::GetSource() const
446 OSL_ENSURE(pInterface
,"Interface is null!");
448 pInterface
->get_Source(&aBSTR
);
452 sal_Int32
WpADOError::GetNumber() const
454 OSL_ENSURE(pInterface
,"Interface is null!");
456 pInterface
->get_Number(&nErrNr
);
460 ::rtl::OUString
WpADOError::GetSQLState() const
462 OSL_ENSURE(pInterface
,"Interface is null!");
464 pInterface
->get_SQLState(&aBSTR
);
468 sal_Int32
WpADOError::GetNativeError() const
470 OSL_ENSURE(pInterface
,"Interface is null!");
472 pInterface
->get_NativeError(&nErrNr
);
475 WpADOProperties
WpADOField::get_Properties()
477 OSL_ENSURE(pInterface
,"Interface is null!");
478 ADOProperties
* pProps
= NULL
;
479 pInterface
->get_Properties(&pProps
);
480 WpADOProperties aProps
;
482 aProps
.setWithOutAddRef(pProps
);
486 sal_Int32
WpADOField::GetActualSize() const
488 OSL_ENSURE(pInterface
,"Interface is null!");
489 sal_Int32 nActualSize
=0;
490 pInterface
->get_ActualSize(&nActualSize
);
494 sal_Int32
WpADOField::GetAttributes() const
496 OSL_ENSURE(pInterface
,"Interface is null!");
497 sal_Int32 eADOSFieldAttributes
=0;
498 pInterface
->get_Attributes(&eADOSFieldAttributes
);
499 return eADOSFieldAttributes
;
502 sal_Int32
WpADOField::GetStatus() const
504 OSL_ENSURE(pInterface
,"Interface is null!");
505 sal_Int32 eADOSFieldAttributes
=0;
506 // pInterface->get_Status(&eADOSFieldAttributes);
507 return eADOSFieldAttributes
;
510 sal_Int32
WpADOField::GetDefinedSize() const
512 OSL_ENSURE(pInterface
,"Interface is null!");
513 sal_Int32 nDefinedSize
=0;
514 pInterface
->get_DefinedSize(&nDefinedSize
);
518 // gibt den Namen des Feldes zur"ueck
519 ::rtl::OUString
WpADOField::GetName() const
521 OSL_ENSURE(pInterface
,"Interface is null!");
523 pInterface
->get_Name(&aBSTR
);
527 DataTypeEnum
WpADOField::GetADOType() const
529 OSL_ENSURE(pInterface
,"Interface is null!");
530 DataTypeEnum eType
=adEmpty
;
531 pInterface
->get_Type(&eType
);
535 void WpADOField::get_Value(OLEVariant
& aValVar
) const
537 OSL_ENSURE(pInterface
,"Interface is null!");
539 sal_Bool bOk
= SUCCEEDED(pInterface
->get_Value(&aValVar
));
543 OLEVariant
WpADOField::get_Value() const
545 OSL_ENSURE(pInterface
,"Interface is null!");
547 pInterface
->get_Value(&aValVar
);
551 sal_Bool
WpADOField::PutValue(const OLEVariant
& aVariant
)
553 OSL_ENSURE(pInterface
,"Interface is null!");
554 return (SUCCEEDED(pInterface
->put_Value(aVariant
)));
557 sal_Int32
WpADOField::GetPrecision() const
559 OSL_ENSURE(pInterface
,"Interface is null!");
561 pInterface
->get_Precision(&eType
);
565 sal_Int32
WpADOField::GetNumericScale() const
567 OSL_ENSURE(pInterface
,"Interface is null!");
569 pInterface
->get_NumericScale(&eType
);
573 sal_Bool
WpADOField::AppendChunk(const OLEVariant
& _Variant
)
575 OSL_ENSURE(pInterface
,"Interface is null!");
576 return (SUCCEEDED(pInterface
->AppendChunk(_Variant
)));
579 OLEVariant
WpADOField::GetChunk(long Length
) const
581 OSL_ENSURE(pInterface
,"Interface is null!");
583 pInterface
->GetChunk(Length
,&aValVar
);
587 void WpADOField::GetChunk(long Length
,OLEVariant
&aValVar
) const
589 OSL_ENSURE(pInterface
,"Interface is null!");
590 pInterface
->GetChunk(Length
,&aValVar
);
593 OLEVariant
WpADOField::GetOriginalValue() const
595 OSL_ENSURE(pInterface
,"Interface is null!");
597 pInterface
->get_OriginalValue(&aValVar
);
601 void WpADOField::GetOriginalValue(OLEVariant
&aValVar
) const
603 OSL_ENSURE(pInterface
,"Interface is null!");
604 pInterface
->get_OriginalValue(&aValVar
);
607 OLEVariant
WpADOField::GetUnderlyingValue() const
609 OSL_ENSURE(pInterface
,"Interface is null!");
611 pInterface
->get_UnderlyingValue(&aValVar
);
615 void WpADOField::GetUnderlyingValue(OLEVariant
&aValVar
) const
617 OSL_ENSURE(pInterface
,"Interface is null!");
618 pInterface
->get_UnderlyingValue(&aValVar
);
621 sal_Bool
WpADOField::PutPrecision(sal_Int8 _prec
)
623 OSL_ENSURE(pInterface
,"Interface is null!");
624 return (SUCCEEDED(pInterface
->put_Precision(_prec
)));
627 sal_Bool
WpADOField::PutNumericScale(sal_Int8 _prec
)
629 OSL_ENSURE(pInterface
,"Interface is null!");
630 return (SUCCEEDED(pInterface
->put_NumericScale(_prec
)));
633 void WpADOField::PutADOType(DataTypeEnum eType
)
635 OSL_ENSURE(pInterface
,"Interface is null!");
636 pInterface
->put_Type(eType
);
639 sal_Bool
WpADOField::PutDefinedSize(sal_Int32 _nDefSize
)
641 OSL_ENSURE(pInterface
,"Interface is null!");
642 return (SUCCEEDED(pInterface
->put_DefinedSize(_nDefSize
)));
645 sal_Bool
WpADOField::PutAttributes(sal_Int32 _nDefSize
)
647 OSL_ENSURE(pInterface
,"Interface is null!");
648 return (SUCCEEDED(pInterface
->put_Attributes(_nDefSize
)));
651 OLEVariant
WpADOProperty::GetValue() const
655 pInterface
->get_Value(&aValVar
);
659 void WpADOProperty::GetValue(OLEVariant
&aValVar
) const
661 OSL_ENSURE(pInterface
,"Interface is null!");
663 pInterface
->get_Value(&aValVar
);
666 sal_Bool
WpADOProperty::PutValue(const OLEVariant
&aValVar
)
668 OSL_ENSURE(pInterface
,"Interface is null!");
669 return (SUCCEEDED(pInterface
->put_Value(aValVar
)));
672 ::rtl::OUString
WpADOProperty::GetName() const
674 OSL_ENSURE(pInterface
,"Interface is null!");
676 pInterface
->get_Name(&aBSTR
);
680 DataTypeEnum
WpADOProperty::GetADOType() const
682 OSL_ENSURE(pInterface
,"Interface is null!");
683 DataTypeEnum eType
=adEmpty
;
684 pInterface
->get_Type(&eType
);
688 sal_Int32
WpADOProperty::GetAttributes() const
690 OSL_ENSURE(pInterface
,"Interface is null!");
691 sal_Int32 eADOSFieldAttributes
=0;
692 pInterface
->get_Attributes(&eADOSFieldAttributes
);
693 return eADOSFieldAttributes
;
696 sal_Bool
WpADOProperty::PutAttributes(sal_Int32 _nDefSize
)
698 OSL_ENSURE(pInterface
,"Interface is null!");
699 return (SUCCEEDED(pInterface
->put_Attributes(_nDefSize
)));
701 void WpADORecordset::Create()
703 IClassFactory2
* pInterface2
= NULL
;
704 IUnknown
*pOuter
= NULL
;
706 hr
= CoGetClassObject( ADOS::CLSID_ADORECORDSET_21
,
707 CLSCTX_INPROC_SERVER
,
710 (void**)&pInterface2
);
714 ADORecordset
*pRec
= NULL
;
715 hr
= pInterface2
->CreateInstanceLic( pOuter
,
717 ADOS::IID_ADORECORDSET_21
,
727 pInterface2
->Release();
731 sal_Bool
WpADORecordset::Open(
732 /* [optional][in] */ VARIANT Source
,
733 /* [optional][in] */ VARIANT ActiveConnection
,
734 /* [defaultvalue][in] */ CursorTypeEnum CursorType
,
735 /* [defaultvalue][in] */ LockTypeEnum LockType
,
736 /* [defaultvalue][in] */ sal_Int32 Options
)
738 OSL_ENSURE(pInterface
,"Interface is null!");
739 return (SUCCEEDED(pInterface
->Open(Source
,ActiveConnection
,CursorType
,LockType
,Options
)));
743 LockTypeEnum
WpADORecordset::GetLockType()
745 OSL_ENSURE(pInterface
,"Interface is null!");
746 LockTypeEnum eType
=adLockUnspecified
;
747 pInterface
->get_LockType(&eType
);
751 void WpADORecordset::Close()
753 OSL_ENSURE(pInterface
,"Interface is null!");
754 OSL_ENSURE(pInterface
,"Interface is null!");
758 sal_Bool
WpADORecordset::Cancel() const
760 OSL_ENSURE(pInterface
,"Interface is null!");
761 return (SUCCEEDED(pInterface
->Cancel()));
764 sal_Int32
WpADORecordset::get_State( )
766 OSL_ENSURE(pInterface
,"Interface is null!");
767 sal_Int32 nState
= 0;
768 pInterface
->get_State(&nState
);
772 sal_Bool
WpADORecordset::Supports( /* [in] */ CursorOptionEnum CursorOptions
)
774 OSL_ENSURE(pInterface
,"Interface is null!");
775 VARIANT_BOOL bSupports
=VARIANT_FALSE
;
776 pInterface
->Supports(CursorOptions
,&bSupports
);
777 return bSupports
== VARIANT_TRUE
;
780 PositionEnum
WpADORecordset::get_AbsolutePosition()
782 OSL_ENSURE(pInterface
,"Interface is null!");
783 PositionEnum aTemp
=adPosUnknown
;
784 pInterface
->get_AbsolutePosition(&aTemp
);
788 void WpADORecordset::GetDataSource(IUnknown
** _pInterface
) const
790 OSL_ENSURE(pInterface
,"Interface is null!");
791 pInterface
->get_DataSource(_pInterface
);
794 void WpADORecordset::PutRefDataSource(IUnknown
* _pInterface
)
796 OSL_ENSURE(pInterface
,"Interface is null!");
797 pInterface
->putref_DataSource(_pInterface
);
800 void WpADORecordset::GetBookmark(VARIANT
& var
)
802 OSL_ENSURE(pInterface
,"Interface is null!");
803 pInterface
->get_Bookmark(&var
);
806 OLEVariant
WpADORecordset::GetBookmark()
808 OSL_ENSURE(pInterface
,"Interface is null!");
810 pInterface
->get_Bookmark(&var
);
814 CompareEnum
WpADORecordset::CompareBookmarks(const OLEVariant
& left
,const OLEVariant
& right
)
816 OSL_ENSURE(pInterface
,"Interface is null!");
817 CompareEnum eNum
=adCompareNotComparable
;
818 pInterface
->CompareBookmarks(left
,right
,&eNum
);
822 sal_Bool
WpADORecordset::SetBookmark(const OLEVariant
&pSafeAr
)
824 OSL_ENSURE(pInterface
,"Interface is null!");
825 return SUCCEEDED(pInterface
->put_Bookmark(pSafeAr
));
829 WpADOFields
WpADORecordset::GetFields() const
831 OSL_ENSURE(pInterface
,"Interface is null!");
832 ADOFields
* pFields
=NULL
;
833 pInterface
->get_Fields(&pFields
);
835 aFields
.setWithOutAddRef(pFields
);
840 sal_Bool
WpADORecordset::Move(sal_Int32 nRows
, VARIANT aBmk
) {return pInterface
&& SUCCEEDED(pInterface
->Move(nRows
, aBmk
));}
841 sal_Bool
WpADORecordset::MoveNext() {return pInterface
&& SUCCEEDED(pInterface
->MoveNext());}
842 sal_Bool
WpADORecordset::MovePrevious() {return pInterface
&& SUCCEEDED(pInterface
->MovePrevious());}
843 sal_Bool
WpADORecordset::MoveFirst() {return pInterface
&& SUCCEEDED(pInterface
->MoveFirst());}
844 sal_Bool
WpADORecordset::MoveLast() {return pInterface
&& SUCCEEDED(pInterface
->MoveLast());}
846 sal_Bool
WpADORecordset::IsAtBOF() const
848 OSL_ENSURE(pInterface
,"Interface is null!");
849 VARIANT_BOOL bIsAtBOF
=VARIANT_FALSE
;
850 pInterface
->get_BOF(&bIsAtBOF
);
851 return bIsAtBOF
== VARIANT_TRUE
;
854 sal_Bool
WpADORecordset::IsAtEOF() const
856 OSL_ENSURE(pInterface
,"Interface is null!");
857 VARIANT_BOOL bIsAtEOF
=VARIANT_FALSE
;
858 pInterface
->get_EOF(&bIsAtEOF
);
859 return bIsAtEOF
== VARIANT_TRUE
;
862 sal_Bool
WpADORecordset::Delete(AffectEnum eNum
)
864 OSL_ENSURE(pInterface
,"Interface is null!");
865 return SUCCEEDED(pInterface
->Delete(eNum
));
868 sal_Bool
WpADORecordset::AddNew(const OLEVariant
&FieldList
,const OLEVariant
&Values
)
870 OSL_ENSURE(pInterface
,"Interface is null!");
871 return SUCCEEDED(pInterface
->AddNew(FieldList
,Values
));
874 sal_Bool
WpADORecordset::Update(const OLEVariant
&FieldList
,const OLEVariant
&Values
)
876 OSL_ENSURE(pInterface
,"Interface is null!");
877 return SUCCEEDED(pInterface
->Update(FieldList
,Values
));
880 sal_Bool
WpADORecordset::CancelUpdate()
882 OSL_ENSURE(pInterface
,"Interface is null!");
883 return SUCCEEDED(pInterface
->CancelUpdate());
886 WpADOProperties
WpADORecordset::get_Properties() const
888 OSL_ENSURE(pInterface
,"Interface is null!");
889 ADOProperties
* pProps
=NULL
;
890 pInterface
->get_Properties(&pProps
);
891 WpADOProperties aProps
;
892 aProps
.setWithOutAddRef(pProps
);
896 sal_Bool
WpADORecordset::NextRecordset(OLEVariant
& RecordsAffected
,ADORecordset
** ppiRset
)
898 OSL_ENSURE(pInterface
,"Interface is null!");
899 return SUCCEEDED(pInterface
->NextRecordset(&RecordsAffected
,ppiRset
));
902 sal_Bool
WpADORecordset::get_RecordCount(sal_Int32
&_nRet
) const
904 OSL_ENSURE(pInterface
,"Interface is null!");
905 return SUCCEEDED(pInterface
->get_RecordCount(&_nRet
));
908 sal_Bool
WpADORecordset::get_MaxRecords(sal_Int32
&_nRet
) const
910 OSL_ENSURE(pInterface
,"Interface is null!");
911 return SUCCEEDED(pInterface
->get_MaxRecords(&_nRet
));
914 sal_Bool
WpADORecordset::put_MaxRecords(sal_Int32 _nRet
)
916 OSL_ENSURE(pInterface
,"Interface is null!");
917 return SUCCEEDED(pInterface
->put_MaxRecords(_nRet
));
920 sal_Bool
WpADORecordset::get_CursorType(CursorTypeEnum
&_nRet
) const
922 OSL_ENSURE(pInterface
,"Interface is null!");
923 return SUCCEEDED(pInterface
->get_CursorType(&_nRet
));
926 sal_Bool
WpADORecordset::put_CursorType(CursorTypeEnum _nRet
)
928 OSL_ENSURE(pInterface
,"Interface is null!");
929 return SUCCEEDED(pInterface
->put_CursorType(_nRet
));
932 sal_Bool
WpADORecordset::get_LockType(LockTypeEnum
&_nRet
) const
934 OSL_ENSURE(pInterface
,"Interface is null!");
935 return SUCCEEDED(pInterface
->get_LockType(&_nRet
));
938 sal_Bool
WpADORecordset::put_LockType(LockTypeEnum _nRet
)
940 OSL_ENSURE(pInterface
,"Interface is null!");
941 return SUCCEEDED(pInterface
->put_LockType(_nRet
));
944 sal_Bool
WpADORecordset::get_CacheSize(sal_Int32
&_nRet
) const
946 OSL_ENSURE(pInterface
,"Interface is null!");
947 return SUCCEEDED(pInterface
->get_CacheSize(&_nRet
));
950 sal_Bool
WpADORecordset::put_CacheSize(sal_Int32 _nRet
)
952 OSL_ENSURE(pInterface
,"Interface is null!");
953 return SUCCEEDED(pInterface
->put_CacheSize(_nRet
));
956 sal_Bool
WpADORecordset::UpdateBatch(AffectEnum AffectRecords
)
958 OSL_ENSURE(pInterface
,"Interface is null!");
959 return SUCCEEDED(pInterface
->UpdateBatch(AffectRecords
));
962 ::rtl::OUString
WpADOParameter::GetName() const
964 OSL_ENSURE(pInterface
,"Interface is null!");
966 pInterface
->get_Name(&aBSTR
);
970 DataTypeEnum
WpADOParameter::GetADOType() const
972 OSL_ENSURE(pInterface
,"Interface is null!");
973 DataTypeEnum eType
=adEmpty
;
974 pInterface
->get_Type(&eType
);
978 void WpADOParameter::put_Type(const DataTypeEnum
& _eType
)
980 OSL_ENSURE(pInterface
,"Interface is null!");
981 pInterface
->put_Type(_eType
);
984 sal_Int32
WpADOParameter::GetAttributes() const
986 OSL_ENSURE(pInterface
,"Interface is null!");
987 sal_Int32 eADOSFieldAttributes
=0;
988 pInterface
->get_Attributes(&eADOSFieldAttributes
);
989 return eADOSFieldAttributes
;
992 sal_Int32
WpADOParameter::GetPrecision() const
994 OSL_ENSURE(pInterface
,"Interface is null!");
996 pInterface
->get_Precision(&eType
);
1000 sal_Int32
WpADOParameter::GetNumericScale() const
1002 OSL_ENSURE(pInterface
,"Interface is null!");
1004 pInterface
->get_NumericScale(&eType
);
1008 ParameterDirectionEnum
WpADOParameter::get_Direction() const
1010 OSL_ENSURE(pInterface
,"Interface is null!");
1011 ParameterDirectionEnum alParmDirection
=adParamUnknown
;
1012 pInterface
->get_Direction(&alParmDirection
);
1013 return alParmDirection
;
1016 void WpADOParameter::GetValue(OLEVariant
& aValVar
) const
1018 OSL_ENSURE(pInterface
,"Interface is null!");
1019 pInterface
->get_Value(&aValVar
);
1022 OLEVariant
WpADOParameter::GetValue() const
1024 OSL_ENSURE(pInterface
,"Interface is null!");
1026 pInterface
->get_Value(&aValVar
);
1030 sal_Bool
WpADOParameter::PutValue(const OLEVariant
& aVariant
)
1032 OSL_ENSURE(pInterface
,"Interface is null!");
1033 return (SUCCEEDED(pInterface
->put_Value(aVariant
)));
1035 sal_Bool
WpADOParameter::AppendChunk(const OLEVariant
& aVariant
)
1037 OSL_ENSURE(pInterface
,"Interface is null!");
1038 return (SUCCEEDED(pInterface
->AppendChunk(aVariant
)));
1040 sal_Bool
WpADOParameter::put_Size(const sal_Int32
& _nSize
)
1042 OSL_ENSURE(pInterface
,"Interface is null!");
1043 return (SUCCEEDED(pInterface
->put_Size(_nSize
)));
1046 ::rtl::OUString
WpADOColumn::get_Name() const
1048 OSL_ENSURE(pInterface
,"Interface is null!");
1050 pInterface
->get_Name(&aBSTR
);
1054 ::rtl::OUString
WpADOColumn::get_RelatedColumn() const
1056 OSL_ENSURE(pInterface
,"Interface is null!");
1058 pInterface
->get_RelatedColumn(&aBSTR
);
1062 void WpADOColumn::put_Name(const ::rtl::OUString
& _rName
)
1064 OSL_ENSURE(pInterface
,"Interface is null!");
1065 OLEString
bstr(_rName
);
1066 sal_Bool bErg
= SUCCEEDED(pInterface
->put_Name(bstr
));
1069 void WpADOColumn::put_RelatedColumn(const ::rtl::OUString
& _rName
)
1071 OSL_ENSURE(pInterface
,"Interface is null!");
1072 OLEString
bstr(_rName
);
1073 sal_Bool bErg
= SUCCEEDED(pInterface
->put_RelatedColumn(bstr
));
1077 DataTypeEnum
WpADOColumn::get_Type() const
1079 OSL_ENSURE(pInterface
,"Interface is null!");
1080 DataTypeEnum eNum
= adVarChar
;
1081 pInterface
->get_Type(&eNum
);
1085 void WpADOColumn::put_Type(const DataTypeEnum
& _eNum
)
1087 OSL_ENSURE(pInterface
,"Interface is null!");
1088 pInterface
->put_Type(_eNum
);
1091 sal_Int32
WpADOColumn::get_Precision() const
1093 OSL_ENSURE(pInterface
,"Interface is null!");
1095 pInterface
->get_Precision(&nPrec
);
1099 void WpADOColumn::put_Precision(sal_Int32 _nPre
)
1101 OSL_ENSURE(pInterface
,"Interface is null!");
1102 pInterface
->put_Precision(_nPre
);
1105 sal_Int32
WpADOColumn::get_DefinedSize() const
1107 OSL_ENSURE(pInterface
,"Interface is null!");
1109 pInterface
->get_DefinedSize(&nPrec
);
1112 sal_uInt8
WpADOColumn::get_NumericScale() const
1114 OSL_ENSURE(pInterface
,"Interface is null!");
1116 pInterface
->get_NumericScale(&nPrec
);
1120 void WpADOColumn::put_NumericScale(sal_Int8 _nScale
)
1122 OSL_ENSURE(pInterface
,"Interface is null!");
1123 pInterface
->put_NumericScale(_nScale
);
1126 SortOrderEnum
WpADOColumn::get_SortOrder() const
1128 OSL_ENSURE(pInterface
,"Interface is null!");
1129 SortOrderEnum nPrec
=adSortAscending
;
1130 pInterface
->get_SortOrder(&nPrec
);
1134 void WpADOColumn::put_SortOrder(SortOrderEnum _nScale
)
1136 OSL_ENSURE(pInterface
,"Interface is null!");
1137 pInterface
->put_SortOrder(_nScale
);
1140 ColumnAttributesEnum
WpADOColumn::get_Attributes() const
1142 OSL_ENSURE(pInterface
,"Interface is null!");
1143 ColumnAttributesEnum eNum
=adColNullable
;
1144 pInterface
->get_Attributes(&eNum
);
1148 sal_Bool
WpADOColumn::put_Attributes(const ColumnAttributesEnum
& _eNum
)
1150 OSL_ENSURE(pInterface
,"Interface is null!");
1151 return SUCCEEDED(pInterface
->put_Attributes(_eNum
));
1154 WpADOProperties
WpADOColumn::get_Properties() const
1156 OSL_ENSURE(pInterface
,"Interface is null!");
1157 ADOProperties
* pProps
= NULL
;
1158 pInterface
->get_Properties(&pProps
);
1159 WpADOProperties aProps
;
1161 aProps
.setWithOutAddRef(pProps
);
1165 ::rtl::OUString
WpADOKey::get_Name() const
1167 OSL_ENSURE(pInterface
,"Interface is null!");
1169 pInterface
->get_Name(&aBSTR
);
1173 void WpADOKey::put_Name(const ::rtl::OUString
& _rName
)
1175 OSL_ENSURE(pInterface
,"Interface is null!");
1176 OLEString
bstr(_rName
);
1177 sal_Bool bErg
= SUCCEEDED(pInterface
->put_Name(bstr
));
1181 KeyTypeEnum
WpADOKey::get_Type() const
1183 OSL_ENSURE(pInterface
,"Interface is null!");
1184 KeyTypeEnum eNum
=adKeyPrimary
;
1185 pInterface
->get_Type(&eNum
);
1189 void WpADOKey::put_Type(const KeyTypeEnum
& _eNum
)
1191 OSL_ENSURE(pInterface
,"Interface is null!");
1192 pInterface
->put_Type(_eNum
);
1195 ::rtl::OUString
WpADOKey::get_RelatedTable() const
1197 OSL_ENSURE(pInterface
,"Interface is null!");
1199 pInterface
->get_RelatedTable(&aBSTR
);
1203 void WpADOKey::put_RelatedTable(const ::rtl::OUString
& _rName
)
1205 OSL_ENSURE(pInterface
,"Interface is null!");
1206 OLEString
bstr(_rName
);
1207 sal_Bool bErg
= SUCCEEDED(pInterface
->put_RelatedTable(bstr
));
1211 RuleEnum
WpADOKey::get_DeleteRule() const
1213 OSL_ENSURE(pInterface
,"Interface is null!");
1214 RuleEnum eNum
= adRINone
;
1215 pInterface
->get_DeleteRule(&eNum
);
1219 void WpADOKey::put_DeleteRule(const RuleEnum
& _eNum
)
1221 OSL_ENSURE(pInterface
,"Interface is null!");
1222 pInterface
->put_DeleteRule(_eNum
);
1225 RuleEnum
WpADOKey::get_UpdateRule() const
1227 OSL_ENSURE(pInterface
,"Interface is null!");
1228 RuleEnum eNum
= adRINone
;
1229 pInterface
->get_UpdateRule(&eNum
);
1233 void WpADOKey::put_UpdateRule(const RuleEnum
& _eNum
)
1235 OSL_ENSURE(pInterface
,"Interface is null!");
1236 pInterface
->put_UpdateRule(_eNum
);
1239 WpADOColumns
WpADOKey::get_Columns() const
1241 OSL_ENSURE(pInterface
,"Interface is null!");
1242 ADOColumns
* pCols
= NULL
;
1243 pInterface
->get_Columns(&pCols
);
1245 aCols
.setWithOutAddRef(pCols
);
1249 ::rtl::OUString
WpADOIndex::get_Name() const
1251 OSL_ENSURE(pInterface
,"Interface is null!");
1253 pInterface
->get_Name(&aBSTR
);
1257 void WpADOIndex::put_Name(const ::rtl::OUString
& _rName
)
1259 OSL_ENSURE(pInterface
,"Interface is null!");
1260 OLEString
bstr(_rName
);
1261 sal_Bool bErg
= SUCCEEDED(pInterface
->put_Name(bstr
));
1265 sal_Bool
WpADOIndex::get_Clustered() const
1267 OSL_ENSURE(pInterface
,"Interface is null!");
1268 VARIANT_BOOL eNum
= VARIANT_FALSE
;
1269 pInterface
->get_Clustered(&eNum
);
1270 return eNum
== VARIANT_TRUE
;
1273 void WpADOIndex::put_Clustered(sal_Bool _b
)
1275 OSL_ENSURE(pInterface
,"Interface is null!");
1276 pInterface
->put_Clustered(_b
? VARIANT_TRUE
: VARIANT_FALSE
);
1279 sal_Bool
WpADOIndex::get_Unique() const
1281 OSL_ENSURE(pInterface
,"Interface is null!");
1282 VARIANT_BOOL eNum
= VARIANT_FALSE
;
1283 pInterface
->get_Unique(&eNum
);
1284 return eNum
== VARIANT_TRUE
;
1287 void WpADOIndex::put_Unique(sal_Bool _b
)
1289 OSL_ENSURE(pInterface
,"Interface is null!");
1290 pInterface
->put_Unique(_b
? VARIANT_TRUE
: VARIANT_FALSE
);
1293 sal_Bool
WpADOIndex::get_PrimaryKey() const
1295 OSL_ENSURE(pInterface
,"Interface is null!");
1296 VARIANT_BOOL eNum
= VARIANT_FALSE
;
1297 pInterface
->get_PrimaryKey(&eNum
);
1298 return eNum
== VARIANT_TRUE
;
1301 void WpADOIndex::put_PrimaryKey(sal_Bool _b
)
1303 OSL_ENSURE(pInterface
,"Interface is null!");
1304 pInterface
->put_PrimaryKey(_b
? VARIANT_TRUE
: VARIANT_FALSE
);
1307 WpADOColumns
WpADOIndex::get_Columns() const
1309 OSL_ENSURE(pInterface
,"Interface is null!");
1310 ADOColumns
* pCols
= NULL
;
1311 pInterface
->get_Columns(&pCols
);
1313 aCols
.setWithOutAddRef(pCols
);
1317 void WpADOCatalog::putref_ActiveConnection(IDispatch
* pCon
)
1319 OSL_ENSURE(pInterface
,"Interface is null!");
1320 pInterface
->putref_ActiveConnection(pCon
);
1323 WpADOTables
WpADOCatalog::get_Tables()
1325 OSL_ENSURE(pInterface
,"Interface is null!");
1326 ADOTables
* pRet
= NULL
;
1327 pInterface
->get_Tables(&pRet
);
1329 aRet
.setWithOutAddRef(pRet
);
1333 WpADOViews
WpADOCatalog::get_Views()
1335 OSL_ENSURE(pInterface
,"Interface is null!");
1336 ADOViews
* pRet
= NULL
;
1337 pInterface
->get_Views(&pRet
);
1339 aRet
.setWithOutAddRef(pRet
);
1343 WpADOGroups
WpADOCatalog::get_Groups()
1345 OSL_ENSURE(pInterface
,"Interface is null!");
1346 ADOGroups
* pRet
= NULL
;
1347 pInterface
->get_Groups(&pRet
);
1349 aRet
.setWithOutAddRef(pRet
);
1353 WpADOUsers
WpADOCatalog::get_Users()
1355 OSL_ENSURE(pInterface
,"Interface is null!");
1356 ADOUsers
* pRet
= NULL
;
1357 pInterface
->get_Users(&pRet
);
1359 aRet
.setWithOutAddRef(pRet
);
1363 ADOProcedures
* WpADOCatalog::get_Procedures()
1365 OSL_ENSURE(pInterface
,"Interface is null!");
1366 ADOProcedures
* pRet
= NULL
;
1367 pInterface
->get_Procedures(&pRet
);
1371 ::rtl::OUString
WpADOTable::get_Name() const
1373 OSL_ENSURE(pInterface
,"Interface is null!");
1375 pInterface
->get_Name(&aBSTR
);
1379 void WpADOTable::put_Name(const ::rtl::OUString
& _rName
)
1381 OSL_ENSURE(pInterface
,"Interface is null!");
1382 OLEString
bstr(_rName
);
1383 sal_Bool bErg
= SUCCEEDED(pInterface
->put_Name(bstr
));
1387 ::rtl::OUString
WpADOTable::get_Type() const
1389 OSL_ENSURE(pInterface
,"Interface is null!");
1391 pInterface
->get_Type(&aBSTR
);
1395 WpADOColumns
WpADOTable::get_Columns() const
1397 OSL_ENSURE(pInterface
,"Interface is null!");
1398 ADOColumns
* pCols
= NULL
;
1399 pInterface
->get_Columns(&pCols
);
1401 aCols
.setWithOutAddRef(pCols
);
1405 WpADOIndexes
WpADOTable::get_Indexes() const
1407 OSL_ENSURE(pInterface
,"Interface is null!");
1408 ADOIndexes
* pCols
= NULL
;
1409 pInterface
->get_Indexes(&pCols
);
1411 aRet
.setWithOutAddRef(pCols
);
1415 WpADOKeys
WpADOTable::get_Keys() const
1417 OSL_ENSURE(pInterface
,"Interface is null!");
1418 ADOKeys
* pCols
= NULL
;
1419 pInterface
->get_Keys(&pCols
);
1421 aRet
.setWithOutAddRef(pCols
);
1425 WpADOCatalog
WpADOTable::get_ParentCatalog() const
1427 OSL_ENSURE(pInterface
,"Interface is null!");
1428 ADOCatalog
* pCat
= NULL
;
1429 pInterface
->get_ParentCatalog(&pCat
);
1431 aRet
.setWithOutAddRef(pCat
);
1435 WpADOProperties
WpADOTable::get_Properties() const
1437 OSL_ENSURE(pInterface
,"Interface is null!");
1438 ADOProperties
* pProps
= NULL
;
1439 pInterface
->get_Properties(&pProps
);
1440 WpADOProperties aProps
;
1441 aProps
.setWithOutAddRef(pProps
);
1445 ::rtl::OUString
WpADOView::get_Name() const
1447 OSL_ENSURE(pInterface
,"Interface is null!");
1449 pInterface
->get_Name(&aBSTR
);
1453 void WpADOView::get_Command(OLEVariant
& _rVar
) const
1455 OSL_ENSURE(pInterface
,"Interface is null!");
1456 pInterface
->get_Command(&_rVar
);
1459 void WpADOView::put_Command(OLEVariant
& _rVar
)
1461 pInterface
->put_Command(_rVar
);
1464 ::rtl::OUString
WpADOGroup::get_Name() const
1467 pInterface
->get_Name(&aBSTR
);
1471 void WpADOGroup::put_Name(const ::rtl::OUString
& _rName
)
1473 OLEString
bstr(_rName
);
1474 sal_Bool bErg
= SUCCEEDED(pInterface
->put_Name(bstr
));
1478 RightsEnum
WpADOGroup::GetPermissions(
1479 /* [in] */ const OLEVariant
& Name
,
1480 /* [in] */ ObjectTypeEnum ObjectType
)
1482 RightsEnum Rights
=adRightNone
;
1483 OLEVariant ObjectTypeId
;
1484 ObjectTypeId
.setNoArg();
1485 pInterface
->GetPermissions(Name
,ObjectType
,ObjectTypeId
,&Rights
);
1489 sal_Bool
WpADOGroup::SetPermissions(
1490 /* [in] */ const OLEVariant
& Name
,
1491 /* [in] */ ObjectTypeEnum ObjectType
,
1492 /* [in] */ ActionEnum Action
,
1493 /* [in] */ RightsEnum Rights
)
1495 OLEVariant ObjectTypeId
;
1496 ObjectTypeId
.setNoArg();
1497 return SUCCEEDED(pInterface
->SetPermissions(Name
,ObjectType
,Action
,Rights
,adInheritNone
,ObjectTypeId
));
1500 WpADOUsers
WpADOGroup::get_Users( )
1502 ADOUsers
* pRet
= NULL
;
1503 pInterface
->get_Users( &pRet
);
1505 aRet
.setWithOutAddRef(pRet
);
1509 ::rtl::OUString
WpADOUser::get_Name() const
1512 pInterface
->get_Name(&aBSTR
);
1516 void WpADOUser::put_Name(const ::rtl::OUString
& _rName
)
1518 OLEString
bstr(_rName
);
1519 sal_Bool bErg
= SUCCEEDED(pInterface
->put_Name(bstr
));
1523 sal_Bool
WpADOUser::ChangePassword(const ::rtl::OUString
& _rPwd
,const ::rtl::OUString
& _rNewPwd
)
1525 OLEString
sStr1(_rPwd
);
1526 OLEString
sStr2(_rNewPwd
);
1527 sal_Bool bErg
= SUCCEEDED(pInterface
->ChangePassword(sStr1
,sStr2
));
1531 WpADOGroups
WpADOUser::get_Groups()
1533 ADOGroups
* pRet
= NULL
;
1534 pInterface
->get_Groups(&pRet
);
1536 aRet
.setWithOutAddRef(pRet
);
1540 RightsEnum
WpADOUser::GetPermissions(
1541 /* [in] */ const OLEVariant
& Name
,
1542 /* [in] */ ObjectTypeEnum ObjectType
)
1544 RightsEnum Rights
=adRightNone
;
1545 OLEVariant ObjectTypeId
;
1546 ObjectTypeId
.setNoArg();
1547 pInterface
->GetPermissions(Name
,ObjectType
,ObjectTypeId
,&Rights
);
1551 sal_Bool
WpADOUser::SetPermissions(
1552 /* [in] */ const OLEVariant
& Name
,
1553 /* [in] */ ObjectTypeEnum ObjectType
,
1554 /* [in] */ ActionEnum Action
,
1555 /* [in] */ RightsEnum Rights
)
1557 OLEVariant ObjectTypeId
;
1558 ObjectTypeId
.setNoArg();
1559 return SUCCEEDED(pInterface
->SetPermissions(Name
,ObjectType
,Action
,Rights
,adInheritNone
,ObjectTypeId
));
1562 WpBase::WpBase() : pIUnknown(NULL
)
1565 WpBase::WpBase(IDispatch
* pInt
)
1570 ULONG nCount
= pIUnknown
->AddRef();
1572 // OSL_ENSURE(nCount == 1,"Count is greater than 1");
1577 WpBase
& WpBase::operator=(const WpBase
& rhs
)
1579 if (rhs
.pIUnknown
!= pIUnknown
)
1582 pIUnknown
->Release();
1583 pIUnknown
= rhs
.pIUnknown
;
1585 pIUnknown
->AddRef();
1590 WpBase
& WpBase::operator=(IDispatch
* rhs
)
1592 if (pIUnknown
!= rhs
)
1595 pIUnknown
->Release();
1598 pIUnknown
->AddRef();
1603 WpBase::WpBase(const WpBase
& aWrapper
)
1605 operator=(aWrapper
);
1612 pIUnknown
->Release();
1617 void WpBase::clear()
1621 pIUnknown
->Release();
1627 sal_Bool
WpBase::IsValid() const
1629 return pIUnknown
!= NULL
;
1631 WpBase::operator IDispatch
*()
1636 ADORecordset
* WpADOConnection::getExportedKeys( const ::com::sun::star::uno::Any
& catalog
, const ::rtl::OUString
& schema
, const ::rtl::OUString
& table
)
1638 // Create elements used in the array
1640 SAFEARRAYBOUND rgsabound
[1];
1641 SAFEARRAY
*psa
= NULL
;
1642 OLEVariant varCriteria
[6];
1644 // Create SafeArray Bounds and initialize the array
1645 rgsabound
[0].lLbound
= 0;
1646 rgsabound
[0].cElements
= sizeof varCriteria
/ sizeof varCriteria
[0];
1647 psa
= SafeArrayCreate( VT_VARIANT
, 1, rgsabound
);
1650 if(catalog
.hasValue())
1651 varCriteria
[nPos
].setString(::comphelper::getString(catalog
));
1653 hr
= SafeArrayPutElement(psa
,&nPos
,&varCriteria
[nPos
]);nPos
++;// TABLE_CATALOG
1654 if(schema
.getLength() && schema
.toChar() != '%')
1655 varCriteria
[nPos
].setString(schema
);
1656 hr
= SafeArrayPutElement(psa
,&nPos
,&varCriteria
[nPos
]);nPos
++;// TABLE_SCHEMA
1658 varCriteria
[nPos
].setString(table
);
1659 hr
= SafeArrayPutElement(psa
,&nPos
,&varCriteria
[nPos
]);nPos
++;// TABLE_NAME
1661 hr
= SafeArrayPutElement(psa
,&nPos
,&varCriteria
[nPos
]);nPos
++;// TABLE_CATALOG
1662 hr
= SafeArrayPutElement(psa
,&nPos
,&varCriteria
[nPos
]);nPos
++;// TABLE_SCHEMA
1663 hr
= SafeArrayPutElement(psa
,&nPos
,&varCriteria
[nPos
]);nPos
++;// TABLE_NAME
1668 // Initialize and fill the SafeArray
1670 vsa
.setArray(psa
,VT_VARIANT
);
1672 ADORecordset
*pRecordset
= NULL
;
1673 OpenSchema(adSchemaForeignKeys
,vsa
,vtEmpty
,&pRecordset
);
1676 // -----------------------------------------------------------------------------
1677 ADORecordset
* WpADOConnection::getImportedKeys( const ::com::sun::star::uno::Any
& catalog
, const ::rtl::OUString
& schema
, const ::rtl::OUString
& table
)
1679 // Create elements used in the array
1681 SAFEARRAYBOUND rgsabound
[1];
1682 SAFEARRAY
*psa
= NULL
;
1683 OLEVariant varCriteria
[6];
1685 // Create SafeArray Bounds and initialize the array
1686 rgsabound
[0].lLbound
= 0;
1687 rgsabound
[0].cElements
= sizeof varCriteria
/ sizeof varCriteria
[0];
1688 psa
= SafeArrayCreate( VT_VARIANT
, 1, rgsabound
);
1691 hr
= SafeArrayPutElement(psa
,&nPos
,&varCriteria
[nPos
]);nPos
++;// TABLE_CATALOG
1692 hr
= SafeArrayPutElement(psa
,&nPos
,&varCriteria
[nPos
]);nPos
++;// TABLE_SCHEMA
1693 hr
= SafeArrayPutElement(psa
,&nPos
,&varCriteria
[nPos
]);nPos
++;// TABLE_NAME
1695 if(catalog
.hasValue())
1696 varCriteria
[nPos
].setString(::comphelper::getString(catalog
));
1698 hr
= SafeArrayPutElement(psa
,&nPos
,&varCriteria
[nPos
]);nPos
++;// TABLE_CATALOG
1699 if(schema
.getLength() && schema
.toChar() != '%')
1700 varCriteria
[nPos
].setString(schema
);
1701 hr
= SafeArrayPutElement(psa
,&nPos
,&varCriteria
[nPos
]);nPos
++;// TABLE_SCHEMA
1703 varCriteria
[nPos
].setString(table
);
1704 hr
= SafeArrayPutElement(psa
,&nPos
,&varCriteria
[nPos
]);nPos
++;// TABLE_NAME
1709 // Initialize and fill the SafeArray
1711 vsa
.setArray(psa
,VT_VARIANT
);
1713 ADORecordset
*pRecordset
= NULL
;
1714 OpenSchema(adSchemaForeignKeys
,vsa
,vtEmpty
,&pRecordset
);
1719 // -----------------------------------------------------------------------------
1720 ADORecordset
* WpADOConnection::getPrimaryKeys( const ::com::sun::star::uno::Any
& catalog
, const ::rtl::OUString
& schema
, const ::rtl::OUString
& table
)
1722 // Create elements used in the array
1724 SAFEARRAYBOUND rgsabound
[1];
1725 SAFEARRAY
*psa
= NULL
;
1726 OLEVariant varCriteria
[3];
1728 // Create SafeArray Bounds and initialize the array
1729 rgsabound
[0].lLbound
= 0;
1730 rgsabound
[0].cElements
= sizeof varCriteria
/ sizeof varCriteria
[0];
1731 psa
= SafeArrayCreate( VT_VARIANT
, 1, rgsabound
);
1734 if(catalog
.hasValue())
1735 varCriteria
[nPos
].setString(::comphelper::getString(catalog
));
1737 hr
= SafeArrayPutElement(psa
,&nPos
,&varCriteria
[nPos
]);nPos
++;// TABLE_CATALOG
1738 if(schema
.getLength() && schema
.toChar() != '%')
1739 varCriteria
[nPos
].setString(schema
);
1740 hr
= SafeArrayPutElement(psa
,&nPos
,&varCriteria
[nPos
]);nPos
++;// TABLE_SCHEMA
1742 varCriteria
[nPos
].setString(table
);
1743 hr
= SafeArrayPutElement(psa
,&nPos
,&varCriteria
[nPos
]);nPos
++;// TABLE_NAME
1749 // Initialize and fill the SafeArray
1751 vsa
.setArray(psa
,VT_VARIANT
);
1753 ADORecordset
*pRecordset
= NULL
;
1754 OpenSchema(adSchemaPrimaryKeys
,vsa
,vtEmpty
,&pRecordset
);
1758 // -----------------------------------------------------------------------------
1759 ADORecordset
* WpADOConnection::getIndexInfo(
1760 const ::com::sun::star::uno::Any
& catalog
, const ::rtl::OUString
& schema
, const ::rtl::OUString
& table
,
1761 sal_Bool
/*unique*/, sal_Bool
/*approximate*/ )
1763 // Create elements used in the array
1765 SAFEARRAYBOUND rgsabound
[1];
1766 SAFEARRAY
*psa
= NULL
;
1767 OLEVariant varCriteria
[5];
1769 // Create SafeArray Bounds and initialize the array
1770 rgsabound
[0].lLbound
= 0;
1771 rgsabound
[0].cElements
= sizeof varCriteria
/ sizeof varCriteria
[0];
1772 psa
= SafeArrayCreate( VT_VARIANT
, 1, rgsabound
);
1775 if(catalog
.hasValue())
1776 varCriteria
[nPos
].setString(::comphelper::getString(catalog
));
1778 hr
= SafeArrayPutElement(psa
,&nPos
,&varCriteria
[nPos
]);nPos
++;// TABLE_CATALOG
1779 if(schema
.getLength() && schema
.toChar() != '%')
1780 varCriteria
[nPos
].setString(schema
);
1781 hr
= SafeArrayPutElement(psa
,&nPos
,&varCriteria
[nPos
]);nPos
++;// TABLE_SCHEMA
1783 hr
= SafeArrayPutElement(psa
,&nPos
,&varCriteria
[nPos
]);nPos
++;// INDEX_NAME
1785 hr
= SafeArrayPutElement(psa
,&nPos
,&varCriteria
[nPos
]);nPos
++;// TYPE
1787 varCriteria
[nPos
].setString(table
);
1788 hr
= SafeArrayPutElement(psa
,&nPos
,&varCriteria
[nPos
]);nPos
++;// TABLE_NAME
1793 // Initialize and fill the SafeArray
1795 vsa
.setArray(psa
,VT_VARIANT
);
1797 ADORecordset
*pRecordset
= NULL
;
1798 OpenSchema(adSchemaIndexes
,vsa
,vtEmpty
,&pRecordset
);
1802 // -----------------------------------------------------------------------------
1803 ADORecordset
* WpADOConnection::getTablePrivileges( const ::com::sun::star::uno::Any
& catalog
,
1804 const ::rtl::OUString
& schemaPattern
,
1805 const ::rtl::OUString
& tableNamePattern
)
1808 SAFEARRAYBOUND rgsabound
[1];
1809 SAFEARRAY
*psa
= NULL
;
1810 OLEVariant varCriteria
[5];
1812 // Create SafeArray Bounds and initialize the array
1813 rgsabound
[0].lLbound
= 0;
1814 rgsabound
[0].cElements
= sizeof varCriteria
/ sizeof varCriteria
[0];
1815 psa
= SafeArrayCreate( VT_VARIANT
, 1, rgsabound
);
1818 if(catalog
.hasValue())
1819 varCriteria
[nPos
].setString(::comphelper::getString(catalog
));
1821 hr
= SafeArrayPutElement(psa
,&nPos
,&varCriteria
[nPos
]);nPos
++;// TABLE_CATALOG
1822 if(schemaPattern
.getLength() && schemaPattern
.toChar() != '%')
1823 varCriteria
[nPos
].setString(schemaPattern
);
1824 hr
= SafeArrayPutElement(psa
,&nPos
,&varCriteria
[nPos
]);nPos
++;// TABLE_SCHEMA
1826 if(tableNamePattern
.toChar() != '%')
1827 varCriteria
[nPos
].setString(tableNamePattern
);
1828 hr
= SafeArrayPutElement(psa
,&nPos
,&varCriteria
[nPos
]);nPos
++;// TABLE_NAME
1830 hr
= SafeArrayPutElement(psa
,&nPos
,&varCriteria
[nPos
]);nPos
++;// GRANTOR
1831 hr
= SafeArrayPutElement(psa
,&nPos
,&varCriteria
[nPos
]);nPos
++;// GRANTEE
1836 // Initialize and fill the SafeArray
1838 vsa
.setArray(psa
,VT_VARIANT
);
1840 ADORecordset
*pRecordset
= NULL
;
1841 OpenSchema(adSchemaTablePrivileges
,vsa
,vtEmpty
,&pRecordset
);
1845 // -----------------------------------------------------------------------------
1846 ADORecordset
* WpADOConnection::getCrossReference( const ::com::sun::star::uno::Any
& primaryCatalog
,
1847 const ::rtl::OUString
& primarySchema
,
1848 const ::rtl::OUString
& primaryTable
,
1849 const ::com::sun::star::uno::Any
& foreignCatalog
,
1850 const ::rtl::OUString
& foreignSchema
,
1851 const ::rtl::OUString
& foreignTable
)
1853 // Create elements used in the array
1855 SAFEARRAYBOUND rgsabound
[1];
1856 SAFEARRAY
*psa
= NULL
;
1857 OLEVariant varCriteria
[6];
1859 // Create SafeArray Bounds and initialize the array
1860 rgsabound
[0].lLbound
= 0;
1861 rgsabound
[0].cElements
= sizeof varCriteria
/ sizeof varCriteria
[0];
1862 psa
= SafeArrayCreate( VT_VARIANT
, 1, rgsabound
);
1865 if(primaryCatalog
.hasValue())
1866 varCriteria
[nPos
].setString(::comphelper::getString(primaryCatalog
));
1868 hr
= SafeArrayPutElement(psa
,&nPos
,&varCriteria
[nPos
]);nPos
++;// TABLE_CATALOG
1869 if(primarySchema
.getLength() && primarySchema
.toChar() != '%')
1870 varCriteria
[nPos
].setString(primarySchema
);
1871 hr
= SafeArrayPutElement(psa
,&nPos
,&varCriteria
[nPos
]);nPos
++;// TABLE_SCHEMA
1873 varCriteria
[nPos
].setString(primaryTable
);
1874 hr
= SafeArrayPutElement(psa
,&nPos
,&varCriteria
[nPos
]);nPos
++;// TABLE_NAME
1876 if(foreignCatalog
.hasValue())
1877 varCriteria
[nPos
].setString(::comphelper::getString(foreignCatalog
));
1879 hr
= SafeArrayPutElement(psa
,&nPos
,&varCriteria
[nPos
]);nPos
++;// TABLE_CATALOG
1880 if(foreignSchema
.getLength() && foreignSchema
.toChar() != '%')
1881 varCriteria
[nPos
].setString(foreignSchema
);
1882 hr
= SafeArrayPutElement(psa
,&nPos
,&varCriteria
[nPos
]);nPos
++;// TABLE_SCHEMA
1884 varCriteria
[nPos
].setString(foreignTable
);
1885 hr
= SafeArrayPutElement(psa
,&nPos
,&varCriteria
[nPos
]);nPos
++;// TABLE_NAME
1890 // Initialize and fill the SafeArray
1892 vsa
.setArray(psa
,VT_VARIANT
);
1894 ADORecordset
*pRecordset
= NULL
;
1895 OpenSchema(adSchemaForeignKeys
,vsa
,vtEmpty
,&pRecordset
);
1899 // -----------------------------------------------------------------------------
1900 ADORecordset
* WpADOConnection::getProcedures( const ::com::sun::star::uno::Any
& catalog
,
1901 const ::rtl::OUString
& schemaPattern
,
1902 const ::rtl::OUString
& procedureNamePattern
)
1905 SAFEARRAYBOUND rgsabound
[1];
1906 SAFEARRAY
*psa
= NULL
;
1907 OLEVariant varCriteria
[3];
1909 // Create SafeArray Bounds and initialize the array
1910 rgsabound
[0].lLbound
= 0;
1911 rgsabound
[0].cElements
= sizeof varCriteria
/ sizeof varCriteria
[0];
1912 psa
= SafeArrayCreate( VT_VARIANT
, 1, rgsabound
);
1915 if(catalog
.hasValue())
1916 varCriteria
[nPos
].setString(::comphelper::getString(catalog
));
1918 hr
= SafeArrayPutElement(psa
,&nPos
,&varCriteria
[nPos
]);nPos
++;// TABLE_CATALOG
1919 if(schemaPattern
.getLength() && schemaPattern
.toChar() != '%')
1920 varCriteria
[nPos
].setString(schemaPattern
);
1921 hr
= SafeArrayPutElement(psa
,&nPos
,&varCriteria
[nPos
]);nPos
++;// TABLE_SCHEMA
1923 if(procedureNamePattern
.toChar() != '%')
1924 varCriteria
[nPos
].setString(procedureNamePattern
);
1925 hr
= SafeArrayPutElement(psa
,&nPos
,&varCriteria
[nPos
]);nPos
++;// TABLE_NAME
1930 // Initialize and fill the SafeArray
1932 vsa
.setArray(psa
,VT_VARIANT
);
1934 ADORecordset
*pRecordset
= NULL
;
1935 OpenSchema(adSchemaProcedures
,vsa
,vtEmpty
,&pRecordset
);
1939 // -----------------------------------------------------------------------------
1940 ADORecordset
* WpADOConnection::getProcedureColumns( const ::com::sun::star::uno::Any
& catalog
,
1941 const ::rtl::OUString
& schemaPattern
,
1942 const ::rtl::OUString
& procedureNamePattern
,
1943 const ::rtl::OUString
& columnNamePattern
)
1945 // Create elements used in the array
1947 SAFEARRAYBOUND rgsabound
[1];
1948 SAFEARRAY
*psa
= NULL
;
1949 OLEVariant varCriteria
[4];
1951 // Create SafeArray Bounds and initialize the array
1952 rgsabound
[0].lLbound
= 0;
1953 rgsabound
[0].cElements
= sizeof varCriteria
/ sizeof varCriteria
[0];
1954 psa
= SafeArrayCreate( VT_VARIANT
, 1, rgsabound
);
1957 if(catalog
.hasValue())
1958 varCriteria
[nPos
].setString(::comphelper::getString(catalog
));
1960 hr
= SafeArrayPutElement(psa
,&nPos
,&varCriteria
[nPos
]);nPos
++;// TABLE_CATALOG
1961 if(schemaPattern
.getLength() && schemaPattern
.toChar() != '%')
1962 varCriteria
[nPos
].setString(schemaPattern
);
1963 hr
= SafeArrayPutElement(psa
,&nPos
,&varCriteria
[nPos
]);nPos
++;// TABLE_SCHEMA
1965 if(procedureNamePattern
.toChar() != '%')
1966 varCriteria
[nPos
].setString(procedureNamePattern
);
1967 hr
= SafeArrayPutElement(psa
,&nPos
,&varCriteria
[nPos
]);nPos
++;// TABLE_NAME
1969 if(columnNamePattern
.toChar() != '%')
1970 varCriteria
[nPos
].setString(columnNamePattern
);
1971 hr
= SafeArrayPutElement(psa
,&nPos
,&varCriteria
[nPos
]);nPos
++;// COLUMN_NAME
1976 // Initialize and fill the SafeArray
1978 vsa
.setArray(psa
,VT_VARIANT
);
1980 ADORecordset
*pRecordset
= NULL
;
1981 OpenSchema(adSchemaProcedureParameters
,vsa
,vtEmpty
,&pRecordset
);
1985 // -----------------------------------------------------------------------------
1986 ADORecordset
* WpADOConnection::getTables( const ::com::sun::star::uno::Any
& catalog
,
1987 const ::rtl::OUString
& schemaPattern
,
1988 const ::rtl::OUString
& tableNamePattern
,
1989 const ::com::sun::star::uno::Sequence
< ::rtl::OUString
>& types
)
1991 // Create elements used in the array
1993 OLEVariant varCriteria
[4];
1996 ::rtl::OUString sCatalog
;
1997 if ( catalog
.hasValue() && (catalog
>>= sCatalog
) )
1998 varCriteria
[nPos
].setString(sCatalog
);
2001 if(schemaPattern
.getLength() && schemaPattern
.toChar() != '%')
2002 varCriteria
[nPos
].setString(schemaPattern
);
2005 if(tableNamePattern
.toChar() != '%')
2006 varCriteria
[nPos
].setString(tableNamePattern
);
2009 ::rtl::OUStringBuffer aTypes
;
2010 ::rtl::OUString aComma
= ::rtl::OUString::createFromAscii(",");
2011 const ::rtl::OUString
* pIter
= types
.getConstArray();
2012 const ::rtl::OUString
* pEnd
= pIter
+ types
.getLength();
2013 for( ; pIter
!= pEnd
; ++pIter
)
2015 if ( aTypes
.getLength() )
2016 aTypes
.append(aComma
);
2017 aTypes
.append(*pIter
);
2020 ::rtl::OUString sTypeNames
= aTypes
.makeStringAndClear();
2021 if ( sTypeNames
.getLength() )
2022 varCriteria
[nPos
].setString(sTypeNames
);
2024 // Create SafeArray Bounds and initialize the array
2025 const sal_Int32 nCrit
= sizeof varCriteria
/ sizeof varCriteria
[0];
2026 SAFEARRAYBOUND rgsabound
[1];
2027 rgsabound
[0].lLbound
= 0;
2028 rgsabound
[0].cElements
= nCrit
;
2029 SAFEARRAY
*psa
= SafeArrayCreate( VT_VARIANT
, 1, rgsabound
);
2031 // Set the values for each element of the array
2032 for( long i
= 0 ; i
< nCrit
&& SUCCEEDED( hr
);i
++)
2034 hr
= SafeArrayPutElement(psa
, &i
,&varCriteria
[i
]);
2040 // Initialize and fill the SafeArray
2042 vsa
.setArray(psa
,VT_VARIANT
);
2044 ADORecordset
*pRecordset
= NULL
;
2045 OpenSchema(adSchemaTables
,vsa
,vtEmpty
,&pRecordset
);
2049 // -----------------------------------------------------------------------------
2050 ADORecordset
* WpADOConnection::getColumns( const ::com::sun::star::uno::Any
& catalog
,
2051 const ::rtl::OUString
& schemaPattern
,
2052 const ::rtl::OUString
& tableNamePattern
,
2053 const ::rtl::OUString
& columnNamePattern
)
2055 // Create elements used in the array
2057 SAFEARRAYBOUND rgsabound
[1];
2058 SAFEARRAY
*psa
= NULL
;
2059 OLEVariant varCriteria
[4];
2061 // Create SafeArray Bounds and initialize the array
2062 rgsabound
[0].lLbound
= 0;
2063 rgsabound
[0].cElements
= sizeof varCriteria
/ sizeof varCriteria
[0];
2064 psa
= SafeArrayCreate( VT_VARIANT
, 1, rgsabound
);
2067 if(catalog
.hasValue())
2068 varCriteria
[nPos
].setString(::comphelper::getString(catalog
));
2070 hr
= SafeArrayPutElement(psa
,&nPos
,&varCriteria
[nPos
]);nPos
++;// TABLE_CATALOG
2071 if(schemaPattern
.getLength() && schemaPattern
.toChar() != '%')
2072 varCriteria
[nPos
].setString(schemaPattern
);
2073 hr
= SafeArrayPutElement(psa
,&nPos
,&varCriteria
[nPos
]);nPos
++;// TABLE_SCHEMA
2075 if(tableNamePattern
.toChar() != '%')
2076 varCriteria
[nPos
].setString(tableNamePattern
);
2077 hr
= SafeArrayPutElement(psa
,&nPos
,&varCriteria
[nPos
]);nPos
++;// TABLE_NAME
2079 varCriteria
[nPos
].setString(columnNamePattern
);
2080 hr
= SafeArrayPutElement(psa
,&nPos
,&varCriteria
[nPos
]);nPos
++;// COLUMN_NAME
2085 // Initialize and fill the SafeArray
2087 vsa
.setArray(psa
,VT_VARIANT
);
2089 ADORecordset
*pRecordset
= NULL
;
2090 OpenSchema(adSchemaColumns
,vsa
,vtEmpty
,&pRecordset
);
2094 // -----------------------------------------------------------------------------
2095 ADORecordset
* WpADOConnection::getColumnPrivileges( const ::com::sun::star::uno::Any
& catalog
,
2096 const ::rtl::OUString
& schema
,
2097 const ::rtl::OUString
& table
,
2098 const ::rtl::OUString
& columnNamePattern
)
2100 // Create elements used in the array
2102 SAFEARRAYBOUND rgsabound
[1];
2103 SAFEARRAY
*psa
= NULL
;
2104 OLEVariant varCriteria
[4];
2106 // Create SafeArray Bounds and initialize the array
2107 rgsabound
[0].lLbound
= 0;
2108 rgsabound
[0].cElements
= sizeof varCriteria
/ sizeof varCriteria
[0];
2109 psa
= SafeArrayCreate( VT_VARIANT
, 1, rgsabound
);
2112 if(catalog
.hasValue())
2113 varCriteria
[nPos
].setString(::comphelper::getString(catalog
));
2115 hr
= SafeArrayPutElement(psa
,&nPos
,&varCriteria
[nPos
]);nPos
++;// TABLE_CATALOG
2116 if(schema
.getLength() && schema
.toChar() != '%')
2117 varCriteria
[nPos
].setString(schema
);
2118 hr
= SafeArrayPutElement(psa
,&nPos
,&varCriteria
[nPos
]);nPos
++;// TABLE_SCHEMA
2120 varCriteria
[nPos
].setString(table
);
2121 hr
= SafeArrayPutElement(psa
,&nPos
,&varCriteria
[nPos
]);nPos
++;// TABLE_NAME
2123 varCriteria
[nPos
].setString(columnNamePattern
);
2124 hr
= SafeArrayPutElement(psa
,&nPos
,&varCriteria
[nPos
]);nPos
++;// COLUMN_NAME
2129 // Initialize and fill the SafeArray
2131 vsa
.setArray(psa
,VT_VARIANT
);
2133 ADORecordset
*pRecordset
= NULL
;
2134 OpenSchema(adSchemaColumnPrivileges
,vsa
,vtEmpty
,&pRecordset
);
2138 // -----------------------------------------------------------------------------
2139 ADORecordset
* WpADOConnection::getTypeInfo(DataTypeEnum
/*_eType*/)
2141 // Create elements used in the array
2142 OLEVariant varCriteria
[2];
2143 const int nCrit
= sizeof varCriteria
/ sizeof varCriteria
[0];
2144 // Create SafeArray Bounds and initialize the array
2145 SAFEARRAYBOUND rgsabound
[1];
2146 rgsabound
[0].lLbound
= 0;
2147 rgsabound
[0].cElements
= nCrit
;
2148 SAFEARRAY
*psa
= SafeArrayCreate( VT_VARIANT
, 1, rgsabound
);
2151 SafeArrayPutElement(psa
,&nPos
,&varCriteria
[nPos
]);nPos
++;
2152 SafeArrayPutElement(psa
,&nPos
,&varCriteria
[nPos
]);nPos
++;
2154 // Initialize and fill the SafeArray
2156 vsa
.setArray(psa
,VT_VARIANT
);
2161 ADORecordset
*pRec
=NULL
;
2162 OpenSchema(adSchemaProviderTypes
,vsa
,aEmpty
,&pRec
);
2166 // -----------------------------------------------------------------------------
2167 void WpADOColumn::put_ParentCatalog(/* [in] */ _ADOCatalog __RPC_FAR
*ppvObject
)
2169 OSL_ENSURE(pInterface
,"Interface is null!");
2170 sal_Bool bRet
= SUCCEEDED(pInterface
->put_ParentCatalog(ppvObject
));
2171 OSL_ENSURE(bRet
,"Could not set ParentCatalog!");
2174 // -----------------------------------------------------------------------------
2175 void WpADOTable::putref_ParentCatalog(/* [in] */ _ADOCatalog __RPC_FAR
*ppvObject
)
2177 OSL_ENSURE(pInterface
,"Interface is null!");
2178 sal_Bool bRet
= SUCCEEDED(pInterface
->putref_ParentCatalog(ppvObject
));
2179 OSL_ENSURE(bRet
,"Could not set ParentCatalog!");
2182 // -----------------------------------------------------------------------------
2183 void WpBase::setIDispatch(IDispatch
* _pIUnknown
)
2185 pIUnknown
= _pIUnknown
;
2187 // -----------------------------------------------------------------------------
2188 void OTools::putValue(const WpADOProperties
& _rProps
,const OLEVariant
&_aPosition
,const OLEVariant
&_aValVar
)
2190 OSL_ENSURE(_rProps
.IsValid(),"Properties are not valid!");
2191 WpADOProperty
aProp(_rProps
.GetItem(_aPosition
));
2192 if ( aProp
.IsValid() )
2194 sal_Bool bRet
= aProp
.PutValue(_aValVar
);
2195 OSL_ENSURE(bRet
,"Could not put value!");
2199 // -----------------------------------------------------------------------------
2200 OLEVariant
OTools::getValue(const WpADOProperties
& _rProps
,const OLEVariant
&_aPosition
)
2202 WpADOProperty
aProp(_rProps
.GetItem(_aPosition
));
2203 return aProp
.GetValue();