tdf#130857 qt weld: Support mail merge "Server Auth" dialog
[LibreOffice.git] / connectivity / source / inc / odbc / OResultSetMetaData.hxx
blob7f73f6c03f4bdb8bf858b5e300568025bef5b09d
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 #pragma once
22 #include <com/sun/star/sdbc/XResultSetMetaData.hpp>
23 #include <cppuhelper/implbase.hxx>
24 #include <odbc/OFunctions.hxx>
25 #include <odbc/odbcbasedllapi.hxx>
26 #include <vector>
27 #include <odbc/OConnection.hxx>
29 namespace connectivity::odbc
32 //************ Class: ResultSetMetaData
34 typedef ::cppu::WeakImplHelper< css::sdbc::XResultSetMetaData> OResultSetMetaData_BASE;
36 class OResultSetMetaData final :
37 public OResultSetMetaData_BASE
39 std::vector<sal_Int32> m_vMapping; // when not every column is needed
40 std::map<sal_Int32,sal_Int32> m_aColumnTypes;
42 SQLHANDLE m_aStatementHandle;
43 OConnection* m_pConnection;
44 sal_Int32 m_nColCount;
45 bool m_bUseODBC2Types;
47 /// @throws css::sdbc::SQLException
48 /// @throws css::uno::RuntimeException
49 OUString getCharColAttrib(sal_Int32 column,sal_Int32 ident);
50 /// @throws css::sdbc::SQLException
51 /// @throws css::uno::RuntimeException
52 sal_Int32 getNumColAttrib(sal_Int32 column,sal_Int32 ident);
53 public:
54 // A ctor that is needed for returning the object
55 OResultSetMetaData(OConnection* _pConnection, SQLHANDLE _pStmt )
56 :m_aStatementHandle( _pStmt )
57 ,m_pConnection(_pConnection)
58 ,m_nColCount(-1)
59 ,m_bUseODBC2Types(false)
61 OResultSetMetaData(OConnection* _pConnection, SQLHANDLE _pStmt, std::vector<sal_Int32>&& _vMapping)
62 :m_vMapping(std::move(_vMapping))
63 ,m_aStatementHandle( _pStmt )
64 ,m_pConnection(_pConnection)
65 ,m_nColCount(m_vMapping.size()-1)
66 ,m_bUseODBC2Types(false)
68 virtual ~OResultSetMetaData() override;
71 /// @throws css::sdbc::SQLException
72 /// @throws css::uno::RuntimeException
73 static SQLLEN getNumColAttrib(OConnection const * _pConnection
74 ,SQLHANDLE _aStatementHandle
75 ,const css::uno::Reference< css::uno::XInterface >& _xInterface
76 ,sal_Int32 _column
77 ,sal_Int32 ident);
79 /// @throws css::sdbc::SQLException
80 /// @throws css::uno::RuntimeException
81 static SQLSMALLINT getColumnODBCType(OConnection const * _pConnection
82 ,SQLHANDLE _aStatementHandle
83 ,const css::uno::Reference< css::uno::XInterface >& _xInterface
84 ,sal_Int32 column);
86 const Functions& functions() const { return m_pConnection->functions(); }
88 virtual sal_Int32 SAL_CALL getColumnCount( ) override;
89 virtual sal_Bool SAL_CALL isAutoIncrement( sal_Int32 column ) override;
90 virtual sal_Bool SAL_CALL isCaseSensitive( sal_Int32 column ) override;
91 virtual sal_Bool SAL_CALL isSearchable( sal_Int32 column ) override;
92 virtual sal_Bool SAL_CALL isCurrency( sal_Int32 column ) override;
93 virtual sal_Int32 SAL_CALL isNullable( sal_Int32 column ) override;
94 virtual sal_Bool SAL_CALL isSigned( sal_Int32 column ) override;
95 virtual sal_Int32 SAL_CALL getColumnDisplaySize( sal_Int32 column ) override;
96 virtual OUString SAL_CALL getColumnLabel( sal_Int32 column ) override;
97 virtual OUString SAL_CALL getColumnName( sal_Int32 column ) override;
98 virtual OUString SAL_CALL getSchemaName( sal_Int32 column ) override;
99 virtual sal_Int32 SAL_CALL getPrecision( sal_Int32 column ) override;
100 virtual sal_Int32 SAL_CALL getScale( sal_Int32 column ) override;
101 virtual OUString SAL_CALL getTableName( sal_Int32 column ) override;
102 virtual OUString SAL_CALL getCatalogName( sal_Int32 column ) override;
103 virtual sal_Int32 SAL_CALL getColumnType( sal_Int32 column ) override;
104 virtual OUString SAL_CALL getColumnTypeName( sal_Int32 column ) override;
105 virtual sal_Bool SAL_CALL isReadOnly( sal_Int32 column ) override;
106 virtual sal_Bool SAL_CALL isWritable( sal_Int32 column ) override;
107 virtual sal_Bool SAL_CALL isDefinitelyWritable( sal_Int32 column ) override;
108 virtual OUString SAL_CALL getColumnServiceName( sal_Int32 column ) override;
113 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */