Branch data 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 : : * Version: MPL 1.1 / GPLv3+ / LGPLv2.1+
32 : : *
33 : : * The contents of this file are subject to the Mozilla Public License Version
34 : : * 1.1 (the "License"); you may not use this file except in compliance with
35 : : * the License or as specified alternatively below. You may obtain a copy of
36 : : * the License at http://www.mozilla.org/MPL/
37 : : *
38 : : * Software distributed under the License is distributed on an "AS IS" basis,
39 : : * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
40 : : * for the specific language governing rights and limitations under the
41 : : * License.
42 : : *
43 : : * Major Contributor(s):
44 : : * [ Copyright (C) 2011 Lionel Elie Mamane <lionel@mamane.lu> ]
45 : : *
46 : : * All Rights Reserved.
47 : : *
48 : : * For minor contributions see the git repository.
49 : : *
50 : : * Alternatively, the contents of this file may be used under the terms of
51 : : * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
52 : : * the GNU Lesser General Public License Version 2.1 or later (the "LGPLv2.1+"),
53 : : * in which case the provisions of the GPLv3+ or the LGPLv2.1+ are applicable
54 : : * instead of those above.
55 : : *
56 : : ************************************************************************/
57 : :
58 : : #ifndef _PQ_STATICS_HXX_
59 : : #define _PQ_STATICS_HXX_
60 : :
61 : : #include <boost/unordered_map.hpp>
62 : : #include <vector>
63 : :
64 : : #include <rtl/uuid.h>
65 : :
66 : : #include <com/sun/star/uno/Any.hxx>
67 : : #include <com/sun/star/uno/Sequence.hxx>
68 : : #include <com/sun/star/sdbc/DataType.hpp>
69 : :
70 : : #include <cppuhelper/propshlp.hxx>
71 : :
72 : : #include "pq_allocator.hxx"
73 : :
74 : : namespace pq_sdbc_driver
75 : : {
76 : :
77 : 0 : struct ColumnMetaData
78 : : {
79 : 0 : ColumnMetaData(
80 : : const rtl::OUString &_columnName,
81 : : const rtl::OUString &_tableName,
82 : : const rtl::OUString &_schemaTableName,
83 : : const rtl::OUString &_typeName,
84 : : sal_Int32 _type,
85 : : sal_Int32 _precision,
86 : : sal_Int32 _scale,
87 : : sal_Bool _isCurrency,
88 : : sal_Bool _isNullable,
89 : : sal_Bool _isAutoIncrement,
90 : : sal_Bool _isReadOnly,
91 : : sal_Bool _isSigned ) :
92 : : columnName( _columnName ),
93 : : tableName( _tableName ),
94 : : schemaTableName( _schemaTableName ),
95 : : typeName( _typeName ),
96 : : type( _type ),
97 : : precision( _precision ),
98 : : scale( _scale ),
99 : : isCurrency( _isCurrency ),
100 : : isNullable( _isNullable ),
101 : : isAutoIncrement( _isAutoIncrement ),
102 : : isReadOnly( _isReadOnly ),
103 : 0 : isSigned( _isSigned )
104 : 0 : {}
105 : :
106 : : rtl::OUString columnName;
107 : : rtl::OUString tableName;
108 : : rtl::OUString schemaTableName;
109 : : rtl::OUString typeName;
110 : : sal_Int32 type;
111 : : sal_Int32 precision;
112 : : sal_Int32 scale;
113 : : sal_Bool isCurrency;
114 : : sal_Bool isNullable;
115 : : sal_Bool isAutoIncrement;
116 : : sal_Bool isReadOnly;
117 : : sal_Bool isSigned;
118 : : };
119 : :
120 : : typedef std::vector< ColumnMetaData, Allocator< ColumnMetaData > > ColumnMetaDataVector;
121 : :
122 : : struct TypeDetails
123 : : {
124 : : sal_Int32 dataType;
125 : : sal_Int32 minScale;
126 : : sal_Int32 maxScale; // in case nothing is given in getTypeInfo
127 : : sal_Bool isAutoIncrement;
128 : : sal_Bool isSearchable;
129 : : };
130 : :
131 : : typedef ::boost::unordered_map
132 : : <
133 : : rtl::OUString,
134 : : sal_Int32,
135 : : rtl::OUStringHash,
136 : : ::std::equal_to< rtl::OUString >,
137 : : Allocator< ::std::pair< const ::rtl::OUString , sal_Int32 > >
138 : : > BaseTypeMap;
139 : :
140 : :
141 : :
142 : 0 : struct ImplementationStatics
143 : : {
144 : 0 : ImplementationStatics() :
145 : 0 : implementationId( 16 )
146 : : {
147 : 0 : rtl_createUuid( (sal_uInt8*)implementationId.getArray(), 0 , sal_False );
148 : 0 : }
149 : :
150 : : rtl::OUString implName;
151 : : com::sun::star::uno::Sequence< ::rtl::OUString > serviceNames;
152 : : com::sun::star::uno::Sequence< sal_Int8 > implementationId;
153 : : cppu::IPropertyArrayHelper *pProps;
154 : : com::sun::star::uno::Sequence< com::sun::star::uno::Type > types;
155 : : };
156 : :
157 : 0 : struct ReflectionImplementations
158 : : {
159 : : struct ImplementationStatics table;
160 : : struct ImplementationStatics tableDescriptor;
161 : : struct ImplementationStatics column;
162 : : struct ImplementationStatics columnDescriptor;
163 : : struct ImplementationStatics key;
164 : : struct ImplementationStatics keyDescriptor;
165 : : struct ImplementationStatics keycolumn;
166 : : struct ImplementationStatics keycolumnDescriptor;
167 : : struct ImplementationStatics user;
168 : : struct ImplementationStatics userDescriptor;
169 : : struct ImplementationStatics view;
170 : : struct ImplementationStatics viewDescriptor;
171 : : struct ImplementationStatics index;
172 : : struct ImplementationStatics indexDescriptor;
173 : : struct ImplementationStatics indexColumn;
174 : : struct ImplementationStatics indexColumnDescriptor;
175 : :
176 : : struct ImplementationStatics updateableResultSet;
177 : : struct ImplementationStatics resultSet;
178 : : };
179 : :
180 : : static const sal_Int32 TABLE_INDEX_CATALOG = 0;
181 : : static const sal_Int32 TABLE_INDEX_SCHEMA = 1;
182 : : static const sal_Int32 TABLE_INDEX_NAME = 2;
183 : : static const sal_Int32 TABLE_INDEX_TYPE = 3;
184 : : static const sal_Int32 TABLE_INDEX_REMARKS = 4;
185 : :
186 : 0 : struct Statics
187 : : {
188 : : ::rtl::OUString SYSTEM_TABLE;
189 : : ::rtl::OUString TABLE;
190 : : ::rtl::OUString VIEW;
191 : : ::rtl::OUString UNKNOWN;
192 : : ::rtl::OUString YES;
193 : : ::rtl::OUString NO;
194 : : ::rtl::OUString NO_NULLS;
195 : : ::rtl::OUString NULABLE;
196 : : ::rtl::OUString NULLABLE_UNKNOWN;
197 : : ::rtl::OUString SELECT;
198 : : ::rtl::OUString UPDATE;
199 : : ::rtl::OUString INSERT;
200 : : ::rtl::OUString DELETE;
201 : : ::rtl::OUString RULE;
202 : : ::rtl::OUString REFERENCES;
203 : : ::rtl::OUString TRIGGER;
204 : : ::rtl::OUString EXECUTE;
205 : : ::rtl::OUString USAGE;
206 : : ::rtl::OUString CREATE;
207 : : ::rtl::OUString TEMPORARY;
208 : : ::rtl::OUString INDEX;
209 : : ::rtl::OUString INDEX_COLUMN;
210 : :
211 : : ::rtl::OUString NAME;
212 : : ::rtl::OUString SCHEMA_NAME;
213 : : ::rtl::OUString CATALOG_NAME;
214 : : ::rtl::OUString DESCRIPTION;
215 : : ::rtl::OUString TYPE;
216 : : ::rtl::OUString TYPE_NAME;
217 : : ::rtl::OUString PRIVILEGES;
218 : :
219 : : ::rtl::OUString DEFAULT_VALUE;
220 : : ::rtl::OUString IS_AUTO_INCREMENT;
221 : : ::rtl::OUString IS_CURRENCY;
222 : : ::rtl::OUString IS_NULLABLE;
223 : : ::rtl::OUString IS_ROW_VERSISON;
224 : : ::rtl::OUString PRECISION;
225 : : ::rtl::OUString SCALE;
226 : :
227 : : ::rtl::OUString cPERCENT;
228 : :
229 : : ::rtl::OUString BEGIN;
230 : : ::rtl::OUString ROLLBACK;
231 : : ::rtl::OUString COMMIT;
232 : :
233 : : ::rtl::OUString KEY;
234 : : ::rtl::OUString REFERENCED_TABLE;
235 : : ::rtl::OUString UPDATE_RULE;
236 : : ::rtl::OUString DELETE_RULE;
237 : : ::rtl::OUString PRIVATE_COLUMNS;
238 : : ::rtl::OUString PRIVATE_FOREIGN_COLUMNS;
239 : :
240 : : ::rtl::OUString KEY_COLUMN;
241 : : ::rtl::OUString RELATED_COLUMN;
242 : :
243 : : ::rtl::OUString PASSWORD;
244 : : ::rtl::OUString USER;
245 : :
246 : : ::rtl::OUString CURSOR_NAME;
247 : : ::rtl::OUString ESCAPE_PROCESSING;
248 : : ::rtl::OUString FETCH_DIRECTION;
249 : : ::rtl::OUString FETCH_SIZE;
250 : : ::rtl::OUString IS_BOOKMARKABLE;
251 : : ::rtl::OUString RESULT_SET_CONCURRENCY;
252 : : ::rtl::OUString RESULT_SET_TYPE;
253 : :
254 : : ::rtl::OUString COMMAND;
255 : : ::rtl::OUString CHECK_OPTION;
256 : :
257 : : ::rtl::OUString TRUE;
258 : : ::rtl::OUString FALSE;
259 : :
260 : : ::rtl::OUString IS_PRIMARY_KEY_INDEX;
261 : : ::rtl::OUString IS_CLUSTERED;
262 : : ::rtl::OUString IS_UNIQUE;
263 : : ::rtl::OUString PRIVATE_COLUMN_INDEXES;
264 : : ::rtl::OUString HELP_TEXT;
265 : :
266 : : ::rtl::OUString CATALOG;
267 : : ::rtl::OUString IS_ASCENDING;
268 : : ReflectionImplementations refl;
269 : :
270 : : com::sun::star::uno::Sequence< ::rtl::OUString > tablesRowNames;
271 : : com::sun::star::uno::Sequence< ::rtl::OUString > columnRowNames;
272 : : com::sun::star::uno::Sequence< ::rtl::OUString > primaryKeyNames;
273 : : com::sun::star::uno::Sequence< ::rtl::OUString > tablePrivilegesNames;
274 : : com::sun::star::uno::Sequence< ::rtl::OUString > schemaNames;
275 : : com::sun::star::uno::Sequence< ::rtl::OUString > tableTypeNames;
276 : : com::sun::star::uno::Sequence< ::rtl::OUString > typeinfoColumnNames;
277 : : com::sun::star::uno::Sequence< ::rtl::OUString > indexinfoColumnNames;
278 : : com::sun::star::uno::Sequence< ::rtl::OUString > importedKeysColumnNames;
279 : : com::sun::star::uno::Sequence< ::rtl::OUString > resultSetArrayColumnNames;
280 : : com::sun::star::uno::Sequence< com::sun::star::uno::Sequence< com::sun::star::uno::Any > > tableTypeData;
281 : :
282 : : ColumnMetaDataVector typeInfoMetaData;
283 : : BaseTypeMap baseTypeMap;
284 : 0 : Statics(){}
285 : : private:
286 : : Statics( const Statics & );
287 : : Statics & operator = ( const Statics & );
288 : : };
289 : :
290 : : Statics & getStatics();
291 : :
292 : : }
293 : : #endif
|