LibreOffice Module dbaccess (master) 1
definitioncolumn.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
20#include <bitset>
21
22#include <stringconstants.hxx>
23#include <strings.hxx>
24#include <definitioncolumn.hxx>
25#include <sdbcoretools.hxx>
26
27#include <com/sun/star/beans/PropertyAttribute.hpp>
28#include <com/sun/star/sdbcx/XTablesSupplier.hpp>
29
32#include <sal/log.hxx>
33#include <utility>
35
36using namespace ::com::sun::star::sdbc;
37using namespace ::com::sun::star::sdbcx;
38using namespace ::com::sun::star::beans;
39using namespace ::com::sun::star::uno;
40using namespace ::com::sun::star::lang;
41using namespace ::com::sun::star::container;
42using namespace ::cppu;
43using namespace ::comphelper;
44using namespace ::osl;
45using namespace dbaccess;
46
47namespace
48{
49 const sal_Int32 HAS_DESCRIPTION = 0x00000001;
50 const sal_Int32 HAS_DEFAULTVALUE = 0x00000002;
51 const sal_Int32 HAS_ROWVERSION = 0x00000004;
52 const sal_Int32 HAS_AUTOINCREMENT_CREATION = 0x00000008;
53 const sal_Int32 HAS_CATALOGNAME = 0x00000010;
54 const sal_Int32 HAS_SCHEMANAME = 0x00000020;
55 const sal_Int32 HAS_TABLENAME = 0x00000040;
56}
57
58// OTableColumnDescriptor
60
61void OTableColumnDescriptor::impl_registerProperties()
62{
63 sal_Int32 nDefaultAttr = m_bActAsDescriptor ? 0 : PropertyAttribute::READONLY;
64
65 registerProperty( PROPERTY_TYPENAME, PROPERTY_ID_TYPENAME, nDefaultAttr, &m_aTypeName, cppu::UnoType<decltype(m_aTypeName)>::get() );
66 registerProperty( PROPERTY_DESCRIPTION, PROPERTY_ID_DESCRIPTION, nDefaultAttr, &m_aDescription, cppu::UnoType<decltype(m_aDescription)>::get() );
67 registerProperty( PROPERTY_DEFAULTVALUE, PROPERTY_ID_DEFAULTVALUE, nDefaultAttr, &m_aDefaultValue, cppu::UnoType<decltype(m_aDefaultValue)>::get() );
68
69 if ( m_bActAsDescriptor )
70 registerProperty( PROPERTY_AUTOINCREMENTCREATION, PROPERTY_ID_AUTOINCREMENTCREATION, nDefaultAttr, &m_aAutoIncrementValue, cppu::UnoType<decltype(m_aAutoIncrementValue)>::get() );
71
72 registerProperty( PROPERTY_TYPE, PROPERTY_ID_TYPE, nDefaultAttr, &m_nType, cppu::UnoType<decltype(m_nType)>::get() );
73 registerProperty( PROPERTY_PRECISION, PROPERTY_ID_PRECISION, nDefaultAttr, &m_nPrecision, cppu::UnoType<decltype(m_nPrecision)>::get() );
74 registerProperty( PROPERTY_SCALE, PROPERTY_ID_SCALE, nDefaultAttr, &m_nScale, cppu::UnoType<decltype(m_nScale)>::get() );
75 registerProperty( PROPERTY_ISNULLABLE, PROPERTY_ID_ISNULLABLE, nDefaultAttr, &m_nIsNullable, cppu::UnoType<decltype(m_nIsNullable)>::get() );
76 registerProperty( PROPERTY_ISAUTOINCREMENT, PROPERTY_ID_ISAUTOINCREMENT, nDefaultAttr, &m_bAutoIncrement, cppu::UnoType<decltype(m_bAutoIncrement)>::get() );
77 registerProperty( PROPERTY_ISROWVERSION, PROPERTY_ID_ISROWVERSION, nDefaultAttr, &m_bRowVersion, cppu::UnoType<decltype(m_bRowVersion)>::get() );
78 registerProperty( PROPERTY_ISCURRENCY, PROPERTY_ID_ISCURRENCY, nDefaultAttr, &m_bCurrency, cppu::UnoType<decltype(m_bCurrency)>::get() );
79
80 OColumnSettings::registerProperties( *this );
81}
82
84
85// css::lang::XServiceInfo
86OUString OTableColumnDescriptor::getImplementationName( )
87{
88 return "com.sun.star.sdb.OTableColumnDescriptor";
89}
90
91Sequence< OUString > OTableColumnDescriptor::getSupportedServiceNames( )
92{
95}
96
97// comphelper::OPropertyArrayUsageHelper
99{
100 Sequence< Property > aProps;
101 describeProperties( aProps );
102 return new ::cppu::OPropertyArrayHelper( aProps );
103}
104
105// cppu::OPropertySetHelper
107{
109}
110
111void OTableColumnDescriptor::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const Any& rValue )
112{
113 OColumn::setFastPropertyValue_NoBroadcast( nHandle, rValue );
115}
116
117Reference< XInterface > SAL_CALL OTableColumnDescriptor::getParent( )
118{
119 ::osl::MutexGuard aGuard(m_aMutex);
120 return m_xParent;
121}
122
123void SAL_CALL OTableColumnDescriptor::setParent( const Reference< XInterface >& _xParent )
124{
125 ::osl::MutexGuard aGuard(m_aMutex);
126 m_xParent = _xParent;
127}
128
129// OTableColumn
130
131OTableColumn::OTableColumn( const OUString& _rName )
132 :OTableColumnDescriptor( false /* do not act as descriptor */ )
133{
134 m_sName = _rName;
135}
136
138{
139}
140
142
143OUString OTableColumn::getImplementationName( )
144{
145 return "com.sun.star.sdb.OTableColumn";
146}
147
149{
151}
152
154{
156}
157
158// OQueryColumn
159
160OQueryColumn::OQueryColumn( const Reference< XPropertySet >& _rxParserColumn, const Reference< XConnection >& _rxConnection, OUString i_sLabel )
161 :OTableColumnDescriptor( false /* do not act as descriptor */ )
162 ,m_sLabel(std::move(i_sLabel))
163{
164 const sal_Int32 nPropAttr = PropertyAttribute::READONLY;
165 registerProperty( PROPERTY_CATALOGNAME, PROPERTY_ID_CATALOGNAME, nPropAttr, &m_sCatalogName, cppu::UnoType<decltype(m_sCatalogName)>::get() );
166 registerProperty( PROPERTY_SCHEMANAME, PROPERTY_ID_SCHEMANAME, nPropAttr, &m_sSchemaName, cppu::UnoType<decltype(m_sSchemaName)>::get() );
167 registerProperty( PROPERTY_TABLENAME, PROPERTY_ID_TABLENAME, nPropAttr, &m_sTableName, cppu::UnoType<decltype(m_sTableName)>::get() );
168 registerProperty( PROPERTY_REALNAME, PROPERTY_ID_REALNAME, nPropAttr, &m_sRealName, cppu::UnoType<decltype(m_sRealName)>::get() );
169 registerProperty( PROPERTY_LABEL, PROPERTY_ID_LABEL, nPropAttr, &m_sLabel, cppu::UnoType<decltype(m_sLabel)>::get() );
170
171
172 if( ! (_rxParserColumn->getPropertyValue( PROPERTY_TYPENAME ) >>= m_aTypeName) )
173 SAL_WARN("dbaccess.core", "OQueryColumn: unable to get property " + PROPERTY_TYPENAME);
174
175 if( ! (_rxParserColumn->getPropertyValue( PROPERTY_ISNULLABLE ) >>= m_nIsNullable) )
176 SAL_WARN("dbaccess.core", "OQueryColumn: unable to get property " + PROPERTY_ISNULLABLE);
177
178 if( ! (_rxParserColumn->getPropertyValue( PROPERTY_PRECISION ) >>= m_nPrecision) )
179 SAL_WARN("dbaccess.core", "OQueryColumn: unable to get property " + PROPERTY_PRECISION);
180
181 if( ! (_rxParserColumn->getPropertyValue( PROPERTY_SCALE ) >>= m_nScale) )
182 SAL_WARN("dbaccess.core", "OQueryColumn: unable to get property " + PROPERTY_SCALE);
183
184 if( ! (_rxParserColumn->getPropertyValue( PROPERTY_TYPE ) >>= m_nType) )
185 SAL_WARN("dbaccess.core", "OQueryColumn: unable to get property " + PROPERTY_TYPE);
186
187 if( ! (_rxParserColumn->getPropertyValue( PROPERTY_ISAUTOINCREMENT ) >>= m_bAutoIncrement) )
188 SAL_WARN("dbaccess.core", "OQueryColumn: unable to get property " + PROPERTY_ISAUTOINCREMENT);
189
190 if( ! (_rxParserColumn->getPropertyValue( PROPERTY_ISCURRENCY ) >>= m_bCurrency) )
191 SAL_WARN("dbaccess.core", "OQueryColumn: unable to get property " + PROPERTY_ISCURRENCY);
192
193 if( ! (_rxParserColumn->getPropertyValue( PROPERTY_NAME ) >>= m_sName) )
194 SAL_WARN("dbaccess.core", "OQueryColumn: unable to get property " + PROPERTY_NAME);
195
197
198 Reference< XPropertySetInfo > xPSI( _rxParserColumn->getPropertySetInfo(), UNO_SET_THROW );
199 if ( xPSI->hasPropertyByName( PROPERTY_DEFAULTVALUE ) )
200 if( ! (_rxParserColumn->getPropertyValue( PROPERTY_DEFAULTVALUE ) >>= m_aDefaultValue) )
201 SAL_WARN("dbaccess.core", "OQueryColumn: unable to get property " + PROPERTY_DEFAULTVALUE);
202
203 // copy some optional properties from the parser column
204 struct PropertyDescriptor
205 {
206 OUString sName;
207 sal_Int32 nHandle;
208 };
209 const PropertyDescriptor aProps[] =
210 {
215 };
216 for (const auto & aProp : aProps)
217 {
218 if ( xPSI->hasPropertyByName( aProp.sName ) )
219 setFastPropertyValue_NoBroadcast( aProp.nHandle, _rxParserColumn->getPropertyValue( aProp.sName ) );
220 }
221
222 // determine the table column we're based on
223 osl_atomic_increment( &m_refCount );
224 {
226 }
227 osl_atomic_decrement( &m_refCount );
228}
229
231{
232}
233
234Reference< XPropertySet > OQueryColumn::impl_determineOriginalTableColumn( const Reference< XConnection >& _rxConnection )
235{
236 OSL_PRECOND( _rxConnection.is(), "OQueryColumn::impl_determineOriginalTableColumn: illegal connection!" );
237 if ( !_rxConnection.is() )
238 return nullptr;
239
240 Reference< XPropertySet > xOriginalTableColumn;
241 try
242 {
243 // determine the composed table name, plus the column name, as indicated by the
244 // respective properties
245 OUString sCatalog, sSchema, sTable;
247 SAL_WARN("dbaccess.core", "impl_determineOriginalTableColumn: unable to get property " + PROPERTY_CATALOGNAME);
249 SAL_WARN("dbaccess.core", "impl_determineOriginalTableColumn: unable to get property " + PROPERTY_SCHEMANAME);
250 if( ! (getPropertyValue( PROPERTY_TABLENAME ) >>= sTable) )
251 SAL_WARN("dbaccess.core", "impl_determineOriginalTableColumn: unable to get property " + PROPERTY_TABLENAME);
252 if ( sCatalog.isEmpty() && sSchema.isEmpty() && sTable.isEmpty() )
253 return nullptr;
254
255 OUString sComposedTableName = ::dbtools::composeTableName(
256 _rxConnection->getMetaData(), sCatalog, sSchema, sTable, false, ::dbtools::EComposeRule::Complete );
257
258 // retrieve the table in question
259 Reference< XTablesSupplier > xSuppTables( _rxConnection, UNO_QUERY_THROW );
260 Reference< XNameAccess > xTables( xSuppTables->getTables(), UNO_SET_THROW );
261 if ( !xTables->hasByName( sComposedTableName ) )
262 return nullptr;
263
264 Reference< XColumnsSupplier > xSuppCols( xTables->getByName( sComposedTableName ), UNO_QUERY_THROW );
265 Reference< XNameAccess > xColumns( xSuppCols->getColumns(), UNO_SET_THROW );
266
267 OUString sColumn;
268 if( ! (getPropertyValue( PROPERTY_REALNAME ) >>= sColumn) )
269 SAL_WARN("dbaccess.core", "impl_determineOriginalTableColumn: unable to get property " + PROPERTY_REALNAME);
270 if ( !xColumns->hasByName( sColumn ) )
271 return nullptr;
272
273 xOriginalTableColumn.set( xColumns->getByName( sColumn ), UNO_QUERY );
274 }
275 catch( const Exception& )
276 {
277 DBG_UNHANDLED_EXCEPTION("dbaccess");
278 }
279 return xOriginalTableColumn;
280}
281
283
284OUString SAL_CALL OQueryColumn::getImplementationName( )
285{
286 return "org.openoffice.comp.dbaccess.OQueryColumn";
287}
288
290{
292}
293
295{
297}
298
299void SAL_CALL OQueryColumn::getFastPropertyValue( Any& _rValue, sal_Int32 _nHandle ) const
300{
301 OTableColumnDescriptor::getFastPropertyValue( _rValue, _nHandle );
302
303 // special treatment for column settings:
305 return;
306
307 // If the setting has its default value, then try to obtain the value from the table column which
308 // this query column is based on
309 if ( !OColumnSettings::isDefaulted( _nHandle, _rValue ) )
310 return;
311
312 if ( !m_xOriginalTableColumn.is() )
313 return;
314
315 try
316 {
317 // determine original property name
318 OUString sPropName;
319 sal_Int16 nAttributes( 0 );
320 const_cast< OQueryColumn* >( this )->getInfoHelper().fillPropertyMembersByHandle( &sPropName, &nAttributes, _nHandle );
321 OSL_ENSURE( !sPropName.isEmpty(), "OColumnWrapper::impl_getPropertyNameFromHandle: property not found!" );
322
323 _rValue = m_xOriginalTableColumn->getPropertyValue( sPropName );
324 }
325 catch( const Exception& )
326 {
327 DBG_UNHANDLED_EXCEPTION("dbaccess");
328 }
329}
330
331// OColumnWrapper
332
333OColumnWrapper::OColumnWrapper( const Reference< XPropertySet > & rCol, const bool _bNameIsReadOnly )
334 :OColumn( _bNameIsReadOnly )
335 ,m_xAggregate(rCol)
336 ,m_nColTypeID(-1)
337{
338 // which type of aggregate property do we have?
339 // we distinguish the properties by the containment of optional properties
340 m_nColTypeID = 0;
341 if ( !m_xAggregate.is() )
342 return;
343
344 Reference <XPropertySetInfo > xInfo(m_xAggregate->getPropertySetInfo());
345 m_nColTypeID |= xInfo->hasPropertyByName(PROPERTY_DESCRIPTION) ? HAS_DESCRIPTION : 0;
346 m_nColTypeID |= xInfo->hasPropertyByName(PROPERTY_DEFAULTVALUE) ? HAS_DEFAULTVALUE : 0;
347 m_nColTypeID |= xInfo->hasPropertyByName(PROPERTY_ISROWVERSION) ? HAS_ROWVERSION : 0;
348 m_nColTypeID |= xInfo->hasPropertyByName(PROPERTY_AUTOINCREMENTCREATION) ? HAS_AUTOINCREMENT_CREATION : 0;
349 m_nColTypeID |= xInfo->hasPropertyByName(PROPERTY_CATALOGNAME) ? HAS_CATALOGNAME : 0;
350 m_nColTypeID |= xInfo->hasPropertyByName(PROPERTY_SCHEMANAME) ? HAS_SCHEMANAME : 0;
351 m_nColTypeID |= xInfo->hasPropertyByName(PROPERTY_TABLENAME) ? HAS_TABLENAME : 0;
352
353 m_xAggregate->getPropertyValue(PROPERTY_NAME) >>= m_sName;
354}
355
357{
358}
359
360OUString OColumnWrapper::impl_getPropertyNameFromHandle( const sal_Int32 _nHandle ) const
361{
362 OUString sPropName;
363 sal_Int16 nAttributes( 0 );
364 const_cast< OColumnWrapper* >( this )->getInfoHelper().fillPropertyMembersByHandle( &sPropName, &nAttributes, _nHandle );
365 OSL_ENSURE( !sPropName.isEmpty(), "OColumnWrapper::impl_getPropertyNameFromHandle: property not found!" );
366 return sPropName;
367}
368
369void OColumnWrapper::getFastPropertyValue( Any& rValue, sal_Int32 nHandle ) const
370{
371 // derived classes are free to either use the OPropertyContainer(Helper) mechanisms for properties,
372 // or to declare additional properties which are to be forwarded to the wrapped object. So we need
373 // to distinguish those cases.
374 if ( OColumn::isRegisteredProperty( nHandle ) )
375 {
376 OColumn::getFastPropertyValue( rValue, nHandle );
377 }
378 else
379 {
380 rValue = m_xAggregate->getPropertyValue( impl_getPropertyNameFromHandle( nHandle ) );
381 }
382}
383
384sal_Bool OColumnWrapper::convertFastPropertyValue( Any & rConvertedValue, Any & rOldValue, sal_Int32 nHandle,
385 const Any& rValue )
386{
387 bool bModified( false );
388 if ( OColumn::isRegisteredProperty( nHandle ) )
389 {
390 bModified = OColumn::convertFastPropertyValue( rConvertedValue, rOldValue, nHandle, rValue );
391 }
392 else
393 {
394 getFastPropertyValue( rOldValue, nHandle );
395 if ( rOldValue != rValue )
396 {
397 rConvertedValue = rValue;
398 bModified = true;
399 }
400 }
401 return bModified;
402}
403
404void OColumnWrapper::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const Any& rValue )
405{
406 if ( OColumn::isRegisteredProperty( nHandle ) )
407 {
408 OColumn::setFastPropertyValue_NoBroadcast( nHandle, rValue );
409 }
410 else
411 {
412 m_xAggregate->setPropertyValue( impl_getPropertyNameFromHandle( nHandle ), rValue );
413 }
414}
415
416// OTableColumnDescriptorWrapper
417OTableColumnDescriptorWrapper::OTableColumnDescriptorWrapper( const Reference< XPropertySet >& _rCol, const bool _bPureWrap, const bool _bIsDescriptor )
418 :OColumnWrapper( _rCol, !_bIsDescriptor )
419 ,m_bPureWrap( _bPureWrap )
420 ,m_bIsDescriptor( _bIsDescriptor )
421{
422 // let the ColumnSettings register its properties
424}
425
426// css::lang::XTypeProvider
428
429// css::lang::XServiceInfo
430OUString OTableColumnDescriptorWrapper::getImplementationName( )
431{
432 return "com.sun.star.sdb.OTableColumnDescriptorWrapper";
433}
434
436{
438}
439
440// comphelper::OPropertyArrayUsageHelper
442{
443 const sal_Int32 nHaveAlways = 7;
444
445 // Which optional properties are contained?
446 const sal_Int32 nHaveOptionally (std::bitset<7>(nId).count());
447
448 css::uno::Sequence< css::beans::Property> aDescriptor(nHaveAlways + nHaveOptionally);
449 css::beans::Property* pDesc = aDescriptor.getArray();
450 sal_Int32 nPos = 0;
451
453 pDesc[nPos++] = css::beans::Property(PROPERTY_ISCURRENCY, PROPERTY_ID_ISCURRENCY, cppu::UnoType<bool>::get(), 0);
455 pDesc[nPos++] = css::beans::Property(PROPERTY_PRECISION, PROPERTY_ID_PRECISION, cppu::UnoType<sal_Int32>::get(), 0);
456 pDesc[nPos++] = css::beans::Property(PROPERTY_SCALE, PROPERTY_ID_SCALE, cppu::UnoType<sal_Int32>::get(), 0);
457 pDesc[nPos++] = css::beans::Property(PROPERTY_TYPE, PROPERTY_ID_TYPE, cppu::UnoType<sal_Int32>::get(), 0);
458 pDesc[nPos++] = css::beans::Property(PROPERTY_TYPENAME, PROPERTY_ID_TYPENAME, cppu::UnoType<OUString >::get(), 0);
459
460 if ( nId & HAS_AUTOINCREMENT_CREATION )
461 {
462 pDesc[nPos++] = css::beans::Property(PROPERTY_AUTOINCREMENTCREATION, PROPERTY_ID_AUTOINCREMENTCREATION, cppu::UnoType<OUString>::get(), css::beans::PropertyAttribute::MAYBEVOID );
463 }
464 if ( nId & HAS_DEFAULTVALUE )
465 {
467 }
468 if ( nId & HAS_DESCRIPTION )
469 {
471 }
472 if ( nId & HAS_ROWVERSION )
473 {
474 pDesc[nPos++] = css::beans::Property(PROPERTY_ISROWVERSION, PROPERTY_ID_ISROWVERSION, cppu::UnoType<bool>::get(), 0);
475 }
476 if ( nId & HAS_CATALOGNAME )
477 {
479 }
480 if ( nId & HAS_SCHEMANAME )
481 {
483 }
484 if ( nId & HAS_TABLENAME )
485 {
486 pDesc[nPos++] = css::beans::Property(PROPERTY_TABLENAME, PROPERTY_ID_TABLENAME, cppu::UnoType<OUString >::get(), 0);
487 }
488
489 OSL_ENSURE(nPos == aDescriptor.getLength(), "forgot to adjust the count ?");
490
491 if ( !m_bIsDescriptor )
492 {
493 for ( auto & prop : asNonConstRange(aDescriptor) )
494 {
495 prop.Attributes |= PropertyAttribute::READONLY;
496 }
497 }
498
499 // finally also describe the properties which are maintained by our base class, in particular the OPropertyContainerHelper
500 Sequence< Property > aBaseProperties;
501 describeProperties( aBaseProperties );
502
503 Sequence< Property > aAllProperties( ::comphelper::concatSequences( aDescriptor, aBaseProperties ) );
504 return new ::cppu::OPropertyArrayHelper( aAllProperties, false );
505}
506
507// cppu::OPropertySetHelper
509{
511}
512
513void OTableColumnDescriptorWrapper::getFastPropertyValue( Any& rValue, sal_Int32 nHandle ) const
514{
515 if ( m_bPureWrap )
516 {
517 rValue = m_xAggregate->getPropertyValue( impl_getPropertyNameFromHandle( nHandle ) );
518 }
519 else
520 {
522 }
523}
524
525sal_Bool OTableColumnDescriptorWrapper::convertFastPropertyValue( Any & rConvertedValue, Any & rOldValue, sal_Int32 nHandle, const Any& rValue )
526{
527 bool bModified(false);
528 if ( m_bPureWrap )
529 {
530 // do not delegate to OColumnWrapper: It would, for the properties which were registered with registerProperty,
531 // ask the OPropertyContainer base class, which is not what we want here.
532 // TODO: the whole "m_bPureWrap"-thingie is strange. We should have a dedicated class doing this wrapping,
533 // not a class which normally serves other purposes, and only sometimes does a "pure wrap". It makes the
534 // code unnecessarily hard to maintain, and error prone.
535 rOldValue = m_xAggregate->getPropertyValue( impl_getPropertyNameFromHandle( nHandle ) );
536 if ( rOldValue != rValue )
537 {
538 rConvertedValue = rValue;
539 bModified = true;
540 }
541 }
542 else
543 {
544 bModified = OColumnWrapper::convertFastPropertyValue( rConvertedValue, rOldValue, nHandle, rValue );
545 }
546 return bModified;
547}
548
550 sal_Int32 nHandle,
551 const Any& rValue
552 )
553{
554 if ( m_bPureWrap )
555 {
556 m_xAggregate->setPropertyValue( impl_getPropertyNameFromHandle( nHandle ), rValue );
557 }
558 else
559 {
561 }
562}
563
564// OTableColumnWrapper
565OTableColumnWrapper::OTableColumnWrapper( const Reference< XPropertySet >& rCol, const Reference< XPropertySet >& _xColDefinition,
566 const bool _bPureWrap )
567 :OTableColumnDescriptorWrapper( rCol, _bPureWrap, false )
568{
569 osl_atomic_increment( &m_refCount );
570 if ( _xColDefinition.is() )
571 {
572 try
573 {
574 ::comphelper::copyProperties( _xColDefinition, this );
575 }
576 catch( const Exception& )
577 {
578 DBG_UNHANDLED_EXCEPTION("dbaccess");
579 }
580 }
581 osl_atomic_decrement( &m_refCount );
582}
583
585{
586}
587
589
590OUString OTableColumnWrapper::getImplementationName( )
591{
592 return "com.sun.star.sdb.OTableColumnWrapper";
593}
594
596{
598}
599
601{
603}
604
605// comphelper::OPropertyArrayUsageHelper
607{
609}
610
611/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
OptionalString sSchema
OptionalString sCatalog
OptionalString sName
css::uno::Any m_aDefaultValue
::cppu::IPropertyArrayHelper * getArrayHelper(sal_Int32 nId)
virtual sal_Bool SAL_CALL fillPropertyMembersByHandle(::rtl::OUString *pPropName, sal_Int16 *pAttributes, sal_Int32 nHandle)=0
void registerProperties(IPropertyContainer &_rPropertyContainer)
static bool isDefaulted(const sal_Int32 _nPropertyHandle, const css::uno::Any &_rPropertyValue)
static bool isColumnSettingProperty(const sal_Int32 _nPropertyHandle)
determines whether the property with the given handle is handled by the class
describes all properties for a columns of a table.
virtual void SAL_CALL getFastPropertyValue(css::uno::Any &rValue, sal_Int32 nHandle) const override
css::uno::Reference< css::beans::XPropertySet > m_xAggregate
OColumnWrapper(const css::uno::Reference< css::beans::XPropertySet > &_rCol, const bool _bNameIsReadOnly)
virtual ~OColumnWrapper() override
OUString impl_getPropertyNameFromHandle(const sal_Int32 _nHandle) const
virtual sal_Bool SAL_CALL convertFastPropertyValue(css::uno::Any &rConvertedValue, css::uno::Any &rOldValue, sal_Int32 nHandle, const css::uno::Any &rValue) override
virtual void SAL_CALL setFastPropertyValue_NoBroadcast(sal_Int32 nHandle, const css::uno::Any &rValue) override
a column of a Query, with additional information obtained from parsing the query statement
virtual ::cppu::IPropertyArrayHelper &SAL_CALL getInfoHelper() override
virtual ::cppu::IPropertyArrayHelper * createArrayHelper() const override
OQueryColumn(const css::uno::Reference< css::beans::XPropertySet > &_rxParserColumn, const css::uno::Reference< css::sdbc::XConnection > &_rxConnection, OUString i_sLabel)
css::uno::Reference< css::beans::XPropertySet > impl_determineOriginalTableColumn(const css::uno::Reference< css::sdbc::XConnection > &_rxConnection)
virtual ~OQueryColumn() override
virtual void SAL_CALL getFastPropertyValue(css::uno::Any &rValue, sal_Int32 nHandle) const override
css::uno::Reference< css::beans::XPropertySet > m_xOriginalTableColumn
provides the properties for description.
virtual void SAL_CALL getFastPropertyValue(css::uno::Any &rValue, sal_Int32 nHandle) const override
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
virtual sal_Bool SAL_CALL convertFastPropertyValue(css::uno::Any &rConvertedValue, css::uno::Any &rOldValue, sal_Int32 nHandle, const css::uno::Any &rValue) override
virtual void SAL_CALL setFastPropertyValue_NoBroadcast(sal_Int32 nHandle, const css::uno::Any &rValue) override
virtual ::cppu::IPropertyArrayHelper &SAL_CALL getInfoHelper() override
OTableColumnDescriptorWrapper(const css::uno::Reference< css::beans::XPropertySet > &rCol, const bool _bPureWrap, const bool _bIsDescriptor)
virtual ::cppu::IPropertyArrayHelper * createArrayHelper(sal_Int32 nId) const override
provides the properties for description.
virtual void SAL_CALL setFastPropertyValue_NoBroadcast(sal_Int32 nHandle, const css::uno::Any &rValue) override
virtual ::cppu::IPropertyArrayHelper &SAL_CALL getInfoHelper() override
virtual void SAL_CALL setParent(const css::uno::Reference< css::uno::XInterface > &Parent) override
virtual ::cppu::IPropertyArrayHelper * createArrayHelper() const override
css::uno::Reference< css::uno::XInterface > m_xParent
virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getParent() override
describes all properties for a columns of a table.
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
virtual ::cppu::IPropertyArrayHelper &SAL_CALL getInfoHelper() override
OTableColumnWrapper(const css::uno::Reference< css::beans::XPropertySet > &rCol, const css::uno::Reference< css::beans::XPropertySet > &rColDefinition, const bool _bPureWrap)
virtual ~OTableColumnWrapper() override
virtual ::cppu::IPropertyArrayHelper * createArrayHelper(sal_Int32 nId) const override
describes a column of a table
virtual ::cppu::IPropertyArrayHelper &SAL_CALL getInfoHelper() override
OTableColumn(const OUString &_rName)
virtual ::cppu::IPropertyArrayHelper * createArrayHelper() const override
virtual ~OTableColumn() override
#define DBG_UNHANDLED_EXCEPTION(...)
ULONG m_refCount
OUString m_sName
std::mutex m_aMutex
sal_uInt16 nPos
#define SAL_WARN(area, stream)
@ Exception
void notifyDataSourceModified(const css::uno::Reference< css::uno::XInterface > &_rxObject)
IMPLEMENT_GET_IMPLEMENTATION_ID(DrawController)
bool getPropertyValue(ValueType &rValue, css::uno::Reference< css::beans::XPropertySet > const &xPropSet, OUString const &propName)
sal_Int16 nId
sal_Int32 nHandle
sal_Int16 nAttributes
IMPLEMENT_FORWARD_XINTERFACE2(OStatement, OStatementBase, OStatement_IFACE)
#define PROPERTY_ID_AUTOINCREMENTCREATION
#define PROPERTY_ID_TYPE
#define PROPERTY_ID_TABLENAME
#define PROPERTY_ID_DESCRIPTION
#define PROPERTY_ID_CATALOGNAME
#define PROPERTY_ID_ISROWVERSION
#define PROPERTY_ID_ISNULLABLE
#define PROPERTY_ID_PRECISION
#define PROPERTY_ID_LABEL
#define PROPERTY_ID_SCHEMANAME
#define PROPERTY_ID_ISAUTOINCREMENT
#define PROPERTY_ID_ISCURRENCY
#define PROPERTY_ID_TYPENAME
#define PROPERTY_ID_DEFAULTVALUE
#define PROPERTY_ID_REALNAME
#define PROPERTY_ID_SCALE
constexpr OUStringLiteral PROPERTY_ISAUTOINCREMENT(u"IsAutoIncrement")
constexpr OUStringLiteral PROPERTY_ISCURRENCY(u"IsCurrency")
constexpr OUStringLiteral SERVICE_SDBCX_COLUMNDESCRIPTOR
Definition: strings.hxx:177
constexpr OUStringLiteral PROPERTY_PRECISION(u"Precision")
constexpr OUStringLiteral PROPERTY_TYPENAME(u"TypeName")
constexpr OUStringLiteral PROPERTY_LABEL(u"Label")
constexpr OUStringLiteral PROPERTY_ISROWVERSION(u"IsRowVersion")
constexpr OUStringLiteral PROPERTY_ISNULLABLE(u"IsNullable")
constexpr OUStringLiteral PROPERTY_SCHEMANAME(u"SchemaName")
constexpr OUStringLiteral PROPERTY_DESCRIPTION(u"Description")
constexpr OUStringLiteral PROPERTY_SCALE(u"Scale")
constexpr OUStringLiteral PROPERTY_REALNAME(u"RealName")
constexpr OUStringLiteral PROPERTY_TABLENAME(u"TableName")
constexpr OUStringLiteral SERVICE_SDB_COLUMNSETTINGS
Definition: strings.hxx:178
constexpr OUStringLiteral PROPERTY_DEFAULTVALUE(u"DefaultValue")
constexpr OUStringLiteral SERVICE_SDBCX_COLUMN
Definition: strings.hxx:175
constexpr OUStringLiteral PROPERTY_CATALOGNAME(u"CatalogName")
constexpr OUStringLiteral PROPERTY_TYPE(u"Type")
constexpr OUStringLiteral PROPERTY_NAME(u"Name")
constexpr OUStringLiteral PROPERTY_AUTOINCREMENTCREATION(u"AutoIncrementCreation")
unsigned char sal_Bool