1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * Effective License of whole file:
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.
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.
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,
20 * Parts "Copyright by Sun Microsystems, Inc" prior to August 2011:
22 * The Contents of this file are made available subject to the terms of
23 * the GNU Lesser General Public License Version 2.1
25 * Copyright: 2000 by Sun Microsystems, Inc.
27 * Contributor(s): Joerg Budischewski
29 * All parts contributed on or after August 2011:
31 * Version: MPL 1.1 / GPLv3+ / LGPLv2.1+
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/
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
43 * Major Contributor(s):
44 * [ Copyright (C) 2011 Lionel Elie Mamane <lionel@mamane.lu> ]
46 * All Rights Reserved.
48 * For minor contributions see the git repository.
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.
56 ************************************************************************/
58 #ifndef _PQ_STATICS_HXX_
59 #define _PQ_STATICS_HXX_
61 #include <boost/unordered_map.hpp>
66 #include <com/sun/star/uno/Any.hxx>
67 #include <com/sun/star/uno/Sequence.hxx>
68 #include <com/sun/star/sdbc/DataType.hpp>
70 #include <cppuhelper/propshlp.hxx>
72 #include "pq_allocator.hxx"
74 namespace pq_sdbc_driver
80 const rtl::OUString
&_columnName
,
81 const rtl::OUString
&_tableName
,
82 const rtl::OUString
&_schemaTableName
,
83 const rtl::OUString
&_typeName
,
89 sal_Bool _isAutoIncrement
,
91 sal_Bool _isSigned
) :
92 columnName( _columnName
),
93 tableName( _tableName
),
94 schemaTableName( _schemaTableName
),
95 typeName( _typeName
),
97 precision( _precision
),
99 isCurrency( _isCurrency
),
100 isNullable( _isNullable
),
101 isAutoIncrement( _isAutoIncrement
),
102 isReadOnly( _isReadOnly
),
103 isSigned( _isSigned
)
106 rtl::OUString columnName
;
107 rtl::OUString tableName
;
108 rtl::OUString schemaTableName
;
109 rtl::OUString typeName
;
115 sal_Bool isAutoIncrement
;
120 typedef std::vector
< ColumnMetaData
, Allocator
< ColumnMetaData
> > ColumnMetaDataVector
;
126 sal_Int32 maxScale
; // in case nothing is given in getTypeInfo
127 sal_Bool isAutoIncrement
;
128 sal_Bool isSearchable
;
131 typedef ::boost::unordered_map
136 ::std::equal_to
< rtl::OUString
>,
137 Allocator
< ::std::pair
< const ::rtl::OUString
, sal_Int32
> >
142 struct ImplementationStatics
144 ImplementationStatics() :
145 implementationId( 16 )
147 rtl_createUuid( (sal_uInt8
*)implementationId
.getArray(), 0 , sal_False
);
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
;
157 struct ReflectionImplementations
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
;
176 struct ImplementationStatics updateableResultSet
;
177 struct ImplementationStatics resultSet
;
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;
188 ::rtl::OUString SYSTEM_TABLE
;
189 ::rtl::OUString TABLE
;
190 ::rtl::OUString VIEW
;
191 ::rtl::OUString UNKNOWN
;
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
;
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
;
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
;
227 ::rtl::OUString cPERCENT
;
229 ::rtl::OUString BEGIN
;
230 ::rtl::OUString ROLLBACK
;
231 ::rtl::OUString COMMIT
;
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
;
240 ::rtl::OUString KEY_COLUMN
;
241 ::rtl::OUString RELATED_COLUMN
;
243 ::rtl::OUString PASSWORD
;
244 ::rtl::OUString USER
;
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
;
254 ::rtl::OUString COMMAND
;
255 ::rtl::OUString CHECK_OPTION
;
257 ::rtl::OUString TRUE
;
258 ::rtl::OUString FALSE
;
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
;
266 ::rtl::OUString CATALOG
;
267 ::rtl::OUString IS_ASCENDING
;
268 ReflectionImplementations refl
;
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
;
282 ColumnMetaDataVector typeInfoMetaData
;
283 BaseTypeMap baseTypeMap
;
286 Statics( const Statics
& );
287 Statics
& operator = ( const Statics
& );
290 Statics
& getStatics();