LibreOffice Module dbaccess (master) 1
TypeInfo.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19#pragma once
20
21#include <rtl/ustring.hxx>
22#include <com/sun/star/sdbc/DataType.hpp>
23#include <com/sun/star/sdbc/ColumnSearch.hpp>
24#include <map>
25#include <memory>
26
27namespace dbaui
28{
29// Based on these ids the language dependent OUString are fetched from the resource
30const sal_uInt16 TYPE_UNKNOWN = 0;
31const sal_uInt16 TYPE_TEXT = 1;
32const sal_uInt16 TYPE_NUMERIC = 2;
33const sal_uInt16 TYPE_DATETIME = 3;
34const sal_uInt16 TYPE_DATE = 4;
35const sal_uInt16 TYPE_TIME = 5;
36const sal_uInt16 TYPE_BOOL = 6;
37const sal_uInt16 TYPE_CURRENCY = 7;
38const sal_uInt16 TYPE_MEMO = 8;
39const sal_uInt16 TYPE_COUNTER = 9;
40const sal_uInt16 TYPE_IMAGE = 10;
41const sal_uInt16 TYPE_CHAR = 11;
42const sal_uInt16 TYPE_DECIMAL = 12;
43const sal_uInt16 TYPE_BINARY = 13;
44const sal_uInt16 TYPE_VARBINARY = 14;
45const sal_uInt16 TYPE_BIGINT = 15;
46const sal_uInt16 TYPE_DOUBLE = 16;
47const sal_uInt16 TYPE_FLOAT = 17;
48const sal_uInt16 TYPE_REAL = 18;
49const sal_uInt16 TYPE_INTEGER = 19;
50const sal_uInt16 TYPE_SMALLINT = 20;
51const sal_uInt16 TYPE_TINYINT = 21;
52const sal_uInt16 TYPE_SQLNULL = 22;
53const sal_uInt16 TYPE_OBJECT = 23;
54const sal_uInt16 TYPE_DISTINCT = 24;
55const sal_uInt16 TYPE_STRUCT = 25;
56const sal_uInt16 TYPE_ARRAY = 26;
57const sal_uInt16 TYPE_BLOB = 27;
58const sal_uInt16 TYPE_CLOB = 28;
59const sal_uInt16 TYPE_REF = 29;
60const sal_uInt16 TYPE_OTHER = 30;
61const sal_uInt16 TYPE_BIT = 31;
62
64 {
65 public:
66 OUString aUIName; // the name which is the user see (a combination of resource text and aTypeName)
67 OUString aTypeName; // name of type in database
68 OUString aCreateParams; // parameter for creation
70
71 sal_Int32 nPrecision; // length of type
72 sal_Int32 nNumPrecRadix; // indicating the radix, which is usually 2 or 10
73 sal_Int32 nType; // database type
74
75 sal_Int16 nMaximumScale; // decimal places after decimal point
76 sal_Int16 nMinimumScale; // min decimal places after decimal point
77
78 sal_Int16 nSearchType; // if it is possible to search for type
79
80 bool bCurrency : 1, // currency
81 bAutoIncrement : 1, // if automatic incrementing field
82 bNullable : 1; // if field can be NULL
83
85 :nPrecision(0)
86 ,nNumPrecRadix(10)
87 ,nType(css::sdbc::DataType::OTHER)
89 ,nMinimumScale(0)
90 ,nSearchType(css::sdbc::ColumnSearch::FULL)
91 ,bCurrency(false)
92 ,bAutoIncrement(false)
93 ,bNullable(true)
94 {}
95 const OUString& getDBName() const { return aTypeName; }
96
97 };
98
99 typedef std::shared_ptr<OTypeInfo> TOTypeInfoSP;
100 typedef std::multimap<sal_Int32,TOTypeInfoSP> OTypeInfoMap;
112 sal_Int32 _nType,
113 const OUString& _sTypeName,
114 const OUString& _sCreateParams,
115 sal_Int32 _nPrecision,
116 sal_Int32 _nScale,
117 bool _bAutoIncrement,
118 bool& _brForceToType);
119}
120
121/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
#define FULL
OUString aTypeName
Definition: TypeInfo.hxx:67
OUString aUIName
Definition: TypeInfo.hxx:66
OUString aLocalTypeName
Definition: TypeInfo.hxx:69
sal_Int16 nMinimumScale
Definition: TypeInfo.hxx:76
sal_Int32 nType
Definition: TypeInfo.hxx:73
sal_Int32 nNumPrecRadix
Definition: TypeInfo.hxx:72
sal_Int32 nPrecision
Definition: TypeInfo.hxx:71
sal_Int16 nMaximumScale
Definition: TypeInfo.hxx:75
sal_Int16 nSearchType
Definition: TypeInfo.hxx:78
const OUString & getDBName() const
Definition: TypeInfo.hxx:95
OUString aCreateParams
Definition: TypeInfo.hxx:68
const sal_uInt16 TYPE_IMAGE
Definition: TypeInfo.hxx:40
const sal_uInt16 TYPE_NUMERIC
Definition: TypeInfo.hxx:32
const sal_uInt16 TYPE_REAL
Definition: TypeInfo.hxx:48
const sal_uInt16 TYPE_OTHER
Definition: TypeInfo.hxx:60
const sal_uInt16 TYPE_CURRENCY
Definition: TypeInfo.hxx:37
const sal_uInt16 TYPE_TINYINT
Definition: TypeInfo.hxx:51
const sal_uInt16 TYPE_DATE
Definition: TypeInfo.hxx:34
const sal_uInt16 TYPE_SQLNULL
Definition: TypeInfo.hxx:52
const sal_uInt16 TYPE_STRUCT
Definition: TypeInfo.hxx:55
const sal_uInt16 TYPE_SMALLINT
Definition: TypeInfo.hxx:50
const sal_uInt16 TYPE_CHAR
Definition: TypeInfo.hxx:41
std::multimap< sal_Int32, TOTypeInfoSP > OTypeInfoMap
Definition: TypeInfo.hxx:100
TOTypeInfoSP getTypeInfoFromType(const OTypeInfoMap &_rTypeInfo, sal_Int32 _nType, const OUString &_sTypeName, const OUString &_sCreateParams, sal_Int32 _nPrecision, sal_Int32 _nScale, bool _bAutoIncrement, bool &_brForceToType)
return the most suitable typeinfo for a requested type
Definition: UITools.cxx:263
const sal_uInt16 TYPE_TEXT
Definition: TypeInfo.hxx:31
const sal_uInt16 TYPE_DECIMAL
Definition: TypeInfo.hxx:42
std::shared_ptr< OTypeInfo > TOTypeInfoSP
Definition: TypeInfo.hxx:99
const sal_uInt16 TYPE_DATETIME
Definition: TypeInfo.hxx:33
const sal_uInt16 TYPE_OBJECT
Definition: TypeInfo.hxx:53
const sal_uInt16 TYPE_MEMO
Definition: TypeInfo.hxx:38
const sal_uInt16 TYPE_COUNTER
Definition: TypeInfo.hxx:39
const sal_uInt16 TYPE_CLOB
Definition: TypeInfo.hxx:58
const sal_uInt16 TYPE_DISTINCT
Definition: TypeInfo.hxx:54
const sal_uInt16 TYPE_BIT
Definition: TypeInfo.hxx:61
const sal_uInt16 TYPE_TIME
Definition: TypeInfo.hxx:35
const sal_uInt16 TYPE_BINARY
Definition: TypeInfo.hxx:43
const sal_uInt16 TYPE_UNKNOWN
Definition: TypeInfo.hxx:30
const sal_uInt16 TYPE_INTEGER
Definition: TypeInfo.hxx:49
const sal_uInt16 TYPE_VARBINARY
Definition: TypeInfo.hxx:44
const sal_uInt16 TYPE_ARRAY
Definition: TypeInfo.hxx:56
const sal_uInt16 TYPE_FLOAT
Definition: TypeInfo.hxx:47
const sal_uInt16 TYPE_BLOB
Definition: TypeInfo.hxx:57
const sal_uInt16 TYPE_BOOL
Definition: TypeInfo.hxx:36
const sal_uInt16 TYPE_REF
Definition: TypeInfo.hxx:59
const sal_uInt16 TYPE_DOUBLE
Definition: TypeInfo.hxx:46
const sal_uInt16 TYPE_BIGINT
Definition: TypeInfo.hxx:45
DataType