Branch data Line data Source code
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 _CONNECTIVITY_PCOLUMN_HXX_
20 : : #define _CONNECTIVITY_PCOLUMN_HXX_
21 : :
22 : : #include "connectivity/dbtoolsdllapi.hxx"
23 : : #include "connectivity/sdbcx/VColumn.hxx"
24 : : #include "connectivity/CommonTools.hxx"
25 : : #include <rtl/ref.hxx>
26 : : #include <com/sun/star/sdbc/XResultSetMetaData.hpp>
27 : : #include <com/sun/star/sdbc/XDatabaseMetaData.hpp>
28 : : #include <com/sun/star/container/XNameAccess.hpp>
29 : : #include <comphelper/proparrhlp.hxx>
30 : :
31 : : namespace connectivity
32 : : {
33 : : namespace parse
34 : : {
35 : : class OParseColumn;
36 : :
37 : : typedef sdbcx::OColumn OParseColumn_BASE;
38 : : typedef ::comphelper::OPropertyArrayUsageHelper<OParseColumn> OParseColumn_PROP;
39 : :
40 : : class OOO_DLLPUBLIC_DBTOOLS OParseColumn :
41 : : public OParseColumn_BASE, public OParseColumn_PROP
42 : : {
43 : : ::rtl::OUString m_aRealName;
44 : : ::rtl::OUString m_aTableName;
45 : : ::rtl::OUString m_sLabel;
46 : : sal_Bool m_bFunction;
47 : : sal_Bool m_bDbasePrecisionChanged;
48 : : sal_Bool m_bAggregateFunction;
49 : : sal_Bool m_bIsSearchable;
50 : :
51 : : protected:
52 : : virtual ::cppu::IPropertyArrayHelper* createArrayHelper() const;
53 : : virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper();
54 : :
55 : : virtual ~OParseColumn();
56 : : public:
57 : : OParseColumn(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _xColumn,sal_Bool _bCase);
58 : : OParseColumn(const ::rtl::OUString& _Name,
59 : : const ::rtl::OUString& _TypeName,
60 : : const ::rtl::OUString& _DefaultValue,
61 : : const ::rtl::OUString& _Description,
62 : : sal_Int32 _IsNullable,
63 : : sal_Int32 _Precision,
64 : : sal_Int32 _Scale,
65 : : sal_Int32 _Type,
66 : : sal_Bool _IsAutoIncrement,
67 : : sal_Bool _IsCurrency,
68 : : sal_Bool _bCase);
69 : :
70 : : virtual void construct();
71 : :
72 : 3486 : void setRealName(const ::rtl::OUString& _rName) { m_aRealName = _rName; }
73 : 0 : void setLabel(const ::rtl::OUString& i_sLabel) { m_sLabel = i_sLabel; }
74 : 3448 : void setTableName(const ::rtl::OUString& _rName) { m_aTableName = _rName; }
75 : 0 : void setFunction(sal_Bool _bFunction) { m_bFunction = _bFunction; }
76 : 0 : void setAggregateFunction(sal_Bool _bFunction) { m_bAggregateFunction = _bFunction; }
77 : 0 : void setIsSearchable( sal_Bool _bIsSearchable ) { m_bIsSearchable = _bIsSearchable; }
78 : : void setDbasePrecisionChanged(sal_Bool _bDbasePrecisionChanged) { m_bDbasePrecisionChanged = _bDbasePrecisionChanged; }
79 : :
80 : 0 : ::rtl::OUString getRealName() const { return m_aRealName; }
81 : : ::rtl::OUString getLabel() const { return m_sLabel; }
82 : : ::rtl::OUString getTableName() const { return m_aTableName; }
83 : : sal_Bool getFunction() const { return m_bFunction; }
84 : : sal_Bool getDbasePrecisionChanged() const { return m_bDbasePrecisionChanged; }
85 : :
86 : : public:
87 : : /** creates a collection of OParseColumn, as described by a result set meta data instance.
88 : : */
89 : : static ::rtl::Reference< OSQLColumns >
90 : : createColumnsForResultSet(
91 : : const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData >& _rxResMetaData,
92 : : const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData >& _rxDBMetaData,
93 : : const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess>& i_xQueryColumns
94 : : );
95 : :
96 : : DECLARE_STL_USTRINGACCESS_MAP(int,StringMap);
97 : : /** creates a single OParseColumn, as described by a result set meta data instance.
98 : : The column names are unique.
99 : : */
100 : : static OParseColumn*
101 : : createColumnForResultSet(
102 : : const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData >& _rxResMetaData,
103 : : const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData >& _rxDBMetaData,
104 : : sal_Int32 _nColumnPos,
105 : : StringMap& _rColumns
106 : : );
107 : :
108 : : private:
109 : : using OParseColumn_BASE::createArrayHelper;
110 : : };
111 : :
112 : : class OOrderColumn;
113 : :
114 : : typedef sdbcx::OColumn OOrderColumn_BASE;
115 : : typedef ::comphelper::OPropertyArrayUsageHelper<OOrderColumn> OOrderColumn_PROP;
116 : :
117 : : class OOO_DLLPUBLIC_DBTOOLS OOrderColumn :
118 : : public OOrderColumn_BASE, public OOrderColumn_PROP
119 : : {
120 : : const sal_Bool m_bAscending;
121 : : const ::rtl::OUString m_sTableName;
122 : :
123 : : protected:
124 : : virtual ::cppu::IPropertyArrayHelper* createArrayHelper() const;
125 : : virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper();
126 : :
127 : : virtual ~OOrderColumn();
128 : : public:
129 : : OOrderColumn(
130 : : const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _xColumn,
131 : : const ::rtl::OUString& i_rOriginatingTableName,
132 : : sal_Bool _bCase,
133 : : sal_Bool _bAscending
134 : : );
135 : :
136 : : OOrderColumn(
137 : : const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _xColumn,
138 : : sal_Bool _bCase,
139 : : sal_Bool _bAscending
140 : : );
141 : :
142 : : virtual void construct();
143 : :
144 : : virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException);
145 : : private:
146 : : using OOrderColumn_BASE::createArrayHelper;
147 : : };
148 : : }
149 : : }
150 : :
151 : : #endif //_CONNECTIVITY_PCOLUMN_HXX_
152 : :
153 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|