diff options
Diffstat (limited to 'connectivity/source/parse/PColumn.cxx')
-rw-r--r-- | connectivity/source/parse/PColumn.cxx | 96 |
1 files changed, 70 insertions, 26 deletions
diff --git a/connectivity/source/parse/PColumn.cxx b/connectivity/source/parse/PColumn.cxx index 43e38f5a1674..abcac583dfbc 100644 --- a/connectivity/source/parse/PColumn.cxx +++ b/connectivity/source/parse/PColumn.cxx @@ -28,12 +28,12 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_connectivity.hxx" -#ifndef _CONNECTIVITY_SDBCX_COLUMN_HXX_ #include "connectivity/PColumn.hxx" -#endif #include "connectivity/dbtools.hxx" #include "TConnection.hxx" + #include <comphelper/types.hxx> +#include <tools/diagnose_ex.h> using namespace ::comphelper; using namespace connectivity; @@ -191,38 +191,85 @@ void OParseColumn::construct() // ----------------------------------------------------------------------------- ::cppu::IPropertyArrayHelper & SAL_CALL OParseColumn::getInfoHelper() { - OSL_ENSURE( !isNew(), "OParseColumn::OOrderColumn: a *new* OrderColumn?" ); + OSL_ENSURE( !isNew(), "OParseColumn::getInfoHelper: a *new* ParseColumn?" ); return *OParseColumn_PROP::getArrayHelper(); } + // ----------------------------------------------------------------------------- -OOrderColumn::OOrderColumn( const Reference<XPropertySet>& _xColumn - ,sal_Bool _bCase - ,sal_Bool _bAscending) - : connectivity::sdbcx::OColumn( getString(_xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME))) - , getString(_xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPENAME))) - , getString(_xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_DEFAULTVALUE))) - , getString(_xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_DESCRIPTION))) - , getINT32(_xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISNULLABLE))) - , getINT32(_xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PRECISION))) - , getINT32(_xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_SCALE))) - , getINT32(_xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE))) - , getBOOL(_xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISAUTOINCREMENT))) - , sal_False - , getBOOL(_xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISCURRENCY))) - , _bCase - ) - , m_bAscending(_bAscending) +namespace +{ + ::rtl::OUString lcl_getColumnTableName( const Reference< XPropertySet >& i_parseColumn ) + { + ::rtl::OUString sColumnTableName; + try + { + OSL_VERIFY( i_parseColumn->getPropertyValue( OMetaConnection::getPropMap().getNameByIndex( PROPERTY_ID_TABLENAME ) ) >>= sColumnTableName ); + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + return sColumnTableName; + } +} + +// ----------------------------------------------------------------------------- +OOrderColumn::OOrderColumn( const Reference<XPropertySet>& _xColumn, const ::rtl::OUString& i_rOriginatingTableName, + sal_Bool _bCase, sal_Bool _bAscending ) + : connectivity::sdbcx::OColumn( + getString(_xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME))), + getString(_xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPENAME))), + getString(_xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_DEFAULTVALUE))), + getString(_xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_DESCRIPTION))), + getINT32(_xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISNULLABLE))), + getINT32(_xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PRECISION))), + getINT32(_xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_SCALE))), + getINT32(_xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE))), + getBOOL(_xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISAUTOINCREMENT))), + sal_False, + getBOOL(_xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISCURRENCY))), + _bCase + ) + ,m_bAscending(_bAscending) + ,m_sTableName( i_rOriginatingTableName ) { construct(); } + +// ----------------------------------------------------------------------------- +OOrderColumn::OOrderColumn( const Reference<XPropertySet>& _xColumn, sal_Bool _bCase, sal_Bool _bAscending ) + : connectivity::sdbcx::OColumn( + getString(_xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME))), + getString(_xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPENAME))), + getString(_xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_DEFAULTVALUE))), + getString(_xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_DESCRIPTION))), + getINT32(_xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISNULLABLE))), + getINT32(_xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PRECISION))), + getINT32(_xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_SCALE))), + getINT32(_xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE))), + getBOOL(_xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISAUTOINCREMENT))), + sal_False, + getBOOL(_xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISCURRENCY))), + _bCase + ) + ,m_bAscending(_bAscending) + ,m_sTableName( lcl_getColumnTableName( _xColumn ) ) +{ + construct(); +} + // ------------------------------------------------------------------------- OOrderColumn::~OOrderColumn() { } + // ------------------------------------------------------------------------- void OOrderColumn::construct() { - registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISASCENDING),PROPERTY_ID_ISASCENDING,0,&m_bAscending, ::getCppuType(reinterpret_cast< sal_Bool*>(NULL))); + registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISASCENDING), PROPERTY_ID_ISASCENDING, + PropertyAttribute::READONLY, const_cast< sal_Bool* >( &m_bAscending ), ::getCppuType( reinterpret_cast< sal_Bool* >( NULL ) ) ); + registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TABLENAME), PROPERTY_ID_TABLENAME, + PropertyAttribute::READONLY, const_cast< ::rtl::OUString* >( &m_sTableName ), ::getCppuType(reinterpret_cast< ::rtl::OUString*>(NULL))); } // ----------------------------------------------------------------------------- ::cppu::IPropertyArrayHelper* OOrderColumn::createArrayHelper() const @@ -232,17 +279,14 @@ void OOrderColumn::construct() // ----------------------------------------------------------------------------- ::cppu::IPropertyArrayHelper & SAL_CALL OOrderColumn::getInfoHelper() { - OSL_ENSURE( !isNew(), "OOrderColumn::OOrderColumn: a *new* OrderColumn?" ); + OSL_ENSURE( !isNew(), "OOrderColumn::getInfoHelper: a *new* OrderColumn?" ); return *OOrderColumn_PROP::getArrayHelper(); } // ----------------------------------------------------------------------------- ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL OOrderColumn::getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException) { ::com::sun::star::uno::Sequence< ::rtl::OUString > aSupported(1); - if ( m_bOrder ) - aSupported[0] = ::rtl::OUString::createFromAscii("com.sun.star.sdb.OrderColumn"); - else - aSupported[0] = ::rtl::OUString::createFromAscii("com.sun.star.sdb.GroupColumn"); + aSupported[0] = ::rtl::OUString::createFromAscii("com.sun.star.sdb.OrderColumn"); return aSupported; } |