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 .
19 #ifndef INCLUDED_CONNECTIVITY_PCOLUMN_HXX
20 #define INCLUDED_CONNECTIVITY_PCOLUMN_HXX
22 #include <sal/config.h>
26 #include <connectivity/dbtoolsdllapi.hxx>
27 #include <connectivity/sdbcx/VColumn.hxx>
28 #include <connectivity/CommonTools.hxx>
29 #include <rtl/ref.hxx>
30 #include <com/sun/star/sdbc/XResultSetMetaData.hpp>
31 #include <com/sun/star/sdbc/XDatabaseMetaData.hpp>
32 #include <com/sun/star/container/XNameAccess.hpp>
33 #include <comphelper/proparrhlp.hxx>
35 namespace connectivity
41 typedef sdbcx::OColumn OParseColumn_BASE
;
42 typedef ::comphelper::OPropertyArrayUsageHelper
<OParseColumn
> OParseColumn_PROP
;
44 class OOO_DLLPUBLIC_DBTOOLS OParseColumn
:
45 public OParseColumn_BASE
, public OParseColumn_PROP
50 bool m_bDbasePrecisionChanged
;
51 bool m_bAggregateFunction
;
55 virtual ::cppu::IPropertyArrayHelper
* createArrayHelper() const override
;
56 virtual ::cppu::IPropertyArrayHelper
& SAL_CALL
getInfoHelper() override
;
58 virtual ~OParseColumn() override
;
60 OParseColumn(const css::uno::Reference
< css::beans::XPropertySet
>& _xColumn
, bool _bCase
);
61 OParseColumn(const OUString
& Name
,
62 const OUString
& TypeName
,
63 const OUString
& DefaultValue
,
64 const OUString
& Description
,
72 const OUString
& CatalogName
,
73 const OUString
& SchemaName
,
74 const OUString
& TableName
);
76 virtual void construct() override
;
78 void setRealName(const OUString
& _rName
) { m_aRealName
= _rName
; }
79 void setLabel(const OUString
& i_sLabel
) { m_sLabel
= i_sLabel
; }
80 void setTableName(const OUString
& _rName
) { m_TableName
= _rName
; }
81 void setFunction(bool _bFunction
) { m_bFunction
= _bFunction
; }
82 void setAggregateFunction(bool _bFunction
) { m_bAggregateFunction
= _bFunction
; }
83 void setIsSearchable( bool _bIsSearchable
) { m_bIsSearchable
= _bIsSearchable
; }
84 const OUString
& getRealName() const { return m_aRealName
; }
86 /** creates a collection of OParseColumn, as described by a result set meta data instance.
88 static ::rtl::Reference
< OSQLColumns
>
89 createColumnsForResultSet(
90 const css::uno::Reference
< css::sdbc::XResultSetMetaData
>& _rxResMetaData
,
91 const css::uno::Reference
< css::sdbc::XDatabaseMetaData
>& _rxDBMetaData
,
92 const css::uno::Reference
< css::container::XNameAccess
>& i_xQueryColumns
95 typedef std::map
<OUString
, int> StringMap
;
96 /** creates a single OParseColumn, as described by a result set meta data instance.
97 The column names are unique.
100 createColumnForResultSet(
101 const css::uno::Reference
< css::sdbc::XResultSetMetaData
>& _rxResMetaData
,
102 const css::uno::Reference
< css::sdbc::XDatabaseMetaData
>& _rxDBMetaData
,
103 sal_Int32 _nColumnPos
,
108 using OParseColumn_BASE::createArrayHelper
;
113 typedef sdbcx::OColumn OOrderColumn_BASE
;
114 typedef ::comphelper::OPropertyArrayUsageHelper
<OOrderColumn
> OOrderColumn_PROP
;
116 class OOO_DLLPUBLIC_DBTOOLS OOrderColumn
:
117 public OOrderColumn_BASE
, public OOrderColumn_PROP
119 const bool m_bAscending
;
122 virtual ::cppu::IPropertyArrayHelper
* createArrayHelper() const override
;
123 virtual ::cppu::IPropertyArrayHelper
& SAL_CALL
getInfoHelper() override
;
125 virtual ~OOrderColumn() override
;
128 const css::uno::Reference
< css::beans::XPropertySet
>& _xColumn
,
129 const OUString
& i_rOriginatingTableName
,
135 const css::uno::Reference
< css::beans::XPropertySet
>& _xColumn
,
140 virtual void construct() override
;
142 virtual css::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames( ) throw(css::uno::RuntimeException
, std::exception
) override
;
144 using OOrderColumn_BASE::createArrayHelper
;
149 #endif // INCLUDED_CONNECTIVITY_PCOLUMN_HXX
151 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */