xref: /trunk/main/connectivity/source/inc/OColumn.hxx (revision 1ecadb572e7010ff3b3382ad9bf179dbc6efadbb)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #ifndef _CONNECTIVITY_COLUMN_HXX_
29 #define _CONNECTIVITY_COLUMN_HXX_
30 
31 #include <rtl/ustring.hxx>
32 #include <sal/types.h>
33 #include "connectivity/dbtoolsdllapi.hxx"
34 
35 namespace connectivity
36 {
37     class OOO_DLLPUBLIC_DBTOOLS OColumn
38     {
39         ::rtl::OUString m_CatalogName;
40         ::rtl::OUString m_SchemaName;
41         ::rtl::OUString m_TableName;
42         ::rtl::OUString m_ColumnName;
43         ::rtl::OUString m_ColumnLabel;
44         ::rtl::OUString m_ColumnTypeName;
45         ::rtl::OUString m_ColumnServiceName;
46 
47         sal_Int32       m_Nullable;
48         sal_Int32       m_ColumnDisplaySize;
49         sal_Int32       m_Precision;
50         sal_Int32       m_Scale;
51         sal_Int32       m_ColumnType;
52 
53         sal_Bool        m_AutoIncrement;
54         sal_Bool        m_CaseSensitive;
55         sal_Bool        m_Searchable;
56         sal_Bool        m_Currency;
57         sal_Bool        m_Signed;
58         sal_Bool        m_ReadOnly;
59         sal_Bool        m_Writable;
60         sal_Bool        m_DefinitelyWritable;
61 
62     public:
63         OColumn() {}
64         OColumn(const ::rtl::OUString &_aTableName,
65                 const ::rtl::OUString &_aColumnName,
66 
67                 sal_Int32       _aNullable=0,
68                 sal_Int32       _aColumnDisplaySize=0,
69                 sal_Int32       _aPrecision=0,
70                 sal_Int32       _aScale=0,
71                 sal_Int32       _aColumnType=0,
72 
73                 sal_Bool        _aAutoIncrement=sal_False,
74                 sal_Bool        _aCaseSensitive=sal_False,
75                 sal_Bool        _aSearchable=sal_True,
76                 sal_Bool        _aCurrency=sal_False,
77                 sal_Bool        _aSigned=sal_False,
78                 sal_Bool        _aReadOnly=sal_True,
79                 sal_Bool        _aWritable=sal_False,
80                 sal_Bool        _aDefinitelyWritable=sal_False,
81 
82                 const ::rtl::OUString &_aColumnLabel = ::rtl::OUString(),
83                 const ::rtl::OUString &_aColumnTypeName = ::rtl::OUString(),
84                 const ::rtl::OUString &_aColumnServiceName = ::rtl::OUString())
85         :   m_TableName(_aTableName),
86             m_ColumnName(_aColumnName),
87             m_ColumnLabel(_aColumnLabel),
88             m_ColumnTypeName(_aColumnTypeName),
89             m_ColumnServiceName(_aColumnServiceName),
90 
91             m_Nullable(_aNullable),
92             m_ColumnDisplaySize(_aColumnDisplaySize),
93             m_Precision(_aPrecision),
94             m_Scale(_aScale),
95             m_ColumnType(_aColumnType),
96 
97             m_AutoIncrement(_aAutoIncrement),
98             m_CaseSensitive(_aCaseSensitive),
99             m_Searchable(_aSearchable),
100             m_Currency(_aCurrency),
101             m_Signed(_aSigned),
102             m_ReadOnly(_aReadOnly),
103             m_Writable(_aWritable),
104             m_DefinitelyWritable(_aDefinitelyWritable)
105         {
106             if(!m_ColumnLabel.getLength())
107                 m_ColumnLabel = _aColumnName;
108         }
109 
110         inline static void * SAL_CALL operator new( size_t nSize ) SAL_THROW( () )
111             { return ::rtl_allocateMemory( nSize ); }
112         inline static void * SAL_CALL operator new( size_t ,void* _pHint ) SAL_THROW( () )
113             { return _pHint; }
114         inline static void SAL_CALL operator delete( void * pMem ) SAL_THROW( () )
115             { ::rtl_freeMemory( pMem ); }
116         inline static void SAL_CALL operator delete( void *,void* ) SAL_THROW( () )
117             {  }
118 
119         sal_Bool isAutoIncrement()              const { return m_AutoIncrement; }
120         sal_Bool isCaseSensitive()              const { return m_CaseSensitive; }
121         sal_Bool isSearchable()                 const { return m_Searchable; }
122         sal_Bool isCurrency()                   const { return m_Currency; }
123         sal_Bool isSigned()                     const { return m_Signed; }
124         sal_Bool isReadOnly()                   const { return m_ReadOnly; }
125         sal_Bool isWritable()                   const { return m_Writable; }
126         sal_Bool isDefinitelyWritable()         const { return m_DefinitelyWritable; }
127 
128         sal_Int32 isNullable()                  const { return m_Nullable; }
129         sal_Int32 getColumnDisplaySize()        const { return m_ColumnDisplaySize; }
130         sal_Int32 getPrecision()                const { return m_Precision; }
131         sal_Int32 getScale()                    const { return m_Scale; }
132         sal_Int32 getColumnType()               const { return m_ColumnType; }
133 
134         const ::rtl::OUString& getColumnLabel()         const { return m_ColumnLabel; }
135         const ::rtl::OUString& getColumnName()          const { return m_ColumnName; }
136         const ::rtl::OUString& getSchemaName()          const { return m_SchemaName; }
137         const ::rtl::OUString& getTableName()           const { return m_TableName; }
138         const ::rtl::OUString& getCatalogName()         const { return m_CatalogName; }
139         const ::rtl::OUString& getColumnTypeName()      const { return m_ColumnTypeName; }
140         const ::rtl::OUString& getColumnServiceName()   const { return m_ColumnServiceName; }
141 
142     };
143 }
144 
145 #endif //_CONNECTIVITY_COLUMN_HXX_
146 
147