diff options
Diffstat (limited to 'dbaccess/source/core/api/TableDeco.cxx')
-rw-r--r-- | dbaccess/source/core/api/TableDeco.cxx | 131 |
1 files changed, 35 insertions, 96 deletions
diff --git a/dbaccess/source/core/api/TableDeco.cxx b/dbaccess/source/core/api/TableDeco.cxx index a296833ab6ef..d2b724f68a04 100644 --- a/dbaccess/source/core/api/TableDeco.cxx +++ b/dbaccess/source/core/api/TableDeco.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,73 +29,30 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_dbaccess.hxx" -#ifndef _DBA_CORE_TABLEDECORATOR_HXX_ #include "TableDeco.hxx" -#endif -#ifndef _DBACORE_DEFINITIONCOLUMN_HXX_ #include <definitioncolumn.hxx> -#endif -#ifndef DBACCESS_SHARED_DBASTRINGS_HRC #include "dbastrings.hrc" -#endif -#ifndef _DBA_CORE_RESOURCE_HXX_ #include "core_resource.hxx" -#endif -#ifndef _DBA_CORE_RESOURCE_HRC_ #include "core_resource.hrc" -#endif -#ifndef _TOOLS_DEBUG_HXX #include <tools/debug.hxx> -#endif +#include <osl/diagnose.h> -#ifndef _CPPUHELPER_TYPEPROVIDER_HXX_ #include <cppuhelper/typeprovider.hxx> -#endif -#ifndef _COMPHELPER_ENUMHELPER_HXX_ #include <comphelper/enumhelper.hxx> -#endif -#ifndef _COMPHELPER_CONTAINER_HXX_ #include <comphelper/container.hxx> -#endif -#ifndef _COMPHELPER_SEQUENCE_HXX_ #include <comphelper/sequence.hxx> -#endif -#ifndef _COMPHELPER_PROPERTY_HXX_ #include <comphelper/property.hxx> -#endif -#ifndef _COMPHELPER_TYPES_HXX_ #include <comphelper/types.hxx> -#endif -#ifndef _COM_SUN_STAR_UTIL_XREFRESHLISTENER_HPP_ #include <com/sun/star/util/XRefreshListener.hpp> -#endif -#ifndef _COM_SUN_STAR_SDBC_XCONNECTION_HPP_ #include <com/sun/star/sdbc/XConnection.hpp> -#endif -#ifndef _COM_SUN_STAR_SDBC_XROW_HPP_ #include <com/sun/star/sdbc/XRow.hpp> -#endif -#ifndef _COM_SUN_STAR_SDBCX_PRIVILEGE_HPP_ #include <com/sun/star/sdbcx/Privilege.hpp> -#endif -#ifndef _COM_SUN_STAR_BEANS_PROPERTYATTRIBUTE_HPP_ #include <com/sun/star/beans/PropertyAttribute.hpp> -#endif -#ifndef _CONNECTIVITY_DBTOOLS_HXX_ #include <connectivity/dbtools.hxx> -#endif -#ifndef _DBHELPER_DBEXCEPTION_HXX_ #include <connectivity/dbexception.hxx> -#endif -#ifndef _CONNECTIVITY_DBTOOLS_HXX_ #include <connectivity/dbtools.hxx> -#endif -#ifndef _COMPHELPER_EXTRACT_HXX_ #include <comphelper/extract.hxx> -#endif -#ifndef DBA_CONTAINERMEDIATOR_HXX #include "ContainerMediator.hxx" -#endif #include <rtl/logfile.hxx> using namespace dbaccess; @@ -114,7 +72,7 @@ using namespace ::cppu; //= ODBTableDecorator //========================================================================== DBG_NAME(ODBTableDecorator) -// ----------------------------------------------------------------------------- + ODBTableDecorator::ODBTableDecorator( const Reference< XConnection >& _rxConnection, const Reference< XColumnsSupplier >& _rxNewTable, const Reference< XNumberFormatsSupplier >& _rxNumberFormats, const Reference< XNameAccess >& _xColumnDefinitions ) throw(SQLException) :OTableDescriptor_BASE(m_aMutex) @@ -131,7 +89,7 @@ ODBTableDecorator::ODBTableDecorator( const Reference< XConnection >& _rxConnect DBG_CTOR(ODBTableDecorator, NULL); ODataSettings::registerPropertiesFor(this); } -// ------------------------------------------------------------------------- + ODBTableDecorator::~ODBTableDecorator() { DBG_DTOR(ODBTableDecorator, NULL); @@ -139,7 +97,6 @@ ODBTableDecorator::~ODBTableDecorator() delete m_pColumns; } -//-------------------------------------------------------------------------- Sequence< sal_Int8 > ODBTableDecorator::getImplementationId() throw (RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTableDecorator::getImplementationId" ); @@ -157,7 +114,6 @@ Sequence< sal_Int8 > ODBTableDecorator::getImplementationId() throw (RuntimeExce } // OComponentHelper -//------------------------------------------------------------------------------ void SAL_CALL ODBTableDecorator::disposing() { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTableDecorator::disposing" ); @@ -174,7 +130,7 @@ void SAL_CALL ODBTableDecorator::disposing() m_pColumns->disposing(); m_xColumnMediator = NULL; } -// ----------------------------------------------------------------------------- + sal_Bool SAL_CALL ODBTableDecorator::convertFastPropertyValue( Any & rConvertedValue, Any & rOldValue, @@ -182,7 +138,6 @@ sal_Bool SAL_CALL ODBTableDecorator::convertFastPropertyValue( const Any& rValue ) throw (::com::sun::star::lang::IllegalArgumentException) { - //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTableDecorator::convertFastPropertyValue" ); sal_Bool bRet = sal_True; switch(nHandle) { @@ -225,14 +180,14 @@ sal_Bool SAL_CALL ODBTableDecorator::convertFastPropertyValue( } return bRet; } -// ----------------------------------------------------------------------------- + void ODBTableDecorator::setFastPropertyValue_NoBroadcast(sal_Int32 _nHandle, const Any& _rValue) throw (Exception) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTableDecorator::setFastPropertyValue_NoBroadcast" ); switch(_nHandle) { case PROPERTY_ID_PRIVILEGES: - OSL_ENSURE(0,"Property is readonly!"); + OSL_FAIL("Property is readonly!"); case PROPERTY_ID_FILTER: case PROPERTY_ID_ORDER: case PROPERTY_ID_APPLYFILTER: @@ -293,10 +248,10 @@ void ODBTableDecorator::setFastPropertyValue_NoBroadcast(sal_Int32 _nHandle, con break; } } -//------------------------------------------------------------------------------ + void ODBTableDecorator::getFastPropertyValue(Any& _rValue, sal_Int32 _nHandle) const { - //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTableDecorator::getFastPropertyValue" ); + switch(_nHandle) { case PROPERTY_ID_PRIVILEGES: @@ -371,10 +326,10 @@ void ODBTableDecorator::getFastPropertyValue(Any& _rValue, sal_Int32 _nHandle) c } break; default: - OSL_ENSURE(0,"Invalid Handle for table"); + OSL_FAIL("Invalid Handle for table"); } } -// ------------------------------------------------------------------------- + void ODBTableDecorator::construct() { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTableDecorator::construct" ); @@ -389,10 +344,9 @@ void ODBTableDecorator::construct() registerProperty(PROPERTY_PRIVILEGES, PROPERTY_ID_PRIVILEGES, PropertyAttribute::BOUND | PropertyAttribute::READONLY, &m_nPrivileges, ::getCppuType(static_cast<sal_Int32*>(NULL))); } -// ----------------------------------------------------------------------------- + ::cppu::IPropertyArrayHelper* ODBTableDecorator::createArrayHelper(sal_Int32 /*_nId*/) const { - //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTableDecorator::createArrayHelper" ); Reference<XPropertySet> xProp(m_xTable,UNO_QUERY); Reference<XPropertySetInfo> xInfo = xProp->getPropertySetInfo(); @@ -419,10 +373,9 @@ void ODBTableDecorator::construct() return new ::cppu::OPropertyArrayHelper(aTableProps); } -// ----------------------------------------------------------------------------- + ::cppu::IPropertyArrayHelper & SAL_CALL ODBTableDecorator::getInfoHelper() { - //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTableDecorator::getInfoHelper" ); Reference<XPropertySet> xProp(m_xTable,UNO_QUERY); Reference<XPropertySetInfo> xInfo = xProp->getPropertySetInfo(); @@ -438,13 +391,12 @@ void ODBTableDecorator::construct() // property set infos: Depending on the table for which we act as decorator, different property // sets might exist. } -// ------------------------------------------------------------------------- + // XServiceInfo IMPLEMENT_SERVICE_INFO1(ODBTableDecorator, "com.sun.star.sdb.dbaccess.ODBTableDecorator", SERVICE_SDBCX_TABLE) -// ------------------------------------------------------------------------- + Any SAL_CALL ODBTableDecorator::queryInterface( const Type & rType ) throw(RuntimeException) { - //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTableDecorator::queryInterface" ); Any aRet; if(m_xTable.is()) { @@ -459,18 +411,15 @@ Any SAL_CALL ODBTableDecorator::queryInterface( const Type & rType ) throw(Runti return aRet; } -// ------------------------------------------------------------------------- + Sequence< Type > SAL_CALL ODBTableDecorator::getTypes( ) throw(RuntimeException) { - //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTableDecorator::getTypes" ); Reference<XTypeProvider> xTypes(m_xTable,UNO_QUERY); OSL_ENSURE(xTypes.is(),"Table must be a TypePropvider!"); return xTypes->getTypes(); } -// ----------------------------------------------------------------------------- // XRename, -//------------------------------------------------------------------------------ void SAL_CALL ODBTableDecorator::rename( const ::rtl::OUString& _rNewName ) throw(SQLException, ElementExistException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTableDecorator::rename" ); @@ -479,9 +428,6 @@ void SAL_CALL ODBTableDecorator::rename( const ::rtl::OUString& _rNewName ) thro Reference<XRename> xRename(m_xTable,UNO_QUERY); if(xRename.is()) { -// ::rtl::OUString sOldName; -// Reference<XPropertySet> xProp(m_xTable,UNO_QUERY); -// xProp->getPropertyValue(PROPERTY_NAME) >>= sOldName; xRename->rename(_rNewName); } else // not supported @@ -489,7 +435,6 @@ void SAL_CALL ODBTableDecorator::rename( const ::rtl::OUString& _rNewName ) thro } // XAlterTable, -//------------------------------------------------------------------------------ void SAL_CALL ODBTableDecorator::alterColumnByName( const ::rtl::OUString& _rName, const Reference< XPropertySet >& _rxDescriptor ) throw(SQLException, NoSuchElementException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTableDecorator::alterColumnByName" ); @@ -506,7 +451,6 @@ void SAL_CALL ODBTableDecorator::alterColumnByName( const ::rtl::OUString& _rNam m_pColumns->refresh(); } -//------------------------------------------------------------------------------ void SAL_CALL ODBTableDecorator::alterColumnByIndex( sal_Int32 _nIndex, const Reference< XPropertySet >& _rxDescriptor ) throw(SQLException, IndexOutOfBoundsException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTableDecorator::alterColumnByIndex" ); @@ -522,7 +466,7 @@ void SAL_CALL ODBTableDecorator::alterColumnByIndex( sal_Int32 _nIndex, const Re else // not supported throw SQLException(DBACORE_RESSTRING(RID_STR_COLUMN_ALTER_BY_INDEX),*this,SQLSTATE_GENERAL,1000,Any() ); } -// ----------------------------------------------------------------------------- + Reference< XNameAccess> ODBTableDecorator::getIndexes() throw (RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTableDecorator::getIndexes" ); @@ -530,7 +474,7 @@ Reference< XNameAccess> ODBTableDecorator::getIndexes() throw (RuntimeException) ::connectivity::checkDisposed(OTableDescriptor_BASE::rBHelper.bDisposed); return Reference< XIndexesSupplier>(m_xTable,UNO_QUERY)->getIndexes(); } -// ------------------------------------------------------------------------- + Reference< XIndexAccess> ODBTableDecorator::getKeys() throw (RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTableDecorator::getKeys" ); @@ -538,7 +482,7 @@ Reference< XIndexAccess> ODBTableDecorator::getKeys() throw (RuntimeException) ::connectivity::checkDisposed(OTableDescriptor_BASE::rBHelper.bDisposed); return Reference< XKeysSupplier>(m_xTable,UNO_QUERY)->getKeys(); } -// ------------------------------------------------------------------------- + Reference< XNameAccess> ODBTableDecorator::getColumns() throw (RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTableDecorator::getColumns" ); @@ -550,7 +494,7 @@ Reference< XNameAccess> ODBTableDecorator::getColumns() throw (RuntimeException) return m_pColumns; } -// ----------------------------------------------------------------------------- + ::rtl::OUString SAL_CALL ODBTableDecorator::getName() throw(RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTableDecorator::getName" ); @@ -560,7 +504,7 @@ Reference< XNameAccess> ODBTableDecorator::getColumns() throw (RuntimeException) OSL_ENSURE(xName.is(),"Table should support the XNamed interface"); return xName->getName(); } -// ----------------------------------------------------------------------------- + sal_Int64 SAL_CALL ODBTableDecorator::getSomething( const Sequence< sal_Int8 >& rId ) throw(RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTableDecorator::getSomething" ); @@ -573,7 +517,7 @@ sal_Int64 SAL_CALL ODBTableDecorator::getSomething( const Sequence< sal_Int8 >& nRet = xTunnel->getSomething(rId); return nRet; } -// ----------------------------------------------------------------------------- + Sequence< sal_Int8 > ODBTableDecorator::getUnoTunnelImplementationId() { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTableDecorator::getUnoTunnelImplementationId" ); @@ -589,11 +533,11 @@ Sequence< sal_Int8 > ODBTableDecorator::getUnoTunnelImplementationId() } return pId->getImplementationId(); } -// ----------------------------------------------------------------------------- + void ODBTableDecorator::fillPrivileges() const { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTableDecorator::fillPrivileges" ); - // somebody is asking for the privileges an we do not know them, yet + // somebody is asking for the privileges and we do not know them, yet m_nPrivileges = 0; try { @@ -617,10 +561,10 @@ void ODBTableDecorator::fillPrivileges() const catch(const SQLException& e) { (void)e; - DBG_ERROR("ODBTableDecorator::ODBTableDecorator : could not collect the privileges !"); + OSL_FAIL("ODBTableDecorator::ODBTableDecorator : could not collect the privileges !"); } } -// ----------------------------------------------------------------------------- + Reference< XPropertySet > SAL_CALL ODBTableDecorator::createDataDescriptor( ) throw (RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTableDecorator::createDataDescriptor" ); @@ -628,7 +572,7 @@ Reference< XPropertySet > SAL_CALL ODBTableDecorator::createDataDescriptor( ) t ::connectivity::checkDisposed(OTableDescriptor_BASE::rBHelper.bDisposed); Reference< XDataDescriptorFactory > xFactory( m_xTable, UNO_QUERY ); - DBG_ASSERT( xFactory.is(), "ODBTableDecorator::createDataDescriptor: invalid table!" ); + OSL_ENSURE( xFactory.is(), "ODBTableDecorator::createDataDescriptor: invalid table!" ); Reference< XColumnsSupplier > xColsSupp; if ( xFactory.is() ) xColsSupp = xColsSupp.query( xFactory->createDataDescriptor() ); @@ -640,13 +584,13 @@ Reference< XPropertySet > SAL_CALL ODBTableDecorator::createDataDescriptor( ) t NULL ); } -// ----------------------------------------------------------------------------- + Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL ODBTableDecorator::getPropertySetInfo( ) throw(RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTableDecorator::getPropertySetInfo" ); return ::cppu::OPropertySetHelper::createPropertySetInfo(getInfoHelper()); } -// ----------------------------------------------------------------------------- + void ODBTableDecorator::refreshColumns() { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTableDecorator::refreshColumns" ); @@ -684,7 +628,7 @@ void ODBTableDecorator::refreshColumns() else m_pColumns->reFill(aVector); } -// ----------------------------------------------------------------------------- + OColumn* ODBTableDecorator::createColumn(const ::rtl::OUString& _rName) const { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTableDecorator::createColumn" ); @@ -708,13 +652,13 @@ OColumn* ODBTableDecorator::createColumn(const ::rtl::OUString& _rName) const } return pReturn; } -// ----------------------------------------------------------------------------- + void ODBTableDecorator::columnAppended( const Reference< XPropertySet >& /*_rxSourceDescriptor*/ ) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTableDecorator::columnAppended" ); // not interested in } -// ----------------------------------------------------------------------------- + void ODBTableDecorator::columnDropped(const ::rtl::OUString& _sName) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTableDecorator::columnDropped" ); @@ -723,7 +667,6 @@ void ODBTableDecorator::columnDropped(const ::rtl::OUString& _sName) xDrop->dropByName(_sName); } -// ----------------------------------------------------------------------------- Reference< XPropertySet > ODBTableDecorator::createColumnDescriptor() { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTableDecorator::createColumnDescriptor" ); @@ -735,24 +678,20 @@ Reference< XPropertySet > ODBTableDecorator::createColumnDescriptor() xRet = new OTableColumnDescriptorWrapper( xNames->createDataDescriptor(), false, true ); return xRet; } -// ----------------------------------------------------------------------------- + void SAL_CALL ODBTableDecorator::acquire() throw() { OTableDescriptor_BASE::acquire(); } -// ----------------------------------------------------------------------------- + void SAL_CALL ODBTableDecorator::release() throw() { OTableDescriptor_BASE::release(); } -// ----------------------------------------------------------------------------- void SAL_CALL ODBTableDecorator::setName( const ::rtl::OUString& /*aName*/ ) throw (::com::sun::star::uno::RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTableDecorator::setName" ); throwFunctionNotSupportedException( "XNamed::setName", *this ); } - -// ----------------------------------------------------------------------------- - - +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |