bump product version to 5.0.4.1
[LibreOffice.git] / connectivity / source / inc / ado / ADatabaseMetaDataResultSet.hxx
blobb9d740eec8f6f293f2f248de7644144fbba2ce84
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_ADATABASEMETADATARESULTSET_HXX
21 #define INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_ADATABASEMETADATARESULTSET_HXX
23 #include <com/sun/star/sdbc/XResultSet.hpp>
24 #include <com/sun/star/sdbc/XRow.hpp>
25 #include <com/sun/star/sdbc/XResultSetMetaDataSupplier.hpp>
26 #include <com/sun/star/sdbc/XCloseable.hpp>
27 #include <com/sun/star/sdbc/XColumnLocate.hpp>
28 #include <com/sun/star/util/XCancellable.hpp>
29 #include <com/sun/star/sdbc/XWarningsSupplier.hpp>
30 #include <com/sun/star/sdbc/XResultSetUpdate.hpp>
31 #include <com/sun/star/sdbc/XRowUpdate.hpp>
32 #include <cppuhelper/compbase7.hxx>
33 #include <comphelper/proparrhlp.hxx>
34 #include "ado/AStatement.hxx"
35 #include <comphelper/broadcasthelper.hxx>
36 #include <connectivity/StdTypeDefs.hxx>
38 namespace connectivity
40 namespace ado
43 ** java_sql_ResultSet
45 typedef ::cppu::WeakComponentImplHelper7< ::com::sun::star::sdbc::XResultSet,
46 ::com::sun::star::sdbc::XRow,
47 ::com::sun::star::sdbc::XResultSetMetaDataSupplier,
48 ::com::sun::star::util::XCancellable,
49 ::com::sun::star::sdbc::XWarningsSupplier,
50 ::com::sun::star::sdbc::XCloseable,
51 ::com::sun::star::sdbc::XColumnLocate> ODatabaseMetaDataResultSet_BASE;
53 class ODatabaseMetaDataResultSet : public comphelper::OBaseMutex,
54 public ODatabaseMetaDataResultSet_BASE,
55 public ::cppu::OPropertySetHelper,
56 public ::comphelper::OPropertyArrayUsageHelper<ODatabaseMetaDataResultSet>
58 ::std::vector<sal_Int32> m_aColMapping; // pos 0 is unused so we don't have to decrement 1 every time
60 ::std::map<sal_Int32, TInt2IntMap > m_aValueRange;
61 ::std::map<sal_Int32, TInt2IntMap >::iterator m_aValueRangeIter;
63 ::std::map<sal_Int32, ::std::map< OUString,sal_Int32> > m_aStrValueRange;
64 ::std::map<sal_Int32, ::std::map< OUString,sal_Int32> >::iterator m_aStrValueRangeIter;
66 ::std::map<sal_Int32, ::std::map< sal_Int32,OUString> > m_aIntValueRange;
67 ::std::map<sal_Int32, ::std::map< sal_Int32,OUString> >::iterator m_aIntValueRangeIter;
69 ADORecordset* m_pRecordSet;
70 ::com::sun::star::uno::WeakReferenceHelper m_aStatement;
71 ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData> m_xMetaData;
72 OLEVariant m_aValue;
73 sal_Int32 m_nRowPos;
74 sal_Bool m_bWasNull;
75 sal_Bool m_bEOF;
76 sal_Bool m_bOnFirstAfterOpen;
78 sal_Int32 getResultSetConcurrency() const throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
79 sal_Int32 getResultSetType() const throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
80 sal_Int32 getFetchDirection() const throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
81 sal_Int32 getFetchSize() const throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
82 OUString getCursorName() const throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
84 void setFetchDirection(sal_Int32 _par0) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
85 void setFetchSize(sal_Int32 _par0) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
88 inline sal_Int32 mapColumn (sal_Int32 column);
89 void checkRecordSet() throw(::com::sun::star::sdbc::SQLException);
90 OLEVariant getValue(sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
92 protected:
94 // OPropertyArrayUsageHelper
95 virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const;
96 // OPropertySetHelper
97 virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper();
99 virtual sal_Bool SAL_CALL convertFastPropertyValue(
100 ::com::sun::star::uno::Any & rConvertedValue,
101 ::com::sun::star::uno::Any & rOldValue,
102 sal_Int32 nHandle,
103 const ::com::sun::star::uno::Any& rValue )
104 throw (::com::sun::star::lang::IllegalArgumentException);
105 virtual void SAL_CALL setFastPropertyValue_NoBroadcast(
106 sal_Int32 nHandle,
107 const ::com::sun::star::uno::Any& rValue
109 throw (::com::sun::star::uno::Exception);
110 virtual void SAL_CALL getFastPropertyValue(
111 ::com::sun::star::uno::Any& rValue,
112 sal_Int32 nHandle
113 ) const;
114 public:
115 // a Constructor, that is needed for when Returning the Object is needed:
116 ODatabaseMetaDataResultSet( ADORecordset* _pRecordSet);
117 ~ODatabaseMetaDataResultSet();
119 // ::cppu::OComponentHelper
120 virtual void SAL_CALL disposing();
121 // XInterface
122 virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
123 virtual void SAL_CALL acquire() throw();
124 virtual void SAL_CALL release() throw();
125 //XTypeProvider
126 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException);
127 // XPropertySet
128 virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
129 // XResultSet
130 virtual sal_Bool SAL_CALL next( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
131 virtual sal_Bool SAL_CALL isBeforeFirst( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
132 virtual sal_Bool SAL_CALL isAfterLast( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
133 virtual sal_Bool SAL_CALL isFirst( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
134 virtual sal_Bool SAL_CALL isLast( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
135 virtual void SAL_CALL beforeFirst( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
136 virtual void SAL_CALL afterLast( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
137 virtual sal_Bool SAL_CALL first( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
138 virtual sal_Bool SAL_CALL last( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
139 virtual sal_Int32 SAL_CALL getRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
140 virtual sal_Bool SAL_CALL absolute( sal_Int32 row ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
141 virtual sal_Bool SAL_CALL relative( sal_Int32 rows ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
142 virtual sal_Bool SAL_CALL previous( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
143 virtual void SAL_CALL refreshRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
144 virtual sal_Bool SAL_CALL rowUpdated( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
145 virtual sal_Bool SAL_CALL rowInserted( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
146 virtual sal_Bool SAL_CALL rowDeleted( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
147 virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL getStatement( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
148 // XRow
149 virtual sal_Bool SAL_CALL wasNull( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
150 virtual OUString SAL_CALL getString( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
151 virtual sal_Bool SAL_CALL getBoolean( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
152 virtual sal_Int8 SAL_CALL getByte( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
153 virtual sal_Int16 SAL_CALL getShort( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
154 virtual sal_Int32 SAL_CALL getInt( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
155 virtual sal_Int64 SAL_CALL getLong( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
156 virtual float SAL_CALL getFloat( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
157 virtual double SAL_CALL getDouble( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
158 virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getBytes( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
159 virtual ::com::sun::star::util::Date SAL_CALL getDate( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
160 virtual ::com::sun::star::util::Time SAL_CALL getTime( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
161 virtual ::com::sun::star::util::DateTime SAL_CALL getTimestamp( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
162 virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL getBinaryStream( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
163 virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL getCharacterStream( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
164 virtual ::com::sun::star::uno::Any SAL_CALL getObject( sal_Int32 columnIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& typeMap ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
165 virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRef > SAL_CALL getRef( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
166 virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XBlob > SAL_CALL getBlob( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
167 virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XClob > SAL_CALL getClob( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
168 virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XArray > SAL_CALL getArray( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
169 // XResultSetMetaDataSupplier
170 virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData > SAL_CALL getMetaData( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
171 // XCancellable
172 virtual void SAL_CALL cancel( ) throw(::com::sun::star::uno::RuntimeException);
173 // XCloseable
174 virtual void SAL_CALL close( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
175 // XWarningsSupplier
176 virtual ::com::sun::star::uno::Any SAL_CALL getWarnings( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
177 virtual void SAL_CALL clearWarnings( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
178 // XColumnLocate
179 virtual sal_Int32 SAL_CALL findColumn( const OUString& columnName ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
181 const ::std::vector<sal_Int32>& getColumnMapping() { return m_aColMapping; }
183 void setCatalogsMap();
184 void setSchemasMap();
185 void setColumnPrivilegesMap();
186 void setColumnsMap();
187 void setTablesMap();
188 void setProcedureColumnsMap();
189 void setProceduresMap();
190 void setExportedKeysMap();
191 void setImportedKeysMap();
192 void setPrimaryKeysMap();
193 void setIndexInfoMap();
194 void setTablePrivilegesMap();
195 void setCrossReferenceMap();
196 void setTypeInfoMap(sal_Bool _bJetEngine);
199 inline sal_Int32 ODatabaseMetaDataResultSet::mapColumn (sal_Int32 column)
201 sal_Int32 map = column;
203 if (!m_aColMapping.empty())
205 // Validate column number
206 map = m_aColMapping[column];
209 return map;
214 #endif // INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_ADATABASEMETADATARESULTSET_HXX
216 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */