bump product version to 5.0.4.1
[LibreOffice.git] / connectivity / source / inc / ado / Awrapado.hxx
blob9907e828013c1a0f15eadc5b2c6949d49b68119c
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
19 #ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_AWRAPADO_HXX
20 #define INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_AWRAPADO_HXX
22 #include <com/sun/star/beans/PropertyAttribute.hpp>
24 // Includes for ADO
25 #include "ado_pre_sys_include.h"
26 #include <oledb.h>
27 #include <ocidl.h>
28 #include <adoint.h>
29 #include "ado_post_sys_include.h"
30 #include "ado/adoimp.hxx"
31 #include "ado/Aolewrap.hxx"
32 #include "ado/Aolevariant.hxx"
34 namespace connectivity
36 namespace ado
38 class WpADOConnection;
39 class WpADOCommand;
40 class WpADORecordset;
41 class WpADOField;
42 class WpADOParameter;
43 class WpADOError;
44 class WpADOProperty;
46 typedef WpOLEAppendCollection< ADOFields, ADOField, WpADOField> WpADOFields;
47 typedef WpOLECollection< ADOProperties, ADOProperty, WpADOProperty> WpADOProperties;
50 class WpADOConnection : public WpOLEBase<ADOConnection>
52 friend class WpADOCommand;
53 public:
55 WpADOConnection(ADOConnection* pInt) : WpOLEBase<ADOConnection>(pInt){}
57 WpADOConnection(const WpADOConnection& rhs) : WpOLEBase<ADOConnection>(rhs) {}
59 WpADOConnection& operator=(const WpADOConnection& rhs)
60 {WpOLEBase<ADOConnection>::operator=(rhs); return *this;}
64 WpADOProperties get_Properties() const;
66 OUString GetConnectionString() const;
67 sal_Bool PutConnectionString(const OUString &aCon) const;
68 sal_Int32 GetCommandTimeout() const;
69 void PutCommandTimeout(sal_Int32 nRet);
70 sal_Int32 GetConnectionTimeout() const ;
71 void PutConnectionTimeout(sal_Int32 nRet);
73 sal_Bool Close( ) ;
74 sal_Bool Execute(const OUString& _CommandText,OLEVariant& RecordsAffected,long Options, WpADORecordset** ppiRset);
75 sal_Bool BeginTrans();
76 sal_Bool CommitTrans( ) ;
77 sal_Bool RollbackTrans( );
78 sal_Bool Open(const OUString& ConnectionString, const OUString& UserID,const OUString& Password,long Options);
79 sal_Bool GetErrors(ADOErrors** pErrors);
81 OUString GetDefaultDatabase() const;
82 sal_Bool PutDefaultDatabase(const OUString& _bstr);
84 IsolationLevelEnum get_IsolationLevel() const ;
85 sal_Bool put_IsolationLevel(const IsolationLevelEnum& eNum) ;
87 sal_Int32 get_Attributes() const;
88 sal_Bool put_Attributes(sal_Int32 nRet);
90 CursorLocationEnum get_CursorLocation() const;
91 sal_Bool put_CursorLocation(const CursorLocationEnum &eNum) ;
93 ConnectModeEnum get_Mode() const;
94 sal_Bool put_Mode(const ConnectModeEnum &eNum) ;
96 OUString get_Provider() const;
97 sal_Bool put_Provider(const OUString& _bstr);
99 sal_Int32 get_State() const;
101 sal_Bool OpenSchema(SchemaEnum eNum,OLEVariant& Restrictions,OLEVariant& SchemaID,ADORecordset**pprset);
103 OUString get_Version() const;
105 // special methods
106 ADORecordset* getExportedKeys( const ::com::sun::star::uno::Any& catalog, const OUString& schema, const OUString& table );
107 ADORecordset* getImportedKeys( const ::com::sun::star::uno::Any& catalog, const OUString& schema, const OUString& table );
108 ADORecordset* getPrimaryKeys( const ::com::sun::star::uno::Any& catalog, const OUString& schema, const OUString& table );
109 ADORecordset* getIndexInfo( const ::com::sun::star::uno::Any& catalog, const OUString& schema, const OUString& table, sal_Bool unique, sal_Bool approximate );
110 ADORecordset* getTablePrivileges( const ::com::sun::star::uno::Any& catalog,
111 const OUString& schemaPattern,
112 const OUString& tableNamePattern );
113 ADORecordset* getCrossReference( const ::com::sun::star::uno::Any& primaryCatalog,
114 const OUString& primarySchema,
115 const OUString& primaryTable,
116 const ::com::sun::star::uno::Any& foreignCatalog,
117 const OUString& foreignSchema,
118 const OUString& foreignTable);
119 ADORecordset* getProcedures( const ::com::sun::star::uno::Any& catalog,
120 const OUString& schemaPattern,
121 const OUString& procedureNamePattern );
122 ADORecordset* getProcedureColumns( const ::com::sun::star::uno::Any& catalog,
123 const OUString& schemaPattern,
124 const OUString& procedureNamePattern,
125 const OUString& columnNamePattern );
126 ADORecordset* getTables( const ::com::sun::star::uno::Any& catalog,
127 const OUString& schemaPattern,
128 const OUString& tableNamePattern,
129 const ::com::sun::star::uno::Sequence< OUString >& types );
130 ADORecordset* getColumns( const ::com::sun::star::uno::Any& catalog,
131 const OUString& schemaPattern,
132 const OUString& tableNamePattern,
133 const OUString& columnNamePattern );
134 ADORecordset* getColumnPrivileges( const ::com::sun::star::uno::Any& catalog,
135 const OUString& schemaPattern,
136 const OUString& table,
137 const OUString& columnNamePattern );
138 ADORecordset* getTypeInfo(DataTypeEnum _eType = adEmpty );
142 class WpADOCommand : public WpOLEBase<ADOCommand>
144 public:
145 WpADOCommand(){}
146 // Ctors, operator=
147 // They only call the superclass
148 WpADOCommand(ADOCommand* pInt) : WpOLEBase<ADOCommand>(pInt){}
150 WpADOCommand(const WpADOCommand& rhs) : WpOLEBase<ADOCommand>(rhs) {}
152 WpADOCommand& operator=(const WpADOCommand& rhs)
154 WpOLEBase<ADOCommand>::operator=(rhs); return *this;}
158 sal_Bool putref_ActiveConnection( WpADOConnection *pCon);
160 void put_ActiveConnection(/* [in] */ const OLEVariant& vConn);
161 void Create();
162 sal_Int32 get_State() const;
163 OUString get_CommandText() const;
164 sal_Bool put_CommandText(const OUString &aCon) ;
165 sal_Int32 get_CommandTimeout() const;
166 void put_CommandTimeout(sal_Int32 nRet);
167 sal_Bool get_Prepared() const;
168 sal_Bool put_Prepared(VARIANT_BOOL bPrepared) const;
169 sal_Bool Execute(OLEVariant& RecordsAffected,OLEVariant& Parameters,long Options, ADORecordset** ppiRset);
170 ADOParameter* CreateParameter(const OUString &_bstr,DataTypeEnum Type,ParameterDirectionEnum Direction,long nSize,const OLEVariant &Value);
172 ADOParameters* get_Parameters() const;
173 sal_Bool put_CommandType( /* [in] */ CommandTypeEnum lCmdType);
174 CommandTypeEnum get_CommandType( ) const ;
175 // Returns the field's name
176 OUString GetName() const ;
177 sal_Bool put_Name(const OUString& _Name);
178 sal_Bool Cancel();
181 class WpADOError : public WpOLEBase<ADOError>
183 public:
185 // Ctors, operator=
186 // They only call the superclass
187 WpADOError(ADOError* pInt):WpOLEBase<ADOError>(pInt){}
189 WpADOError(const WpADOError& rhs) : WpOLEBase<ADOError>(rhs) {}
191 WpADOError& operator=(const WpADOError& rhs)
192 {WpOLEBase<ADOError>::operator=(rhs); return *this;}
196 OUString GetDescription() const;
197 OUString GetSource() const ;
198 sal_Int32 GetNumber() const ;
199 OUString GetSQLState() const ;
200 sal_Int32 GetNativeError() const ;
206 class WpADOField : public WpOLEBase<ADOField>
208 // friend class WpADOFields;
209 public:
211 // Ctors, operator=
212 // They only call the superclass
213 WpADOField(ADOField* pInt=NULL):WpOLEBase<ADOField>(pInt){}
214 WpADOField(const WpADOField& rhs) : WpOLEBase<ADOField>(rhs) {}
216 WpADOField& operator=(const WpADOField& rhs)
217 {WpOLEBase<ADOField>::operator=(rhs); return *this;}
220 WpADOProperties get_Properties();
221 sal_Int32 GetActualSize() const ;
222 sal_Int32 GetAttributes() const ;
223 sal_Int32 GetStatus() const ;
224 sal_Int32 GetDefinedSize() const ;
225 // Returns the field's name
226 OUString GetName() const ;
227 DataTypeEnum GetADOType() const ;
228 void get_Value(OLEVariant& aValVar) const ;
229 OLEVariant get_Value() const;
230 sal_Bool PutValue(const OLEVariant& aVariant);
231 sal_Int32 GetPrecision() const ;
232 sal_Int32 GetNumericScale() const ;
233 sal_Bool AppendChunk(const OLEVariant& _Variant);
234 OLEVariant GetChunk(long Length) const;
235 void GetChunk(long Length,OLEVariant &aValVar) const;
236 OLEVariant GetOriginalValue() const;
237 void GetOriginalValue(OLEVariant &aValVar) const;
238 OLEVariant GetUnderlyingValue() const;
240 void GetUnderlyingValue(OLEVariant &aValVar) const;
242 sal_Bool PutPrecision(sal_Int8 _prec);
244 sal_Bool PutNumericScale(sal_Int8 _prec);
246 void PutADOType(DataTypeEnum eType) ;
248 sal_Bool PutDefinedSize(sal_Int32 _nDefSize);
250 sal_Bool PutAttributes(sal_Int32 _nDefSize);
256 class WpADOProperty: public WpOLEBase<ADOProperty>
258 public:
259 // Ctors, operator=
260 // They only call the superclass
261 WpADOProperty(ADOProperty* pInt=NULL):WpOLEBase<ADOProperty>(pInt){}
262 WpADOProperty(const WpADOProperty& rhs) : WpOLEBase<ADOProperty>(rhs) {}
263 WpADOProperty& operator=(const WpADOProperty& rhs)
264 {WpOLEBase<ADOProperty>::operator=(rhs); return *this;}
267 OLEVariant GetValue() const;
268 void GetValue(OLEVariant &aValVar) const;
269 sal_Bool PutValue(const OLEVariant &aValVar) ;
270 OUString GetName() const ;
271 DataTypeEnum GetADOType() const ;
272 sal_Int32 GetAttributes() const ;
273 sal_Bool PutAttributes(sal_Int32 _nDefSize);
277 class WpADORecordset : public WpOLEBase<ADORecordset>
280 public:
281 // Ctors, operator=
282 // They only call the superclass
283 WpADORecordset(ADORecordset* pInt=NULL):WpOLEBase<ADORecordset>(pInt){}
284 WpADORecordset(const WpADORecordset& rhs) : WpOLEBase<ADORecordset>() {operator=(rhs);}
285 WpADORecordset& operator=(const WpADORecordset& rhs)
287 WpOLEBase<ADORecordset>::operator=(rhs);
288 return *this;
290 ~WpADORecordset()
292 // if(pInterface && get_State() == adStateOpen)
293 // Close();
296 void Create();
297 sal_Bool Open(
298 /* [optional][in] */ VARIANT Source,
299 /* [optional][in] */ VARIANT ActiveConnection,
300 /* [defaultvalue][in] */ CursorTypeEnum CursorType,
301 /* [defaultvalue][in] */ LockTypeEnum LockType,
302 /* [defaultvalue][in] */ sal_Int32 Options);
303 LockTypeEnum GetLockType();
304 void Close();
305 sal_Bool Cancel() const;
306 sal_Int32 get_State( );
307 sal_Bool Supports( /* [in] */ CursorOptionEnum CursorOptions);
308 PositionEnum_Param get_AbsolutePosition();
309 void GetDataSource(IUnknown** pIUnknown) const ;
310 void PutRefDataSource(IUnknown* pIUnknown);
311 void GetBookmark(VARIANT& var);
312 OLEVariant GetBookmark();
313 CompareEnum CompareBookmarks(const OLEVariant& left,const OLEVariant& right);
314 sal_Bool SetBookmark(const OLEVariant &pSafeAr);
315 WpADOFields GetFields() const;
316 sal_Bool Move(sal_Int32 nRows, VARIANT aBmk);
317 sal_Bool MoveNext();
318 sal_Bool MovePrevious();
319 sal_Bool MoveFirst();
320 sal_Bool MoveLast();
322 sal_Bool IsAtBOF() const;
323 sal_Bool IsAtEOF() const;
324 sal_Bool Delete(AffectEnum eNum);
325 sal_Bool AddNew(const OLEVariant &FieldList,const OLEVariant &Values);
326 sal_Bool Update(const OLEVariant &FieldList,const OLEVariant &Values);
327 sal_Bool CancelUpdate();
328 WpADOProperties get_Properties() const;
329 sal_Bool NextRecordset(OLEVariant& RecordsAffected,ADORecordset** ppiRset);
330 sal_Bool get_RecordCount(ADO_LONGPTR &_nRet) const;
331 sal_Bool get_MaxRecords(ADO_LONGPTR &_nRet) const;
332 sal_Bool put_MaxRecords(ADO_LONGPTR _nRet);
333 sal_Bool get_CursorType(CursorTypeEnum &_nRet) const;
334 sal_Bool put_CursorType(CursorTypeEnum _nRet);
335 sal_Bool get_LockType(LockTypeEnum &_nRet) const;
336 sal_Bool put_LockType(LockTypeEnum _nRet);
337 sal_Bool get_CacheSize(sal_Int32 &_nRet) const;
338 sal_Bool put_CacheSize(sal_Int32 _nRet);
339 sal_Bool UpdateBatch(AffectEnum AffectRecords);
343 class WpADOParameter:public WpOLEBase<ADOParameter>
345 public:
346 // Ctors, operator=
347 // They only call the superclass
348 WpADOParameter(ADOParameter* pInt):WpOLEBase<ADOParameter>(pInt){}
349 WpADOParameter(const WpADOParameter& rhs):WpOLEBase<ADOParameter>(rhs){}
350 WpADOParameter& operator=(const WpADOParameter& rhs)
351 {WpOLEBase<ADOParameter>::operator=(rhs); return *this;}
354 OUString GetName() const ;
355 DataTypeEnum GetADOType() const ;
356 void put_Type(const DataTypeEnum& _eType);
357 sal_Bool put_Size(const sal_Int32& _nSize);
358 sal_Int32 GetAttributes() const ;
359 sal_Int32 GetPrecision() const ;
360 sal_Int32 GetNumericScale() const ;
361 ParameterDirectionEnum get_Direction() const;
362 void GetValue(OLEVariant& aValVar) const ;
363 OLEVariant GetValue() const;
364 sal_Bool PutValue(const OLEVariant& aVariant);
365 sal_Bool AppendChunk(const OLEVariant& aVariant);
368 class OTools
370 public:
371 /** putValue set the property value at the ado column
372 @param _rProps the properties where to set
373 @param _aPosition which property to set
374 @param _aValVar the value to set
376 static void putValue(const WpADOProperties& _rProps,const OLEVariant &_aPosition,const OLEVariant &_aValVar);
378 /** getValue returns a specific property value
379 @param _rProps the properties where to set
380 @param _aPosition the property
382 @return the property value
384 static OLEVariant getValue(const WpADOProperties& _rProps,const OLEVariant &_aPosition);
388 #endif // INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_AWRAPADO_HXX
390 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */