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 _PQ_STATICS_HXX_
38 : #define _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 : #include "pq_allocator.hxx"
50 :
51 : namespace pq_sdbc_driver
52 : {
53 :
54 0 : struct ColumnMetaData
55 : {
56 0 : ColumnMetaData(
57 : const OUString &_columnName,
58 : const OUString &_tableName,
59 : const OUString &_schemaTableName,
60 : const OUString &_typeName,
61 : sal_Int32 _type,
62 : sal_Int32 _precision,
63 : sal_Int32 _scale,
64 : sal_Bool _isCurrency,
65 : sal_Bool _isNullable,
66 : sal_Bool _isAutoIncrement,
67 : sal_Bool _isReadOnly,
68 : sal_Bool _isSigned ) :
69 : columnName( _columnName ),
70 : tableName( _tableName ),
71 : schemaTableName( _schemaTableName ),
72 : typeName( _typeName ),
73 : type( _type ),
74 : precision( _precision ),
75 : scale( _scale ),
76 : isCurrency( _isCurrency ),
77 : isNullable( _isNullable ),
78 : isAutoIncrement( _isAutoIncrement ),
79 : isReadOnly( _isReadOnly ),
80 0 : isSigned( _isSigned )
81 0 : {}
82 :
83 : OUString columnName;
84 : OUString tableName;
85 : OUString schemaTableName;
86 : OUString typeName;
87 : sal_Int32 type;
88 : sal_Int32 precision;
89 : sal_Int32 scale;
90 : sal_Bool isCurrency;
91 : sal_Bool isNullable;
92 : sal_Bool isAutoIncrement;
93 : sal_Bool isReadOnly;
94 : sal_Bool isSigned;
95 : };
96 :
97 : typedef std::vector< ColumnMetaData, Allocator< ColumnMetaData > > ColumnMetaDataVector;
98 :
99 : struct TypeDetails
100 : {
101 : sal_Int32 dataType;
102 : sal_Int32 minScale;
103 : sal_Int32 maxScale; // in case nothing is given in getTypeInfo
104 : sal_Bool isAutoIncrement;
105 : sal_Bool isSearchable;
106 : };
107 :
108 : typedef ::boost::unordered_map
109 : <
110 : OUString,
111 : sal_Int32,
112 : OUStringHash,
113 : ::std::equal_to< OUString >,
114 : Allocator< ::std::pair< const OUString , sal_Int32 > >
115 : > BaseTypeMap;
116 :
117 :
118 :
119 0 : struct ImplementationStatics
120 : {
121 0 : ImplementationStatics() :
122 0 : pProps(0)
123 0 : {}
124 :
125 : OUString implName;
126 : com::sun::star::uno::Sequence< OUString > serviceNames;
127 : cppu::IPropertyArrayHelper *pProps;
128 : com::sun::star::uno::Sequence< com::sun::star::uno::Type > types;
129 : };
130 :
131 0 : struct ReflectionImplementations
132 : {
133 : struct ImplementationStatics table;
134 : struct ImplementationStatics tableDescriptor;
135 : struct ImplementationStatics column;
136 : struct ImplementationStatics columnDescriptor;
137 : struct ImplementationStatics key;
138 : struct ImplementationStatics keyDescriptor;
139 : struct ImplementationStatics keycolumn;
140 : struct ImplementationStatics keycolumnDescriptor;
141 : struct ImplementationStatics user;
142 : struct ImplementationStatics userDescriptor;
143 : struct ImplementationStatics view;
144 : struct ImplementationStatics viewDescriptor;
145 : struct ImplementationStatics index;
146 : struct ImplementationStatics indexDescriptor;
147 : struct ImplementationStatics indexColumn;
148 : struct ImplementationStatics indexColumnDescriptor;
149 :
150 : struct ImplementationStatics updateableResultSet;
151 : struct ImplementationStatics resultSet;
152 : };
153 :
154 : static const sal_Int32 TABLE_INDEX_CATALOG = 0;
155 : static const sal_Int32 TABLE_INDEX_SCHEMA = 1;
156 : static const sal_Int32 TABLE_INDEX_NAME = 2;
157 : static const sal_Int32 TABLE_INDEX_TYPE = 3;
158 : static const sal_Int32 TABLE_INDEX_REMARKS = 4;
159 :
160 0 : struct Statics
161 : {
162 : OUString SYSTEM_TABLE;
163 : OUString TABLE;
164 : OUString VIEW;
165 : OUString UNKNOWN;
166 : OUString YES;
167 : OUString NO;
168 : OUString NO_NULLS;
169 : OUString NULABLE;
170 : OUString NULLABLE_UNKNOWN;
171 : OUString SELECT;
172 : OUString UPDATE;
173 : OUString INSERT;
174 : OUString DELETE;
175 : OUString RULE;
176 : OUString REFERENCES;
177 : OUString TRIGGER;
178 : OUString EXECUTE;
179 : OUString USAGE;
180 : OUString CREATE;
181 : OUString TEMPORARY;
182 : OUString INDEX;
183 : OUString INDEX_COLUMN;
184 :
185 : OUString NAME;
186 : OUString SCHEMA_NAME;
187 : OUString CATALOG_NAME;
188 : OUString DESCRIPTION;
189 : OUString TYPE;
190 : OUString TYPE_NAME;
191 : OUString PRIVILEGES;
192 :
193 : OUString DEFAULT_VALUE;
194 : OUString IS_AUTO_INCREMENT;
195 : OUString IS_CURRENCY;
196 : OUString IS_NULLABLE;
197 : OUString IS_ROW_VERSISON;
198 : OUString PRECISION;
199 : OUString SCALE;
200 :
201 : OUString cPERCENT;
202 :
203 : OUString BEGIN;
204 : OUString ROLLBACK;
205 : OUString COMMIT;
206 :
207 : OUString KEY;
208 : OUString REFERENCED_TABLE;
209 : OUString UPDATE_RULE;
210 : OUString DELETE_RULE;
211 : OUString PRIVATE_COLUMNS;
212 : OUString PRIVATE_FOREIGN_COLUMNS;
213 :
214 : OUString KEY_COLUMN;
215 : OUString RELATED_COLUMN;
216 :
217 : OUString PASSWORD;
218 : OUString USER;
219 :
220 : OUString CURSOR_NAME;
221 : OUString ESCAPE_PROCESSING;
222 : OUString FETCH_DIRECTION;
223 : OUString FETCH_SIZE;
224 : OUString IS_BOOKMARKABLE;
225 : OUString RESULT_SET_CONCURRENCY;
226 : OUString RESULT_SET_TYPE;
227 :
228 : OUString COMMAND;
229 : OUString CHECK_OPTION;
230 :
231 : OUString TRUE;
232 : OUString FALSE;
233 :
234 : OUString IS_PRIMARY_KEY_INDEX;
235 : OUString IS_CLUSTERED;
236 : OUString IS_UNIQUE;
237 : OUString PRIVATE_COLUMN_INDEXES;
238 : OUString HELP_TEXT;
239 :
240 : OUString CATALOG;
241 : OUString IS_ASCENDING;
242 : ReflectionImplementations refl;
243 :
244 : com::sun::star::uno::Sequence< OUString > tablesRowNames;
245 : com::sun::star::uno::Sequence< OUString > columnRowNames;
246 : com::sun::star::uno::Sequence< OUString > primaryKeyNames;
247 : com::sun::star::uno::Sequence< OUString > tablePrivilegesNames;
248 : com::sun::star::uno::Sequence< OUString > schemaNames;
249 : com::sun::star::uno::Sequence< OUString > tableTypeNames;
250 : com::sun::star::uno::Sequence< OUString > typeinfoColumnNames;
251 : com::sun::star::uno::Sequence< OUString > indexinfoColumnNames;
252 : com::sun::star::uno::Sequence< OUString > importedKeysColumnNames;
253 : com::sun::star::uno::Sequence< OUString > resultSetArrayColumnNames;
254 : com::sun::star::uno::Sequence< com::sun::star::uno::Sequence< com::sun::star::uno::Any > > tableTypeData;
255 :
256 : ColumnMetaDataVector typeInfoMetaData;
257 : BaseTypeMap baseTypeMap;
258 0 : Statics(){}
259 : private:
260 : Statics( const Statics & );
261 : Statics & operator = ( const Statics & );
262 : };
263 :
264 : Statics & getStatics();
265 :
266 : }
267 : #endif
268 :
269 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|