LibreOffice Module connectivity (master) 1
pq_statics.cxx
Go to the documentation of this file.
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#include "pq_statics.hxx"
38#include <com/sun/star/sdbc/DataType.hpp>
39#include <com/sun/star/beans/PropertyAttribute.hpp>
40#include <utility>
41
43using com::sun::star::uno::Any;
44using com::sun::star::uno::Type;
45
46using com::sun::star::beans::PropertyAttribute::READONLY;
47using com::sun::star::beans::Property;
48
49namespace pq_sdbc_driver
50{
51
52namespace {
53
54struct DefColumnMetaData
55{
56 const char * columnName;
57 const char * tableName;
58 const char * schemaTableName;
59 const char * typeName;
60 sal_Int32 type;
61 sal_Int32 precision;
62 sal_Int32 scale;
66};
67
68struct BaseTypeDef { const char * typeName; sal_Int32 value; };
69
70struct PropertyDef
71{
72 PropertyDef( OUString str, const Type &t )
73 : name(std::move( str )) , type( t ) {}
74 OUString name;
75 css::uno::Type type;
76};
77
78struct PropertyDefEx : public PropertyDef
79{
80 PropertyDefEx( const OUString & str, const Type &t , sal_Int32 a )
81 : PropertyDef( str, t ) , attribute( a )
82 {}
83 sal_Int32 attribute;
84};
85
86}
87
89 PropertyDef const *props, int count , sal_Int16 attr )
90{
92 auto seqRange = asNonConstRange(seq);
93 for( int i = 0 ; i < count ; i ++ )
94 {
95 seqRange[i] = Property( props[i].name, i, props[i].type, attr );
96 }
97 return new cppu::OPropertyArrayHelper( seq, true );
98}
99
101 PropertyDefEx const *props, int count )
102{
104 auto seqRange = asNonConstRange(seq);
105 for( int i = 0 ; i < count ; i ++ )
106 {
107 seqRange[i] = Property( props[i].name, i, props[i].type, props[i].attribute );
108 }
109 return new cppu::OPropertyArrayHelper( seq, true );
110}
111
113{
114 static Statics* p = []() {
115 static Statics statics ;
116 statics.SYSTEM_TABLE = "SYSTEM TABLE";
117 statics.TABLE = "TABLE";
118 statics.VIEW = "VIEW";
119 statics.UNKNOWN = "UNKNOWN";
120 statics.YES = "YES";
121 statics.NO = "NO";
122 statics.NO_NULLS = "NO_NULLS";
123 statics.NULABLE = "NULABLE";
124 statics.NULLABLE_UNKNOWN = "NULLABLE_UNKNOWN";
125
126 statics.TYPE = "Type";
127 statics.TYPE_NAME = "TypeName";
128 statics.NAME = "Name";
129 statics.SCHEMA_NAME = "SchemaName";
130 statics.CATALOG_NAME = "CatalogName";
131 statics.DESCRIPTION = "Description";
132 statics.PRIVILEGES = "Privileges";
133
134 statics.DEFAULT_VALUE = "DefaultValue";
135 statics.IS_AUTO_INCREMENT = "IsAutoIncrement";
136 statics.IS_CURRENCY = "IsCurrency";
137 statics.IS_NULLABLE = "IsNullable";
138 statics.IS_ROW_VERSISON = "IsRowVersion";
139 statics.PRECISION = "Precision";
140 statics.SCALE = "Scale";
141
142 statics.cPERCENT = "%";
143 statics.BEGIN = "BEGIN";
144 statics.COMMIT = "COMMIT";
145 statics.ROLLBACK = "ROLLBACK";
146
147 statics.KEY = "Key";
148 statics.REFERENCED_TABLE = "ReferencedTable";
149 statics.UPDATE_RULE = "UpdateRule";
150 statics.DELETE_RULE = "DeleteRule";
151 statics.PRIVATE_COLUMNS = "PrivateColumns";
152 statics.PRIVATE_FOREIGN_COLUMNS = "PrivateForeignColumns";
153
154 statics.KEY_COLUMN = "KeyColumn";
155 statics.RELATED_COLUMN = "RelatedColumn";
156 statics.PASSWORD = "Password";
157 statics.USER = "User";
158
159 statics.CURSOR_NAME = "CursorName";
160 statics.ESCAPE_PROCESSING = "EscapeProcessing";
161 statics.FETCH_DIRECTION = "FetchDirection";
162 statics.FETCH_SIZE = "FetchSize";
163 statics.IS_BOOKMARKABLE = "IsBookmarkable";
164 statics.RESULT_SET_CONCURRENCY = "ResultSetConcurrency";
165 statics.RESULT_SET_TYPE = "ResultSetType";
166
167 statics.COMMAND = "Command";
168 statics.CHECK_OPTION = "CheckOption";
169
170 statics.TRUE = "t";
171 statics.FALSE = "f";
172 statics.IS_PRIMARY_KEY_INDEX = "IsPrimaryKeyIndex";
173 statics.IS_CLUSTERED = "IsClustered";
174 statics.IS_UNIQUE = "IsUnique";
175 statics.IS_ASCENDING = "IsAscending";
176 statics.PRIVATE_COLUMN_INDEXES = "PrivateColumnIndexes";
177 statics.HELP_TEXT = "HelpText";
178
179 statics.CATALOG = "Catalog";
180
184 Type tStringSequence = cppu::UnoType<css::uno::Sequence< OUString >>::get();
185
186 // Table props set
187 ImplementationStatics &ist = statics.refl.table;
188 ist.implName = "org.openoffice.comp.pq.sdbcx.Table";
189 ist.serviceNames = { "com.sun.star.sdbcx.Table" };
190 PropertyDef tableDef[] =
191 {
192 PropertyDef( statics.CATALOG_NAME , tString ),
193 PropertyDef( statics.DESCRIPTION , tString ),
194 PropertyDef( statics.NAME , tString ),
195 PropertyDef( statics.PRIVILEGES , tInt ),
196 PropertyDef( statics.SCHEMA_NAME , tString ),
197 PropertyDef( statics.TYPE , tString )
198 };
200 tableDef, std::size(tableDef), READONLY );
201
203 "org.openoffice.comp.pq.sdbcx.TableDescriptor";
204 statics.refl.tableDescriptor.serviceNames = { "com.sun.star.sdbcx.TableDescriptor" };
205 PropertyDef tableDescDef[] =
206 {
207 PropertyDef( statics.CATALOG_NAME , tString ),
208 PropertyDef( statics.DESCRIPTION , tString ),
209 PropertyDef( statics.NAME , tString ),
210 PropertyDef( statics.PRIVILEGES , tInt ),
211 PropertyDef( statics.SCHEMA_NAME , tString )
212 };
214 tableDescDef, std::size(tableDescDef), 0 );
215
216 // Column props set
217 statics.refl.column.implName = "org.openoffice.comp.pq.sdbcx.Column";
218 statics.refl.column.serviceNames = { "com.sun.star.sdbcx.Column" };
219 PropertyDefEx columnDef[] =
220 {
221 PropertyDefEx( statics.CATALOG_NAME , tString, READONLY ),
222 PropertyDefEx( statics.DEFAULT_VALUE, tString, READONLY ),
223 PropertyDefEx( statics.DESCRIPTION , tString, READONLY ),
224// PropertyDefEx( statics.HELP_TEXT , tString, BOUND ),
225 PropertyDefEx( statics.IS_AUTO_INCREMENT, tBool, READONLY ),
226 PropertyDefEx( statics.IS_CURRENCY, tBool, READONLY ),
227 PropertyDefEx( statics.IS_NULLABLE, tInt, READONLY ),
228 PropertyDefEx( statics.IS_ROW_VERSISON, tBool,READONLY ),
229 PropertyDefEx( statics.NAME , tString,READONLY ),
230 PropertyDefEx( statics.PRECISION , tInt, READONLY ),
231 PropertyDefEx( statics.SCALE , tInt ,READONLY),
232 PropertyDefEx( statics.TYPE , tInt ,READONLY),
233 PropertyDefEx( statics.TYPE_NAME , tString ,READONLY)
234 };
236 columnDef, std::size(columnDef) );
237
239 "org.openoffice.comp.pq.sdbcx.ColumnDescriptor";
240 statics.refl.columnDescriptor.serviceNames = { "com.sun.star.sdbcx.ColumnDescriptor" };
241 PropertyDef columnDescDef[] =
242 {
243 PropertyDef( statics.CATALOG_NAME , tString ),
244 PropertyDef( statics.DEFAULT_VALUE, tString ),
245 PropertyDef( statics.DESCRIPTION , tString ),
246// PropertyDef( statics.HELP_TEXT , tString ),
247 PropertyDef( statics.IS_AUTO_INCREMENT, tBool ),
248 PropertyDef( statics.IS_CURRENCY, tBool ),
249 PropertyDef( statics.IS_NULLABLE, tInt ),
250 PropertyDef( statics.IS_ROW_VERSISON, tBool ),
251 PropertyDef( statics.NAME , tString ),
252 PropertyDef( statics.PRECISION , tInt ),
253 PropertyDef( statics.SCALE , tInt ),
254 PropertyDef( statics.TYPE , tInt ),
255 PropertyDef( statics.TYPE_NAME , tString )
256 };
257
259 columnDescDef, std::size(columnDescDef), 0 );
260
261 // Key properties
262 statics.refl.key.implName = "org.openoffice.comp.pq.sdbcx.Key";
263 statics.refl.key.serviceNames = { "com.sun.star.sdbcx.Key" };
264 PropertyDef keyDef[] =
265 {
266 PropertyDef( statics.DELETE_RULE, tInt ),
267 PropertyDef( statics.NAME, tString ),
268 PropertyDef( statics.PRIVATE_COLUMNS, tStringSequence ),
269 PropertyDef( statics.PRIVATE_FOREIGN_COLUMNS, tStringSequence ),
270 PropertyDef( statics.REFERENCED_TABLE, tString ),
271 PropertyDef( statics.TYPE, tInt ),
272 PropertyDef( statics.UPDATE_RULE, tInt )
273 };
275 keyDef, std::size(keyDef), READONLY );
276
277
278 // Key properties
279 statics.refl.keyDescriptor.implName =
280 "org.openoffice.comp.pq.sdbcx.KeyDescriptor";
281 statics.refl.keyDescriptor.serviceNames = { "com.sun.star.sdbcx.KeyDescriptor" };
282 PropertyDef keyDescDef[] =
283 {
284 PropertyDef( statics.DELETE_RULE, tInt ),
285 PropertyDef( statics.NAME, tString ),
286 PropertyDef( statics.REFERENCED_TABLE, tString ),
287 PropertyDef( statics.TYPE, tInt ),
288 PropertyDef( statics.UPDATE_RULE, tInt )
289 };
291 keyDescDef, std::size(keyDescDef), 0 );
292
293
294 // KeyColumn props set
295 statics.refl.keycolumn.implName = "org.openoffice.comp.pq.sdbcx.KeyColumn";
296 statics.refl.keycolumn.serviceNames = { "com.sun.star.sdbcx.KeyColumn" };
297 PropertyDef keycolumnDef[] =
298 {
299 PropertyDef( statics.CATALOG_NAME , tString ),
300 PropertyDef( statics.DEFAULT_VALUE, tString ),
301 PropertyDef( statics.DESCRIPTION , tString ),
302 PropertyDef( statics.IS_AUTO_INCREMENT, tBool ),
303 PropertyDef( statics.IS_CURRENCY, tBool ),
304 PropertyDef( statics.IS_NULLABLE, tInt ),
305 PropertyDef( statics.IS_ROW_VERSISON, tBool ),
306 PropertyDef( statics.NAME , tString ),
307 PropertyDef( statics.PRECISION , tInt ),
308 PropertyDef( statics.RELATED_COLUMN, tString ),
309 PropertyDef( statics.SCALE , tInt ),
310 PropertyDef( statics.TYPE , tInt ),
311 PropertyDef( statics.TYPE_NAME , tString )
312 };
314 keycolumnDef, std::size(keycolumnDef), READONLY );
315
316 // KeyColumn props set
318 "org.openoffice.comp.pq.sdbcx.KeyColumnDescriptor";
320 { "com.sun.star.sdbcx.KeyColumnDescriptor" };
321 PropertyDef keycolumnDescDef[] =
322 {
323 PropertyDef( statics.NAME , tString ),
324 PropertyDef( statics.RELATED_COLUMN, tString )
325 };
327 keycolumnDescDef, std::size(keycolumnDescDef), 0 );
328
329 // view props set
330 statics.refl.view.implName = "org.openoffice.comp.pq.sdbcx.View";
331 statics.refl.view.serviceNames = { "com.sun.star.sdbcx.View" };
332 PropertyDef viewDef[] =
333 {
334 PropertyDef( statics.CATALOG_NAME , tString ),
335 PropertyDef( statics.CHECK_OPTION , tInt ),
336 PropertyDef( statics.COMMAND , tString ),
337 PropertyDef( statics.NAME , tString ),
338 PropertyDef( statics.SCHEMA_NAME , tString )
339 };
341 viewDef, std::size(viewDef), READONLY );
342
343 // view props set
344 statics.refl.viewDescriptor.implName = "org.openoffice.comp.pq.sdbcx.ViewDescriptor";
345 statics.refl.viewDescriptor.serviceNames = { "com.sun.star.sdbcx.ViewDescriptor" };
347 viewDef, std::size(viewDef), 0 ); // reuse view, as it is identical
348 // user props set
349 statics.refl.user.implName = "org.openoffice.comp.pq.sdbcx.User";
350 statics.refl.user.serviceNames = { "com.sun.star.sdbcx.User" };
351 PropertyDef userDefRO[] =
352 {
353 PropertyDef( statics.NAME , tString )
354 };
356 userDefRO, std::size(userDefRO), READONLY );
357
358 // user props set
360 "org.openoffice.comp.pq.sdbcx.UserDescriptor";
361 statics.refl.userDescriptor.serviceNames = { "com.sun.star.sdbcx.UserDescriptor" };
362 PropertyDef userDefWR[] =
363 {
364 PropertyDef( statics.NAME , tString ),
365 PropertyDef( statics.PASSWORD , tString )
366 };
368 userDefWR, std::size(userDefWR), 0 );
369
370 // index props set
371 statics.refl.index.implName = "org.openoffice.comp.pq.sdbcx.Index";
372 statics.refl.index.serviceNames = { "com.sun.star.sdbcx.Index" };
373 PropertyDef indexDef[] =
374 {
375 PropertyDef( statics.CATALOG , tString ),
376 PropertyDef( statics.IS_CLUSTERED, tBool ),
377 PropertyDef( statics.IS_PRIMARY_KEY_INDEX, tBool ),
378 PropertyDef( statics.IS_UNIQUE, tBool ),
379 PropertyDef( statics.NAME , tString ),
380 PropertyDef( statics.PRIVATE_COLUMN_INDEXES, tStringSequence )
381 };
383 indexDef, std::size(indexDef), READONLY );
384
385 // index props set
387 "org.openoffice.comp.pq.sdbcx.IndexDescriptor";
388 statics.refl.indexDescriptor.serviceNames = { "com.sun.star.sdbcx.IndexDescriptor" };
390 indexDef, std::size(indexDef), 0 );
391
392 // indexColumn props set
393 statics.refl.indexColumn.implName = "org.openoffice.comp.pq.sdbcx.IndexColumn";
394 statics.refl.indexColumn.serviceNames = { "com.sun.star.sdbcx.IndexColumn" };
395 PropertyDef indexColumnDef[] =
396 {
397 PropertyDef( statics.CATALOG_NAME , tString ),
398 PropertyDef( statics.DEFAULT_VALUE, tString ),
399 PropertyDef( statics.DESCRIPTION , tString ),
400 PropertyDef( statics.IS_ASCENDING, tBool ),
401 PropertyDef( statics.IS_AUTO_INCREMENT, tBool ),
402 PropertyDef( statics.IS_CURRENCY, tBool ),
403 PropertyDef( statics.IS_NULLABLE, tInt ),
404 PropertyDef( statics.IS_ROW_VERSISON, tBool ),
405 PropertyDef( statics.NAME , tString ),
406 PropertyDef( statics.PRECISION , tInt ),
407 PropertyDef( statics.SCALE , tInt ),
408 PropertyDef( statics.TYPE , tInt ),
409 PropertyDef( statics.TYPE_NAME , tString )
410 };
412 indexColumnDef, std::size(indexColumnDef), READONLY );
413
414 // indexColumn props set
416 "org.openoffice.comp.pq.sdbcx.IndexColumnDescriptor";
418 { "com.sun.star.sdbcx.IndexColumnDescriptor" };
419 PropertyDef indexColumnDescDef[] =
420 {
421 PropertyDef( statics.IS_ASCENDING, tBool ),
422 PropertyDef( statics.NAME , tString )
423 };
425 indexColumnDescDef, std::size(indexColumnDescDef), 0 );
426
427 // databasemetadata
428 statics.tablesRowNames = std::vector< OUString > ( 5 );
429 statics.tablesRowNames[TABLE_INDEX_CATALOG] = "TABLE_CAT";
430 statics.tablesRowNames[TABLE_INDEX_SCHEMA] = "TABLE_SCHEM";
431 statics.tablesRowNames[TABLE_INDEX_NAME] = "TABLE_NAME";
432 statics.tablesRowNames[TABLE_INDEX_TYPE] = "TABLE_TYPE";
433 statics.tablesRowNames[TABLE_INDEX_REMARKS] = "REMARKS";
434
435 statics.primaryKeyNames = std::vector< OUString > ( 6 );
436 statics.primaryKeyNames[0] = "TABLE_CAT";
437 statics.primaryKeyNames[1] = "TABLE_SCHEM";
438 statics.primaryKeyNames[2] = "TABLE_NAME";
439 statics.primaryKeyNames[3] = "COLUMN_NAME";
440 statics.primaryKeyNames[4] = "KEY_SEQ";
441 statics.primaryKeyNames[5] = "PK_NAME";
442
443 statics.SELECT = "SELECT";
444 statics.UPDATE = "UPDATE";
445 statics.INSERT = "INSERT";
446 statics.DELETE = "DELETE";
447 statics.RULE = "RULE";
448 statics.REFERENCES = "REFERENCES";
449 statics.TRIGGER = "TRIGGER";
450 statics.EXECUTE = "EXECUTE";
451 statics.USAGE = "USAGE";
452 statics.CREATE = "CREATE";
453 statics.TEMPORARY = "TEMPORARY";
454 statics.INDEX = "Index";
455 statics.INDEX_COLUMN = "IndexColumn";
456
457 statics.schemaNames = std::vector< OUString > ( 1 );
458 statics.schemaNames[0] = "TABLE_SCHEM";
459
460 statics.tableTypeData = std::vector< std::vector< Any > >( 2 );
461
462 statics.tableTypeData[0] = std::vector< Any > ( 1 );
463 statics.tableTypeData[0][0] <<= statics.TABLE;
464
465// statics.tableTypeData[2] = Sequence< Any > ( 1 );
466// statics.tableTypeData[2][0] <<= statics.VIEW;
467
468 statics.tableTypeData[1] = std::vector< Any > ( 1 );
469 statics.tableTypeData[1][0] <<= statics.SYSTEM_TABLE;
470
471 statics.tableTypeNames = std::vector< OUString > ( 1 );
472 statics.tableTypeNames[0] = "TABLE_TYPE";
473
474 statics.columnRowNames =
475 {
476 "TABLE_CAT", "TABLE_SCHEM", "TABLE_NAME", "COLUMN_NAME",
477 "DATA_TYPE", "TYPE_NAME", "COLUMN_SIZE", "BUFFER_LENGTH",
478 "DECIMAL_DIGITS", "NUM_PREC_RADIX", "NULLABLE", "REMARKS",
479 "COLUMN_DEF", "SQL_DATA_TYPE", "SQL_DATETIME_SUB", "CHAR_OCTET_LENGTH",
480 "ORDINAL_POSITION", "IS_NULLABLE"
481 };
482
483 statics.typeinfoColumnNames =
484 {
485 "TYPE_NAME", "DATA_TYPE", "PRECISION", "LITERAL_PREFIX",
486 "LITERAL_SUFFIX", "CREATE_PARAMS", "NULLABLE", "CASE_SENSITIVE",
487 "SEARCHABLE", "UNSIGNED_ATTRIBUTE", "FIXED_PREC_SCALE",
488 "AUTO_INCREMENT", "LOCAL_TYPE_NAME", "MINIMUM_SCALE",
489 "MAXIMUM_SCALE", "SQL_DATA_TYPE", "SQL_DATETIME_SUB",
490 "NUM_PREC_RADIX"
491 };
492
493 statics.indexinfoColumnNames =
494 {
495 "TABLE_CAT", "TABLE_SCHEM", "TABLE_NAME",
496 "NON_UNIQUE", "INDEX_QUALIFIER", "INDEX_NAME",
497 "TYPE", "ORDINAL_POSITION", "COLUMN_NAME",
498 "ASC_OR_DESC", "CARDINALITY", "PAGES", "FILTER_CONDITION"
499 };
500
501 statics.resultSetArrayColumnNames = { "INDEX" , "VALUE" };
502
503 // LEM TODO see if a refresh is needed; obtain automatically from pg_catalog.pg_type?
504 BaseTypeDef baseTypeDefs[] =
505 {
506 { "bool" , css::sdbc::DataType::BOOLEAN },
507 { "bytea", css::sdbc::DataType::VARBINARY },
508 { "char" , css::sdbc::DataType::CHAR },
509
510 { "int8" , css::sdbc::DataType::BIGINT },
511 { "serial8" , css::sdbc::DataType::BIGINT },
512
513
514 { "int2" , css::sdbc::DataType::SMALLINT },
515
516 { "int4" , css::sdbc::DataType::INTEGER },
517// { "regproc" , css::sdbc::DataType::INTEGER },
518// { "oid" , css::sdbc::DataType::INTEGER },
519// { "xid" , css::sdbc::DataType::INTEGER },
520// { "cid" , css::sdbc::DataType::INTEGER },
521// { "serial", css::sdbc::DataType::INTEGER },
522// { "serial4", css::sdbc::DataType::INTEGER },
523
524 { "text", css::sdbc::DataType::LONGVARCHAR },
525 { "bpchar", css::sdbc::DataType::CHAR },
526 { "varchar", css::sdbc::DataType::VARCHAR },
527
528 { "float4", css::sdbc::DataType::REAL },
529 { "float8", css::sdbc::DataType::DOUBLE },
530
531 { "numeric", css::sdbc::DataType::NUMERIC },
532 { "decimal", css::sdbc::DataType::DECIMAL },
533
534 { "date", css::sdbc::DataType::DATE },
535 { "time", css::sdbc::DataType::TIME },
536 { "timestamp", css::sdbc::DataType::TIMESTAMP },
537
538// { "_bool" , css::sdbc::DataType::ARRAY },
539// { "_bytea", css::sdbc::DataType::ARRAY },
540// { "_char" , css::sdbc::DataType::ARRAY },
541
542// { "_int8" , css::sdbc::DataType::ARRAY },
543// { "_serial8" , css::sdbc::DataType::ARRAY },
544
545
546// { "_int2" , css::sdbc::DataType::ARRAY },
547
548// { "_int4" , css::sdbc::DataType::ARRAY },
549// { "_regproc" , css::sdbc::DataType::ARRAY },
550// { "_oid" , css::sdbc::DataType::ARRAY },
551// { "_xid" , css::sdbc::DataType::ARRAY },
552// { "_cid" , css::sdbc::DataType::ARRAY },
553
554// { "_text", css::sdbc::DataType::ARRAY },
555// { "_bpchar", css::sdbc::DataType::ARRAY },
556// { "_varchar", css::sdbc::DataType::ARRAY },
557
558// { "_float4", css::sdbc::DataType::ARRAY },
559// { "_float8", css::sdbc::DataType::ARRAY },
560
561// { "_numeric", css::sdbc::DataType::ARRAY },
562// { "_decimal", css::sdbc::DataType::ARRAY },
563
564// { "_date", css::sdbc::DataType::ARRAY }, // switch to date later
565// { "_time", css::sdbc::DataType::ARRAY }, // switch to time later
566
567 { nullptr, 0 }
568 };
569 int i;
570 for( i = 0 ; baseTypeDefs[i].typeName ; i ++ )
571 {
572 statics.baseTypeMap[
573 OUString::createFromAscii( baseTypeDefs[i].typeName) ] =
574 baseTypeDefs[i].value;
575 }
576
577 // This is the metadata for the columns of the recordset returned
578 // by css::sdbc::XDatabaseMetaData::getTypeInfo(),
579 // that is what is returned by getTypeInfo().getMetaData()
580 DefColumnMetaData defTypeInfoMetaData[] =
581 {
582 { "TYPE_NAME", "TYPEINFO", "pg_catalog", "", css::sdbc::DataType::VARCHAR, 0,50,false,false,false }, // 0
583 { "DATA_TYPE", "TYPEINFO", "pg_catalog", "", css::sdbc::DataType::SMALLINT, 0,50,false,false,false }, // 1
584 { "PRECISION", "TYPEINFO", "pg_catalog", "", css::sdbc::DataType::INTEGER, 0,50,false,false,false }, // 2
585 { "LITERAL_PREFIX", "TYPEINFO", "pg_catalog", "", css::sdbc::DataType::VARCHAR, 0,50,false,false,false }, // 3
586 { "LITERAL_SUFFIX", "TYPEINFO", "pg_catalog", "", css::sdbc::DataType::VARCHAR, 0,50,false,false,false }, // 4
587 { "CREATE_PARAMS", "TYPEINFO", "pg_catalog", "", css::sdbc::DataType::VARCHAR, 0,50,false,false,false }, // 5
588 { "NULLABLE", "TYPEINFO", "pg_catalog", "", css::sdbc::DataType::INTEGER, 0,50,false,false,false }, // 6
589 { "CASE_SENSITIVE", "TYPEINFO", "pg_catalog", "", css::sdbc::DataType::BOOLEAN, 0,50,false,false,false }, // 7
590 { "SEARCHABLE", "TYPEINFO", "pg_catalog", "", css::sdbc::DataType::SMALLINT, 0,50,false,false,false }, // 8
591 { "UNSIGNED_ATTRIBUTE", "TYPEINFO", "pg_catalog", "", css::sdbc::DataType::BOOLEAN, 0,50,false,false,false }, // 9
592 { "FIXED_PREC_SCALE", "TYPEINFO", "pg_catalog", "", css::sdbc::DataType::BOOLEAN, 0,50,false,false,false }, // 10
593 { "AUTO_INCREMENT", "TYPEINFO", "pg_catalog", "", css::sdbc::DataType::BOOLEAN, 0,50,false,false,false }, // 11
594 { "LOCAL_TYPE_NAME", "TYPEINFO", "pg_catalog", "", css::sdbc::DataType::VARCHAR, 0,50,false,false,false }, // 12
595 { "MINIMUM_SCALE", "TYPEINFO", "pg_catalog", "", css::sdbc::DataType::SMALLINT, 0,50,false,false,false}, // 13
596 { "MAXIMUM_SCALE", "TYPEINFO", "pg_catalog", "", css::sdbc::DataType::SMALLINT, 0,50,false,false,false }, // 14
597 { "SQL_DATA_TYPE", "TYPEINFO", "pg_catalog", "", css::sdbc::DataType::INTEGER, 0,50,false,false,false }, // 15
598 { "SQL_DATETIME_SUB", "TYPEINFO", "pg_catalog", "", css::sdbc::DataType::INTEGER, 0,50,false,false,false}, // 16
599 { "NUM_PREC_RADIX", "TYPEINFO", "pg_catalog", "", css::sdbc::DataType::INTEGER, 0,50,false,false,false }, // 17
600 {nullptr,nullptr,nullptr,nullptr,0,0,0,false,false,false}
601 };
602
603 for( i = 0 ; defTypeInfoMetaData[i].columnName ; i++ )
604 {
605 statics.typeInfoMetaData.push_back(
607 OUString::createFromAscii( defTypeInfoMetaData[i].columnName ),
608 OUString::createFromAscii( defTypeInfoMetaData[i].tableName ),
609 OUString::createFromAscii( defTypeInfoMetaData[i].schemaTableName ),
610 OUString::createFromAscii( defTypeInfoMetaData[i].typeName ),
611 defTypeInfoMetaData[i].type,
612 defTypeInfoMetaData[i].precision,
613 defTypeInfoMetaData[i].scale,
614 defTypeInfoMetaData[i].isCurrency,
615 defTypeInfoMetaData[i].isNullable,
616 defTypeInfoMetaData[i].isAutoIncrement ) );
617 }
618
619 return &statics;
620 }();
621 return *p;
622}
623
624
625}
626
627/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
XPropertyListType t
css::uno::Type const & get()
Any value
const bool READONLY
void * p
uno_Any a
Type
int i
Statics & getStatics()
Definition: pq_statics.cxx:112
const sal_Int32 TABLE_INDEX_SCHEMA
Definition: pq_statics.hxx:129
static Any isAutoIncrement(std::u16string_view defaultValue)
Definition: pq_xcolumns.cxx:90
const sal_Int32 TABLE_INDEX_TYPE
Definition: pq_statics.hxx:131
const sal_Int32 TABLE_INDEX_REMARKS
Definition: pq_statics.hxx:132
const sal_Int32 TABLE_INDEX_NAME
Definition: pq_statics.hxx:130
const sal_Int32 TABLE_INDEX_CATALOG
Definition: pq_statics.hxx:128
static Any isCurrency(std::u16string_view typeName)
Definition: pq_xcolumns.cxx:79
static cppu::IPropertyArrayHelper * createPropertyArrayHelper(PropertyDef const *props, int count, sal_Int16 attr)
Definition: pq_statics.cxx:88
dictionary props
sal_Int32 scale
Definition: pq_statics.cxx:62
sal_Int32 precision
Definition: pq_statics.cxx:61
bool isNullable
Definition: pq_statics.cxx:64
const char * columnName
Definition: pq_statics.cxx:56
OUString name
Definition: pq_statics.cxx:74
sal_Int32 type
Definition: pq_statics.cxx:60
const char * typeName
Definition: pq_statics.cxx:59
const char * tableName
Definition: pq_statics.cxx:57
sal_Int32 attribute
Definition: pq_statics.cxx:83
const char * schemaTableName
Definition: pq_statics.cxx:58
css::uno::Sequence< OUString > serviceNames
Definition: pq_statics.hxx:103
cppu::IPropertyArrayHelper * pProps
Definition: pq_statics.hxx:104
struct ImplementationStatics viewDescriptor
Definition: pq_statics.hxx:121
struct ImplementationStatics indexDescriptor
Definition: pq_statics.hxx:123
struct ImplementationStatics user
Definition: pq_statics.hxx:118
struct ImplementationStatics keycolumnDescriptor
Definition: pq_statics.hxx:117
struct ImplementationStatics key
Definition: pq_statics.hxx:114
struct ImplementationStatics keycolumn
Definition: pq_statics.hxx:116
struct ImplementationStatics column
Definition: pq_statics.hxx:112
struct ImplementationStatics keyDescriptor
Definition: pq_statics.hxx:115
struct ImplementationStatics table
Definition: pq_statics.hxx:110
struct ImplementationStatics indexColumn
Definition: pq_statics.hxx:124
struct ImplementationStatics index
Definition: pq_statics.hxx:122
struct ImplementationStatics view
Definition: pq_statics.hxx:120
struct ImplementationStatics tableDescriptor
Definition: pq_statics.hxx:111
struct ImplementationStatics columnDescriptor
Definition: pq_statics.hxx:113
struct ImplementationStatics indexColumnDescriptor
Definition: pq_statics.hxx:125
struct ImplementationStatics userDescriptor
Definition: pq_statics.hxx:119
std::vector< OUString > typeinfoColumnNames
Definition: pq_statics.hxx:223
std::vector< OUString > tableTypeNames
Definition: pq_statics.hxx:222
std::vector< OUString > indexinfoColumnNames
Definition: pq_statics.hxx:224
std::vector< OUString > columnRowNames
Definition: pq_statics.hxx:219
ColumnMetaDataVector typeInfoMetaData
Definition: pq_statics.hxx:228
std::vector< OUString > primaryKeyNames
Definition: pq_statics.hxx:220
ReflectionImplementations refl
Definition: pq_statics.hxx:216
std::vector< OUString > tablesRowNames
Definition: pq_statics.hxx:218
OUString PRIVATE_FOREIGN_COLUMNS
Definition: pq_statics.hxx:186
std::vector< std::vector< css::uno::Any > > tableTypeData
Definition: pq_statics.hxx:226
std::vector< OUString > schemaNames
Definition: pq_statics.hxx:221
std::vector< OUString > resultSetArrayColumnNames
Definition: pq_statics.hxx:225