/src/libreoffice/include/connectivity/PColumn.hxx
Line | Count | Source |
1 | | /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
2 | | /* |
3 | | * This file is part of the LibreOffice project. |
4 | | * |
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/. |
8 | | * |
9 | | * This file incorporates work covered by the following license notice: |
10 | | * |
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 . |
18 | | */ |
19 | | #ifndef INCLUDED_CONNECTIVITY_PCOLUMN_HXX |
20 | | #define INCLUDED_CONNECTIVITY_PCOLUMN_HXX |
21 | | |
22 | | #include <sal/config.h> |
23 | | |
24 | | #include <map> |
25 | | |
26 | | #include <connectivity/dbtoolsdllapi.hxx> |
27 | | #include <connectivity/sdbcx/VColumn.hxx> |
28 | | #include <connectivity/CommonTools.hxx> |
29 | | #include <comphelper/proparrhlp.hxx> |
30 | | |
31 | | namespace com::sun::star::container { class XNameAccess; } |
32 | | namespace com::sun::star::sdbc { class XDatabaseMetaData; } |
33 | | namespace com::sun::star::sdbc { class XResultSetMetaData; } |
34 | | namespace rtl { template <class reference_type> class Reference; } |
35 | | |
36 | | namespace connectivity::parse |
37 | | { |
38 | | class OParseColumn; |
39 | | |
40 | | typedef sdbcx::OColumn OParseColumn_BASE; |
41 | | typedef ::comphelper::OPropertyArrayUsageHelper<OParseColumn> OParseColumn_PROP; |
42 | | |
43 | | class UNLESS_MERGELIBS_MORE(OOO_DLLPUBLIC_DBTOOLS) OParseColumn final : |
44 | | public OParseColumn_BASE, public OParseColumn_PROP |
45 | | { |
46 | | OUString m_aRealName; |
47 | | OUString m_sLabel; |
48 | | bool m_bFunction; |
49 | | bool m_bDbasePrecisionChanged; |
50 | | bool m_bAggregateFunction; |
51 | | bool m_bIsSearchable; |
52 | | |
53 | | virtual ::cppu::IPropertyArrayHelper* createArrayHelper() const override; |
54 | | virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() override; |
55 | | |
56 | | virtual ~OParseColumn() override; |
57 | | public: |
58 | | OParseColumn(const css::uno::Reference< css::beans::XPropertySet>& _xColumn, bool _bCase); |
59 | | OParseColumn(const OUString& Name, |
60 | | const OUString& TypeName, |
61 | | const OUString& DefaultValue, |
62 | | const OUString& Description, |
63 | | sal_Int32 IsNullable, |
64 | | sal_Int32 Precision, |
65 | | sal_Int32 Scale, |
66 | | sal_Int32 Type, |
67 | | bool IsAutoIncrement, |
68 | | bool IsCurrency, |
69 | | bool _bCase, |
70 | | const OUString& CatalogName, |
71 | | const OUString& SchemaName, |
72 | | const OUString& TableName); |
73 | | |
74 | | virtual void construct() override; |
75 | | |
76 | 1.62M | void setRealName(const OUString& _rName) { m_aRealName = _rName; } |
77 | 0 | void setLabel(const OUString& i_sLabel) { m_sLabel = i_sLabel; } |
78 | 1.62M | void setTableName(const OUString& _rName) { m_TableName = _rName; } |
79 | 0 | void setFunction(bool _bFunction) { m_bFunction = _bFunction; } |
80 | 0 | void setAggregateFunction(bool _bFunction) { m_bAggregateFunction = _bFunction; } |
81 | 0 | void setIsSearchable( bool _bIsSearchable ) { m_bIsSearchable = _bIsSearchable; } |
82 | 0 | const OUString& getRealName() const { return m_aRealName; } |
83 | | |
84 | | /** creates a collection of OParseColumn, as described by a result set meta data instance. |
85 | | */ |
86 | | static ::rtl::Reference< OSQLColumns > |
87 | | createColumnsForResultSet( |
88 | | const css::uno::Reference< css::sdbc::XResultSetMetaData >& _rxResMetaData, |
89 | | const css::uno::Reference< css::sdbc::XDatabaseMetaData >& _rxDBMetaData, |
90 | | const css::uno::Reference< css::container::XNameAccess>& i_xQueryColumns |
91 | | ); |
92 | | |
93 | | typedef std::map<OUString, int> StringMap; |
94 | | /** creates a single OParseColumn, as described by a result set meta data instance. |
95 | | The column names are unique. |
96 | | */ |
97 | | static rtl::Reference<OParseColumn> |
98 | | createColumnForResultSet( |
99 | | const css::uno::Reference< css::sdbc::XResultSetMetaData >& _rxResMetaData, |
100 | | const css::uno::Reference< css::sdbc::XDatabaseMetaData >& _rxDBMetaData, |
101 | | sal_Int32 _nColumnPos, |
102 | | StringMap& _rColumns |
103 | | ); |
104 | | |
105 | | private: |
106 | | using OParseColumn_BASE::createArrayHelper; |
107 | | }; |
108 | | |
109 | | class OOrderColumn; |
110 | | |
111 | | typedef sdbcx::OColumn OOrderColumn_BASE; |
112 | | typedef ::comphelper::OPropertyArrayUsageHelper<OOrderColumn> OOrderColumn_PROP; |
113 | | |
114 | | class OOrderColumn final : |
115 | | public OOrderColumn_BASE, public OOrderColumn_PROP |
116 | | { |
117 | | const bool m_bAscending; |
118 | | |
119 | | virtual ::cppu::IPropertyArrayHelper* createArrayHelper() const override; |
120 | | virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() override; |
121 | | |
122 | | virtual ~OOrderColumn() override; |
123 | | public: |
124 | | OOrderColumn( |
125 | | const css::uno::Reference< css::beans::XPropertySet>& _xColumn, |
126 | | const OUString& i_rOriginatingTableName, |
127 | | bool _bCase, |
128 | | bool _bAscending |
129 | | ); |
130 | | |
131 | | OOrderColumn( |
132 | | const css::uno::Reference< css::beans::XPropertySet>& _xColumn, |
133 | | bool _bCase, |
134 | | bool _bAscending |
135 | | ); |
136 | | |
137 | | virtual void construct() override; |
138 | | |
139 | | virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override; |
140 | | private: |
141 | | using OOrderColumn_BASE::createArrayHelper; |
142 | | }; |
143 | | |
144 | | } |
145 | | |
146 | | #endif // INCLUDED_CONNECTIVITY_PCOLUMN_HXX |
147 | | |
148 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |