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 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_dbaccess.hxx"
30 
31 #include "dbastrings.hrc"
32 #include "apitools.hxx"
33 #include "CRowSetColumn.hxx"
34 
35 #include <com/sun/star/sdb/XColumn.hpp>
36 #include <com/sun/star/beans/PropertyAttribute.hpp>
37 
38 #include <comphelper/types.hxx>
39 #include <cppuhelper/typeprovider.hxx>
40 
41 using namespace ::com::sun::star::uno;
42 using namespace ::com::sun::star::sdbc;
43 using namespace ::com::sun::star::sdb;
44 using namespace ::com::sun::star::beans;
45 
46 //..............................................................................
47 namespace dbaccess
48 {
49 //..............................................................................
50 
51 //------------------------------------------------------------------------------
52 ORowSetColumn::ORowSetColumn(	const Reference < XResultSetMetaData >& _xMetaData, const Reference < XRow >& _xRow, sal_Int32 _nPos,
53                 const Reference< XDatabaseMetaData >& _rxDBMeta, const ::rtl::OUString& _rDescription, const ::rtl::OUString& i_sLabel,ORowSetCacheIterator& _rColumnValue )
54     :ORowSetDataColumn( _xMetaData, _xRow, NULL, _nPos, _rxDBMeta, _rDescription, i_sLabel,_rColumnValue )
55 {
56 }
57 
58 //------------------------------------------------------------------------------
59 ::cppu::IPropertyArrayHelper* ORowSetColumn::createArrayHelper( ) const
60 {
61     const sal_Int32 nDerivedProperties = 21;
62 	Sequence< Property> aDerivedProperties( nDerivedProperties );
63 	Property* pDesc = aDerivedProperties.getArray();
64 	sal_Int32 nPos = 0;
65 
66     DECL_PROP1( CATALOGNAME,                ::rtl::OUString,    READONLY );
67     DECL_PROP1( DISPLAYSIZE,                sal_Int32,          READONLY );
68     DECL_PROP1_BOOL( ISAUTOINCREMENT,                           READONLY );
69     DECL_PROP1_BOOL( ISCASESENSITIVE,                           READONLY );
70     DECL_PROP1_BOOL( ISCURRENCY,                                READONLY );
71     DECL_PROP1_BOOL( ISDEFINITELYWRITABLE,                      READONLY );
72     DECL_PROP1( ISNULLABLE,                 sal_Int32,          READONLY );
73     DECL_PROP1_BOOL( ISREADONLY,                                BOUND );
74     DECL_PROP1_BOOL( ISROWVERSION,                              READONLY );
75     DECL_PROP1_BOOL( ISSEARCHABLE,                              READONLY );
76     DECL_PROP1_BOOL( ISSIGNED,                                  READONLY );
77     DECL_PROP1_BOOL( ISWRITABLE,                                READONLY );
78     DECL_PROP1( LABEL,                      ::rtl::OUString,    READONLY );
79     DECL_PROP1( PRECISION,                  sal_Int32,          READONLY );
80     DECL_PROP1( SCALE,                      sal_Int32,          READONLY );
81     DECL_PROP1( SCHEMANAME,                 ::rtl::OUString,    READONLY );
82     DECL_PROP1( SERVICENAME,                ::rtl::OUString,    READONLY );
83     DECL_PROP1( TABLENAME,                  ::rtl::OUString,    READONLY );
84     DECL_PROP1( TYPE,                       sal_Int32,          READONLY );
85     DECL_PROP1( TYPENAME,                   ::rtl::OUString,    READONLY );
86     DECL_PROP2( VALUE,                      Any,                READONLY, BOUND );
87     OSL_ENSURE( nPos == nDerivedProperties, "ORowSetColumn::createArrayHelper: inconsistency!" );
88 
89     Sequence< Property > aRegisteredProperties;
90     describeProperties( aRegisteredProperties );
91 
92     return new ::cppu::OPropertyArrayHelper( ::comphelper::concatSequences( aDerivedProperties, aRegisteredProperties ), sal_False );
93 }
94 
95 //------------------------------------------------------------------------------
96 ::cppu::IPropertyArrayHelper& ORowSetColumn::getInfoHelper()
97 {
98 	return *static_cast< ::comphelper::OPropertyArrayUsageHelper< ORowSetColumn >* >(this)->getArrayHelper();
99 }
100 
101 //------------------------------------------------------------------------------
102 void SAL_CALL ORowSetColumn::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const Any& rValue )throw (Exception)
103 {
104     OSL_ENSURE( nHandle != PROPERTY_ID_VALUE, "ORowSetColumn::setFastPropertyValue_NoBroadcast: hmm? This property is marked as READONLY!" );
105     if ( nHandle != PROPERTY_ID_VALUE )
106 		ORowSetDataColumn::setFastPropertyValue_NoBroadcast( nHandle, rValue );
107 }
108 
109 //..............................................................................
110 }   // namespace dbaccess
111 //..............................................................................
112