xref: /AOO41X/main/odk/examples/DevelopersGuide/Database/DriverSkeleton/OTypeInfo.hxx (revision 34dd1e2512dbacb6a9a7e4c7f17b9296daa8eff3)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef _CONNECTIVITY_OTYPEINFO_HXX_
25 #define _CONNECTIVITY_OTYPEINFO_HXX_
26 
27 #include <com/sun/star/sdbc/ColumnSearch.hpp>
28 #include <com/sun/star/sdbc/DataType.hpp>
29 
30 namespace connectivity
31 {
32     struct OTypeInfo
33     {
34         ::rtl::OUString aTypeName;      // Name des Types in der Datenbank
35         ::rtl::OUString aLiteralPrefix; // Prefix zum Quoten
36         ::rtl::OUString aLiteralSuffix; // Suffix zum Quoten
37         ::rtl::OUString aCreateParams;  // Parameter zum Erstellen
38         ::rtl::OUString aLocalTypeName;
39 
40         sal_Int32       nPrecision;     // Laenge des Types
41 
42         sal_Int16       nMaximumScale;  // Nachkommastellen
43         sal_Int16       nMinimumScale;  // Min Nachkommastellen
44 
45         sal_Int16       nType;          // Datenbanktyp
46         sal_Int16       nSearchType;    // kann nach dem Typen gesucht werden
47         sal_Int16       nNumPrecRadix;  // indicating the radix, which is usually 2 or 10
48 
49         sal_Bool        bCurrency       : 1,    // Waehrung
50                         bAutoIncrement  : 1,    // Ist es ein automatisch incrementierendes Feld
51                         bNullable       : 1,    // Kann das Feld NULL annehmen
52                         bCaseSensitive  : 1,    // Ist der Type Casesensitive
53                         bUnsigned       : 1,    // Ist der Type Unsigned
54                         bEmpty_1        : 1,    // for later use
55                         bEmpty_2        : 1;
56 
OTypeInfoconnectivity::OTypeInfo57         OTypeInfo()
58                 :bCurrency(sal_False)
59                 ,bAutoIncrement(sal_False)
60                 ,bNullable(sal_True)
61                 ,bCaseSensitive(sal_False)
62                 ,bUnsigned(sal_False)
63                 ,nMaximumScale(0)
64                 ,nMinimumScale(0)
65                 ,nType( ::com::sun::star::sdbc::DataType::OTHER)
66                 ,nPrecision(0)
67                 ,nSearchType( ::com::sun::star::sdbc::ColumnSearch::FULL)
68         {}
69 
operator newconnectivity::OTypeInfo70         inline static void * SAL_CALL operator new( size_t nSize ) SAL_THROW( () )
71             { return ::rtl_allocateMemory( nSize ); }
operator newconnectivity::OTypeInfo72         inline static void * SAL_CALL operator new( size_t nSize,void* _pHint ) SAL_THROW( () )
73             { return _pHint; }
operator deleteconnectivity::OTypeInfo74         inline static void SAL_CALL operator delete( void * pMem ) SAL_THROW( () )
75             { ::rtl_freeMemory( pMem ); }
operator deleteconnectivity::OTypeInfo76         inline static void SAL_CALL operator delete( void * pMem,void* _pHint ) SAL_THROW( () )
77             {  }
78 
operator ==connectivity::OTypeInfo79         sal_Bool operator == (const OTypeInfo& lh) const { return lh.nType == nType; }
operator !=connectivity::OTypeInfo80         sal_Bool operator != (const OTypeInfo& lh) const { return lh.nType != nType; }
81 
getDBNameconnectivity::OTypeInfo82         inline ::rtl::OUString getDBName() const { return aTypeName; }
83     };
84 }
85 #endif // _CONNECTIVITY_OTYPEINFO_HXX_
86 
87 
88