summaryrefslogtreecommitdiff
path: root/connectivity/source/inc/ado/Awrapado.hxx
blob: 84e60c600a33d5333b5a78a7e5043c35426b2b73 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
/*************************************************************************
 *
 *  $RCSfile: Awrapado.hxx,v $
 *
 *  $Revision: 1.1.1.1 $
 *
 *  last change: $Author: hr $ $Date: 2000-09-18 16:14:25 $
 *
 *  The Contents of this file are made available subject to the terms of
 *  either of the following licenses
 *
 *         - GNU Lesser General Public License Version 2.1
 *         - Sun Industry Standards Source License Version 1.1
 *
 *  Sun Microsystems Inc., October, 2000
 *
 *  GNU Lesser General Public License Version 2.1
 *  =============================================
 *  Copyright 2000 by Sun Microsystems, Inc.
 *  901 San Antonio Road, Palo Alto, CA 94303, USA
 *
 *  This library is free software; you can redistribute it and/or
 *  modify it under the terms of the GNU Lesser General Public
 *  License version 2.1, as published by the Free Software Foundation.
 *
 *  This library is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 *  Lesser General Public License for more details.
 *
 *  You should have received a copy of the GNU Lesser General Public
 *  License along with this library; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston,
 *  MA  02111-1307  USA
 *
 *
 *  Sun Industry Standards Source License Version 1.1
 *  =================================================
 *  The contents of this file are subject to the Sun Industry Standards
 *  Source License Version 1.1 (the "License"); You may not use this file
 *  except in compliance with the License. You may obtain a copy of the
 *  License at http://www.openoffice.org/license.html.
 *
 *  Software provided under this License is provided on an "AS IS" basis,
 *  WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
 *  WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
 *  MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
 *  See the License for the specific provisions governing your rights and
 *  obligations concerning the Software.
 *
 *  The Initial Developer of the Original Code is: Sun Microsystems, Inc.
 *
 *  Copyright: 2000 by Sun Microsystems, Inc.
 *
 *  All Rights Reserved.
 *
 *  Contributor(s): _______________________________________
 *
 *
 ************************************************************************/
#ifndef _CONNECTIVITY_ADO_AWRAPADO_HXX_
#define _CONNECTIVITY_ADO_AWRAPADO_HXX_

#include <tools/prewin.h>
// Includes fuer ADO
#include <oledb.h>
//#include <objbase.h>
//#include <initguid.h>
//#include <mapinls.h>
#include <ocidl.h>

#ifndef _ADOINT_H_
#include <adoint.h>
#endif

#include <tools/postwin.h>

#ifndef _CONNECTIVITY_ADO_ADOIMP_HXX_
#include "ado/adoimp.hxx"
#endif
#ifndef _CONNECTIVITY_ADO_AOLEWRAP_HXX_
#include "ado/Aolewrap.hxx"
#endif
#ifndef _CONNECTIVITY_ADO_AOLEVARIANT_HXX_
#include "ado/Aolevariant.hxx"
#endif

namespace connectivity
{
    namespace ado
    {
        class WpADOConnection;
        class WpADOCommand;
        class WpADORecordset;
        class WpADOField;
        class WpADOParameter;
        class WpADOError;
        class WpADOProperty;

        typedef WpOLEAppendCollection<ADOFields, ADOField, WpADOField> WpADOFields;

        //------------------------------------------------------------------------
        class WpADOConnection : public WpOLEBase<ADOConnection>
        {
            friend class WpADOCommand;
        public:

            WpADOConnection(ADOConnection* pInt)    :   WpOLEBase<ADOConnection>(pInt){}

            WpADOConnection(const WpADOConnection& rhs){operator=(rhs);}

            inline WpADOConnection& operator=(const WpADOConnection& rhs)
                {WpOLEBase<ADOConnection>::operator=(rhs); return *this;}

            //////////////////////////////////////////////////////////////////////

            inline ADOProperties* get_Properties() const
            {
                ADOProperties* pProps=NULL;
                pInterface->get_Properties(&pProps);
                return pProps;
            }

            inline rtl::OUString GetConnectionString() const
            {
                BSTR aBSTR; pInterface->get_ConnectionString(&aBSTR);
                rtl::OUString sRetStr((sal_Unicode*)aBSTR);
                SysFreeString(aBSTR);
                return sRetStr;
            }

            inline sal_Bool PutConnectionString(const ::rtl::OUString &aCon) const
            {
                return SUCCEEDED(pInterface->put_ConnectionString(SysAllocString(aCon.getStr())));
            }

            inline sal_Int32 GetCommandTimeout() const
            {
                sal_Int32 nRet;
                pInterface->get_CommandTimeout(&nRet);
                return nRet;
            }

            inline void PutCommandTimeout(sal_Int32 nRet)
            {
                pInterface->put_CommandTimeout(nRet);
            }

            inline sal_Int32 GetConnectionTimeout() const
            {
                sal_Int32 nRet;
                pInterface->get_ConnectionTimeout(&nRet);
                return nRet;
            }

            inline void PutConnectionTimeout(sal_Int32 nRet)
            {
                pInterface->put_ConnectionTimeout(nRet);
            }

            inline sal_Bool Close( )
            {
                return (SUCCEEDED(pInterface->Close()));
            }

            inline sal_Bool Execute(const ::rtl::OUString& _CommandText,OLEVariant& RecordsAffected,long Options, WpADORecordset** ppiRset)
            {
                return SUCCEEDED(pInterface->Execute(SysAllocString(_CommandText.getStr()),&RecordsAffected,Options,(_ADORecordset**)ppiRset));
            }

            inline sal_Bool BeginTrans()
            {
                sal_Int32 nIso;
                return SUCCEEDED(pInterface->BeginTrans(&nIso));
            }

            inline sal_Bool CommitTrans( )
            {
                return SUCCEEDED(pInterface->CommitTrans());
            }

            inline sal_Bool RollbackTrans( )
            {
                return SUCCEEDED(pInterface->RollbackTrans());
            }

            inline sal_Bool Open(const ::rtl::OUString& ConnectionString, const ::rtl::OUString& UserID,const ::rtl::OUString& Password,long Options)
            {
                return SUCCEEDED(pInterface->Open(SysAllocString(ConnectionString.getStr()),SysAllocString(UserID.getStr()),SysAllocString(Password.getStr()),Options));
            }

            inline sal_Bool GetErrors(ADOErrors** pErrors)
            {
                return SUCCEEDED(pInterface->get_Errors(pErrors));
            }

            inline ::rtl::OUString GetDefaultDatabase() const
            {
                BSTR aBSTR; pInterface->get_DefaultDatabase(&aBSTR);
                ::rtl::OUString sRetStr(aBSTR);
                SysFreeString(aBSTR); return sRetStr;
            }

            inline sal_Bool PutDefaultDatabase(const ::rtl::OUString& bstr)
            {
                return SUCCEEDED(pInterface->put_DefaultDatabase(SysAllocString(bstr.getStr())));
            }

            inline IsolationLevelEnum get_IsolationLevel() const
            {
                IsolationLevelEnum eNum;
                pInterface->get_IsolationLevel(&eNum);
                return eNum;
            }

            inline sal_Bool put_IsolationLevel(const IsolationLevelEnum& eNum)
            {
                return SUCCEEDED(pInterface->put_IsolationLevel(eNum));
            }

            inline sal_Int32 get_Attributes() const
            {
                sal_Int32 nRet;
                pInterface->get_Attributes(&nRet);
                return nRet;
            }

            inline sal_Bool put_Attributes(sal_Int32 nRet)
            {
                return SUCCEEDED(pInterface->put_Attributes(nRet));
            }

            inline CursorLocationEnum get_CursorLocation() const
            {
                CursorLocationEnum eNum;
                pInterface->get_CursorLocation(&eNum);
                return eNum;
            }

            inline sal_Bool put_CursorLocation(const CursorLocationEnum &eNum)
            {
                return SUCCEEDED(pInterface->put_CursorLocation(eNum));
            }

            inline ConnectModeEnum get_Mode() const
            {
                ConnectModeEnum eNum;
                pInterface->get_Mode(&eNum);
                return eNum;
            }

            inline sal_Bool put_Mode(const ConnectModeEnum &eNum)
            {

                return SUCCEEDED(pInterface->put_Mode(eNum));
            }

            inline ::rtl::OUString get_Provider() const
            {
                BSTR aBSTR; pInterface->get_Provider(&aBSTR);
                ::rtl::OUString sRetStr(aBSTR);
                SysFreeString(aBSTR); return sRetStr;
            }

            inline sal_Bool put_Provider(const ::rtl::OUString& bstr)
            {
                return SUCCEEDED(pInterface->put_Provider(SysAllocString(bstr.getStr())));
            }

            inline sal_Int32 get_State() const
            {
                sal_Int32 nRet;
                pInterface->get_State(&nRet);
                return nRet;
            }

            inline sal_Bool OpenSchema(SchemaEnum eNum,OLEVariant& Restrictions,OLEVariant& SchemaID,ADORecordset**pprset)
            {
                return SUCCEEDED(pInterface->OpenSchema(eNum,Restrictions,SchemaID,pprset));
            }

            inline ::rtl::OUString get_Version() const
            {
                BSTR aBSTR;
                pInterface->get_Version(&aBSTR);
                ::rtl::OUString sRetStr(aBSTR);
                SysFreeString(aBSTR); return sRetStr;
            }
        };

        //------------------------------------------------------------------------
        class WpADOCommand : public WpOLEBase<ADOCommand>
        {
        public:
            WpADOCommand(){}
            // Konstruktoren, operator=
            // diese rufen nur die Oberklasse
            WpADOCommand(ADOCommand* pInt)  :   WpOLEBase<ADOCommand>(pInt){}

            WpADOCommand(const WpADOCommand& rhs){operator=(rhs);}

            inline WpADOCommand& operator=(const WpADOCommand& rhs)
            {
                WpOLEBase<ADOCommand>::operator=(rhs); return *this;}

            //////////////////////////////////////////////////////////////////////

            sal_Bool putref_ActiveConnection( WpADOConnection *pCon)
            {
                return SUCCEEDED(pInterface->putref_ActiveConnection(pCon->pInterface));
            }

            void put_ActiveConnection(/* [in] */ const OLEVariant& vConn)
            {
                pInterface->put_ActiveConnection(vConn);
            }

            inline void Create()
            {
                IClassFactory2* pIUnknown   = NULL;
                IUnknown        *pOuter     = NULL;
                HRESULT         hr;
                hr = CoGetClassObject( ADOS::CLSID_ADOCOMMAND_21,
                                      CLSCTX_INPROC_SERVER,
                                      NULL,
                                      IID_IClassFactory2,
                                      (void**)&pIUnknown );

                if( !FAILED( hr ) )
                {
                    pIUnknown->AddRef();
                    ADOCommand* pCommand;

                    hr = pIUnknown->CreateInstanceLic(  pOuter,
                                                        NULL,
                                                        ADOS::IID_ADOCOMMAND_21,
                                                        ADOS::GetKeyStr(),
                                                        (void**) &pCommand);

                    if( !FAILED( hr ) )
                    {
                        pInterface = pCommand;
                        pInterface->AddRef();
                    }
                    pIUnknown->Release();
                }
            }

            inline sal_Int32 get_State() const
            {
                sal_Int32 nRet;
                pInterface->get_State(&nRet);
                return nRet;
            }

            inline ::rtl::OUString get_CommandText() const
            {
                BSTR aBSTR; pInterface->get_CommandText(&aBSTR);
                ::rtl::OUString sRetStr(aBSTR);
                SysFreeString(aBSTR); return sRetStr;
            }

            inline sal_Bool put_CommandText(const ::rtl::OUString &aCon)
            {
                BSTR bstr = SysAllocString(aCon.getStr());
                sal_Bool bErg = SUCCEEDED(pInterface->put_CommandText(bstr));
                SysFreeString(bstr);
                return bErg;
            }

            inline sal_Int32 get_CommandTimeout() const
            {
                sal_Int32 nRet;
                pInterface->get_CommandTimeout(&nRet);
                return nRet;
            }

            inline void put_CommandTimeout(sal_Int32 nRet)
            {
                pInterface->put_CommandTimeout(nRet);
            }

            inline sal_Bool get_Prepared() const
            {
                VARIANT_BOOL bPrepared;
                pInterface->get_Prepared(&bPrepared);
                return bPrepared == VARIANT_TRUE;
            }

            inline sal_Bool put_Prepared(VARIANT_BOOL bPrepared) const
            {
                return SUCCEEDED(pInterface->put_Prepared(bPrepared));
            }

            inline sal_Bool Execute(OLEVariant& RecordsAffected,OLEVariant& Parameters,long Options, ADORecordset** ppiRset)
            {
                return SUCCEEDED(pInterface->Execute(&RecordsAffected,&Parameters,Options,ppiRset));
            }

            inline ADOParameter* CreateParameter(const ::rtl::OUString &bstr,DataTypeEnum Type,ParameterDirectionEnum Direction,long nSize,const OLEVariant &Value)
            {
                ADOParameter* pPara = NULL;
                if(SUCCEEDED(pInterface->CreateParameter(bstr.getLength() ? SysAllocString(bstr.getStr()) : NULL,Type,Direction,nSize,Value,&pPara)))
                    return pPara;
                return NULL;
            }

            inline ADOParameters* get_Parameters() const
            {
                ADOParameters* pPara;
                pInterface->get_Parameters(&pPara);
                return pPara;
            }

            inline sal_Bool put_CommandType( /* [in] */ CommandTypeEnum lCmdType)
            {
                return SUCCEEDED(pInterface->put_CommandType(lCmdType));
            }

            inline CommandTypeEnum get_CommandType( ) const
            {
                CommandTypeEnum eNum;
                pInterface->get_CommandType(&eNum);
                return eNum;
            }

            // gibt den Namen des Feldes zur"ueck
            inline ::rtl::OUString GetName() const
            {
                BSTR aBSTR; pInterface->get_Name(&aBSTR);
                ::rtl::OUString sRetStr(aBSTR);
                SysFreeString(aBSTR); return sRetStr;
            }

            inline sal_Bool put_Name(const ::rtl::OUString& _Name)
            {
                return SUCCEEDED(pInterface->put_Name(SysAllocString(_Name.getStr())));
            }
            inline sal_Bool Cancel()
            {
                return SUCCEEDED(pInterface->Cancel());
            }
        };
        //------------------------------------------------------------------------
        class WpADOError:public WpOLEBase<ADOError>
        {
        public:

            // Konstruktoren, operator=
            // diese rufen nur die Oberklasse

            WpADOError(ADOError* pInt):WpOLEBase<ADOError>(pInt){}

            WpADOError(const WpADOError& rhs){operator=(rhs);}

            inline WpADOError& operator=(const WpADOError& rhs)
                {WpOLEBase<ADOError>::operator=(rhs); return *this;}

            //////////////////////////////////////////////////////////////////////

            inline ::rtl::OUString GetDescription() const
            {
                BSTR aBSTR; pInterface->get_Description(&aBSTR);
                ::rtl::OUString sRetStr(aBSTR);
                SysFreeString(aBSTR); return sRetStr;
            }

            inline ::rtl::OUString GetSource() const {BSTR aBSTR; pInterface->get_Source(&aBSTR);
                                ::rtl::OUString sRetStr(aBSTR);
                                SysFreeString(aBSTR); return sRetStr;}

            inline sal_Int32 GetNumber() const {sal_Int32 nErrNr; pInterface->get_Number(&nErrNr);
                                    return nErrNr;}

            inline ::rtl::OUString GetSQLState() const
            {
                BSTR aBSTR; pInterface->get_SQLState(&aBSTR);
                ::rtl::OUString sRetStr(aBSTR);
                SysFreeString(aBSTR); return sRetStr;
            }

            inline sal_Int32 GetNativeError() const
            {
                sal_Int32 nErrNr; pInterface->get_NativeError(&nErrNr);
                return nErrNr;
            }
        };



        //------------------------------------------------------------------------
        class WpADOField : public WpOLEBase<ADOField>
        {
            //  friend class WpADOFields;
        public:

            // Konstruktoren, operator=
            // diese rufen nur die Oberklasse
            WpADOField(ADOField* pInt=NULL):WpOLEBase<ADOField>(pInt){}
            WpADOField(const WpADOField& rhs){operator=(rhs);}

            inline WpADOField& operator=(const WpADOField& rhs)
                {WpOLEBase<ADOField>::operator=(rhs); return *this;}
            //////////////////////////////////////////////////////////////////////

            inline ADOProperties* get_Properties()
            {
                ADOProperties* pProps = NULL;
                pInterface->get_Properties(&pProps);
                return pProps;
            }

            inline sal_Int32 GetActualSize() const
            {
                sal_Int32 nActualSize; pInterface->get_ActualSize(&nActualSize);
                return nActualSize;
            }

            inline sal_Int32 GetAttributes() const
            {
                sal_Int32 eADOSFieldAttributes; pInterface->get_Attributes(&eADOSFieldAttributes);
                return eADOSFieldAttributes;
            }

            inline sal_Int32 GetStatus() const
            {
                sal_Int32 eADOSFieldAttributes=0;
                //  pInterface->get_Status(&eADOSFieldAttributes);
                return eADOSFieldAttributes;
            }

            inline sal_Int32 GetDefinedSize() const
            {
                sal_Int32 nDefinedSize;
                pInterface->get_DefinedSize(&nDefinedSize);
                return nDefinedSize;
            }

            // gibt den Namen des Feldes zur"ueck
            inline ::rtl::OUString GetName() const
            {
                BSTR aBSTR; pInterface->get_Name(&aBSTR);
                ::rtl::OUString sRetStr(aBSTR);
                SysFreeString(aBSTR); return sRetStr;
            }

            inline DataTypeEnum GetADOType() const
            {
                DataTypeEnum eType; pInterface->get_Type(&eType);
                return eType;
            }

            inline void get_Value(OLEVariant& aValVar) const
            {
                aValVar.setEmpty();
                pInterface->get_Value(&aValVar);
            }

            inline OLEVariant get_Value() const
            {
                OLEVariant aValVar;
                pInterface->get_Value(&aValVar);
                return aValVar;
            }

            inline sal_Bool PutValue(const OLEVariant& aVariant)
            {
                return (SUCCEEDED(pInterface->put_Value(aVariant)));
            }

            inline sal_Int32 GetPrecision() const
            {
                sal_uInt8 eType; pInterface->get_Precision(&eType);
                return eType;
            }

            inline sal_Int32 GetNumericScale() const
            {
                sal_uInt8 eType; pInterface->get_NumericScale(&eType);
                return eType;
            }

            inline sal_Bool AppendChunk(const OLEVariant& _Variant)
            {
                return (SUCCEEDED(pInterface->AppendChunk(_Variant)));
            }

            inline OLEVariant GetChunk(long Length) const
            {
                OLEVariant aValVar;
                pInterface->GetChunk(Length,&aValVar);
                return aValVar;
            }

            inline void GetChunk(long Length,OLEVariant &aValVar) const
            {
                pInterface->GetChunk(Length,&aValVar);
            }

            inline OLEVariant GetOriginalValue() const
            {
                OLEVariant aValVar;
                pInterface->get_OriginalValue(&aValVar);
                return aValVar;
            }

            inline void GetOriginalValue(OLEVariant &aValVar) const
            {
                pInterface->get_OriginalValue(&aValVar);
            }

            inline OLEVariant GetUnderlyingValue() const
            {
                OLEVariant aValVar;
                pInterface->get_UnderlyingValue(&aValVar);
                return aValVar;
            }

            inline void GetUnderlyingValue(OLEVariant &aValVar) const
            {
                pInterface->get_UnderlyingValue(&aValVar);
            }

            inline sal_Bool PutPrecision(sal_Int8 _prec)
            {
                return (SUCCEEDED(pInterface->put_Precision(_prec)));
            }

            inline sal_Bool PutNumericScale(sal_Int8 _prec)
            {
                return (SUCCEEDED(pInterface->put_NumericScale(_prec)));
            }

            inline void PutADOType(DataTypeEnum eType)
            {
                pInterface->put_Type(eType);
            }

            inline sal_Bool PutDefinedSize(sal_Int32 _nDefSize)
            {
                return (SUCCEEDED(pInterface->put_DefinedSize(_nDefSize)));
            }

            inline sal_Bool PutAttributes(sal_Int32 _nDefSize)
            {
                return (SUCCEEDED(pInterface->put_Attributes(_nDefSize)));
            }
        };



        //------------------------------------------------------------------------
        class WpADOProperty: public WpOLEBase<ADOProperty>
        {
            friend class WpADOProperties;

        public:
            // Konstruktoren, operator=
            // diese rufen nur die Oberklasse
            WpADOProperty(ADOProperty* pInt):WpOLEBase<ADOProperty>(pInt){}
            WpADOProperty(const WpADOProperty& rhs){operator=(rhs);}
            inline WpADOProperty& operator=(const WpADOProperty& rhs)
                {WpOLEBase<ADOProperty>::operator=(rhs); return *this;}
            //////////////////////////////////////////////////////////////////////

            inline OLEVariant GetValue() const
            {
                OLEVariant aValVar;
                pInterface->get_Value(&aValVar);
                return aValVar;
            }

            inline void GetValue(OLEVariant &aValVar) const
            {
                pInterface->get_Value(&aValVar);
            }

            inline sal_Bool PutValue(const OLEVariant &aValVar)
            {
                return (SUCCEEDED(pInterface->put_Value(aValVar)));
            }

            inline ::rtl::OUString GetName() const
            {
                BSTR aBSTR; pInterface->get_Name(&aBSTR);
                ::rtl::OUString sRetStr(aBSTR);
                SysFreeString(aBSTR); return sRetStr;
            }

            inline DataTypeEnum GetADOType() const
            {
                DataTypeEnum eType; pInterface->get_Type(&eType);
                return eType;
            }

            inline sal_Int32 GetAttributes() const
            {
                sal_Int32 eADOSFieldAttributes; pInterface->get_Attributes(&eADOSFieldAttributes);
                return eADOSFieldAttributes;
            }

            inline sal_Bool PutAttributes(sal_Int32 _nDefSize)
            {
                return (SUCCEEDED(pInterface->put_Attributes(_nDefSize)));
            }
        };


        class WpADORecordset:public WpOLEBase<ADORecordset>
        {

        public:
            // Konstruktoren, operator=
            // diese rufen nur die Oberklasse
            WpADORecordset(ADORecordset* pInt=NULL):WpOLEBase<ADORecordset>(pInt){}
            WpADORecordset(const WpADORecordset& rhs){operator=(rhs);}
            inline WpADORecordset& operator=(const WpADORecordset& rhs)
            {
                WpOLEBase<ADORecordset>::operator=(rhs);
                return *this;
            }
            ~WpADORecordset()
            {
                //  if(pInterface && get_State() == adStateOpen)
                    //  Close();
            }
            //////////////////////////////////////////////////////////////////////
            inline void Create()
            {
                IClassFactory2* pIUnknown   = NULL;
                IUnknown        *pOuter     = NULL;
                HRESULT         hr;
                hr = CoGetClassObject( ADOS::CLSID_ADORECORDSET_21,
                                      CLSCTX_INPROC_SERVER,
                                      NULL,
                                      IID_IClassFactory2,
                                      (void**)&pIUnknown );

                if( !FAILED( hr ) )
                {
                    pIUnknown->AddRef();

                    ADORecordset *pRec = NULL;
                    hr = pIUnknown->CreateInstanceLic(  pOuter,
                                                        NULL,
                                                        ADOS::IID_ADORECORDSET_21,
                                                        ADOS::GetKeyStr(),
                                                        (void**) &pRec);

                    if( !FAILED( hr ) )
                    {
                        pInterface = pRec;
                        pInterface->AddRef();
                    }
                    pIUnknown->Release();
                }
            }

            inline sal_Bool Open(
                    /* [optional][in] */ VARIANT Source,
                    /* [optional][in] */ VARIANT ActiveConnection,
                    /* [defaultvalue][in] */ CursorTypeEnum CursorType,
                    /* [defaultvalue][in] */ LockTypeEnum LockType,
                    /* [defaultvalue][in] */ sal_Int32 Options)
            {
                return (SUCCEEDED(pInterface->Open(Source,ActiveConnection,CursorType,LockType,Options)));
            }


            inline LockTypeEnum GetLockType()
            {
                LockTypeEnum eType;
                pInterface->get_LockType(&eType);
                return eType;
            }

            inline void Close()
            {
                pInterface->Close();
            }

            inline sal_Bool Cancel() const
            {
                return (SUCCEEDED(pInterface->Cancel()));
            }

            inline sal_Int32 get_State( )
            {
                sal_Int32 nState = 0;
                pInterface->get_State(&nState);
                return nState;
            }

            inline sal_Bool Supports( /* [in] */ CursorOptionEnum CursorOptions)
            {
                VARIANT_BOOL bSupports;
                pInterface->Supports(CursorOptions,&bSupports);
                return (sal_Bool) bSupports;
            }

            PositionEnum get_AbsolutePosition()
            {
                PositionEnum aTemp;
                pInterface->get_AbsolutePosition(&aTemp);
                return aTemp;
            }

            inline void GetDataSource(IUnknown** pIUnknown) const
            {
                pInterface->get_DataSource(pIUnknown);
            }

            inline void PutRefDataSource(IUnknown* pIUnknown)
            {
                pInterface->putref_DataSource(pIUnknown);
            }

            inline void GetBookmark(VARIANT& var)
            {
                pInterface->get_Bookmark(&var);
            }

            inline OLEVariant GetBookmark()
            {
                OLEVariant var;
                pInterface->get_Bookmark(&var);
                return var;
            }

            CompareEnum CompareBookmarks(const OLEVariant& left,const OLEVariant& right)
            {
                CompareEnum eNum;
                pInterface->CompareBookmarks(left,right,&eNum);
                return eNum;
            }

            inline sal_Bool SetBookmark(const OLEVariant &pSafeAr)
            {
                return SUCCEEDED(pInterface->put_Bookmark(pSafeAr));
            }


            inline ADOFields* GetFields() const
            {
                ADOFields* pFields;
                pInterface->get_Fields(&pFields);
                return pFields;
            }


            inline sal_Bool Move(sal_Int32 nRows, VARIANT aBmk) {return SUCCEEDED(pInterface->Move(nRows, aBmk));}
            inline sal_Bool MoveNext() {return SUCCEEDED(pInterface->MoveNext());}
            inline sal_Bool MovePrevious() {return SUCCEEDED(pInterface->MovePrevious());}
            inline sal_Bool MoveFirst() {return SUCCEEDED(pInterface->MoveFirst());}
            inline sal_Bool MoveLast()  {return SUCCEEDED(pInterface->MoveLast());}

            inline sal_Bool IsAtBOF() const
            {
                VARIANT_BOOL bIsAtBOF;
                pInterface->get_BOF(&bIsAtBOF);
                return (sal_Bool) bIsAtBOF;
            }

            inline sal_Bool IsAtEOF() const
            {
                VARIANT_BOOL bIsAtEOF;
                pInterface->get_EOF(&bIsAtEOF);
                return (sal_Bool) bIsAtEOF;
            }

            inline sal_Bool Delete(AffectEnum eNum)
            {
                return SUCCEEDED(pInterface->Delete(eNum));
            }

            inline sal_Bool AddNew(const OLEVariant &FieldList,const OLEVariant &Values)
            {
                return SUCCEEDED(pInterface->AddNew(FieldList,Values));
            }

            inline sal_Bool Update(const OLEVariant &FieldList,const OLEVariant &Values)
            {
                return SUCCEEDED(pInterface->Update(FieldList,Values));
            }

            inline sal_Bool CancelUpdate()
            {
                return SUCCEEDED(pInterface->CancelUpdate());
            }

            inline ADOProperties* get_Properties() const
            {
                ADOProperties* pProps=NULL;
                pInterface->get_Properties(&pProps);
                return pProps;
            }

            inline sal_Bool NextRecordset(OLEVariant& RecordsAffected,ADORecordset** ppiRset)
            {
                return SUCCEEDED(pInterface->NextRecordset(&RecordsAffected,ppiRset));
            }

            inline sal_Bool get_RecordCount(sal_Int32 &_nRet) const
            {
                return SUCCEEDED(pInterface->get_RecordCount(&_nRet));
            }

            inline sal_Bool get_MaxRecords(sal_Int32 &_nRet) const
            {
                return SUCCEEDED(pInterface->get_MaxRecords(&_nRet));
            }

            inline sal_Bool put_MaxRecords(sal_Int32 _nRet)
            {
                return SUCCEEDED(pInterface->put_MaxRecords(_nRet));
            }

            inline sal_Bool get_CursorType(CursorTypeEnum &_nRet) const
            {
                return SUCCEEDED(pInterface->get_CursorType(&_nRet));
            }

            inline sal_Bool put_CursorType(CursorTypeEnum _nRet)
            {
                return SUCCEEDED(pInterface->put_CursorType(_nRet));
            }

            inline sal_Bool get_LockType(LockTypeEnum &_nRet) const
            {
                return SUCCEEDED(pInterface->get_LockType(&_nRet));
            }

            inline sal_Bool put_LockType(LockTypeEnum _nRet)
            {
                return SUCCEEDED(pInterface->put_LockType(_nRet));
            }

            inline sal_Bool get_CacheSize(sal_Int32 &_nRet) const
            {
                return SUCCEEDED(pInterface->get_CacheSize(&_nRet));
            }

            inline sal_Bool put_CacheSize(sal_Int32 _nRet)
            {
                return SUCCEEDED(pInterface->put_CacheSize(_nRet));
            }

            inline sal_Bool UpdateBatch(AffectEnum AffectRecords)
            {
                return SUCCEEDED(pInterface->UpdateBatch(AffectRecords));
            }
        };

        //------------------------------------------------------------------------
        class WpADOParameter:public WpOLEBase<ADOParameter>
        {
        public:
            // Konstruktoren, operator=
            // diese rufen nur die Oberklasse
            WpADOParameter(ADOParameter* pInt):WpOLEBase<ADOParameter>(pInt){}
            WpADOParameter(const WpADOParameter& rhs):WpOLEBase<ADOParameter>(rhs){}
            inline WpADOParameter& operator=(const WpADOParameter& rhs)
                {WpOLEBase<ADOParameter>::operator=(rhs); return *this;}
            //////////////////////////////////////////////////////////////////////

            inline ::rtl::OUString GetName() const {BSTR aBSTR; pInterface->get_Name(&aBSTR);
                                ::rtl::OUString sRetStr(aBSTR);
                                SysFreeString(aBSTR); return sRetStr;}

            inline DataTypeEnum GetADOType() const
            {
                DataTypeEnum eType; pInterface->get_Type(&eType);
                return eType;
            }

            inline sal_Int32 GetAttributes() const
            {
                sal_Int32 eADOSFieldAttributes; pInterface->get_Attributes(&eADOSFieldAttributes);
                return eADOSFieldAttributes;
            }

            inline sal_Int32 GetPrecision() const
            {
                sal_uInt8 eType; pInterface->get_Precision(&eType);
                return eType;
            }

            inline sal_Int32 GetNumericScale() const
            {
                sal_uInt8 eType; pInterface->get_NumericScale(&eType);
                return eType;
            }

            inline ParameterDirectionEnum get_Direction() const
            {
                ParameterDirectionEnum alParmDirection;
                pInterface->get_Direction(&alParmDirection);
                return alParmDirection;
            }

            inline void GetValue(OLEVariant& aValVar) const
            {
                pInterface->get_Value(&aValVar);
            }

            inline OLEVariant GetValue() const
            {
                OLEVariant aValVar;
                pInterface->get_Value(&aValVar);
                return aValVar;
            }

            inline sal_Bool PutValue(const OLEVariant& aVariant)
            {
                return (SUCCEEDED(pInterface->put_Value(aVariant)));
            }
        };
    }
}
#endif //_CONNECTIVITY_ADO_AWRAPADO_HXX_