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