Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*************************************************************************
3 : *
4 : * Effective License of whole file:
5 : *
6 : * This library is free software; you can redistribute it and/or
7 : * modify it under the terms of the GNU Lesser General Public
8 : * License version 2.1, as published by the Free Software Foundation.
9 : *
10 : * This library is distributed in the hope that it will be useful,
11 : * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 : * Lesser General Public License for more details.
14 : *
15 : * You should have received a copy of the GNU Lesser General Public
16 : * License along with this library; if not, write to the Free Software
17 : * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
18 : * MA 02111-1307 USA
19 : *
20 : * Parts "Copyright by Sun Microsystems, Inc" prior to August 2011:
21 : *
22 : * The Contents of this file are made available subject to the terms of
23 : * the GNU Lesser General Public License Version 2.1
24 : *
25 : * Copyright: 2000 by Sun Microsystems, Inc.
26 : *
27 : * Contributor(s): Joerg Budischewski
28 : *
29 : * All parts contributed on or after August 2011:
30 : *
31 : * This Source Code Form is subject to the terms of the Mozilla Public
32 : * License, v. 2.0. If a copy of the MPL was not distributed with this
33 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
34 : *
35 : ************************************************************************/
36 :
37 : #ifndef INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_POSTGRESQL_PQ_STATICS_HXX
38 : #define INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_POSTGRESQL_PQ_STATICS_HXX
39 :
40 : #include <boost/unordered_map.hpp>
41 : #include <vector>
42 :
43 : #include <com/sun/star/uno/Any.hxx>
44 : #include <com/sun/star/uno/Sequence.hxx>
45 : #include <com/sun/star/sdbc/DataType.hpp>
46 :
47 : #include <cppuhelper/propshlp.hxx>
48 :
49 : namespace pq_sdbc_driver
50 : {
51 :
52 0 : struct ColumnMetaData
53 : {
54 0 : ColumnMetaData(
55 : const OUString &_columnName,
56 : const OUString &_tableName,
57 : const OUString &_schemaTableName,
58 : const OUString &_typeName,
59 : sal_Int32 _type,
60 : sal_Int32 _precision,
61 : sal_Int32 _scale,
62 : bool _isCurrency,
63 : bool _isNullable,
64 : bool _isAutoIncrement,
65 : bool _isReadOnly,
66 : bool _isSigned ) :
67 : columnName( _columnName ),
68 : tableName( _tableName ),
69 : schemaTableName( _schemaTableName ),
70 : typeName( _typeName ),
71 : type( _type ),
72 : precision( _precision ),
73 : scale( _scale ),
74 : isCurrency( _isCurrency ),
75 : isNullable( _isNullable ),
76 : isAutoIncrement( _isAutoIncrement ),
77 : isReadOnly( _isReadOnly ),
78 0 : isSigned( _isSigned )
79 0 : {}
80 :
81 : OUString columnName;
82 : OUString tableName;
83 : OUString schemaTableName;
84 : OUString typeName;
85 : sal_Int32 type;
86 : sal_Int32 precision;
87 : sal_Int32 scale;
88 : bool isCurrency;
89 : bool isNullable;
90 : bool isAutoIncrement;
91 : bool isReadOnly;
92 : bool isSigned;
93 : };
94 :
95 : typedef std::vector< ColumnMetaData > ColumnMetaDataVector;
96 :
97 : struct TypeDetails
98 : {
99 : sal_Int32 dataType;
100 : sal_Int32 minScale;
101 : sal_Int32 maxScale; // in case nothing is given in getTypeInfo
102 : bool isAutoIncrement;
103 : bool isSearchable;
104 : };
105 :
106 : typedef ::boost::unordered_map
107 : <
108 : OUString,
109 : sal_Int32,
110 : OUStringHash,
111 : ::std::equal_to< OUString >
112 : > BaseTypeMap;
113 :
114 :
115 :
116 0 : struct ImplementationStatics
117 : {
118 0 : ImplementationStatics() :
119 0 : pProps(0)
120 0 : {}
121 :
122 : OUString implName;
123 : com::sun::star::uno::Sequence< OUString > serviceNames;
124 : cppu::IPropertyArrayHelper *pProps;
125 : com::sun::star::uno::Sequence< com::sun::star::uno::Type > types;
126 : };
127 :
128 0 : struct ReflectionImplementations
129 : {
130 : struct ImplementationStatics table;
131 : struct ImplementationStatics tableDescriptor;
132 : struct ImplementationStatics column;
133 : struct ImplementationStatics columnDescriptor;
134 : struct ImplementationStatics key;
135 : struct ImplementationStatics keyDescriptor;
136 : struct ImplementationStatics keycolumn;
137 : struct ImplementationStatics keycolumnDescriptor;
138 : struct ImplementationStatics user;
139 : struct ImplementationStatics userDescriptor;
140 : struct ImplementationStatics view;
141 : struct ImplementationStatics viewDescriptor;
142 : struct ImplementationStatics index;
143 : struct ImplementationStatics indexDescriptor;
144 : struct ImplementationStatics indexColumn;
145 : struct ImplementationStatics indexColumnDescriptor;
146 :
147 : struct ImplementationStatics updateableResultSet;
148 : struct ImplementationStatics resultSet;
149 : };
150 :
151 : static const sal_Int32 TABLE_INDEX_CATALOG = 0;
152 : static const sal_Int32 TABLE_INDEX_SCHEMA = 1;
153 : static const sal_Int32 TABLE_INDEX_NAME = 2;
154 : static const sal_Int32 TABLE_INDEX_TYPE = 3;
155 : static const sal_Int32 TABLE_INDEX_REMARKS = 4;
156 :
157 0 : struct Statics
158 : {
159 : OUString SYSTEM_TABLE;
160 : OUString TABLE;
161 : OUString VIEW;
162 : OUString UNKNOWN;
163 : OUString YES;
164 : OUString NO;
165 : OUString NO_NULLS;
166 : OUString NULABLE;
167 : OUString NULLABLE_UNKNOWN;
168 : OUString SELECT;
169 : OUString UPDATE;
170 : OUString INSERT;
171 : OUString DELETE;
172 : OUString RULE;
173 : OUString REFERENCES;
174 : OUString TRIGGER;
175 : OUString EXECUTE;
176 : OUString USAGE;
177 : OUString CREATE;
178 : OUString TEMPORARY;
179 : OUString INDEX;
180 : OUString INDEX_COLUMN;
181 :
182 : OUString NAME;
183 : OUString SCHEMA_NAME;
184 : OUString CATALOG_NAME;
185 : OUString DESCRIPTION;
186 : OUString TYPE;
187 : OUString TYPE_NAME;
188 : OUString PRIVILEGES;
189 :
190 : OUString DEFAULT_VALUE;
191 : OUString IS_AUTO_INCREMENT;
192 : OUString IS_CURRENCY;
193 : OUString IS_NULLABLE;
194 : OUString IS_ROW_VERSISON;
195 : OUString PRECISION;
196 : OUString SCALE;
197 :
198 : OUString cPERCENT;
199 :
200 : OUString BEGIN;
201 : OUString ROLLBACK;
202 : OUString COMMIT;
203 :
204 : OUString KEY;
205 : OUString REFERENCED_TABLE;
206 : OUString UPDATE_RULE;
207 : OUString DELETE_RULE;
208 : OUString PRIVATE_COLUMNS;
209 : OUString PRIVATE_FOREIGN_COLUMNS;
210 :
211 : OUString KEY_COLUMN;
212 : OUString RELATED_COLUMN;
213 :
214 : OUString PASSWORD;
215 : OUString USER;
216 :
217 : OUString CURSOR_NAME;
218 : OUString ESCAPE_PROCESSING;
219 : OUString FETCH_DIRECTION;
220 : OUString FETCH_SIZE;
221 : OUString IS_BOOKMARKABLE;
222 : OUString RESULT_SET_CONCURRENCY;
223 : OUString RESULT_SET_TYPE;
224 :
225 : OUString COMMAND;
226 : OUString CHECK_OPTION;
227 :
228 : OUString TRUE;
229 : OUString FALSE;
230 :
231 : OUString IS_PRIMARY_KEY_INDEX;
232 : OUString IS_CLUSTERED;
233 : OUString IS_UNIQUE;
234 : OUString PRIVATE_COLUMN_INDEXES;
235 : OUString HELP_TEXT;
236 :
237 : OUString CATALOG;
238 : OUString IS_ASCENDING;
239 : ReflectionImplementations refl;
240 :
241 : com::sun::star::uno::Sequence< OUString > tablesRowNames;
242 : com::sun::star::uno::Sequence< OUString > columnRowNames;
243 : com::sun::star::uno::Sequence< OUString > primaryKeyNames;
244 : com::sun::star::uno::Sequence< OUString > tablePrivilegesNames;
245 : com::sun::star::uno::Sequence< OUString > schemaNames;
246 : com::sun::star::uno::Sequence< OUString > tableTypeNames;
247 : com::sun::star::uno::Sequence< OUString > typeinfoColumnNames;
248 : com::sun::star::uno::Sequence< OUString > indexinfoColumnNames;
249 : com::sun::star::uno::Sequence< OUString > importedKeysColumnNames;
250 : com::sun::star::uno::Sequence< OUString > resultSetArrayColumnNames;
251 : com::sun::star::uno::Sequence< com::sun::star::uno::Sequence< com::sun::star::uno::Any > > tableTypeData;
252 :
253 : ColumnMetaDataVector typeInfoMetaData;
254 : BaseTypeMap baseTypeMap;
255 0 : Statics(){}
256 : private:
257 : Statics( const Statics & );
258 : Statics & operator = ( const Statics & );
259 : };
260 :
261 : Statics & getStatics();
262 :
263 : }
264 : #endif
265 :
266 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|