1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
19 #ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_TYPEINFO_HXX
20 #define INCLUDED_DBACCESS_SOURCE_UI_INC_TYPEINFO_HXX
22 #include <rtl/ustring.hxx>
23 #include <com/sun/star/sdbc/DataType.hpp>
24 #include <com/sun/star/sdbc/ColumnSearch.hpp>
25 #include <com/sun/star/sdbc/ColumnValue.hpp>
31 // Based on these ids the language dependent OUString are fetched from the resource
32 const sal_uInt16 TYPE_UNKNOWN
= 0;
33 const sal_uInt16 TYPE_TEXT
= 1;
34 const sal_uInt16 TYPE_NUMERIC
= 2;
35 const sal_uInt16 TYPE_DATETIME
= 3;
36 const sal_uInt16 TYPE_DATE
= 4;
37 const sal_uInt16 TYPE_TIME
= 5;
38 const sal_uInt16 TYPE_BOOL
= 6;
39 const sal_uInt16 TYPE_CURRENCY
= 7;
40 const sal_uInt16 TYPE_MEMO
= 8;
41 const sal_uInt16 TYPE_COUNTER
= 9;
42 const sal_uInt16 TYPE_IMAGE
= 10;
43 const sal_uInt16 TYPE_CHAR
= 11;
44 const sal_uInt16 TYPE_DECIMAL
= 12;
45 const sal_uInt16 TYPE_BINARY
= 13;
46 const sal_uInt16 TYPE_VARBINARY
= 14;
47 const sal_uInt16 TYPE_BIGINT
= 15;
48 const sal_uInt16 TYPE_DOUBLE
= 16;
49 const sal_uInt16 TYPE_FLOAT
= 17;
50 const sal_uInt16 TYPE_REAL
= 18;
51 const sal_uInt16 TYPE_INTEGER
= 19;
52 const sal_uInt16 TYPE_SMALLINT
= 20;
53 const sal_uInt16 TYPE_TINYINT
= 21;
54 const sal_uInt16 TYPE_SQLNULL
= 22;
55 const sal_uInt16 TYPE_OBJECT
= 23;
56 const sal_uInt16 TYPE_DISTINCT
= 24;
57 const sal_uInt16 TYPE_STRUCT
= 25;
58 const sal_uInt16 TYPE_ARRAY
= 26;
59 const sal_uInt16 TYPE_BLOB
= 27;
60 const sal_uInt16 TYPE_CLOB
= 28;
61 const sal_uInt16 TYPE_REF
= 29;
62 const sal_uInt16 TYPE_OTHER
= 30;
63 const sal_uInt16 TYPE_BIT
= 31;
68 OUString aUIName
; // the name which is the user see (a combination of resource text and aTypeName)
69 OUString aTypeName
; // name of type in database
70 OUString aLiteralPrefix
; // prefix for quoting
71 OUString aLiteralSuffix
; // suffix for quoting
72 OUString aCreateParams
; // parameter for creation
73 OUString aLocalTypeName
;
75 sal_Int32 nPrecision
; // length of type
76 sal_Int32 nNumPrecRadix
; // indicating the radix, which is usually 2 or 10
77 sal_Int32 nType
; // database type
79 sal_Int16 nMaximumScale
; // decimal places after decimal point
80 sal_Int16 nMinimumScale
; // min decimal places after decimal point
82 sal_Int16 nSearchType
; // if it is possible to search for type
84 bool bCurrency
: 1, // currency
85 bAutoIncrement
: 1, // if automatic incrementing field
86 bNullable
: 1, // if field can be NULL
87 bCaseSensitive
: 1, // if type is case sensitive
88 bUnsigned
: 1; // if type is unsigned
93 ,nType(css::sdbc::DataType::OTHER
)
96 ,nSearchType(css::sdbc::ColumnSearch::FULL
)
98 ,bAutoIncrement(false)
100 ,bCaseSensitive(false)
103 const OUString
& getDBName() const { return aTypeName
; }
107 typedef std::shared_ptr
<OTypeInfo
> TOTypeInfoSP
;
108 typedef ::std::multimap
<sal_Int32
,TOTypeInfoSP
> OTypeInfoMap
;
109 /** return the most suitable typeinfo for a requested type
110 @param _rTypeInfo contains a map of type to typeinfo
111 @param _nType the requested type
112 @param _sTypeName the typename
113 @param _sCreateParams the create params
114 @param _nPrecision the precision
115 @param _nScale the scale
116 @param _bAutoIncrement if it is a auto increment
117 @param _brForceToType true when type was found which has some differenes
119 TOTypeInfoSP
getTypeInfoFromType(const OTypeInfoMap
& _rTypeInfo
,
121 const OUString
& _sTypeName
,
122 const OUString
& _sCreateParams
,
123 sal_Int32 _nPrecision
,
125 bool _bAutoIncrement
,
126 bool& _brForceToType
);
129 #endif // INCLUDED_DBACCESS_SOURCE_UI_INC_TYPEINFO_HXX
131 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */