1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 .
22 #include <com/sun/star/sdbc/XResultSetMetaData.hpp>
23 #include <cppuhelper/implbase.hxx>
25 #include <ado/Awrapado.hxx>
26 #include <ado/ADatabaseMetaDataResultSet.hxx>
27 #include <OColumn.hxx>
29 namespace connectivity::ado
32 //************ Class: ResultSetMetaData
34 typedef ::cppu::WeakImplHelper
< css::sdbc::XResultSetMetaData
> ODatabaseMetaResultSetMetaData_BASE
;
36 class ODatabaseMetaDataResultSetMetaData
: public ODatabaseMetaResultSetMetaData_BASE
38 friend class ODatabaseMetaDataResultSet
;
40 const std::vector
<sal_Int32
> &m_vMapping
; // when not every column is needed
41 std::map
<sal_Int32
,connectivity::OColumn
> m_mColumns
;
42 std::map
<sal_Int32
,connectivity::OColumn
>::const_iterator m_mColumnsIter
;
44 ADORecordset
* m_pRecordSet
;
45 sal_Int32 m_nColCount
;
48 ODatabaseMetaDataResultSetMetaData( const ODatabaseMetaDataResultSetMetaData
& ); // never implemented
49 ODatabaseMetaDataResultSetMetaData
& operator=( const ODatabaseMetaDataResultSetMetaData
& ); // never implemented
52 void setColumnPrivilegesMap();
55 void setProcedureColumnsMap();
56 void setPrimaryKeysMap();
57 void setIndexInfoMap();
58 void setTablePrivilegesMap();
59 void setCrossReferenceMap();
60 void setTypeInfoMap();
61 void setProceduresMap();
63 // a Constructor, that is needed for when Returning the Object is needed:
64 ODatabaseMetaDataResultSetMetaData( ADORecordset
* _pRecordSet
,ODatabaseMetaDataResultSet
* _pRes
)
65 : m_vMapping(_pRes
->getColumnMapping()),
66 m_pRecordSet(_pRecordSet
),
67 m_nColCount(m_vMapping
.size()-1)
70 m_pRecordSet
->AddRef();
72 ~ODatabaseMetaDataResultSetMetaData() override
;
74 /// Avoid ambiguous cast error from the compiler.
75 operator css::uno::Reference
< css::sdbc::XResultSetMetaData
> () noexcept
78 virtual sal_Int32 SAL_CALL
getColumnCount( ) override
;
79 virtual sal_Bool SAL_CALL
isAutoIncrement( sal_Int32 column
) override
;
80 virtual sal_Bool SAL_CALL
isCaseSensitive( sal_Int32 column
) override
;
81 virtual sal_Bool SAL_CALL
isSearchable( sal_Int32 column
) override
;
82 virtual sal_Bool SAL_CALL
isCurrency( sal_Int32 column
) override
;
83 virtual sal_Int32 SAL_CALL
isNullable( sal_Int32 column
) override
;
84 virtual sal_Bool SAL_CALL
isSigned( sal_Int32 column
) override
;
85 virtual sal_Int32 SAL_CALL
getColumnDisplaySize( sal_Int32 column
) override
;
86 virtual OUString SAL_CALL
getColumnLabel( sal_Int32 column
) override
;
87 virtual OUString SAL_CALL
getColumnName( sal_Int32 column
) override
;
88 virtual OUString SAL_CALL
getSchemaName( sal_Int32 column
) override
;
89 virtual sal_Int32 SAL_CALL
getPrecision( sal_Int32 column
) override
;
90 virtual sal_Int32 SAL_CALL
getScale( sal_Int32 column
) override
;
91 virtual OUString SAL_CALL
getTableName( sal_Int32 column
) override
;
92 virtual OUString SAL_CALL
getCatalogName( sal_Int32 column
) override
;
93 virtual sal_Int32 SAL_CALL
getColumnType( sal_Int32 column
) override
;
94 virtual OUString SAL_CALL
getColumnTypeName( sal_Int32 column
) override
;
95 virtual sal_Bool SAL_CALL
isReadOnly( sal_Int32 column
) override
;
96 virtual sal_Bool SAL_CALL
isWritable( sal_Int32 column
) override
;
97 virtual sal_Bool SAL_CALL
isDefinitelyWritable( sal_Int32 column
) override
;
98 virtual OUString SAL_CALL
getColumnServiceName( sal_Int32 column
) override
;
102 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */