1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this
7  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
11  *   Licensed to the Apache Software Foundation (ASF) under one or more
12  *   contributor license agreements. See the NOTICE file distributed
13  *   with this work for additional information regarding copyright
14  *   ownership. The ASF licenses this file to you under the Apache
15  *   License, Version 2.0 (the "License"); you may not use this file
16  *   except in compliance with the License. You may obtain a copy of
17  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
18  */
19 #pragma once
20 
21 #include <com/sun/star/sdbc/SQLException.hpp>
22 
23 #include <adoctint.h>
24 
25 struct ADOConnection;
26 
27 namespace connectivity::ado
28 {
29 
30         class WpADOField;
31         class OLEString;
32         class ADOS
33         {
34         public:
35             // Also here: Free BSTR with SysFreeString()!
36             static OLEString& GetKeyStr();
37 
38             static const CLSID  CLSID_ADOCATALOG_25;
39             static const IID    IID_ADOCATALOG_25;
40 
41             static const CLSID  CLSID_ADOCONNECTION_21;
42             static const IID    IID_ADOCONNECTION_21;
43 
44             static const CLSID  CLSID_ADOCOMMAND_21;
45             static const IID    IID_ADOCOMMAND_21;
46 
47             static const CLSID  CLSID_ADORECORDSET_21;
48             static const IID    IID_ADORECORDSET_21;
49 
50             static const CLSID  CLSID_ADOINDEX_25;
51             static const IID    IID_ADOINDEX_25;
52 
53             static const CLSID  CLSID_ADOCOLUMN_25;
54             static const IID    IID_ADOCOLUMN_25;
55 
56             static const CLSID  CLSID_ADOKEY_25;
57             static const IID    IID_ADOKEY_25;
58 
59             static const CLSID  CLSID_ADOTABLE_25;
60             static const IID    IID_ADOTABLE_25;
61 
62             static const CLSID  CLSID_ADOGROUP_25;
63             static const IID    IID_ADOGROUP_25;
64 
65             static const CLSID  CLSID_ADOUSER_25;
66             static const IID    IID_ADOUSER_25;
67 
68             static const CLSID  CLSID_ADOVIEW_25;
69             static const IID    IID_ADOVIEW_25;
70 
71             /// @throws css::sdbc::SQLException
72             /// @throws css::uno::RuntimeException
73             static void ThrowException(ADOConnection* _pAdoCon,const css::uno::Reference< css::uno::XInterface >& _xInterface);
74             static sal_Int32 MapADOType2Jdbc(DataTypeEnum eType);
75             static DataTypeEnum MapJdbc2ADOType(sal_Int32 _nType,sal_Int32 _nJetEngine);
76             static bool isJetEngine(sal_Int32 _nEngineType);
77 
78             static ObjectTypeEnum   mapObjectType2Ado(sal_Int32 objType);
79             static sal_Int32        mapAdoType2Object(ObjectTypeEnum objType);
80             static sal_Int32        mapAdoRights2Sdbc(RightsEnum eRights);
81             static sal_Int32        mapRights2Ado(sal_Int32 nRights);
82 
83             /// @throws css::sdbc::SQLException
84             /// @throws css::uno::RuntimeException
85             static WpADOField       getField(ADORecordset* _pRecordSet,sal_Int32 _nColumnIndex);
86         };
87 
88 
89 }
90 
91 
92 #define ADO_PROP(ItemName)                                          \
93         WpADOProperty aProp(aProps.GetItem(ItemName));              \
94         OLEVariant aVar;                                            \
95         if(aProp.IsValid())                                         \
96             aVar = aProp.GetValue();                                \
97         else                                                        \
98             ADOS::ThrowException(*m_pADOConnection,*this);
99 
100 
101 
102 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
103