Version 6.4.0.3, tag libreoffice-6.4.0.3
[LibreOffice.git] / connectivity / source / inc / odbc / OResultSetMetaData.hxx
blobb1ffb20ce6396745e4c49d86b5556caafedef176
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_ODBC_ORESULTSETMETADATA_HXX
21 #define INCLUDED_CONNECTIVITY_SOURCE_INC_ODBC_ORESULTSETMETADATA_HXX
23 #include <com/sun/star/sdbc/XResultSetMetaData.hpp>
24 #include <cppuhelper/implbase.hxx>
25 #include <odbc/OFunctions.hxx>
26 #include <odbc/odbcbasedllapi.hxx>
27 #include <vector>
28 #include <odbc/OConnection.hxx>
30 namespace connectivity
32 namespace odbc
35 //************ Class: ResultSetMetaData
37 typedef ::cppu::WeakImplHelper< css::sdbc::XResultSetMetaData> OResultSetMetaData_BASE;
39 class OOO_DLLPUBLIC_ODBCBASE OResultSetMetaData final :
40 public OResultSetMetaData_BASE
42 std::vector<sal_Int32> m_vMapping; // when not every column is needed
43 std::map<sal_Int32,sal_Int32> m_aColumnTypes;
45 SQLHANDLE m_aStatementHandle;
46 OConnection* m_pConnection;
47 sal_Int32 m_nColCount;
48 bool m_bUseODBC2Types;
50 /// @throws css::sdbc::SQLException
51 /// @throws css::uno::RuntimeException
52 OUString getCharColAttrib(sal_Int32 column,sal_Int32 ident);
53 /// @throws css::sdbc::SQLException
54 /// @throws css::uno::RuntimeException
55 sal_Int32 getNumColAttrib(sal_Int32 column,sal_Int32 ident);
56 public:
57 // A ctor that is needed for returning the object
58 OResultSetMetaData(OConnection* _pConnection, SQLHANDLE _pStmt )
59 :m_aStatementHandle( _pStmt )
60 ,m_pConnection(_pConnection)
61 ,m_nColCount(-1)
62 ,m_bUseODBC2Types(false)
64 OResultSetMetaData(OConnection* _pConnection, SQLHANDLE _pStmt ,const std::vector<sal_Int32> & _vMapping)
65 :m_vMapping(_vMapping)
66 ,m_aStatementHandle( _pStmt )
67 ,m_pConnection(_pConnection)
68 ,m_nColCount(_vMapping.size()-1)
69 ,m_bUseODBC2Types(false)
71 virtual ~OResultSetMetaData() override;
74 /// @throws css::sdbc::SQLException
75 /// @throws css::uno::RuntimeException
76 static SQLLEN getNumColAttrib(OConnection const * _pConnection
77 ,SQLHANDLE _aStatementHandle
78 ,const css::uno::Reference< css::uno::XInterface >& _xInterface
79 ,sal_Int32 _column
80 ,sal_Int32 ident);
82 /// @throws css::sdbc::SQLException
83 /// @throws css::uno::RuntimeException
84 static SQLSMALLINT getColumnODBCType(OConnection const * _pConnection
85 ,SQLHANDLE _aStatementHandle
86 ,const css::uno::Reference< css::uno::XInterface >& _xInterface
87 ,sal_Int32 column);
89 oslGenericFunction getOdbcFunction(ODBC3SQLFunctionId _nIndex) const
91 return m_pConnection->getOdbcFunction(_nIndex);
94 virtual sal_Int32 SAL_CALL getColumnCount( ) override;
95 virtual sal_Bool SAL_CALL isAutoIncrement( sal_Int32 column ) override;
96 virtual sal_Bool SAL_CALL isCaseSensitive( sal_Int32 column ) override;
97 virtual sal_Bool SAL_CALL isSearchable( sal_Int32 column ) override;
98 virtual sal_Bool SAL_CALL isCurrency( sal_Int32 column ) override;
99 virtual sal_Int32 SAL_CALL isNullable( sal_Int32 column ) override;
100 virtual sal_Bool SAL_CALL isSigned( sal_Int32 column ) override;
101 virtual sal_Int32 SAL_CALL getColumnDisplaySize( sal_Int32 column ) override;
102 virtual OUString SAL_CALL getColumnLabel( sal_Int32 column ) override;
103 virtual OUString SAL_CALL getColumnName( sal_Int32 column ) override;
104 virtual OUString SAL_CALL getSchemaName( sal_Int32 column ) override;
105 virtual sal_Int32 SAL_CALL getPrecision( sal_Int32 column ) override;
106 virtual sal_Int32 SAL_CALL getScale( sal_Int32 column ) override;
107 virtual OUString SAL_CALL getTableName( sal_Int32 column ) override;
108 virtual OUString SAL_CALL getCatalogName( sal_Int32 column ) override;
109 virtual sal_Int32 SAL_CALL getColumnType( sal_Int32 column ) override;
110 virtual OUString SAL_CALL getColumnTypeName( sal_Int32 column ) override;
111 virtual sal_Bool SAL_CALL isReadOnly( sal_Int32 column ) override;
112 virtual sal_Bool SAL_CALL isWritable( sal_Int32 column ) override;
113 virtual sal_Bool SAL_CALL isDefinitelyWritable( sal_Int32 column ) override;
114 virtual OUString SAL_CALL getColumnServiceName( sal_Int32 column ) override;
118 #endif // INCLUDED_CONNECTIVITY_SOURCE_INC_ODBC_ORESULTSETMETADATA_HXX
120 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */