Gtk-WARNING gtktreestore.c:1047: Invalid column number 1 added to iter
[LibreOffice.git] / include / connectivity / PColumn.hxx
blobe4a5826b861e2c9aef1579cee88a557bf603a44f
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 .
19 #ifndef INCLUDED_CONNECTIVITY_PCOLUMN_HXX
20 #define INCLUDED_CONNECTIVITY_PCOLUMN_HXX
22 #include <sal/config.h>
24 #include <map>
26 #include <connectivity/dbtoolsdllapi.hxx>
27 #include <connectivity/sdbcx/VColumn.hxx>
28 #include <connectivity/CommonTools.hxx>
29 #include <rtl/ref.hxx>
30 #include <comphelper/proparrhlp.hxx>
32 namespace com::sun::star::container { class XNameAccess; }
33 namespace com::sun::star::sdbc { class XDatabaseMetaData; }
34 namespace com::sun::star::sdbc { class XResultSetMetaData; }
36 namespace connectivity::parse
38 class OParseColumn;
40 typedef sdbcx::OColumn OParseColumn_BASE;
41 typedef ::comphelper::OPropertyArrayUsageHelper<OParseColumn> OParseColumn_PROP;
43 class UNLESS_MERGELIBS_MORE(OOO_DLLPUBLIC_DBTOOLS) OParseColumn final :
44 public OParseColumn_BASE, public OParseColumn_PROP
46 OUString m_aRealName;
47 OUString m_sLabel;
48 bool m_bFunction;
49 bool m_bDbasePrecisionChanged;
50 bool m_bAggregateFunction;
51 bool m_bIsSearchable;
53 virtual ::cppu::IPropertyArrayHelper* createArrayHelper() const override;
54 virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() override;
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);
74 virtual void construct() override;
76 void setRealName(const OUString& _rName) { m_aRealName = _rName; }
77 void setLabel(const OUString& i_sLabel) { m_sLabel = i_sLabel; }
78 void setTableName(const OUString& _rName) { m_TableName = _rName; }
79 void setFunction(bool _bFunction) { m_bFunction = _bFunction; }
80 void setAggregateFunction(bool _bFunction) { m_bAggregateFunction = _bFunction; }
81 void setIsSearchable( bool _bIsSearchable ) { m_bIsSearchable = _bIsSearchable; }
82 const OUString& getRealName() const { return m_aRealName; }
84 /** creates a collection of OParseColumn, as described by a result set meta data instance.
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
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.
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
105 private:
106 using OParseColumn_BASE::createArrayHelper;
109 class OOrderColumn;
111 typedef sdbcx::OColumn OOrderColumn_BASE;
112 typedef ::comphelper::OPropertyArrayUsageHelper<OOrderColumn> OOrderColumn_PROP;
114 class OOrderColumn final :
115 public OOrderColumn_BASE, public OOrderColumn_PROP
117 const bool m_bAscending;
119 virtual ::cppu::IPropertyArrayHelper* createArrayHelper() const override;
120 virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() override;
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
131 OOrderColumn(
132 const css::uno::Reference< css::beans::XPropertySet>& _xColumn,
133 bool _bCase,
134 bool _bAscending
137 virtual void construct() override;
139 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override;
140 private:
141 using OOrderColumn_BASE::createArrayHelper;
146 #endif // INCLUDED_CONNECTIVITY_PCOLUMN_HXX
148 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */