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