1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: TypeInfo.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #ifndef DBAUI_TYPEINFO_HXX
31 #define DBAUI_TYPEINFO_HXX
34 #ifndef _RTL_USTRING_HXX_
35 #include <rtl/ustring.hxx>
37 #ifndef _COM_SUN_STAR_SDBC_DATATYPE_HPP_
38 #include <com/sun/star/sdbc/DataType.hpp>
40 #ifndef _COM_SUN_STAR_SDBC_COLUMNSEARCH_HPP_
41 #include <com/sun/star/sdbc/ColumnSearch.hpp>
43 #ifndef _COM_SUN_STAR_SDBC_COLUMNVALUE_HPP_
44 #include <com/sun/star/sdbc/ColumnValue.hpp>
46 #include <boost/shared_ptr.hpp>
53 //========================================================================
54 // Anhand dieser Ids werden die sprachabhaengigen ::rtl::OUString aus der Resource geholt
55 const sal_uInt16 TYPE_UNKNOWN
= 0;
56 const sal_uInt16 TYPE_TEXT
= 1;
57 const sal_uInt16 TYPE_NUMERIC
= 2;
58 const sal_uInt16 TYPE_DATETIME
= 3;
59 const sal_uInt16 TYPE_DATE
= 4;
60 const sal_uInt16 TYPE_TIME
= 5;
61 const sal_uInt16 TYPE_BOOL
= 6;
62 const sal_uInt16 TYPE_CURRENCY
= 7;
63 const sal_uInt16 TYPE_MEMO
= 8;
64 const sal_uInt16 TYPE_COUNTER
= 9;
65 const sal_uInt16 TYPE_IMAGE
= 10;
66 const sal_uInt16 TYPE_CHAR
= 11;
67 const sal_uInt16 TYPE_DECIMAL
= 12;
68 const sal_uInt16 TYPE_BINARY
= 13;
69 const sal_uInt16 TYPE_VARBINARY
= 14;
70 const sal_uInt16 TYPE_BIGINT
= 15;
71 const sal_uInt16 TYPE_DOUBLE
= 16;
72 const sal_uInt16 TYPE_FLOAT
= 17;
73 const sal_uInt16 TYPE_REAL
= 18;
74 const sal_uInt16 TYPE_INTEGER
= 19;
75 const sal_uInt16 TYPE_SMALLINT
= 20;
76 const sal_uInt16 TYPE_TINYINT
= 21;
77 const sal_uInt16 TYPE_SQLNULL
= 22;
78 const sal_uInt16 TYPE_OBJECT
= 23;
79 const sal_uInt16 TYPE_DISTINCT
= 24;
80 const sal_uInt16 TYPE_STRUCT
= 25;
81 const sal_uInt16 TYPE_ARRAY
= 26;
82 const sal_uInt16 TYPE_BLOB
= 27;
83 const sal_uInt16 TYPE_CLOB
= 28;
84 const sal_uInt16 TYPE_REF
= 29;
85 const sal_uInt16 TYPE_OTHER
= 30;
90 ::rtl::OUString aUIName
; // the name which is the user see (a combination of resource text and aTypeName)
91 ::rtl::OUString aTypeName
; // Name des Types in der Datenbank
92 ::rtl::OUString aLiteralPrefix
; // Prefix zum Quoten
93 ::rtl::OUString aLiteralSuffix
; // Suffix zum Quoten
94 ::rtl::OUString aCreateParams
; // Parameter zum Erstellen
95 ::rtl::OUString aLocalTypeName
;
97 sal_Int32 nPrecision
; // Laenge des Types
98 sal_Int32 nType
; // Datenbanktyp
100 sal_Int16 nMaximumScale
; // Nachkommastellen
101 sal_Int16 nMinimumScale
; // Min Nachkommastellen
103 sal_Int16 nSearchType
; // kann nach dem Typen gesucht werden
106 sal_Bool bCurrency
: 1, // Waehrung
107 bAutoIncrement
: 1, // Ist es ein automatisch incrementierendes Feld
108 bNullable
: 1, // Kann das Feld NULL annehmen
109 bCaseSensitive
: 1, // Ist der Type Casesensitive
110 bUnsigned
: 1; // Ist der Type Unsigned
114 ,nType(::com::sun::star::sdbc::DataType::OTHER
)
117 ,nSearchType(::com::sun::star::sdbc::ColumnSearch::FULL
)
118 ,bCurrency(sal_False
)
119 ,bAutoIncrement(sal_False
)
121 ,bCaseSensitive(sal_False
)
122 ,bUnsigned(sal_False
)
124 sal_Bool
operator == (const OTypeInfo
& lh
) const { return lh
.nType
== nType
; }
125 sal_Bool
operator != (const OTypeInfo
& lh
) const { return lh
.nType
!= nType
; }
126 inline ::rtl::OUString
getDBName() const { return aTypeName
; }
130 typedef ::boost::shared_ptr
<OTypeInfo
> TOTypeInfoSP
;
131 typedef ::std::multimap
<sal_Int32
,TOTypeInfoSP
> OTypeInfoMap
;
132 /** return the most suitable typeinfo for a requested type
133 @param _rTypeInfo contains a map of type to typeinfo
134 @param _nType the requested type
135 @param _sTypeName the typename
136 @param _sCreateParams the create params
137 @param _nPrecision the precision
138 @param _nScale the scale
139 @param _bAutoIncrement if it is a auto increment
140 @param _brForceToType true when type was found which has some differenes
142 TOTypeInfoSP
getTypeInfoFromType(const OTypeInfoMap
& _rTypeInfo
,
144 const ::rtl::OUString
& _sTypeName
,
145 const ::rtl::OUString
& _sCreateParams
,
146 sal_Int32 _nPrecision
,
148 sal_Bool _bAutoIncrement
,
149 sal_Bool
& _brForceToType
);
152 #endif // DBAUI_TYPEINFO_HXX